This file is part of mingw-cross-env. See doc/index.html for further information. Fast-forward to latest FreeTDS from cvs http://sourceforge.net/scm/?type=cvs&group.id=33106 Produced with this script: #--------------------------------------------------------------------# #!/bin/bash ( echo "This file is part of mingw-cross-env." echo "See doc/index.html for further information." echo echo "Fast-forward to latest FreeTDS from cvs" echo "http://sourceforge.net/scm/?type=cvs&group.id=33106" echo echo "Produced with this script:" echo "#--------------------------------------------------------------------#" cat "$0" echo "#--------------------------------------------------------------------#" ) > src/freetds-1-fastforward.patch GITDIR=~/projects/freetds.dev/git-freetds PKGDIR=freetds-0.82 # create or update clone (cd "$GITDIR" && git cvsimport -v -d:pserver:anonymous@freetds.cvs.sourceforge.net:/cvsroot/freetds freetds) rm -rf $PKGDIR tar xf pkg/$PKGDIR.tar.gz ( cd $GITDIR git reset --hard git checkout R0_82 ) lst="\ ChangeLog-0.82 \ INSTALL.CVS \ TODO.freddy \ configure.ac \ doc/htdoc/news.html \ doc/htdoc/faq.html \ doc/htdoc/contrib.html \ doc/htdoc/support.html \ doc/README.releasing \ doc/txt2man \ misc/freetds_autobuild \ misc/test-dist.sh \ misc/test-auto.sh \ misc/test-other.sh \ mkinstalldirs \ samples/odbc_rpc.pl \ src/pool/stream.c \ src/tds/alternative_character_sets.h \ src/tds/character_sets.h \ src/tds/encodings.pl \ src/tds/num_limits.pl \ src/tds/unittests/flags.c \ src/tds/tds_willconvert.pl \ src/odbc/unittests/rownumber.c \ src/odbc/checkexport.sh \ vms/Makefile.am \ win32/build_dsw.pl \ " lst="$lst $(cd $GITDIR && find -name .cvsignore)" for a in $lst; do if [ -f $PKGDIR/$a ]; then cp $PKGDIR/$a $GITDIR/$a else rm $GITDIR/$a fi done # write reset patch ( cd $GITDIR echo echo "======== reset files to match 0.82 tag" git diff -R R0_82 -- $lst ) >> src/freetds-1-fastforward.patch ( cd $GITDIR git reset --hard ) # write rewind commits ( cd $GITDIR echo echo "======== climb down out of branch" git log -R -p ^branch-0-82 R0_82 #git diff -R branch-0-82 R0_82 ) >> src/freetds-1-fastforward.patch ( cd $GITDIR git checkout master git reset --hard ) # write fast forward commits ( cd $GITDIR echo echo "======== fast forward to latest" git log --reverse -p ^branch-0-82 master #git diff branch-0-82 master ) >> src/freetds-1-fastforward.patch # check the results cat src/freetds-1-fastforward.patch \ | patch -d $PKGDIR -p1 -s diff -x Makefile.in -rq $GITDIR $PKGDIR #--------------------------------------------------------------------# ======== reset files to match 0.82 tag diff --git b/.cvsignore a/.cvsignore new file mode 100644 index 0000000..d6098e5 --- /dev/null +++ a/.cvsignore @@ -0,0 +1,21 @@ +config.log +config.cache +config.status +config.sub +config.guess +configure +Makefile +Makefile.in +libtool +ltmain.sh +ltconfig +ltcf-c.sh +aclocal.m4 +autom4te.cache +depcomp +so_locations +freetds.spec +PWD +doxyfile +test-dist.log +compile diff --git b/ChangeLog-0.82 a/ChangeLog-0.82 new file mode 100644 index 0000000..cc4cbea --- /dev/null +++ a/ChangeLog-0.82 @@ -0,0 +1,2289 @@ +Tue Jan 8 10:31:43 EST 2008 JK Lowden + * doc/Makefile.am added freetds.conf.5 + * src/dblib/bcp.c applied BCPKEEPIDENTIY patch + - from Jonathan Olson + +Tue Jan 8 14:28:09 CET 2008 Frediano Ziglio + * NEWS doc/README.releasing doc/userguide.sgml: + - updates for new release + +Tue Jan 8 10:33:26 CET 2008 Frediano Ziglio + * src/odbc/unittests/genparams.c: relax for no-dm + +Mon Jan 7 19:32:20 CET 2008 Frediano Ziglio + * src/odbc/sql2tds.c src/odbc/unittests/genparams.c: + - fix millisecond round off for TIMESTAMP + - improve genparams test to catch this problem + - make genparams works with MS ODBC + +Mon Jan 7 15:04:18 CET 2008 Frediano Ziglio + * include/tdssrv.h src/server/login.c src/server/server.c: + * src/server/unittest.c: + - small improves + * src/pool/user.c: style update + +Sun Jan 6 11:48:17 CET 2008 Frediano Ziglio + * src/odbc/odbc.c: even SQLExecDirect support parameters! + * src/odbc/unittests/genparams.c: improve + +Sat Jan 5 12:23:21 CET 2008 Frediano Ziglio + * src/tds/query.c: + - add parameterized flag calling sp_cursoropen if needed + +Wed Jan 2 00:08:45 CET 2008 Frediano Ziglio + * configure.ac src/apps/Makefile.am: + - remove GNU style + * src/dblib/dblib.c: make it compile + + +Mon Dec 31 15:05:16 EST 2007 JK Lowden + * src/dblib/dblib.c fixed DBPRPAD, maybe + +Mon Dec 31 11:29:50 CET 2007 Frediano Ziglio + * misc/test-other.sh src/odbc/odbc.c: + - relax test for cursor + +Mon Dec 31 11:06:13 CET 2007 Frediano Ziglio + * src/ctlib/blk.c src/odbc/unittests/attributes.c: + * src/odbc/unittests/describecol.c src/tds/convert.c: + * src/tds/login.c src/tds/mem.c: + - minor signed/unsigned fixes + * src/dblib/bcp.c: minor performance improve + * src/dblib/dblib.c: fix date portability + +Fri Dec 28 17:57:08 EST 2007 JK Lowden + * src/tds/token.c minor change + * src/tds/convert.c simpler tds_strftime + * src/dblib/unittests/done_handling.c no spurious messages + +Wed Dec 28 15:11:48 CET 2007 Frediano Ziglio + * doc/userguide.sgml: accepted patch #1854381 + +Wed Dec 28 14:44:16 CET 2007 Frediano Ziglio + * misc/freetds_autobuild misc/test-other.sh: + - make amd64 works + * misc/test-auto.sh: add --help option + * src/tds/convert.c: + - fix overflow in tds_convert_char + - minor fixes for tds_strftime + +Thu Dec 27 14:43:14 CET 2007 Frediano Ziglio + * doc/.cvsignore: ignore autogenerated + * include/tds.h src/replacements/vasprintf.c src/tds/convert.c: + * src/tds/login.c src/tds/query.c src/tds/read.c: + - remove some warnings + +Thu Dec 27 11:20:55 CET 2007 Frediano Ziglio + * src/odbc/unittests/common.c: make unixODBC happy + * win32/config.h: define TDS_I64_FORMAT + +Thu Dec 27 10:19:58 CET 2007 Frediano Ziglio + * src/dblib/buffering.h: + - remove warning if compiled with NDEBUG defined + +Wed Dec 26 21:57:12 CET 2007 Frediano Ziglio + * src/odbc/unittests/attributes.c: make it works + +Wed Dec 26 19:44:47 CET 2007 Frediano Ziglio + * doc/freetds.conf.5: typo fix + * src/ctlib/unittests/common.c: make tests compile + * src/odbc/odbc.c: add diagnostic for truncate + +Tue Dec 25 00:55:02 EST 2007 JK Lowden + * freetds.conf doc/Makefile.am doc/freetds.conf.5 (added) + - shortened default freetds.conf and moved documentation + - to a proper man page. Merry Christmas! + +Mon Dec 24 11:34:58 CET 2007 Frediano Ziglio + * include/tds.h: removed unused fields + +Sun Dec 23 16:08:29 EST 2007 JK Lowden + * src/apps/tsql.c + * src/ctlib/cs.c src/ctlib/unittests/common.c + * src/dblib/dblib.c + * src/tds/config.c src/tds/unittests/convert.c + - added STD_DATETIME_FMT to allow for WIN32 shortcomings + +Fri Dec 21 16:20:03 CET 2007 Frediano Ziglio + * include/tds.h src/ctlib/ct.c src/odbc/odbc.c src/tds/query.c: + - make odbc cursor test work using sp_cursoropen with parameters + +Fri Dec 21 11:38:47 CET 2007 Frediano Ziglio + * src/odbc/unittests/common.c src/odbc/unittests/common.h: + * src/odbc/unittests/cursor3.c src/odbc/unittests/cursor4.c: + * src/odbc/unittests/cursor5.c: + - cursor tests should work + +Fri Dec 21 10:05:12 CET 2007 Frediano Ziglio + * configure.ac include/replacements.h src/replacements/vasprintf.c: + * win32/config.h: + - applied modified patch #1848920 + +Thu Dec 20 22:56:34 CET 2007 Frediano Ziglio + * src/dblib/dblib.c src/dblib/unittests/common.h: + * src/dblib/unittests/setnull.c src/dblib/unittests/thread.c: + - remove warnings + +Thu Dec 20 17:46:03 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: + - improve cursor attribute setting + - fix a small issue with unixODBC and 64 bit + +Wed Dec 19 16:08:17 CET 2007 Frediano Ziglio + * src/odbc/unittests/cursor3.c src/odbc/unittests/cursor4.c: + - remove warnings + +Wed Dec 19 15:35:22 CET 2007 Frediano Ziglio + * src/odbc/unittests/attributes.c(added) src/odbc/unittests/attributes.in(added): + * src/odbc/unittests/Makefile.am: add a test for statement attributes + * src/odbc/unittests/describecol.c: fix possible core + +Tue Dec 18 09:09:27 CET 2007 Frediano Ziglio + * src/odbc/unittests/Makefile.am src/odbc/unittests/cursor3.c(added): + * src/odbc/unittests/cursor4.c(added) src/odbc/unittests/cursor5.c(added): + - merged test from Sebastien FLAESCH + +Sun Dec 16 19:08:38 EST 2007 JK Lowden + * doc/api_status.txt + - set useless db-lib functions' status to 'never' + +Sun Dec 16 16:58:35 EST 2007 JK Lowden + * doc/Makefile.am doc/bsqlodbc.txt doc/osql.txt + * doc/userguide.sgml + - updated for next release + +Fri Dec 14 11:23:08 CET 2007 Frediano Ziglio + * misc/test-other.sh: fix some strange echo portability + * src/dblib/unittests/null.c src/dblib/unittests/null2.c: + - make ignore less verbose + +Thu Dec 13 23:45:55 EST 2007 JK Lowden + * src/apps/Makefile.am build bsqlodbc out-of-tree + * src/dblib/unittests/null.c prettier & correct, passes + +Thu Dec 13 21:12:20 CET 2007 Frediano Ziglio + * src/dblib/buffering.h: fix null2 + +Thu Dec 13 19:04:35 CET 2007 Frediano Ziglio + * src/apps/Makefile.am: + - fix bsqlodbc compile if not standard sql.h path + +Wed Dec 12 07:27:07 CET 2007 Frediano Ziglio + * src/tds/net.c: fix for 64bit + +Tue Dec 11 11:09:52 CET 2007 Frediano Ziglio + * doc/userguide.sgml: remove warning + * misc/freetds_autobuild: fix if password empty + +Tue Dec 11 00:02:16 EST 2007 JK Lowden + * doc/userguide.sgml minor touchups + * src/dblib/dblib.c src/dblib/unittests/setnull.c + - unittests/setnull.c passes. + +Mon Dec 10 14:05:06 CET 2007 Frediano Ziglio + * src/tds/convert.c: remove warning + +Mon Dec 10 00:08:45 EST 2007 JK Lowden + * doc/Makefile.am doc/userguide.sgml some improvements + doc/grep_sample_code doc/images/caution.gif + doc/images/warning.gif + doc/images/callouts/1.gif doc/images/callouts/2.gif + doc/images/callouts/3.gif doc/images/callouts/4.gif + doc/images/callouts/5.gif doc/images/callouts/6.gif + doc/images/callouts/7.gif doc/images/callouts/8.gif + doc/images/callouts/9.gif doc/images/callouts/10.gif + - added from http://tldp.org/LDP/abs/images/ + +Sun Dec 9 19:51:11 EST 2007 JK Lowden + * doc/userguide.sgml added tenderfoot tutorial + +Fri Dec 7 00:26:01 EST 2007 JK Lowden + * include/tds.h src/dblib/dblib.c + * src/dblib/dbutil.c src/tds/util.c + - pass errno via tdserror. + +Thu Dec 6 21:41:23 EST 2007 JK Lowden + * src/tds/convert.c tds_willconvert returns size + +Thu Dec 6 21:32:13 CET 2007 Frediano Ziglio + * src/dblib/dblib.c: fix for 64bit machines + * src/dblib/unittests/setnull.c: improve + +Thu Dec 6 19:59:59 CET 2007 Frediano Ziglio + * configure.ac include/replacements.h src/apps/bsqldb.c: + * src/dblib/unittests/setnull.c: + - use basename from MingW if available + * src/dblib/dblib.c: fix malloc portability problem + +Thu Dec 6 10:18:54 CET 2007 Frediano Ziglio + * src/dblib/rpc.c src/dblib/unittests/setnull.c: + - fix compile problems + +Thu Dec 6 01:00:42 EST 2007 JK Lowden + * src/dblib/buffering.h src/dblib/dblib.c: + - dbgetnull tolerates negative varlen, looks pretty good + +Wed Dec 5 10:38:55 EST 2007 JK Lowden + * src/dblib/dblib.c: + - t0011 passes but copy_data_to_host_var likely wrong + +Tue Dec 4 20:19:38 EST 2007 JK Lowden + * include/dblib.h src/dblib/buffering.h src/dblib/dblib.c: + - removed _db_set_null and associated mallocs + - dblib/unittest/t0011.c failing mysteriously + +Mon Dec 3 23:18:55 EST 2007 JK Lowden + * src/dblib/dblib.c src/dblib/unittests/setnull.c: + - corrected dbsetnull() + +Mon Dec 3 18:45:22 EST 2007 JK Lowden + * src/apps/bsqldb.c + * src/dblib/bcp.c src/dblib/dblib.c src/dblib/unittests/rpc.c + * src/dblib/unittests/setnull.c src/dblib/unittests/t0001.c + * src/dblib/unittests/t0002.c src/dblib/unittests/t0003.c + * src/dblib/unittests/t0004.c src/dblib/unittests/t0005.c + * src/dblib/unittests/t0006.c src/dblib/unittests/t0007.c + * src/dblib/unittests/t0008.c src/dblib/unittests/t0011.c + * src/dblib/unittests/t0015.c src/dblib/unittests/t0018.c + * src/dblib/unittests/t0023.c src/dblib/unittests/text_buffer.c + * src/dblib/unittests/thread.c src/dblib/unittests/timeout.c: + - dbbind uses zero, not -1 to indicate sufficient space. + +Mon Dec 3 17:57:54 EST 2007 JK Lowden + * src/dblib/bcp.c: don't cast malloc and don't assume it worked. + +Mon Dec 3 19:54:53 CET 2007 Frediano Ziglio + * src/odbc/Makefile.am: remove GNU make pattern + +Mon Dec 3 15:35:45 CET 2007 Frediano Ziglio + * src/dblib/dblib.c: + - do not call dbcolptr for compute result but call new dbacolptr + - dbcolptr return TDSCOLUMN* to optimize it + +Mon Dec 3 11:53:56 CET 2007 Frediano Ziglio + * src/dblib/dblib.c: remove a warning + +Mon Dec 3 10:18:39 CET 2007 Frediano Ziglio + * src/dblib/dblib.c src/dblib/unittests/.cvsignore: + * src/dblib/unittests/Makefile.am src/dblib/unittests/setnull.c(added): + - add a test for setnull + +Sun Dec 2 17:58:40 EST 2007 JK Lowden + * doc/api_status.txt + * include/dblib.h include/sybdb.h include/tds.h + * src/ctlib/blk.c src/dblib/bcp.c src/dblib/dblib.c + - full implementation of dbsetnull(). + - Replaced _DB_GETCOLINFO macro with dbcolptr(). + +Sat Dec 1 14:05:54 EST 2007 JK Lowden + * src/dblib/bcp.c src/dblib/unittests/null.c + - correct TDS 5.0 bcp offset table calcuation in presence of NULLs. + +Fri Nov 30 09:54:46 CET 2007 Frediano Ziglio + * src/dblib/unittests/common.c: missing new line + +Thu Nov 29 09:03:32 CET 2007 Frediano Ziglio + * src/dblib/unittests/null2.c: improve + +Wed Nov 28 15:15:43 CET 2007 Frediano Ziglio + * configure.ac: + - include windows.h under windows + - include sql.h directly to avoid MingW problems + * include/dblib.h src/dblib/bcp.c src/dblib/dblib.c src/dblib/rpc.c: + - avoid core checking for parameters if argument are expected + * src/dblib/unittests/null.c src/dblib/unittests/null2.c: + - avoid invalid references to deallocated stack + +Wed Nov 28 09:48:50 CET 2007 Frediano Ziglio + * src/dblib/bcp.c: remove warnings + +Wed Nov 28 00:27:36 EST 2007 JK Lowden + * src/dblib/bcp.c fixed TDS 5.0 null-column bug, cf. ML + * doc/tds.html Added BCP, made 4.01 strict, validated. + +Tue Nov 27 16:12:56 CET 2007 Frediano Ziglio + * src/dblib/unittests/Makefile.am src/dblib/unittests/null2.c(added): + - test dbbind/dbnullbind with NULLs + * src/dblib/unittests/null.c: add note + +Tue Nov 27 13:37:35 CET 2007 Frediano Ziglio + * src/dblib/unittests/t0001.c src/dblib/unittests/t0022.c: + - compile with Sybase libraries + * src/dblib/unittests/t0008.c: more verbose + +Mon Nov 26 21:02:57 CET 2007 Frediano Ziglio + * src/odbc/unittests/array_out.c: fix silly core + +Mon Nov 26 19:11:12 CET 2007 Frediano Ziglio + * configure.ac include/tdsodbc.h src/odbc/odbc.c: + * src/odbc/unittests/array_out.c src/odbc/unittests/common.h: + * src/odbc/unittests/describecol.c src/odbc/unittests/freeclose.c: + * src/odbc/unittests/insert_speed.c src/odbc/unittests/timeout.c: + * src/odbc/unittests/timeout3.c src/odbc/unittests/type.c: + - minor fixes for 64bit + +Mon Nov 26 16:47:34 CET 2007 Frediano Ziglio + * configure.ac src/apps/fisql/fisql.c: + - do not use functions not availables + +Mon Nov 26 09:43:03 EST 2007 JK Lowden + * src/dblib/bcp.c src/tds/unittests/iconv_fread.c + - small changes + +Mon Nov 26 09:51:21 CET 2007 Frediano Ziglio + * src/dblib/unittests/bcp.c: fix printf + +Mon Nov 26 07:24:43 CET 2007 Frediano Ziglio + * src/odbc/unittests/array.c src/odbc/unittests/array_out.c: + * src/odbc/unittests/const_params.c src/odbc/unittests/cursor1.c: + * src/odbc/unittests/describecol.c src/odbc/unittests/freeclose.c: + * src/odbc/unittests/insert_speed.c src/odbc/unittests/raiserror.c: + * src/odbc/unittests/rpc.c src/odbc/unittests/scroll.c: + * src/tds/challenge.c: + - fix minor issues with 64bit + +Thu Nov 22 09:43:58 CET 2007 Frediano Ziglio + * configure.ac src/ctlib/Makefile.am src/dblib/Makefile.am: + * src/odbc/Makefile.am: + - do not filter symbols under MacOsX (avoid libtool problems) + +Wed Nov 21 11:31:37 EST 2007 JK Lowden + * src/ctlib/blk.c: correctly test result of cs_convert + * src/dblib/rpc.c: minor edits + * src/dblib/unittests/bcp.c src/dblib/unittests/bcp.h: + - test works for TDS 7.0. + +Tue Nov 20 23:08:15 EST 2007 JK Lowden + * src/dblib/bcp.c src/dblib/unittests/bcp.c: + * src/dblib/dblib.c src/tds/convert.c src/tds/net.c: + - small changes + +Thu Nov 15 14:32:50 CET 2007 Frediano Ziglio + * src/dblib/unittests/.cvsignore src/dblib/dblib.c: + * src/dblib/unittests/Makefile.am src/dblib/unittests/null.c: + - fix problem with empty string and TEXT + - add a test to test empty/NULL behavior of dbdatlen/dbdata + +Thu Nov 15 10:18:40 CET 2007 Frediano Ziglio + * src/tds/login.c: return error if no username given and no Kerberos + +Tue Nov 13 10:13:06 CET 2007 Frediano Ziglio + * include/tds.h src/tds/challenge.c src/tds/gssapi.c: + * src/tds/login.c src/tds/token.c: + - port ntlm to new authentication code + - move all ntlm stuff to challenge.c + +Mon Nov 12 17:15:03 EST 2007 JK Lowden + * include/sybdb.h src/dblib/bcp.c + * src/dblib/dblib.c src/dblib/dbutil.c + * src/dblib/rpc.c + * src/tds/log.c src/tds/login.c + - trying to convince Doxygen not to ignore functions, + - e.g. dbinit + +Mon Nov 12 13:38:04 EST 2007 JK Lowden + * include/dblib.h src/dblib/dbutil.c + * src/dblib/dblib.c src/dblib/rpc.c src/dblib/bcp.c + - added DBDEAD test to all public functions + +Mon Nov 12 14:32:53 CET 2007 Frediano Ziglio + * configure.ac: cleanup + * src/tds/gssapi.c: compute fqdn name in service name + +Mon Nov 12 12:34:14 CET 2007 Frediano Ziglio + * configure.ac include/tds.h src/tds/gssapi.c: + * src/tds/login.c src/tds/mem.c src/tds/token.c: + - new TDSAUTHENTICATION structure + - new --enable-krb5 to enable Kerberos authentication + (disable by default) + +Fri Nov 09 11:29:21 CET 2007 Frediano Ziglio + * src/apps/tsql.c: remove some leaks + +Mon Nov 05 11:05:34 CET 2007 Frediano Ziglio + * src/apps/tsql.c: use pipes to avoid infinite counter + +Mon Nov 05 09:29:54 CET 2007 Frediano Ziglio + * src/tds/login.c: fix log avoidance for long logins + +Sun Nov 04 09:16:08 CET 2007 Frediano Ziglio + * src/tds/gssapi.c: small cleanup + +Sat Nov 03 14:31:40 CET 2007 Frediano Ziglio + * include/tds.h src/tds/config.c src/tds/mem.c: + - add server_host_name to TDSCONNECTION + * src/tds/gssapi.c: some improves + +Fri Nov 02 11:33:16 CET 2007 Frediano Ziglio + * src/tds/gssapi.c: add small comment + +Tue Oct 30 16:45:41 CET 2007 Frediano Ziglio + * src/tds/Makefile.am src/tds/gssapi.c src/tds/login.c: + - include developing code for GSSAPI + +Tue Oct 30 16:36:29 CET 2007 Frediano Ziglio + * include/tds.h src/tds/login.c src/ctlib/ct.c src/tds/read.c: + * src/tds/token.c: + - finish merging tds9 code as developing + +Tue Oct 30 16:02:04 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c: + - make odbc row_count 64bit + +Tue Oct 30 13:14:00 CET 2007 Frediano Ziglio + * src/tds/config.c src/tds/query.c: + - more merge for tds9 + +Tue Oct 30 11:31:30 CET 2007 Frediano Ziglio + * include/tds.h src/ctlib/blk.c src/dblib/bcp.c: + * src/server/server.c src/tds/token.c: + - merge partially tds9 patch + +Tue Oct 30 11:15:20 CET 2007 Frediano Ziglio + * src/tds/net.c: + - avoid wrong assert if error and tdserror called + * src/tds/query.c: limit data length to maximun allowed + +Wed Oct 24 17:55:56 EDT 2007 JK Lowden + * include/sqldb.h define dbfreelogin + * src/dblib/unittests/common.h add commentary + +Tue Oct 23 19:41:03 EDT 2007 JK Lowden + * src/tds/net.c src/tds/util.c + - ct-lib seems OK with EINTR (sqsh works) but db-lib + - applications get a weird message. + +Tue Oct 23 18:08:00 EDT 2007 JK Lowden + * src/tds/net.c + - return from tds_select as if timed out on EINTR. + - sqsh still unhappy when ^C pressed on long-running query. + +Thu Oct 18 16:48:23 CET 2007 Frediano Ziglio + * src/dblib/dblib.c: fix core + +Thu Oct 18 13:49:51 CET 2007 Frediano Ziglio + * src/tds/query.c src/tds/token.c: + - more free(NULL) + +Tue Oct 16 16:59:06 CET 2007 Frediano Ziglio + * src/apps/tsql.c src/ctlib/blk.c src/ctlib/cs.c src/ctlib/ct.c: + * src/dblib/bcp.c src/dblib/dblib.c src/dblib/rpc.c: + * src/dblib/unittests/rpc.c src/odbc/error.c src/odbc/odbc.c: + * src/odbc/sql2tds.c src/odbc/unittests/binary_test.c: + * src/pool/config.c src/tds/locale.c src/tds/login.c: + * src/tds/mem.c src/tds/query.c src/tds/token.c: + * src/tds/vstrbuild.c src/tds/unittests/dataread.c: + - do not check for free(NULL) + +Wed Oct 10 13:59:37 EDT 2007 JK Lowden + * src/apps/tsql.c + - added some error checking for malloc/realloc, more needed + +Tue Oct 09 13:40:24 CET 2007 Frediano Ziglio + * src/tds/mem.c: fix small memory leak + +Mon Sep 24 13:12:47 CET 2007 Frediano Ziglio + * src/tds/query.c: limit size preparing queries + +Mon Sep 24 12:01:46 CET 2007 Frediano Ziglio + * src/server/query.c src/server/server.c: + - small server improve + +Thu Sep 20 17:32:15 CET 2007 Frediano Ziglio + * include/sybdb.h src/dblib/dblib.c src/dblib/dbopen.c: + - apply constify patch #1786200 + +Thu Sep 20 17:02:20 CET 2007 Frediano Ziglio + * src/apps/tsql.c: do not strip empty lines + +Mon Sep 17 17:22:32 EDT 2007 JK Lowden + * src/dblib/bcp.c correct freebcp -L behavior + * src/tds/net.c TDSECONN on no socket failure + * src/tds/util.c change iconv messages + +Mon Sep 17 17:52:09 CET 2007 Frediano Ziglio + * doc/tds.html: update for tds9 + * src/server/login.c: remove warning + +Mon Sep 17 12:13:03 CET 2007 Frediano Ziglio + * src/apps/tsql.c: + - improve for very large query (from 9.2 to 0.3 seconds on my + test machine) + +Mon Sep 17 10:42:45 CET 2007 Frediano Ziglio + * doc/tds.html: update + * src/ctlib/unittests/get_send_data.c: small fix + * include/sybdb.h src/dblib/dblib.c src/dblib/unittests/t0022.c: + - small update for future tds9 + * src/pool/main.c src/pool/user.c src/server/login.c: + - improve portability and possible remote leakage + +Thu Sep 13 12:42:08 CET 2007 Frediano Ziglio + * src/odbc/unittests/freeclose.c: + - make it works even if login is quite long + +Thu Sep 13 08:57:26 CET 2007 Frediano Ziglio + * src/tds/unittests/dynamic1.c: use tds_set_param_type + +Thu Sep 06 13:15:54 CET 2007 Frediano Ziglio + * doc/tds.html: update for tds9 + * src/tds/read.c: work if initial in_pos is != 0 + +Sat Aug 25 12:32:01 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/error.c src/odbc/odbc.c: + - use ODBC_API instead of SQL_API to allow combined compile + +Fri Aug 24 11:50:03 CET 2007 Frediano Ziglio + * include/tds.h src/ctlib/blk.c src/dblib/bcp.c src/tds/login.c: + * src/tds/query.c src/tds/token.c: + - small changes for TDS 9.0 + +Mon Aug 16 10:09:42 CET 2007 Frediano Ziglio + * src/ctlib/unittests/Makefile.am src/dblib/unittests/Makefile.am: + * src/odbc/unittests/Makefile.am src/tds/net.c: + * src/tds/unittests/Makefile.am: + - remove other warnings + +Mon Aug 16 08:29:38 CET 2007 Frediano Ziglio + * src/tds/unittests/convert.c win32/initnet.c: + - remove some warnings compiling with MingW + +Sat Aug 11 08:51:45 CET 2007 Frediano Ziglio + * src/dblib/dblib.c vms/config_h.vms vms/descrip_mms.template: + - applied Craig A. Berry patch #1772080 for VMS systems + +Fri Aug 10 11:17:32 CET 2007 Frediano Ziglio + * NEWS: updated + +Fri Aug 10 11:14:19 CET 2007 Frediano Ziglio + * win32/dev-cpp/Makefile.win: add missing file + +Thu Aug 09 14:52:45 CET 2007 Frediano Ziglio + * src/tds/net.c: small fixes + +Thu Aug 09 10:26:51 CET 2007 Frediano Ziglio + * doc/userguide.sgml: document port override syntax + +Thu Aug 09 09:49:34 CET 2007 Frediano Ziglio + * doc/htdoc/basic_jdbc_question.html doc/htdoc/contrib.html: + * doc/htdoc/docs.html doc/htdoc/index.html doc/htdoc/news.html: + * doc/htdoc/software.html doc/htdoc/support.html: + * doc/htdoc/vague_jdbc_question.html doc/htdoc/which_api.html: + - make xhtml compatible + +Wed Aug 08 15:24:16 CET 2007 Frediano Ziglio + * configure.ac src/odbc/Makefile.am win32/version.rc.in: + - fix odbc cross compile using MingW + +Wed Aug 08 11:34:40 CET 2007 Frediano Ziglio + * misc/freetds_autobuild: + - improved adding test for server:port and server\instance case + +Wed Aug 08 11:10:36 CET 2007 Frediano Ziglio + * src/tds/config.c: fix bug #1759652 (cannot use server\INSTANCE) + +Tue Aug 07 15:34:34 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: improve cursor updates + * src/odbc/unittests/cursor1.c: improved and fixed + +Tue Aug 07 11:55:53 CET 2007 Frediano Ziglio + * src/tds/query.c: use table name for update + +Tue Aug 07 11:19:33 CET 2007 Frediano Ziglio + * include/tds.h src/odbc/odbc.c src/odbc/unittests/getdata.c: + - fix bug #1758831 + - additional fixes and checks for SQLGetData + +Tue Aug 07 10:29:55 CET 2007 Frediano Ziglio + * doc/userguide.sgml: update links + +Fri Aug 03 13:15:42 CET 2007 Frediano Ziglio + * src/tds/config.c: lookup server name correctly for instances + +Thu Aug 02 13:31:45 CET 2007 Frediano Ziglio + * include/sqlfront.h: small compatiblity improve with ms + +Fri Jul 13 18:56:56 CET 2007 Frediano Ziglio + * src/odbc/unittests/getdata.c: portability fix + +Thu Jul 12 16:31:05 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: fix for SQLGetData using empty fields + * src/odbc/unittests/getdata.c: + - improve test to catch previous problem + +Sat Jul 07 19:55:30 CET 2007 Frediano Ziglio + * m4/sprintf_i64_format.m4: improve portability + +Sat Jul 07 19:09:59 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: + - check cbValueMax in SQLGetData even if DM present + +Tue Jul 03 17:12:04 CET 2007 Frediano Ziglio + * src/odbc/unittests/compute.c src/odbc/unittests/tables.c: + * src/odbc/unittests/typeinfo.c: + - relax test for Sybase + * src/tds/token.c: fix length computation + +Tue Jul 03 15:37:03 CET 2007 Frediano Ziglio + * include/tds.h src/ctlib/blk.c src/dblib/bcp.c src/dblib/dblib.c: + * src/odbc/odbc.c src/tds/mem.c src/tds/token.c: + - add table_column_name to read real column name (if available), + read from wire and use when needed + +Sun Jul 01 12:10:31 CET 2007 Frediano Ziglio + * include/tdsstring.h src/odbc/connectparams.c: + * src/odbc/descriptor.c src/odbc/odbc.c src/tds/config.c: + * src/tds/tdsstring.c: + - added tds_dstr_dup to duplicate DSTR + - use tds_dstr_dup + - improve tds_dstr_set + +Wed Jun 27 16:51:30 CET 2007 Frediano Ziglio + * doc/tds.html: add Column Info token + * src/odbc/unittests/timeout2.c: portability fix + +Mon Jun 25 11:47:14 CET 2007 Frediano Ziglio + * doc/api_status.txt include/cspublic.h include/ctlib.h: + * src/ctlib/cs.c src/ctlib/ct.c: + - applied patch #1729392, it adds support for ctlib locale + +Mon Jun 25 10:20:00 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: review cursors + +Thu Jun 21 09:19:32 CET 2007 Frediano Ziglio + * misc/freetds_autobuild: test for Sybase 15 + * src/odbc/unittests/data.c: bigint for Sybase + * src/tds/data.c src/tds/mem.c src/tds/read.c src/tds/tds_checks.c: + - add support for Sybase bigint + - do not check decault capabilities if not necessary + +Tue Jun 19 15:30:12 CET 2007 Frediano Ziglio + * include/tds.h src/ctlib/ct.c src/odbc/odbc_util.c: + * src/pool/stream.c src/tds/data.c src/tds/net.c: + * src/tds/tds_checks.c src/tds/tds_checks.h src/tds/token.c: + - fix problem with Sybase LONGCHAR + +Tue Jun 19 14:06:55 CET 2007 Frediano Ziglio + * src/ctlib/unittests/t0007.c src/odbc/unittests/prepare_results.c: + - more verbose + - fix for possible Sybase conversion + * src/odbc/odbc.c: additional check if no dm + +Mon Jun 18 15:20:00 CET 2007 Frediano Ziglio + * src/tds/convert.c: + - patch #1736289 for bcp/bulk insert problem + +Mon Jun 18 14:02:45 CET 2007 Frediano Ziglio + * src/apps/tsql.c src/tds/locale.c: + - use correct charset based on locale + +Mon Jun 18 13:58:34 CET 2007 Frediano Ziglio + * src/odbc/unittests/genparams.c: remove warning + +Sun Jun 17 19:38:27 CET 2007 Frediano Ziglio + * src/odbc/unittests/freeclose.c src/odbc/unittests/timeout3.c: + - fix small thread problem + - fix possible deadlock + +Sun Jun 17 09:45:55 CET 2007 Frediano Ziglio + * src/odbc/unittests/freeclose.c src/odbc/unittests/genparams.c: + - fix thread and small portability + +Sun Jun 17 09:08:03 CET 2007 Frediano Ziglio + * include/dblib.h src/dblib/buffering.h src/dblib/dblib.c: + - patch #1717123 for dbsetnull implementation (removed warnings) + +Sun Jun 17 08:16:50 CET 2007 Frediano Ziglio + * src/apps/tsql.c: + - patch #1703363 for delimiters (modified) + +Wed Jun 13 09:26:00 CET 2007 Frediano Ziglio + * src/apps/fisql/fisql.c: compile even if readline is not available + +Mon Jun 4 17:09:03 EDT 2007 JK Lowden + * src/apps/Makefile.am skip bsqlodb if ODBC disabled + +Mon Jun 04 10:03:25 CET 2007 Frediano Ziglio + * src/dblib/unittests/.cvsignore src/dblib/unittests/Makefile.am: + * src/dblib/unittests/hang.c(added) src/tds/net.c: + - fix problem with tds_select (detected by Perception Technologies) + +Fri Jun 01 10:52:46 CET 2007 Frediano Ziglio + * src/tds/token.c: avoid overflow leading to memory errors + +Thu May 31 17:02:43 CET 2007 Frediano Ziglio + * src/tds/net.c: + - fixes, partially from Brent of Perception Technologies Ltd + +Thu May 31 10:54:14 EDT 2007 JK Lowden + * TODO add recent potential bug reports + +Thu May 31 14:21:35 CET 2007 Frediano Ziglio + * m4/ac_nullzero.m4: fix cross compile test + +Wed May 30 09:55:52 CET 2007 Frediano Ziglio + * src/tds/threadsafe.c: + - implement gethostbyname_r with getaddrinfo (for UnixWare 7 and others) + +Tue May 29 10:48:45 CET 2007 Frediano Ziglio + * configure.ac win32/config.h: cleanup + +Fri May 25 11:07:04 CET 2007 Frediano Ziglio + * src/odbc/convert_tds2sql.c: + - remove a FIXME + * src/odbc/odbc.c: + - fix bug #1716594 ("SQLFreeStmt with SQL_CLOSE shouldn't + unprepare statement") + * src/odbc/unittests/Makefile.am src/odbc/unittests/freeclose.c(added) + * src/odbc/unittests/.cvsignore: + - add a test for bug #1716594 + +Mon May 21 14:01:13 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: + - fix cursor updates, this undo part of change of src/odbc/odbc.c + from 1.331 to 1.332, log: + Wed Jul 21 16:50:11 CET 2004 + : some fix for SQLFetch and multiple rows + but tests works + * src/odbc/unittests/cursor1.c: improve + +Mon May 21 10:40:40 CET 2007 Frediano Ziglio + * src/odbc/unittests/cursor1.c: improve test + +Thu May 17 12:32:33 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_checks.c: + * src/odbc/odbc_util.c: + - avoid core + - fix and check invalid values of num_param_rows and curr_param_row + +Thu May 17 09:18:19 CET 2007 Frediano Ziglio + * src/odbc/unittests/warning.c: improve and comments + +Wed May 16 14:23:00 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_util.c: + * src/odbc/sql2tds.c: + - support row binding in RPC + - reuse new odbc_get_octet_len + +Wed May 16 14:23:00 CET 2007 Frediano Ziglio + * misc/freetds_autobuild: minor updates + +Mon May 14 16:04:08 CET 2007 Frediano Ziglio + * src/tds/login.c: remove copy error + +Mon May 14 10:16:37 CET 2007 Frediano Ziglio + * src/tds/login.c src/tds/mem.c src/tds/token.c src/tds/util.c: + - give proper errors on protocol autodiscovery + +Wed May 09 10:31:56 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: finish ODBC timeout + +Fri May 03 14:54:58 CET 2007 Frediano Ziglio + * src/odbc/unittests/const_params.c: + - reset statement to be sure to cleanup + +Wed May 02 16:54:13 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c: + - use query timeout from freetds.conf + +Mon Apr 30 15:14:08 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: use default linkage for static functions + +Mon Apr 30 15:02:27 CET 2007 Frediano Ziglio + * src/ctlib/blk.c: fix strange link error using gcc 4.1 + +Mon Apr 23 09:56:05 CET 2007 Frediano Ziglio + * src/tds/net.c: fix portability issue + +Fri Apr 20 15:26:15 CET 2007 Frediano Ziglio + * src/odbc/unittests/cursor1.c src/odbc/unittests/cursor2.c: + * src/odbc/unittests/scroll.c: + - make valgrind more happy if Sybase is used + +Fri Apr 20 11:13:40 CET 2007 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/Makefile.am: + * src/odbc/unittests/timeout4.c(added): + - add a test for timeout + - fix timeout on prepare (not detected) + - fix timeout if connection broken + +Thu Apr 19 11:11:55 CET 2007 Frediano Ziglio + * src/odbc/unittests/cursor1.c src/odbc/unittests/cursor2.c: + * src/odbc/unittests/scroll.c: + - give only warning for Sybase + +Thu Apr 19 10:45:15 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c: + - say we not still support cursors for sybase + +Wed Apr 18 16:28:29 CET 2007 Frediano Ziglio + * TODO.freddy include/tdsodbc.h src/odbc/odbc.c: + * src/odbc/odbc_util.c src/odbc/prepare_query.c src/odbc/sql2tds.c: + - fix cursor updates + +Mon Apr 16 22:08:07 EDT 2007 JK Lowden + * src/apps/bsqlodbc.c ODBC3 conformant + +Sun Apr 15 10:01:36 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: fix leak + +Fri Apr 13 17:27:20 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: cursor update + +Fri Apr 13 17:22:25 CET 2007 Frediano Ziglio + * include/tds.h src/tds/query.c: + - add cursor update to libTDS + +Fri Apr 13 10:08:07 CET 2007 Frediano Ziglio + * src/apps/bsqlodbc.c: + - catch all error + - fix some memory problems + +Thu Apr 12 15:33:15 CET 2007 Frediano Ziglio + * src/odbc/unittests/funccall.c: + - add test from ML + +Thu Apr 12 15:07:09 CET 2007 Frediano Ziglio + * freetds.spec.in: fix odbc directory + * src/dblib/unittests/Makefile.am: fix for make distcheck + * src/odbc/unittests/raiserror.c src/odbc/unittests/warning.c: + - relax if dm used + +Thu Apr 12 09:47:39 CET 2007 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/copydesc.c: + - test and fix a problem with SQLAllocHandle + * src/odbc/unittests/connect2.c: add test for not existing dbs + +Thu Apr 12 09:05:56 CET 2007 Frediano Ziglio + * src/ctlib/unittests/array_bind.c src/ctlib/unittests/ct_diagall.c: + * src/ctlib/unittests/ct_diagclient.c: + - fix buffer overflow leading in core + +Wed Apr 11 14:55:32 CET 2007 Frediano Ziglio + * src/dblib/unittests/common.c src/odbc/unittests/common.c: + - remove warning compiling with MingW + +Wed Apr 11 13:52:50 CET 2007 Frediano Ziglio + * src/odbc/connectparams.c src/odbc/odbc.c: + * src/odbc/unittests/connect2.c: + - finish and fix test for change_database + +Wed Apr 11 11:47:08 CET 2007 Frediano Ziglio + * src/odbc/unittests/connect2.c: fix test + * src/odbc/unittests/describecol.in: relax test + +Wed Apr 11 09:09:13 CET 2007 Frediano Ziglio + * src/odbc/unittests/connect2.c src/odbc/unittests/Makefile.am: + - add a test for change_database + +Tue Apr 10 16:00:47 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_util.c: + - fixes for describecol test + +Tue Apr 10 15:16:28 CET 2007 Frediano Ziglio + * misc/coverage.sh: remove system files + * src/odbc/unittests/describecol.in: relax test + +Fri Apr 06 10:52:25 CET 2007 Frediano Ziglio + * include/tdssrv.h src/server/login.c src/server/unittest.c: + - remove warning + +Fri Apr 06 10:29:31 CET 2007 Frediano Ziglio + * NEWS src/odbc/unittests/funccall.c src/tds/mem.c: + * src/tds/query.c: + - added some notes + +Thu Apr 05 16:16:47 CET 2007 Frediano Ziglio + * INSTALL INSTALL.CVS NEWS README doc/userguide.sgml: + - merge from 0.64 + +Wed Apr 04 13:39:27 CET 2007 Frediano Ziglio + * NEWS: updated + +Wed Apr 04 11:53:20 CET 2007 Frediano Ziglio + * include/tds.h include/tdsodbc.h src/ctlib/ct.c src/dblib/rpc.c: + * src/odbc/prepare_query.c src/odbc/sql2tds.c src/tds/mem.c: + * src/tds/token.c src/tds/unittests/dynamic1.c: + - removed unused paramter from tds_alloc_param_data + - fix possible problem in prepare_rpc + +Wed Apr 04 11:39:12 CET 2007 Frediano Ziglio + * vms/descrip_mms.template: add log.c + * src/server/query.c: use constants + +Wed Apr 04 09:14:47 CET 2007 Frediano Ziglio + * doc/userguide.sgml: improve slow check + +Tue Apr 03 16:23:17 CET 2007 Frediano Ziglio + * win32/dev-cpp/FreeTDS.dev win32/dev-cpp/Makefile.win: + - updated adding log.c + +Mon Apr 02 17:06:43 CET 2007 Frediano Ziglio + * doc/userguide.sgml: add encryption parameter + +Thu Mar 29 16:32:50 CET 2007 Frediano Ziglio + * src/ctlib/blk.c: initial fix for bcp state + +Thu Mar 29 16:25:24 CET 2007 Frediano Ziglio + * include/tds.h src/server/login.c src/tds/config.c: + * src/tds/login.c: + - added encryption setting in freetds.conf + +Thu Mar 29 12:17:34 CET 2007 Frediano Ziglio + * configure.ac: check includes for ODBC + +Thu Mar 29 09:44:11 CET 2007 Frediano Ziglio + * src/odbc/unittests/genparams.c: add test for money + +Wed Mar 28 14:43:34 CET 2007 Frediano Ziglio + * freetds.spec.in src/odbc/unittests/Makefile.am: + - fix test-dist test + +Mon Mar 26 13:27:51 CET 2007 Frediano Ziglio + * src/dblib/unittests/.cvsignore src/dblib/unittests/Makefile.am: + * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: + * win32/build_dsw.pl: + - distribute projects for vc6 unittests + +Mon Mar 26 10:05:47 CET 2007 Frediano Ziglio + * doc/htdoc/news.html: validate page + +Sun Mar 24 09:23:21 CET 2007 Frediano Ziglio + * src/apps/bsqlodbc.c: + - avoid dangerous casts + +Tue Mar 20 16:24:26 CET 2007 Frediano Ziglio + * src/replacements/gettimeofday.c src/apps/datacopy.c: + - remove warning + +Mon Mar 19 11:01:05 CET 2007 Frediano Ziglio + * include/replacements.h: fix warning for win32 + +Sun Mar 18 12:37:47 CET 2007 Frediano Ziglio + * src/dblib/unittests/common.c src/odbc/unittests/timeout2.c: + * src/odbc/unittests/timeout3.c: + - fix cross-compile for win32 + +Sun Mar 18 12:09:57 CET 2007 Frediano Ziglio + * src/apps/Makefile.am src/apps/bsqlodbc.c src/apps/tsql.c: + * src/apps/fisql/Makefile.am win32/winsetup.c: + - fix cross-compile for win32 + +Fri Mar 16 16:32:08 CET 2007 Frediano Ziglio + * include/Makefile.am src/tds/Makefile.am: + - full libTDS privatization + * src/server/unittest.c: use mnemonic + +Wed Mar 14 17:18:23 CET 2007 Frediano Ziglio + * doc/tds.html: update + * include/tdssrv.h src/pool/user.c src/server/login.c: + * src/server/query.c src/server/server.c src/server/unittest.c: + - update server stuff, at least login works + * src/tds/tdsstring.c: fix possible mising NUL terminator + * src/apps/tsql.c: fix wrong error handler result + +Wed Mar 14 09:47:24 CET 2007 Frediano Ziglio + * doc/tds.html include/tds.h: update documentation + +Tue Mar 13 17:24:54 CET 2007 Frediano Ziglio + * include/tds.h src/pool/user.c src/server/login.c: + * src/server/unittest.c src/tds/login.c src/tds/query.c: + - use mnemonic for packet types + +Tue Mar 13 16:45:54 CET 2007 Frediano Ziglio + * doc/tds.html: added known tokens + +Tue Mar 13 14:18:03 CET 2007 Frediano Ziglio + * doc/tds.html: updated from code + +Mon Mar 12 14:27:14 CET 2007 Frediano Ziglio + * include/ctlib.h include/dblib.h include/des.h include/md4.h: + * include/md5.h include/replacements.h include/tdsiconv.h: + * include/tdsstring.h include/replacements/readpassphrase.h: + * src/server/Makefile.am: + - privatize functions using gcc visibility if available + - privatize server library + +Mon Mar 12 13:31:32 CET 2007 Frediano Ziglio + * src/ctlib/unittests/blk_in2.c(added) src/ctlib/unittests/Makefile.am: + - added test from ML to test cancel and bulk together + +Mon Mar 12 10:52:12 CET 2007 Frediano Ziglio + * doc/tds.html: improved, added types + +Fri Feb 16 14:52:10 CET 2007 Frediano Ziglio + * include/tds.h: improve documentation + +Mon Feb 12 14:29:53 EST 2007 Nick Castellano + * src/dblib/dblib.c: Increase size of dbprrow() conversion buffer to 8K. + +Mon Feb 12 10:53:54 CET 2007 Frediano Ziglio + * src/odbc/unittests/timeout3.c: + - use thread instead of fork + +Wed Feb 7 01:11:27 EST 2007 JK Lowden + * src/apps/bsqlodbc.c don't exit on SQL_SUCCESS_WITH_INFO + +Wed Feb 7 00:04:15 EST 2007 JK Lowden + * src/apps/bsqldb.c exit noisily on severe errors + * src/dblib/dblib.c src/tds/token.c + - fix timeout with buffering problem per yesterday's ML. + +Tue Feb 6 17:14:50 EST 2007 Nick Castellano + * src/dblib/dblib.c: + - Sybase docs for dbsqlok() says: "If the command buffer contains + multiple commands, a run-time error will not cause dbsqlok to + fail. Instead, failure will occur with the dbresults call that + processes the command causing the run-time error." + * src/apps/fisql/fisql.c: + - Correct result set processing. + +Tue Feb 6 14:11:02 EST 2007 Nick Castellano + * src/dblib/dblib.c: Don't print or store column separator after final result column + +Tue Feb 06 10:18:00 CET 2007 Frediano Ziglio + * configure.ac src/odbc/Makefile.am: + - use -module option only for darwin + +Tue Feb 06 09:53:14 CET 2007 Frediano Ziglio + * src/apps/bsqlodbc.c: + - make more functions static + - remove warning + * src/tds/net.c: remove warning + +Mon Feb 5 21:48:58 EST 2007 JK Lowden + * src/apps/Makefile.am src/apps/bsqlodbc.c src/apps/osql + - added bsqlodbc as general batch script processor. + +Mon Feb 05 09:41:02 CET 2007 Frediano Ziglio + * misc/test-other.sh phptests/null.php: + - fixed PHP check, updated test to PHP 5.2 + +Fri Feb 02 11:51:19 CET 2007 Frediano Ziglio + * configure.ac src/odbc/odbc.c src/odbc/unittests/.cvsignore: + * src/odbc/unittests/Makefile.am src/odbc/unittests/timeout3.c(added): + - added a test for connection timeout + - fix timeout connection in odbc + +Mon Jan 29 12:02:39 CET 2007 Frediano Ziglio + * include/tds_sysdep_private.h src/apps/fisql/fisql.c: + * src/tds/net.c: + - remove some warnings + +Fri Jan 26 18:19:57 CET 2007 Frediano Ziglio + * src/apps/fisql/fisql.c: + - remove warning + - reuse malloc + - fix compile error including config.h + * src/dblib/dblib.c: remove warning + +Fri Jan 26 18:06:44 CET 2007 Frediano Ziglio + * src/odbc/error.c src/odbc/odbc.c: + - remove warning compiling + +Wed Jan 24 14:14:55 EST 2007 Nick Castellano + * doc/fisql.txt: compute rows in fisql work now, remove BUGS entry + +Wed Jan 24 14:11:56 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: indent + +Wed Jan 24 14:08:09 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: good enough compute layout + +Wed Jan 24 12:24:30 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: almost correct compute layout + +Wed Jan 24 11:32:56 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: minor compute layout fixes, still more to do + +Tue Jan 23 17:15:33 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: better compute results, layout needs fixing + +Tue Jan 23 11:24:40 EST 2007 Nick Castellano + * src/dblib/dblib.c: fix off-by-one bug in dbbylist() + +Mon Jan 22 15:54:02 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: fix :r with unreadable file + +Mon Jan 22 15:50:31 EST 2007 Nick Castellano + * src/dblib/dblib.c: print line separator after compute results + +Mon Jan 22 00:56:12 EST 2007 JK Lowden + * src/odbc/connectparams.c src/odbc/error.c + * src/odbc/odbc.c + - added log entry for API functions + * src/odbc/unittests/common.c always use '/' separator + +Sat Jan 20 15:24:03 EST 2007 JK Lowden + * include/dblib.h include/sybdb.h src/dblib/dblib.c + - moved DBOPTION to dblib.h and removed unused members. + +Sat Jan 20 01:29:36 EST 2007 JK Lowden + * doc/defncopy.txt doc/fisql.txt cleanup formatting + * src/apps/bsqldb.c src/dblib/dblib.c fix compute row headers + +Sat Jan 20 01:30:22 EST 2007 Nick Castellano + * ChangeLog src/apps/fisql/edit.c src/apps/fisql/edit.h + * src/apps/fisql/fisql.c src/apps/fisql/handlers.c + * src/apps/fisql/handlers.h src/apps/fisql/interrupt.c + * src/apps/fisql/interrupt.h src/apps/fisql/terminal.c + * src/apps/fisql/terminal.h: + - Fix my name and the program name + +Sat Jan 20 01:20:39 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: + - Be slightly less stupid about compute rows. + +Sat Jan 20 00:54:57 EST 2007 Nick Castellano + * src/dblib/dblib.c: + - do not return bogus nul character in dbgetchar() + +Sat Jan 20 00:35:45 EST 2007 Nick Castellano + * src/dblib/dblib.c: + - dbspr*() functions get nul termination not line termination + +Fri Jan 19 22:39:00 EST 2007 Nick Castellano + * doc/fisql.txt: restore compute rows BUGS entry. + +Fri Jan 19 14:05:13 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: + - Provide xmalloc() and xrealloc() instead of relying on + libreadline for these. + +Fri Jan 19 13:47:42 EST 2007 Nick Castellano + * src/apps/fisql/Makefile.am + * src/apps/fisql/fisql.c + * src/apps/fisql/xgetpass.c(removed) + * src/apps/fisql/xgetpass.h(removed): + - use readpassphrase() in fisql application. + +Fri Jan 19 13:31:31 EST 2007 Nick Castellano + * src/apps/fisql/edit.c src/apps/fisql/fisql.c + * src/apps/fisql/handlers.c src/apps/fisql/handlers.h + * src/apps/fisql/interrupt.c src/apps/fisql/interrupt.h + * src/apps/fisql/terminal.c src/apps/fisql/terminal.h + * src/apps/fisql/xgetpass.c: + - Indent fisql to standard FreeTDS coding style + +Fri Jan 19 13:19:04 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: remove obsolete code + +Fri Jan 19 13:12:56 EST 2007 Nick Castellano + * doc/fisql.txt: fisql now works, update doc + +Fri Jan 19 13:01:53 EST 2007 Nick Castellano + * .cvsignore doc/.cvsignore: clean up + +Fri Jan 19 12:45:27 EST 2007 Nick Castellano + * src/dblib/dblib.c: fix dbspr1row(), fisql now works + +Fri Jan 19 11:17:13 EST 2007 JK Lowden + * doc/fisql.txt + * src/apps/fisql/edit.c src/apps/fisql/edit.h + * src/apps/fisql/handlers.c src/apps/fisql/handlers.h + * src/apps/fisql/interrupt.c src/apps/fisql/interrupt.h + * src/apps/fisql/terminal.c src/apps/fisql/terminal.h + * src/apps/fisql/xgetpass.c src/apps/fisql/xgetpass.h + * src/apps/fisql/fisql.c + - Added notice of copyright and GPL license + +Thu Jan 18 23:55:17 EST 2007 JK Lowden + * doc/Makefile.am doc/fisql.txt added man page for fisql + * src/apps/fisql/fisql.c fixed discarding const warnings + * doc/api_status.txt include/sybdb.h src/dblib/dblib.c + - added dbgettime() + +Thu Jan 18 17:57:52 EST 2007 Nick Castellano + * AUTHORS: credit myself as a contributor + +Thu Jan 18 17:50:18 EST 2007 Nick Castellano + * src/dblib/dblib.c: + - fix dbprrow() to print character data correctly + - fix dbprrow() to not loop endlessly on aggregate rows + +Thu Jan 18 08:57:10 CET 2007 Frediano Ziglio + * src/tds/unittests/utf8_2.c: fix error handler + +Wed Jan 17 09:48:45 CET 2007 Frediano Ziglio + * src/apps/fisql/fisql.c: use mkstemp instead of mktemp + * src/tds/util.c: cleanup + +Tue Jan 16 16:30:42 EDT 2007 Nick Castellano + * configure.ac + * src/apps/Makefile.am + * src/apps/fisql: contribute free DB-Libary isql application + +Tue Jan 16 09:57:35 CET 2007 Frediano Ziglio + * src/tds/util.c: fix messages + +Tue Jan 16 09:48:43 CET 2007 Frediano Ziglio + * misc/test-other.sh: fix problem with Perl 5.8.8 + * src/dblib/dblib.c: fix possible thread problem + +Tue Jan 16 00:28:28 EST 2007 JK Lowden + * include/dblib.h src/dblib/bcp.c + * src/dblib/dblib.c src/dblib/unittests/rpc.c + - support variadic form of dbperror + +Mon Jan 15 14:40:35 EST 2007 JK Lowden + * src/dblib/unittests/common.c + * src/dblib/unittests/rpc.c + * src/dblib/unittests/t0004.c + * src/dblib/unittests/t0005.c + * src/dblib/unittests/t0007.c + * src/dblib/unittests/t0019.c + * src/dblib/unittests/t0020.c + - fail if an unanticipated message/error is received + +Sun Jan 14 23:16:17 EST 2007 JK Lowden + * src/tds/config.c src/tds/login.c + - began work on autodetecting the server's TDSVER + - works with libtds, not db-lib + +Sun Jan 14 20:38:25 EST 2007 JK Lowden + * include/dblib.h include/tds.h + * src/dblib/dblib.c src/dblib/dbutil.c + * src/dblib/unittests/t0001.c src/dblib/unittests/t0012.c + * src/dblib/unittests/timeout.c + * src/tds/net.c TODO + - timeout unit test also works with dbsetinterrupt + +Sat Jan 13 17:09:05 EST 2007 JK Lowden + * src/dblib/unittests/timeout.c added + * src/dblib/dblib.c + * src/dblib/unittests/Makefile.am src/dblib/unittests/t0001.c + * src/tds/login.c src/tds/query.c src/tds/util.c + - new timeout unit test works. + +Fri Jan 12 14:28:32 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: update code to new libTDS timeout code + * src/tds/net.c: handle send/recv errors + * src/tds/util.c: fix msgno if error not found in table + +Thu Jan 11 10:49:52 EST 2007 JK Lowden + * src/apps/osql + - fixed incorrect report when drivername is not a file + +Tue Jan 09 22:44:08 CET 2007 Frediano Ziglio + * src/apps/tsql.c: fix option problem + +Tue Jan 9 00:16:46 EST 2007 JK Lowden + * src/tds/net.c simpler tds_select, thanks Frediano + +Sun Jan 7 10:45:23 EST 2007 JK Lowden + * src/ctlib/ctutil.c works with tdserror() + +Sun Jan 7 00:41:19 EST 2007 JK Lowden + * include/tds.h + * src/dblib/dblib.c src/dblib/dbutil.c + * src/tds/net.c src/tds/query.c + * src/tds/token.c src/tds/util.c + - implement new timeout strategy using tds_select() and + - calling the client library's error handler (via tdserror). + - db-lib no worse than before, others not yet tested. + +Fri Jan 05 14:08:53 CET 2007 Frediano Ziglio + * include/tds.h src/tds/token.c: new token + * src/tds/util.c: optimize + +Fri Jan 5 02:08:54 EST 2007 JK Lowden + * include/tds.h src/tds/net.c src/tds/util.c + - begin new timeout strategy, not done. + +Thu Jan 4 18:47:46 EST 2007 JK Lowden + * doc/bsqldb.txt src/apps/bsqldb.c nicer headers + * doc/osql.txt src/apps/osql allow ini location override + +Tue Jan 2 15:42:09 EST 2007 JK Lowden + * include/dblib.h include/tds.h + * src/apps/tsql.c + * src/dblib/dblib.c src/dblib/dbutil.c + * src/tds/iconv.c src/tds/login.c src/tds/net.c + * src/tds/token.c src/tds/util.c + - replace tds_client_msg with tdserror() + +Mon Jan 01 12:56:50 CET 2007 Frediano Ziglio + * src/dblib/dblib.c src/tds/query.c: + - remove some warning compiling with SUN compiler + - Happy New Year + +Fri Dec 29 20:43:55 CET 2006 Frediano Ziglio + * src/tds/mem.c: remove warning and optimize + +Fri Dec 29 20:42:41 CET 2006 Frediano Ziglio + * src/apps/tsql.c: remove warnings + +Fri Dec 29 20:05:00 CET 2006 Frediano Ziglio + * include/tdsodbc.h: cleanup + +Fri Dec 29 20:03:30 CET 2006 Frediano Ziglio + * src/ctlib/unittests/rpc_ct_param.c: + * src/ctlib/unittests/rpc_ct_setparam.c src/odbc/odbc.c: + - remove warnings + +Fri Dec 29 17:18:42 CET 2006 Frediano Ziglio + * configure.ac src/tds/log.c: + - use localtime_r if available + +Fri Dec 29 10:06:56 CET 2006 Frediano Ziglio + * src/tds/log.c: + - avoid locking if no logging + +Tue Dec 26 15:57:38 CET 2006 Frediano Ziglio + * include/tds.h src/ctlib/unittests/array_bind.c: + * src/ctlib/unittests/ct_diagall.c: + * src/ctlib/unittests/get_send_data.c: + * src/ctlib/unittests/lang_ct_param.c: + * src/dblib/bcp.c src/dblib/dblib.c: + * src/dblib/dbutil.c src/dblib/rpc.c: + * src/dblib/xact.c src/dblib/unittests/common.h: + * src/dblib/unittests/t0016.c src/odbc/connectparams.c: + * src/odbc/descriptor.c src/odbc/error.c: + * src/odbc/odbc.c src/odbc/odbc_checks.c: + * src/odbc/prepare_query.c src/odbc/unittests/common.h: + * src/odbc/unittests/describecol.c src/pool/config.c: + * src/pool/main.c src/pool/member.c src/pool/stream.c: + * src/pool/user.c src/pool/util.c: + * src/replacements/readpassphrase.c: + * src/replacements/strtok_r.c src/replacements/vasprintf.c: + * src/server/login.c src/server/unittest.c: + * src/tds/config.c src/tds/convert.c src/tds/data.c: + * src/tds/getmac.c src/tds/iconv.c src/tds/locale.c: + * src/tds/login.c src/tds/net.c src/tds/numeric.c: + * src/tds/tds_checks.c src/tds/tdsstring.c src/tds/threadsafe.c: + * src/tds/write.c src/tds/unittests/common.h win32/winlogin.c: + * win32/winsetup.c: + - include stdarg.h always before stdio.h to fix portability + issues defining va_list + +Tue Dec 26 13:54:25 CET 2006 Frediano Ziglio + * src/tds/Makefile.am src/tds/util.c src/tds/log.c (added): + - separate log stuff + +Sun Dec 24 12:40:19 CET 2006 Frediano Ziglio + * src/odbc/descriptor.c: cleanup + +Fri Dec 22 09:34:37 CET 2006 Frediano Ziglio + * src/tds/convert.c: fix typo error + +Mon Dec 21 14:07:55 CET 2006 Frediano Ziglio + * src/tds/iconv.c: use cp1252 instead of iso8859-1 for mssql + +Wed Dec 20 22:47:36 EST 2006 JK Lowden + * src/tds/iconv.c src/tds/token.c log server charset changes + * src/tds/unittests/convert.c permit varbinary + +Mon Dec 18 10:50:34 CET 2006 Frediano Ziglio + * src/tds/Makefile.am: distribute enum_cap.h + +Fri Dec 15 14:41:14 EST 2006 JK Lowden + * src/tds/tds_willconvert.pl allow varbinary + +Thu Dec 14 22:18:16 EST 2006 JK Lowden + * src/tds/mem.c src/tds/unittests/t0001.c + - Added tds_capability_set and enumerated capabilities + * src/tds/enum_cap.h added + +Tue Dec 12 08:45:12 CET 2006 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_util.c: + - improve describecol test + +Sun Dec 10 16:04:02 EST 2006 JK Lowden + * doc/htdoc/faq.html minor fixes + * src/apps/tsql.c send *sybase* charset name in login record + * src/tds/net.c src/tds/read.c a little less logging + +Thu Dec 7 17:06:50 CET 2006 Frediano Ziglio + * src/tds/token.c: make get_send_data works + +Tue Dec 5 11:42:04 CET 2006 Frediano Ziglio + * src/odbc/unittests/funccall.c: add a test + +Fri Dec 1 16:45:59 EST 2006 JK Lowden + * include/sybdb.h src/dblib/bcp.c src/apps/freebcp.c + - Changed freetbcp batch-copied information messages to + - match the output of Sybase's bcp utility. + +Wed Nov 29 15:46:38 EST 2006 JK Lowden + * src/apps/tsql.c fixed broken "go" option handling. + +Tue Nov 28 11:52:27 EST 2006 JK Lowden + * src/apps/tsql.c fix -o option code + * src/tds/net.c reorganize tds_open_socket() + +Mon Nov 27 18:31:18 EST 2006 JK Lowden + * src/tds/net.c more detailed log of connect(2) + +Sun Nov 26 15:26:31 EST 2006 JK Lowden + * src/apps/tsql.c added connection timer feedback + * src/tds/login.c src/tds/net.c slightly better logging + +Thu Nov 23 09:43:00 CET 2006 Frediano Ziglio + * src/odbc/unittests/genparams.c: + - fix possible problem with very remote servers + +Thu Oct 26 15:09:48 EDT 2006 JK Lowden + * src/dblib/dbutil.c log error message from server + * src/tds/net.c log TDS version + +Thu Oct 26 14:26:27 EDT 2006 JK Lowden + * src/dblib/unittests/common.c src/dblib/unittests/common.h + * src/dblib/unittests/t0001.c + - corrected command-line option handling + +Sat Oct 21 16:42:08 EDT 2006 JK Lowden + * src/dblib/dblib.c src/dblib/unittests/t0022.c: + - dbresults succeeds if metadata or only return status is + - present, cf. ML yesterday. + +Sat Oct 21 14:22:44 CET 2006 Frediano Ziglio + * autogen.sh: fix some portability issues + +Wed Oct 18 21:38:57 CET 2006 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/tables.c: + - fix problem with mssql2005 and SQLTables + +Mon Oct 16 09:48:31 CET 2006 Frediano Ziglio + * src/tds/net.c: reduce system calls required + +Thu Oct 12 11:19:02 CET 2006 Frediano Ziglio + * src/tds/token.c: + - fix wrong assert + - return correctly RETURNSTATUS under Sybase + +Wed Oct 11 16:37:04 CET 2006 Frediano Ziglio + * src/tds/token.c: fix wrong assert using numerics + +Tue Oct 10 15:52:22 EDT 2006 JK Lowden + * doc/osql.txt clarified + +Fri Oct 6 17:08:43 EDT 2006 JK Lowden + * src/apps/freebcp.c src/apps/freebcp.h doc/freebcp.txt + - applied -0 patch from ML + - by Constantin Vasilyev + +Wed Oct 4 19:46:29 EDT 2006 JK Lowden + * src/apps/freebcp.c + - applied -P from stdin patch + - from ML Constantin Vasilyev + +Wed Oct 4 17:36:43 EDT 2006 JK Lowden + * src/apps/osql GNU sed does not support -E + +Wed Oct 4 14:48:20 EDT 2006 JK Lowden + * doc/Makefile.am doc/osql.txt added osql man page + +Wed Oct 4 14:12:25 EDT 2006 JK Lowden + * src/apps/Makefile.am add osql as installable script + +Tue Oct 3 15:40:12 EDT 2006 JK Lowden + * src/dblib/bcp.c test fwrite(3) correctly + +Tue Sep 26 16:57:42 EDT 2006 JK Lowden + * src/dblib/bcp.c src/dblib/dblib.c + * src/tds/convert.c src/tds/net.c src/tds/token.c + - added more user-level error checking, checking against + - known list of db-lib error messages + * src/apps/osql added + +Wed Sep 13 13:55:24 CET 2006 Frediano Ziglio + * samples/Makefile.am samples/unixodbc.freetds.driver.template.in: + - add Setup entry to unixODBC template + - unixODBC templates are not executables + +Wed Sep 13 13:52:40 CET 2006 Frediano Ziglio + * src/tds/mem.c: enable wide table + +Wed Sep 13 11:47:27 CET 2006 Frediano Ziglio + * src/tds/token.c: + - fix really broken tds5_process_result + +Fri Sep 08 11:58:24 CET 2006 Frediano Ziglio + * configure.ac src/tds/threadsafe.c: + - fix threadsafe problem on NetBSD + +Fri Sep 08 11:17:55 CET 2006 Frediano Ziglio + * include/tds.h src/tds/token.c: make splint a bit more happy + * src/odbc/odbc.c: small 64bit improvements + +Thu Sep 07 23:10:29 CET 2006 Frediano Ziglio + * src/odbc/sql2tds.c: fix paramset (Levente Tamási) + +Fri Sep 1 10:34:20 CET 2006 Frediano Ziglio + * include/tds.h include/tdsstring.h src/ctlib/ct.c: + * src/odbc/connectparams.c src/odbc/odbc.c src/server/login.c: + * src/tds/config.c src/tds/tdsstring.c: + - add dstr_size to DSTR + - add tds_dstr_alloc, tds_dstr_setlen, tds_dstr_buf + +Wed Aug 30 13:58:56 CET 2006 Frediano Ziglio + * include/tds.h src/tds/challenge.c src/tds/login.c: + - make tds_answer_challenge return flags + - tds_dstr fix + * src/dblib/dblib.c: small fix + * src/odbc/odbc.c: constification + * src/tds/query.c: + - some static functions rename + - do not convert string in tds7_build_param_def_from_query + * src/tds/threadsafe.c: cleanup + +Mon Aug 28 09:36:32 CET 2006 Frediano Ziglio + * include/cspublic.h: + - applied Norbert Sendetzky patch for ctlib compatibility + +Fri Aug 25 11:03:40 CET 2006 Frediano Ziglio + * src/dblib/unittests/Makefile.am src/dblib/unittests/t0017.c: + * src/dblib/unittests/t0017.in.be(added): + - fix big endian problem with t0017 test + +Fri Aug 25 09:17:37 CET 2006 Frediano Ziglio + * src/apps/tsql.c: remove 1024 char limit on tsql_readline + +Thu Aug 24 21:18:48 CET 2006 Frediano Ziglio + * src/apps/tsql.c: applied Christos Zoulas patch for no-tty + +Thu Aug 24 16:29:17 CET 2006 Frediano Ziglio + * include/sybdb.h src/dblib/dblib.c: + - do not change compatibility + * src/tds/config.c: small optimization + +Thu Aug 24 11:37:15 CET 2006 Frediano Ziglio + * m4/sprintf_i64_format.m4: fix 64bit problem for LP64 + +Thu Aug 24 11:17:26 CET 2006 Frediano Ziglio + * include/tds_sysdep_private.h src/apps/tsql.c src/ctlib/Makefile.am: + * src/dblib/Makefile.am src/tds/net.c win32/initnet.c: + * win32/winsetup.c win32/dev-cpp/FreeTDS.dev: + * win32/dev-cpp/Makefile.win win32/msvc6/FreeTDS.dsp: + - initialize socket library on win32 + +Thu Aug 24 08:32:07 CET 2006 Frediano Ziglio + * src/apps/tsql.c: + - do not print return status if quiet (patch from Christos Zoulas) + +Wed Aug 23 21:43:50 CET 2006 Frediano Ziglio + * doc/tsql.txt: applied Christos Zoulas updates + * doc/txt2man: updated + +Wed Aug 23 17:16:10 CET 2006 Frediano Ziglio + * src/tds/net.c: + - clean error before reading SO_ERROR, some system need this + * src/tds/util.c src/ctlib/ct.c: cross compile fixes + +Wed Aug 23 16:25:25 CET 2006 Frediano Ziglio + * m4/ac_tds_func_which_getpwuid_r.m4 m4/sprintf_i64_format.m4: + * configure.ac src/ctlib/cs.c src/apps/tsql.c: + * src/replacements/asprintf.c src/tds/query.c: + - fixes some cross compile issues with hp-ux + +Mon Aug 21 11:08:37 CET 2006 Frediano Ziglio + * src/dblib/dblib.c: remove small buffer overflow + +Thu Aug 17 11:13:40 CET 2006 Frediano Ziglio + * configure.ac include/tds.h src/dblib/unittests/Makefile.am: + * src/tds/net.c src/tds/query.c src/tds/token.c src/tds/util.c: + * m4/acx_pthread.m4(added): + - timeout more precise and use monotonic clock if available + - check pthread support more deeply + +Wed Aug 16 13:04:48 CET 2006 Frediano Ziglio + * src/tds/net.c: cleanup, fix possible problem under Linux + * src/tds/read.c: avoid invalid in_pos value on tds_peek + +Mon Aug 14 19:12:58 CET 2006 Frediano Ziglio + * src/ctlib/blk.c src/dblib/bcp.c src/dblib/dblib.c: + * src/dblib/unittests/common.c: + - fix warnings compiling with SUN cc + * src/dblib/unittests/thread.c: make error more verbose + +Sun Aug 13 15:02:40 CET 2006 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/data.c: + * src/odbc/unittests/transaction.c: + - fix minor issues with 64-bit machines + +Thu Aug 10 10:10:30 CET 2006 Frediano Ziglio + * src/ctlib/ct.c: fix possible buffer overflow + * src/replacements/gettimeofday.c: add comment + * src/tds/threadsafe.c: better and simple win implementation + * vms/descrip_mms.template win32/config.h: + * win32/dev-cpp/FreeTDS.dev win32/msvc6/libTDS.dsp: + - update build file + +Tue Aug 08 19:14:32 CET 2006 Frediano Ziglio + * doc/htdoc/index.html: update link + * src/tds/query.c: add comment + +Tue Aug 08 16:42:39 CET 2006 Frediano Ziglio + * src/tds/query.c src/tds/util.c: + - fix timeout problem setting correctly query_start_time + +Tue Aug 08 14:43:50 CET 2006 Frediano Ziglio + * src/odbc/unittests/Makefile.am: + * src/odbc/unittests/timeout2.c(added): + - added a test for timeout problem (cf "Query Time Out" on ML) + +Mon Aug 07 21:37:39 CET 2006 Frediano Ziglio + * include/tdsstring.h src/odbc/odbc_util.c: + * src/replacements/iconv.c src/tds/challenge.c: + * src/tds/config.c src/tds/convert.c: + * src/tds/iconv.c src/tds/mem.c src/tds/net.c: + * src/tds/query.c src/tds/read.c src/tds/tdsstring.c: + * src/tds/token.c src/tds/write.c: + - updated doxygen comments + +Sun Aug 06 17:54:11 CET 2006 Frediano Ziglio + * freetds.spec.in: fix rpm build on suse + +Thu Aug 03 20:30:07 CET 2006 Frediano Ziglio + * NEWS include/tds.h src/ctlib/ct.c src/odbc/odbc.c: + * src/tds/mem.c src/tds/query.c src/tds/tds_checks.c: + * src/tds/token.c src/tds/util.c: + - use reference counting for TDSCURSOR to avoid memory errors + +Thu Aug 03 10:32:37 CET 2006 Frediano Ziglio + * src/tds/unittests/iconv_fread.c(added): + * src/tds/iconv.c src/tds/unittests/.cvsignore: + * src/tds/unittests/Makefile.am: + - fix tds_iconv_fread and add a test for it + +Mon Jul 31 13:27:53 EDT 2006 JK Lowden + * src/dblib/bcp.c + - proper error message for using bcp with TDS version 4.2 + +Mon Jul 31 13:23:44 EDT 2006 JK Lowden + * include/sybdb.h src/dblib/dblib.c + - proper error message for using bcp with TDS version 4.2 + +Thu Jul 27 15:22:27 EDT 2006 JK Lowden + * samples/odbc_rpc.pl use fetchrow_array + * src/tds/unittests/Makefile.am include parent directory + +Tue Jul 25 10:16:45 CET 2006 Frediano Ziglio + * configure.ac m4/ac_nullzero.m4: add test for portability + +Tue Jul 25 10:10:22 CET 2006 Frediano Ziglio + * src/odbc/unittests/paramcore.c: updated + +Mon Jul 24 11:39:13 CET 2006 Frediano Ziglio + * src/odbc/unittests/prepclose.c: + - test with SQLExecDirect + +Mon Jul 17 15:18:48 CET 2006 Frediano Ziglio + * src/dblib/unittests/build_dsw.pl(removed): + * win32/build_dsw.pl(added) src/dblib/unittests/Makefile.am: + * src/odbc/unittests/Makefile.am: + - add a Makefile target to build projects for msvc6 + +Thu Jul 13 10:20:45 CET 2006 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c src/odbc/unittests/moreandcount.c: + - remove next_row_count, now useless... rpc.c works the same + +Wed Jul 12 13:23:43 EDT 2006 JK Lowden + * src/odbc/odbc.c src/tds/token.c: + - use TDS_NO_COUNT instead of bad rows_affected for next_row_count. + - src/odbc/unittests/rpc.c now works + +Wed Jul 12 16:15:14 CET 2006 Frediano Ziglio + * misc/test-other.sh: add file log + * src/odbc/unittests/rpc.c: fix uninitialized error + +Tue Jul 11 17:52:43 EDT 2006 JK Lowden + * src/odbc/odbc.c src/odbc/unittests/rpc.c: + - Better logging + +Tue Jul 11 17:28:34 CET 2006 Frediano Ziglio + * src/dblib/unittests/done_handling.c: improve + +Tue Jul 11 17:27:26 CET 2006 Frediano Ziglio + * src/odbc/unittests/paramcore.c: + - fix compatibility with sybase + +Tue Jul 11 11:56:53 CET 2006 Frediano Ziglio + * misc/online.pl: generate more friendly names + +Mon Jul 10 17:07:00 EDT 2006 JK Lowden + * src/tds/token.c src/dblib/dblib.c src/dblib/unittests/rpc.c + - dbresults does not return on DONEPROC + +Sun Jul 09 12:52:45 CET 2006 Frediano Ziglio + * doc/Makefile.am: fix compatibility problem + * src/odbc/unittests/rpc.c: fix warning + +Fri Jul 7 19:08:44 EDT 2006 JK Lowden + * include/sybdb.h src/dblib/dblib.c src/tds/token.c: + - Better logging + +Wed Jul 05 14:45:08 CET 2006 Frediano Ziglio + * src/dblib/unittests/Makefile.am src/dblib/unittests/bcp.c: + * src/dblib/unittests/common.c src/dblib/unittests/common.h: + * src/dblib/unittests/dbmorecmds.c: + * src/dblib/unittests/done_handling.c: + * src/dblib/unittests/rpc.c src/dblib/unittests/t0001.c: + * src/dblib/unittests/t0002.c src/dblib/unittests/t0003.c: + * src/dblib/unittests/t0004.c src/dblib/unittests/t0005.c: + * src/dblib/unittests/t0006.c src/dblib/unittests/t0007.c: + * src/dblib/unittests/t0008.c src/dblib/unittests/t0009.c: + * src/dblib/unittests/t0011.c src/dblib/unittests/t0012.c: + * src/dblib/unittests/t0013.c src/dblib/unittests/t0014.c: + * src/dblib/unittests/t0015.c src/dblib/unittests/t0016.c: + * src/dblib/unittests/t0017.c src/dblib/unittests/t0018.c: + * src/dblib/unittests/t0019.c src/dblib/unittests/t0020.c: + * src/dblib/unittests/t0021.c src/dblib/unittests/t0022.c: + * src/dblib/unittests/t0023.c src/dblib/unittests/text_buffer.c: + * src/dblib/unittests/thread.c: + * src/dblib/unittests/build_dsw.pl(added): + - put include stuff in common.h + - fix compile with ms dblib + - simplify testing under windows creating project files + +Wed Jul 5 18:29:21 EDT 2006 JK Lowden + * src/dblib/dblib.c src/dblib/rpc.c: + - removed nonprintable characters from TDSDUMP log + +Wed Jul 5 15:43:24 EDT 2006 JK Lowden + * src/dblib/unittests/rpc.c src/odbc/unittests/rpc.c: + - more thorough tests, currently fail + +Tue Jul 04 17:13:08 CET 2006 Frediano Ziglio + * src/odbc/unittests/Makefile.am: + * src/odbc/unittests/paramcore.c(added): + * src/odbc/unittests/.cvsignore src/odbc/sql2tds.c: + - test for core using SQLBindParameter, small fix + +Mon Jul 03 13:09:40 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: + - assure there is always an error when SQL_ERROR is returned + - fix warning + +Fri Jun 30 10:31:49 EDT 2006 JK Lowden + * src/odbc/sql2tds.c assert good pointer in case user passed NULL + * src/odbc/unittests/Makefile.am src/odbc/unittests/rpc.c + - added new unit test, similar to that used in dblib. + +Thu Jun 29 17:05:35 CET 2006 Frediano Ziglio + * NEWS src/tds/challenge.c: + - fix small buffer overflow + - reuse buffer + +Thu Jun 29 14:07:42 CET 2006 Frediano Ziglio + * include/tds.h src/tds/Makefile.am src/tds/challenge.c: + * src/tds/login.c src/tds/token.c: + - add NTLM2 Session Response support + +Tue Jun 27 15:47:46 CET 2006 Frediano Ziglio + * src/dblib/unittests/done_handling.c: + - improve + - update style + - fix typo + +Mon Jun 26 16:10:02 CET 2006 Frediano Ziglio + * phptests/rpc2.php(added): + - test from Ellert van Koperen (cf "SP parameters" and + http://kb.vankoperen.nl/freetds-problems.html) + +Sun Jun 25 10:12:48 CET 2006 Frediano Ziglio + * src/odbc/unittests/warning.c: + - tested + - fix portability problem with former Sybase db + - test returned warning + +Sun Jun 25 09:50:00 CET 2006 Frediano Ziglio + * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: + * src/odbc/unittests/warning.c(added): + - added warning test from John K. Hohm (cf + "Warning return as copy of last result row" on ML) + * src/odbc/unittests/describecol.c: compile fix + +Wed Jun 21 17:03:55 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: + * src/odbc/unittests/describecol.in(added): + - rewrote describecol test + +Wed Jun 21 09:26:02 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: improve column_length + * src/odbc/odbc_util.c: fix for odbc_sql_to_displaysize + * src/tds/iconv.c: invalid iconv_t is only -1, not NULL + +Tue Jun 20 17:52:19 EDT 2006 Nick Castellano + * src/odbc/unittests/array_out.c: + - rename variable to avoid libc symbol conflict + +Tue Jun 20 14:38:03 CET 2006 Frediano Ziglio + * src/tds/convert.c: use macro in sprintf + +Tue Jun 20 14:34:03 CET 2006 Frediano Ziglio + * src/tds/mem.c: small macro to allocate columns + +Tue Jun 20 14:33:09 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: improved a lot + +Tue Jun 20 11:15:16 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: catch error better + +Mon Jun 19 10:38:36 CET 2006 Frediano Ziglio + * freetds.spec.in misc/test-other.sh src/apps/Makefile.am: + * src/ctlib/Makefile.am src/dblib/Makefile.am src/odbc/Makefile.am: + * src/server/Makefile.am src/tds/Makefile.am: + * src/tds/unittests/Makefile.am: + - do not make libTDS shared library any more + +Mon Jun 19 09:57:23 CET 2006 Frediano Ziglio + * src/ctlib/ct.c src/odbc/sql2tds.c src/odbc/unittests/data.c: + * src/server/unittest.c: + - remove warning compiling with gcc4 + +Thu Jun 15 14:15:24 CET 2006 Frediano Ziglio + * configure.ac src/ctlib/unittests/cancel.c: + * src/dblib/unittests/common.c src/odbc/Makefile.am: + * src/replacements/readpassphrase.c: + - finished cross mingw32 + +Wed Jun 14 17:34:56 CET 2006 Frediano Ziglio + * src/odbc/convert_tds2sql.c: fix for date format + +Wed Jun 14 17:29:13 CET 2006 Frediano Ziglio + * configure.ac: add function + * src/apps/Makefile.am src/dblib/unittests/Makefile.am: + * src/dblib/unittests/bcp.c src/odbc/unittests/Makefile.am: + * src/replacements/Makefile.am src/replacements/gettimeofday.c: + * src/tds/unittests/Makefile.am: + - more fixes for cross mingw32 + +Wed Jun 14 13:26:42 CET 2006 Frediano Ziglio + * include/tds_sysdep_private.h src/apps/Makefile.am: + - fix for cross mingw32 + * src/odbc/unittests/describecol.c: report more clearly problems + +Tue Jun 13 20:17:16 CET 2006 Frediano Ziglio + * src/odbc/unittests/common.h src/server/unittest.c: + - small fixes for cross mingw + +Tue Jun 13 14:38:34 CET 2006 Frediano Ziglio + * src/odbc/unittests/prepclose.c(added) configure.ac: + * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: + - add test to test error closing connection on SQLPrepare + +Mon Jun 12 22:02:57 CET 2006 Frediano Ziglio + * m4/sprintf_i64_format.m4: fix for cross mingw32 + +Mon Jun 12 21:52:24 CET 2006 Frediano Ziglio + * src/odbc/sql2tds.c: fix for possible uninitialized variable + +Mon Jun 12 21:48:15 CET 2006 Frediano Ziglio + * src/apps/datacopy.c src/apps/freebcp.c src/apps/freebcp.h: + * src/pool/main.c src/pool/pool.h: + - fix some issues cross compiling for mingw32 + +Mon Jun 12 16:55:59 CET 2006 Frediano Ziglio + * src/odbc/unittests/data.c: add test for date to char + +Fri Jun 9 14:33:31 EDT 2006 Nick Castellano + * src/apps/tsql.c: inhibit readline tab completion in tsql + +Fri Jun 09 11:50:55 EDT 2006 Nick Castellano + * locales.conf: use same date format as Sybase in default and en_US + +Thu Jun 08 10:18:50 CET 2006 Frediano Ziglio + * src/tds/unittests/t0007.c: + - improved to detect possible date problems + +Wed Jun 07 14:37:56 EDT 2006 Nick Castellano + * src/tds/convert.c: correctly convert dates in January + +Tue Jun 06 12:02:10 CET 2006 Frediano Ziglio + * configure.ac src/tds/config.c: + - fix tsql -C for sybase compatibility + +Tue Jun 06 11:32:24 CET 2006 Frediano Ziglio + * src/tds/mem.c: use calloc instead of malloc/memset + +Mon Jun 05 13:42:24 CET 2006 Frediano Ziglio + * src/ctlib/ct.c src/tds/token.c: + - style and cleanup + +Mon May 29 13:38:05 CET 2006 Frediano Ziglio + * m4/sprintf_i64_format.m4: fix quoting + +Mon May 29 12:58:38 CET 2006 Frediano Ziglio + * NEWS include/tds.h src/tds/token.c: + - make tds_alloc_get_string static + +Mon May 15 17:11:54 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: + - applied fixes from Charlene Herring (cf. "Problems when + using odbc : SQLPutData, SQLExecDirect,Decimals" 2006/05/14 + +Sun May 14 14:34:04 CET 2006 Frediano Ziglio + * src/odbc/descriptor.c: fix memory error + +Sat May 13 10:49:40 CET 2006 Frediano Ziglio + * src/odbc/unittests/copydesc.c: improve + +Mon May 08 11:38:30 CET 2006 Frediano Ziglio + * src/odbc/descriptor.c src/odbc/unittests/Makefile.am: + * src/odbc/unittests/copydesc.c(added): add test for SQLCopyDesc + +Fri Apr 21 17:10:00 CET 2006 Frediano Ziglio + * src/odbc/sql2tds.c: use new tds_convert types + +Fri Apr 21 09:45:56 CET 2006 Frediano Ziglio + * doc/htdoc/faq.html: fix html compatibility + +Thu Apr 20 12:10:28 CET 2006 Frediano Ziglio + * src/ctlib/unittests/ct_dynamic.c: remove leak in test + +Tue Apr 17 19:47:57 CET 2006 Frediano Ziglio + * src/ctlib/ct.c: fix double free + +Mon Apr 17 10:51:09 CET 2006 Frediano Ziglio + * src/odbc/convert_tds2sql.c src/odbc/prepare_query.c: + - use new conversion style in ODBC + +Sun Apr 16 10:11:32 CET 2006 Frediano Ziglio + * include/tds.h src/tds/locale.c src/tds/mem.c: + - TDSLOCALE changes to keep ABI + +Sat Apr 15 10:18:29 CET 2006 Frediano Ziglio + * include/tdsconvert.h * src/tds/convert.c: + - add new type of conversion for copy optimizations + +Sat Apr 15 10:02:20 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: fix for older Sybase versions + * src/tds/config.c: optimize option read + +Sat Apr 15 09:03:34 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: remove warning + +Fri Apr 14 15:22:02 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: + - improved + +Fri Apr 14 13:55:09 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: + - add test for precision returned by SQLDescribeCol + +Wed Apr 12 21:41:51 CET 2006 Frediano Ziglio + * locales.conf: fix charset typo + * doc/userguide.sgml: fix attributes for locales.conf + +Wed Apr 12 15:53:18 CET 2006 Frediano Ziglio + * include/tds.h include/tds_sysdep_private.h: + * include/tds_sysdep_public.h.in include/tdsconvert.h: + * include/tdsver.h.in: + - avoid ident strings in all objects + * m4/sprintf_i64_format.m4: add Ld format + +Tue Apr 11 16:33:41 CET 2006 Frediano Ziglio + * include/tds_sysdep_public.h.in include/tdsver.h.in: + - small constification + +Tue Apr 11 13:51:43 CET 2006 Frediano Ziglio + * src/odbc/unittests/connect.c: do not fail if not FreeTDS + * src/odbc/unittests/raiserror.c: more verbose + +Mon Apr 10 18:14:17 EDT 2006 JK Lowden + * include/tds.h src/apps/tsql.c src/tds/config.c + - report sysconfdir with tsql -C + +Mon Apr 10 11:59:53 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: cleanup + +Fri Apr 07 09:38:45 CET 2006 Frediano Ziglio + * misc/test-other.sh: update to php 5.1 + * phptests/nextres.php: a bit more verbose + +Thu Apr 06 11:37:45 CET 2006 Frediano Ziglio + * misc/coverage.sh: less verbose + * src/dblib/bcp.c: small change + +Wed Apr 05 08:42:54 CET 2006 Frediano Ziglio + * misc/full-test.sh: cleanup + * misc/test-auto.sh: allow configuration + * misc/test-other.sh: make output suitable for online.pl + * src/apps/tsql.c: + - improve documentation + - fix problem for multiple options + * src/odbc/odbc.c src/tds/token.c: avoid void message to application + +Wed Apr 05 07:09:32 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: remove some warnings + +Wed Mar 29 18:25:54 CET 2006 Frediano Ziglio + * m4/ac_caolan_func_which_gethostbyname_r.m4: + * m4/ac_have_inaddr_none.m4 m4/ac_have_malloc_options.m4: + * m4/ac_raf_func_which_getservbyname_r.m4: + * m4/ac_tds_func_which_gethostbyaddr_r.m4: + * m4/ac_tds_func_which_getpwuid_r.m4: + * m4/ac_tds_func_which_localtime_r.m4: + * m4/ax_cflags_gcc_option.m4 m4/lib-link.m4: + * m4/sprintf_i64_format.m4 m4/type_socklen_t.m4: + - quote as necessary + +Mon Mar 27 19:01:05 EST 2006 JK Lowden + * configure.ac + * m4/ac_caolan_func_which_gethostbyname_r.m4 + * m4/ac_have_inaddr_none.m4 + * m4/ac_have_malloc_options.m4 + * m4/ac_raf_func_which_getservbyname_r.m4 + * m4/ac_tds_func_which_gethostbyaddr_r.m4 + * m4/ac_tds_func_which_getpwuid_r.m4 + * m4/ac_tds_func_which_localtime_r.m4 + * m4/ax_cflags_gcc_option.m4 + * m4/sprintf_i64_format.m4 + * m4/type_socklen_t.m4 + * src/ctlib/unittests/Makefile.am + * src/dblib/unittests/Makefile.am + * src/odbc/unittests/Makefile.am + * src/tds/unittests/Makefile.am + - removed/updated obsolete autoconf macros + * m4/am_iconv.m4 removed + * m4/README.iconv + * m4/iconv.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 + - added from GNU libiconv + +Mon Mar 27 09:48:56 EST 2006 JK Lowden + * doc/htdoc/index.html corrected nightly test link + +Mon Mar 27 10:17:42 CET 2006 Frediano Ziglio + * src/dblib/rpc.c: allow again null for fixed types + +Mon Mar 27 02:20:16 EST 2006 JK Lowden + * configure.ac m4/am_iconv.m4 m4/check_openssl.m4 + * src/apps/Makefile.am src/ctlib/Makefile.am src/dblib/Makefile.am + * src/odbc/Makefile.am src/pool/Makefile.am src/replacements/Makefile.am + * src/server/Makefile.am src/tds/Makefile.am + - modernized autotool contructs + * configure.in removed + +Sun Mar 26 19:01:43 CET 2006 Frediano Ziglio + * src/odbc/prepare_query.c: + - fixed constant parameters after mssql 2005 patch + +Fri Mar 24 16:47:26 EST 2006 JK Lowden + * configure.in removed, is now configure.ac + * acinclude.m4 removed, added m4 directory + * Makefile.am include m4 directory + * m4/ac_caolan_func_which_gethostbyname_r.m4 m4/ac_have_inaddr_none.m4 + * m4/ac_have_malloc_options.m4 m4/ac_raf_func_which_getservbyname_r.m4 + * m4/ac_tds_func_which_gethostbyaddr_r.m4 + * m4/ac_tds_func_which_getpwuid_r.m4 + * m4/ac_tds_func_which_localtime_r.m4 m4/am_iconv.m4 + * m4/check_openssl.m4 m4/sprintf_i64_format.m4 m4/type_socklen_t.m4 + - Split acinclude.m4 into one macro defintion per file. + * m4/ax_cflags_gcc_option.m4 + - Check for gcc features e.g. the declaration-after-statement warning. + +Fri Mar 24 13:03:36 EST 2006 JK Lowden + * doc/htdoc/docs.html doc/htdoc/index.html updated + +Fri Mar 24 12:36:02 EST 2006 JK Lowden + * doc/htdoc/software.html fixed broken links added link to RC + +Fri Mar 24 16:27:27 CET 2006 Frediano Ziglio + * misc/full-test.sh misc/test-auto.sh misc/full-test-ol.sh(removed): + - use an "online" version for test + +Thu Mar 23 15:53:45 CET 2006 Frediano Ziglio + * src/odbc/sql2tds.c src/odbc/unittests/earlybind.c: + * src/odbc/unittests/norowset.c src/odbc/unittests/t0004.c: + * src/odbc/unittests/tables.c src/tds/data.c src/tds/tds_checks.c: + - fixes for mssql 2005 + +Thu Mar 23 13:48:23 CET 2006 Frediano Ziglio + * src/tds/query.c: partially fix problem with mssql2k5 + +Thu Mar 23 11:44:32 CET 2006 Frediano Ziglio + * misc/full-test-ol.sh misc/online.pl misc/test-auto.sh: + - changed online.pl with James hints + - enable Valgrind tests using online check + +Tue Mar 21 15:24:04 CET 2006 Frediano Ziglio + * src/odbc/unittests/cursor2.c(aded) src/odbc/unittests/Makefile.am: + - added test to check errors using cursor on no row statement + +Tue Mar 21 13:22:07 CET 2006 Frediano Ziglio + * src/odbc/native.c: + - applied patch from Richard Krehbiel (cf "ODBC datetime literal issue") + +Tue Mar 21 08:49:44 CET 2006 Frediano Ziglio + * configure.in src/dblib/dblib.c: + - fix declaration after statements + +Mon Mar 20 15:28:25 CET 2006 Frediano Ziglio + * src/dblib/bcp.c: fix error in bcp_colfmt + +Mon Mar 20 15:00:45 CET 2006 Frediano Ziglio + * src/dblib/bcp.c src/dblib/dblib.c src/dblib/rpc.c: + - remove some double checks + - return correct values from CHECK_PARAMETER + - fix some possible core if dbproc == NULL + +Mon Mar 20 09:42:55 CET 2006 Frediano Ziglio + * misc/full-test.sh: added timeout + +Sun Mar 19 18:34:47 CET 2006 Frediano Ziglio + * misc/test-auto.sh: fix typo in header + * src/dblib/dblib.c: remove double checks + +Sun Mar 19 18:33:14 CET 2006 Frediano Ziglio + * src/odbc/unittests/genparams.c src/odbc/unittests/transaction.c: + - remove warnings on 64bit int + +Sun Mar 19 09:27:09 EST 2006 JK Lowden + * src/dblib/bcp.c src/dblib/dblib.c more logging repairs + +Sat Mar 18 12:34:02 EST 2006 JK Lowden + * include/dblib.h src/dblib/bcp.c + - validate parameters. Unable to run unittest due to down server. + +Sat Mar 18 01:27:32 EST 2006 JK Lowden + * include/dblib.h src/dblib/dblib.c src/dblib/rpc.c + - test parameters for all public functions (except bcp) + +Fri Mar 17 01:35:17 EST 2006 JK Lowden + * src/dblib/dblib.c src/dblib/rpc.c + - added a TDSDUMP log entry for every public function + +Thu Mar 16 09:59:25 EST 2006 JK Lowden + * TODO add rpc error messages + * src/apps/bsqldb.c exit if severity > 10 + +Wed Mar 15 00:41:11 EST 2006 JK Lowden + * doc/freebcp.txt The freebcp manpage was seriously out of date. + * src/apps/freebcp.c give better error message. + +Thu Mar 9 14:33:37 CET 2006 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c: + - add cursor_type to connection attributes (required for DBD::ODBC) + - removed small TODO on error report + +Mon Mar 6 12:55:10 CET 2006 Frediano Ziglio + * include/tds.h src/ctlib/ct.c src/odbc/connectparams.c: + * src/pool/util.c src/server/login.c src/server/unittest.c: + * src/tds/config.c src/tds/login.c src/tds/mem.c: + - renamed host_name field to client_host_name + - optimize way strings are allocated + +Fri Feb 24 15:04:35 EST 2006 JK Lowden + * src/tds/config.c src/tds/login.c: + - nicer TDSDUMPCONFIG output, including a recap + +Sun Feb 19 14:56:15 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: fix wrong declaration + +Thu Feb 16 08:30:00 CET 2006 Frediano Ziglio + * src/odbc/unittests/scroll.c src/odbc/unittests/raiserror.c: + * src/odbc/unittests/cursor1.c: + - remove warning compiling with gcc4 + * misc/test-other.sh: fix problem with DBD:ODBC test + +Mon Feb 13 17:11:30 CET 2006 Frediano Ziglio + * src/odbc/unittests/genparams.c: add BIGINT type to test + +Wed Feb 8 10:48:36 CET 2006 Frediano Ziglio + * include/tdsodbc.h src/odbc/error.c src/odbc/odbc.c: + * vms/odbc_driver_axp.opt win32/FreeTDS.def: + - start cursor stuff for odbc + - added SQLSetScrollOptions + * src/odbc/unittests/scroll.c: support more fetch types + +Tue Feb 7 15:42:56 CET 2006 Frediano Ziglio + * include/tds.h src/tds/query.c src/ctlib/ct.c NEWS: + - improve cursor support + +Tue Feb 7 14:22:50 CET 2006 Frediano Ziglio + * src/odbc/unittests/scroll.c(added): + * src/odbc/unittests/.cvsignore: + * src/odbc/unittests/Makefile.am: + * src/odbc/unittests/cursor1.c: + - add scroll test for cursor + - build msvc project for odbc unittests + * src/dblib/unittests/Makefile.am: add done_handling test + +Mon Feb 6 16:50:05 CET 2006 Frediano Ziglio + * include/sybdb.h src/apps/freebcp.c src/dblib/bcp.c: + - implemented BCPKEEPIDENTITY for bcp_control + - make freebcp do not depend on dblib internals + +Mon Feb 6 16:44:27 CET 2006 Frediano Ziglio + * src/odbc/unittests/.cvsignore src/odbc/unittests/cursor1.c: + - update cursor1 test + +Thu Feb 2 15:33:21 CET 2006 Frediano Ziglio + * NEWS: updated + * src/odbc/odbc.c vms/odbc_driver_axp.opt win32/FreeTDS.def: + - compile SQLSetPos function + * src/odbc/unittests/Makefile.am src/odbc/unittests/cursor1.c(added): + - added a test for cursors (do not work...) + +Tue Jan 31 14:27:51 CET 2006 Frediano Ziglio + * src/apps/freebcp.c src/dblib/bcp.c: + - fix broken charcater conversion + - use calloc instead of malloc/memset + - support 64bit file on win32 + +Tue Jan 31 09:59:28 CET 2006 Frediano Ziglio + * src/dblib/dblib.c: do more argument check + +Mon Jan 30 16:29:20 CET 2006 Frediano Ziglio + * src/ctlib/unittests/blk_out.c src/ctlib/unittests/ct_cursor.c: + * src/ctlib/unittests/ct_cursors.c src/ctlib/unittests/ct_dynamic.c: + * src/dblib/unittests/t0005.c src/dblib/unittests/t0014.c: + * src/dblib/unittests/t0022.c src/dblib/unittests/thread.c: + - reduce false errors + +Sat Jan 28 15:49:55 CET 2006 Frediano Ziglio + * src/dblib/bcp.c: + - update row allocation using new row_free + - fix native format + - correctly check and handle EOF + - change _bcp_build_bcp_record to direct send row (renamed to + _bcp_send_bcp_record) + - write error file only if needed + * src/dblib/unittests/t0016.c: improved + * src/dblib/unittests/t0016.in: + - make input same of output + * src/dblib/unittests/t0017.c: get all data + * src/tds/mem.c: reset pointer just freed + +Sat Jan 28 09:39:10 CET 2006 Frediano Ziglio + * src/dblib/unittests/t0017.c: reformat output + +Fri Jan 27 14:34:09 EST 2006 JK Lowden + * src/dblib/bcp.c recognize EOF errors from _bcp_read_hostfile + +Fri Jan 27 10:43:54 EST 2006 JK Lowden + * src/dblib/unittests/t0017.c better feedback + +Thu Jan 26 13:58:51 CET 2006 Frediano Ziglio + * src/apps/freebcp.c src/apps/freebcp.h: + - support for NUL in terminators + +Wed Jan 25 15:33:20 CET 2006 Frediano Ziglio + * src/dblib/bcp.c: fix return test for fseeko + +Wed Jan 25 15:01:51 CET 2006 Frediano Ziglio + * acinclude.m4 configure.in src/tds/numeric.c: + - use 64bit sprintf format if available + * misc/test-other.sh: redirect odbc to compiled driver + +Tue Jan 24 16:01:41 CET 2006 Frediano Ziglio + * NEWS include/tds.h src/apps/tsql.c src/ctlib/blk.c: + * src/ctlib/ct.c src/dblib/bcp.c src/dblib/buffering.h: + * src/dblib/dblib.c src/dblib/rpc.c src/odbc/odbc.c: + * src/odbc/odbc_util.c src/odbc/prepare_query.c: + * src/odbc/sql2tds.c src/pool/stream.c src/server/server.c: + * src/tds/mem.c src/tds/query.c src/tds/tds_checks.c: + * src/tds/token.c src/tds/unittests/dataread.c: + * src/tds/unittests/dynamic1.c src/tds/unittests/t0002.c: + * src/tds/unittests/t0004.c src/tds/unittests/t0005.c: + * src/tds/unittests/t0006.c src/tds/unittests/utf8_1.c: + * src/tds/unittests/utf8_2.c: + - use direct pointer column_data instead of old column_offset + +Mon Jan 23 17:30:38 EST 2006 JK Lowden + * src/apps/bsqldb.c bind to printable width, not column size + +Mon Jan 23 14:04:44 CET 2006 Frediano Ziglio + * configure.in: start developing 0.65 version +$Id: ChangeLog-0.82,v 1.1.2.2 2008/01/10 20:58:43 jklowden Exp $ diff --git b/INSTALL.CVS a/INSTALL.CVS new file mode 100644 index 0000000..c23f6b7 --- /dev/null +++ a/INSTALL.CVS @@ -0,0 +1,65 @@ +Building FreeTDS from CVS +James Cameron + +The CVS archive is maintained on Source Forge. See the User Guide or +start at http://sourceforge.net/projects/freetds/ for information on +connecting to the CVS server. Then follow these steps: + +1) satisfy build dependencies, ensure that the following packages are + installed: + + automake (GNU Automake, generates Makefile.in from Makefile.am) + autoconf (GNU Autoconf, generates configure from configure.in) + libtool (GNU Libtool, library creation support scripts) + make (GNU or BSD Make.) + gcc (GNU Compiler Collection, for C code compilation) + + Autotool versions that work: + $ (autoconf --version; automake --version; libtool --version) |grep GNU + autoconf (GNU Autoconf) 2.60 + automake (GNU automake) 1.9.6 + ltmain.sh (GNU libtool) 1.5.18 (1.1220.2.245 2005/05/16 08:55:27) + + The above are used to generate the distributions. + You may get away with older versions, as far back as 2.53 for autoconf. + +2) execute autogen.sh to run automake, autoconf and configure, + + ./autogen.sh + + Any switches provided to autogen.sh will be passed to the configure script. + +3) compile the source using make, + + make + +5) switch to a user that can write to the target installation + directory, usually root, + + su root + +4) install the package, + + make install + ++++ + +You are not required to rely on SourceForge's anonymous CVS server, which at +the present time (July 2004) runs up to 1 hour behind the development server. +You can fetch the CVS tarball (the basis for a CVS server, not a snapshot) from +SourceForge at: + +http://cvs.sourceforge.net/cvstarballs/freetds-cvsroot.tar.bz2 + +We have a backup location, too, via anonymous ftp: + + ftp://rt.fm/pub/freetds/ (thanks to Joshua Stein ) + +Nightly tarballs have been discontinued or deprecated, depending on which +Sourceforge document you believe. Either way, you can now fetch +the CVS tree via rsync: + +$ rsync -av rsync://freetds.cvs.sourceforge.net/cvsroot/freetds/* . + +-- +$Id: INSTALL.CVS,v 1.7.2.1 2008/01/10 20:58:43 jklowden Exp $ diff --git b/TODO.freddy a/TODO.freddy new file mode 100644 index 0000000..521a55a --- /dev/null +++ a/TODO.freddy @@ -0,0 +1,66 @@ +Well.. I don't know how to put these information so I'll put here +Probably I'm the only person who can fully understand these notes... + +Fixes +----- +IMPORTANT fix done_handling +ODBC RPC check (+chained rpcs?? see below) + +Cursor and dynamic +------------------ +libTDS should handle real cursor/dynamic memory deallocation +search for tds_alloc_cursor, tds_free_cursor and similar for dynamic +cursor too complicate... reduce all states, handle more in libTDS +Tests: + - multiple RPCs check returns (possible??) + (see odbc_set_return_status, odbc_set_return_params and odbc_get_param_len + calls) + add multiple chained RPCs for odbc and mssql7+... + - cursor update and multiple tables (using view) +ODBC cursor check (cfr "Progress on CVS") + search "TODO read results, set row count, check type and scroll returned" +http://support.microsoft.com/kb/246265/en-us +http://support.microsoft.com/kb/290413/en-us +http://support.microsoft.com/kb/238336/en-us + +Row handling +------------ +Upper layer should be able to read data from network and handle rows +Possibility to stop sending/receiving data for SQLPutData and similar +Allow upper layer to get if libTDS is sending a request (add new state??) +tds_process_tokens should "return" any row/done/other informations, +not only done_flags +libTDS should handle multiple reply from server (cursors and so on) + +Token handling +-------------- +Split token.c to one base token handling and another with higher +level (callbacks, state and so on) +See James propos about tds_read_results + +Done handling +------------- +Callback when state goes to IDLE +Free unused cursors and dynamic and/or reuse them + +Other +----- +Implement some sort of fast write to network writing directly to +wire buffer. It would be helpful to have "lock" length size, write to +wire, write length, "unlock". Also a function to get current position (to +compute lengths). + +build an array of "flags" to translate type -> flag like SYBCHAR -> +char, variable and so on + +Possibility to lock TDSSOCKET (see odbc, multiple RPCs) + +Support Unicode under ODBC, use iso8859-1 by default and large characters + + +Tests +----- +Rebuild all test support (virtual machines, chroot, msde+mssql2005) +Add a test for rpm (redhat, suse?) +disabling thread safety don't check for thread-safe functions +check cross compiled odbc driver, exports, resource version (test-dist) diff --git b/doc/.cvsignore a/doc/.cvsignore new file mode 100644 index 0000000..1138025 --- /dev/null +++ a/doc/.cvsignore @@ -0,0 +1,19 @@ +Makefile +Makefile.in +freebcp.1 +html +tsql.1 +bsqldb.1 +defncopy.1 +datacopy.1 +osql.1 +fisql.1 +libtds +reference +userguide.dsl +doc +ctlib.api.sgml +dblib.api.sgml +doxy.log +odbc.api.sgml +bsqlodbc.1 diff --git b/doc/README.releasing a/doc/README.releasing new file mode 100644 index 0000000..cae6dc0 --- /dev/null +++ a/doc/README.releasing @@ -0,0 +1,53 @@ +It's pretty simple, basically: + +0) Form a branch in cvs: + + $ cvs tag -b BRANCH0_xx + + Use the form BRANCH0_xx, where xx is the release number. This affects only + the repository, not the working directory. + +1) Change the version number in configure.ac and UG. +2) Update web pages regarding purpose and status of rc. +3) Put out a release candidates until everyone's happy. + jkl has a "make dist" script on /etc/nightly.freetds that works well. +4) ftp tarball to + ftp://login.ibiblio.org/pub/linux/ALPHA/freetds/current +5) ftp user guide to www.freetds.org/userguide/. + repeat 3-4 as necessary. +6) Log into ibiblio. Trim rc# from tarball. Update web site. +7) Create rpm with 'rpmbuild -ta freetds-0.61.tar.gz', post these to + ibiblio as well. + +Announcements to: + + freshmeat.net + comp.os.linux.announce + comp.databases.sybase + comp.databases.ms-sqlserver + linuxpr.com + + +We received this bit of advice on the mailing list on +Wed Oct 15 14:51:06 EDT 2003. + +Please, please, *please* follow the common rules of good release +engineering (in descending order of importance - two orders of magnitude +less important per step ;-) + +(A) (Priority 100) A release is STATIC. You NEVER EVER change the + contents of a release after the fact, such as replacing the + freetds-0.61.tgz archive with a DIFFERENT ARCHIVE containing + freetds-0.61.2. This breaks everybody that has a system in place + for using the tarballs - and I know of at least eight public open + source systems that do this, as well as a bunch of proprietary systems. + +(B) (Priority 1) Release engineering needs to include procedures to + make sure that the documentation in the release is up to date. + FreeTDS 0.61.2 refers to itself as FreeTDS 0.61.1. + +(C) (Priority 0.01) It'd be nice if the archive name followed the normal + convention for naming - .tar.gz for tar and gzip, rather than .tgz. + +-- +$Id: README.releasing,v 1.10 2008/01/08 13:29:40 freddy77 Exp $ diff --git b/doc/htdoc/contrib.html a/doc/htdoc/contrib.html new file mode 100644 index 0000000..284f3e1 --- /dev/null +++ a/doc/htdoc/contrib.html @@ -0,0 +1,71 @@ + + + + + +FreeTDS.org + + + + + + + + + +
FreeTDS.org +Home  |  +News  |  +Software  |  +Documentation  |  +Support  |  +Contribute +
+
+ + + +

+Contribute +
+
+

+ + + + + + + + + + + +
 
+So you want to help out the FreeTDS Project? We greatly appreciate all offers. There are a number of ways to help and this page will let you know about them. +
 
+If you are a programmer and wish to contribute code, please join our Mailing List. Preferred form for patches is a context diffs against the current CVS tree. If you have submitted patches in the past and want to get a CVS account for direct checkin ask James. +
 
+If your C skills aren't up to snuff, but you still want to help, consider pitching in on the FreeTDS documentation. If something didn't make sense when you read it, let us know. Or if you want to detail how you got a specific configuration working, send it in and we'll include it in the User Guide, so those that come after you will have an easier time. +
 
+If on the other hand you simply want to donate money to the FreeTDS Project, we also graciously accept donations via PayPal. Just click on the button below. These funds will be used for purchases of software and hardware specifically needed by those who work on FreeTDS. In particular, our current needs include VMWare, Win2K Server (to complete domain login support), and SQL Server 2000 (for TDS 8.0 support). We will provide a detailed accounting of how these funds are spent to any contributor who requests it. +
 
+ + +
+

+ + + + + + + + + +

+
+ + + + diff --git b/doc/htdoc/faq.html a/doc/htdoc/faq.html new file mode 100644 index 0000000..76126b3 --- /dev/null +++ a/doc/htdoc/faq.html @@ -0,0 +1,864 @@ + + + + + + + + + + FreeTDS Frequently Asked Questions + + + + + + + + + + + +
FreeTDS.orgHome  |  + News  |  Software  |  Documentation  |  Support  |  Contribute
+
+ + +

FAQ

+ +

The FreeTDS User Guide, + included in each release, is the appropriate place for new users + to start.

+ +

This list of frequently asked questions and answers about + FreeTDS is updated between releases to cover problems since the + last release, and to answer perennial questions (there are + some).

+ +
+ $Id: faq.html,v 1.18 2006/12/10 21:07:47 jklowden Exp $ +
+ +
    +
  1. General Questions + + +
  2. + +
  3. Documentation + + +
  4. + +
  5. Implementation + + +
  6. + +
  7. Programming: C++, Sybperl, SQSH, & PHP + + +
  8. + +
  9. Problems Running + + +
  10. +
+ +
+ +

General Questions

+ +

What is FreeTDS?

+ + +

FreeTDS is a free implementation of the TDS (Tabular Data + Stream) protocol that is used by Sybase and Microsoft for their + database products. It implements TDS 4.2, 5.0, 7.0 and + 8.0, and can communicate with any Sybase or Microsoft SQL + Server.

+ +

FreeTDS comes with a low level library (the TDS layer) along + with a number of APIs (Application Programming Interfaces). The + APIs are DB-Lib, CT-Lib, and ODBC.

+ +

A JDBC driver has also been contributed under a BSDish license + and is available from the download page. It does not require the + FreeTDS C libraries.

+ +

Where do I get FreeTDS?

+ + +

You can get the latest FreeTDS from + Ibiblio or its mirrors. See "Quick Links" on the FreeTDS home page. You may also use + the CVS + repository (on sourceforge.net); see the + User Guide for details.

+ +

Your favorite operating system may have a package of some kind + available. You might want to check there. Occasionally someone + contributes a package here, which we keep around. Post a message + to the list if you're looking for one and don't find one in the + usual places.

+ +

Does FreeTDS support Microsoft servers?

+ + +

Yes. Microsoft servers don't usually accept TDS 5.0 + connections. Use one of versions 4.2, 7.0 or 8.0 of the protocol. + See the User + Guide for details.

+ +

How can I get help (or support)?

+ + +

After reading this FAQ and the User Guide, you might want to + look at the mailing list archives. If + you don't see your question answered there (or, if you'd just + like to learn more about what's going on with FreeTDS), please + subscribe to the mailing list. Questions + new and old are cheerfully answered there. Traffic is not high, + normally around 10 messages a day.

+ +

Netiquette note: It's considered poor form to mail + "help me" questions directly to the developers of any free + software project, this one included. Please direct your question + to the list, where someone with the available time and expertise + can help you.

+ +

Who is responsible for FreeTDS?

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Brian + BrunsStarted this crazy thing
Gregg + JensenMessage handlers and extra datatype support and some + sybperl stuff?
Arno + PedusaarDonated his TDS4.2 code to the cause
Mihai + IbanescuGNUified the packet
Craig + SpannringJDBC driver and CVS repository.
Mark + SchaalCleaned up message handling, bug fixes, ctlib + unittests
Kevin + LyonsVarious TDS bug fixes
Sam + TetherowVarious TDS bug fixes
Geoff + WinklessLost connection stuff
Ken + SeymourODBC Driver Fixes
Scott + GrayTDS 7.0 numeric support and bug fixes
Bob + KlineNTEXT support
Koscheev + Andreynegative money patch
Dennis + NicklausvxWorks port and fixes for dbdata() and SYBVARBINARY
Brandon M. + Reynoldsfix for arbitrarily large queries under dblib.
Steve + Langasekoff by one fixes and autoconf byte size thing.
Mark J. + Lilbackimplementation of dbstrlen and dbstrcpy
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.
+ +

(These addresses have been mangled to defy "spamaton" programs + that mindlessly collect email addresses from the web. To send + email to anyone listed above, delete the "nospam." part of the + address.)

+ +

Why LGPL license?

+ + +

Brian Bruns started the project, and that's the choice he + made. LGPL was chosen because if you want a commercial client, + you can buy them from Sybase, Microsoft or others. "I do believe + BSDish licenses are better in some cases, but not for something + like this," he said.

+
+ + +

Documentation

+ + +

What sort of documentation is available?

+ +
    +
  • The FreeTDS User Guide + is the best place to start.
  • + +
  • FreeTDS , on Reference Manual is a + beginning at an independent description of the client APIs and + the TDS layer.
  • +
+ +

What about a Programmer's Reference Manual?

+ +

The best information is available from the vendors. FreeTDS + means to conform to the documented (and, in some cases, + undocumented) behavior of the vendors' offerings.

+ + + +

Is there any documentation on the TDS protocol?

+ + +

Yes, there is some preliminary + documentation available. The most up to date version is in + the User Guide.

+ +

Sybase publishes its TDS 5.0 Functional Specification.

+
+ + +

Implementation

+ + +

What is this SYBASE environment variable?

+ +

Many programs look for the SYBASE environment + variable in order to find the library's home. You will want to + set this to the main FreeTDS directory. For example, if + FreeTDS is installed in /usr/local/freetds + (meaning the libraries were installed in + /usr/local/freetds/lib), then your SYBASE + variable would be set to /usr/local/freetds.

+ +

How do I install the RPM?

+ + +

rpm -ivh freetds-0.52-1.i386.rpm (as root) will + install the libraries.

+ +

rpm -ivh freetds-devel-0.52-1.i386.rpm (as root) will + install the headers and other stuff needed to build other + stuff.

+
+ + +

Programming: C++, Sybperl, SQSH, & PHP

+ + +

How do I compile Sybperl with FreeTDS?

+

How do I compile SQSH with FreeTDS?

+

How do I compile PHP 3 with FreeTDS?

+ +

Please refer to the User Guide.

+ +

One small PHP hint, mailed to the FAQ master in May 2001:

+ +

In the mailing list archives I noticed a few people discussing + a problem I just had.

+ +
+

An attempt to make a connection to a MS SQL server from PHP + would fail, leaving a message in the Apache error log:

+
+        "connect: Network is unreachable
+         DB-Library: Login incorrect"
+
+ +

The problem turned out to be a very simple one to fix. In + the php.ini file under the sybase section, there is a directive + that sets the path to the sybase interfaces file + "sybase.interface_file = "

+ +

After uncommenting this and setting it to a reasonable value + (ie. /usr/local/freetds/interfaces), things started + working.

+
+ +

How should I choose among db-lib, ct-lib, + and ODBC

+ +

FreeTDS offers three client libraries and one + internal one (libtds). We generally encourage people to + use one of the client libraries, and discourage writing to + libtds, because the latter is evolving, more subject to + change, less well documented, and harder to use. In choosing + which client API to write to, you might want to peruse our + brief discussion.

+ +

Which Perl library should I use?

+ + +

There are four options for using TDS and Perl to connect to a + Sybase or MSSQL database, DBD::Sybase, DBD::ODBC, DBD::FreeTDS, + and Sybperl.

+ +

From Mark Schaal:

+ +

DBD::Sybase is the recommended option, and yes it does work + with MSSQL. You will need to install the perl DBI module and the + FreeTDS package, particularly the CTLib portion. Set your SYBASE + environment variable to /usr/local/freetds and install + DBD::Sybase. Don't worry too much if some of the tests fail. Do + worry if the module doesn't compile. Make sure you have the most + recent version of FreeTDS installed. You can check the mailing list + archives or ask the mailing list for help.

+ +

DBD::FreeTDS does not depend on the FreeTDS libraries. It is + minimally functional but it is considered alpha software and is + not being actively developed.

+ +

From Michael + Peppler:
+ Sybperl is a thin wrapper around the Sybase C APIs. It's a lot + more mature than DBI/DBD::Sybase (I've been working on it for 9 + years :-) and it's maybe more natural to use for someone who + already knows the Sybase APIs (or MS's DBlibrary). It's a little + more powerful/flexible than DBI, though obviously less portable. + It's still actively maintained and developed (by yours truly)

+ +

From Brian:
+ DBD::ODBC is the newest option available. Its primary advantage + is not having to load another DBI driver if you already have + DBI::ODBC load for other systems. On the downside, it may be a + little less robust than DBD::Sybase.

+ +

Are there any known issues?

+ +
    +
  • ODBC can be confusing to set up. See the samples + directory for example .ini files, and follow the User + Guide's instructions carefully.
  • + +
  • BCP of text and image types is broken for + Microsoft servers.
  • + +
  • BCP does not support TDS 4.2. You must use a more modern + protocol version.
  • + +
  • Server-side cursors work only in ct-lib.
  • + +
  • ODBC lacks a client-side cursor implementation.
  • + +
  • DBD::Sybase dynamic SQL placeholders don't work, pending a client-side SQL parser. (The ODBC ones do.)
  • + +
  • There are no plans to implement db-lib's browse mode.
  • +
+ +

Errors can sometimes be confusing. When an application uses + the library incorrectly, or when there are problems in a data + file being uploaded with BCP, the message returned by FreeTDS can + sometimes be misleading. In the latter case, it's often necessary + to examine the log file to understand what went wrong.

+ +

Why does each connection support only one query at a time?

+ + +

If you are accustomed to programming with other database + servers, you may be surprised when you first encounter this + aspect of the TDS protocol. When a TDS server—be it by + Microsoft or Sybase—responds to a query, it may send a result + set to the client. The server does not construct a complete + result set first, unless it needs to (say, to execute an + ORDER BY clause). Instead, it sends the rows as they're + selected/formed, in real time (if you will). Likewise, the client + libraries do not read all the rows from the server before + making them available to the client application.

+ +

The client library is tightly coupled to the server; they are + synchronized, share state information. The server requires the + client either to read all the results from a query, or to + indicate that no further rows are desired i.e., to issue a + cancellation. Until one of those two things happens, the server + will not accept new queries on that connection. It will complain + about "pending results".

+ +

How do mortal programmers cope with this strict + one-query-at-a-time limitation? For one thing, they become better + programmers.

+ +
    +
  • The solution often involves doing more SQL work, which + often results in less interaction with the server, which is + almost always faster.
  • + +
  • Even when that's not true, there's nothing to prevent the + application from caching the whole results set in its own + collection object.
  • + +
  • Sometimes, the best answer is to open a new connection. + That's not as bad as it sounds, and it certainly not unheard of + to have 4 or more simultaneous connections supporting an + application.
  • +
It's important to realize that the selection of rows and + their accumulation into a container of some sort are two + different functions. A TDS server issues its results a row at a + time, which the client library dutifully makes available to the + application on arrival. It's up to the application—or a + higher-level library—to form a "rowset" of some kind if + desired. + +

PHP note

If you use PHP, you will still run into this + problem even if you create a new connection. The reason is that + PHP is so nice that it will re-use the first connection if you + connect again with the same parameters. You my wish to refer to + this + post by Daniel Fazekas in the mailing list archives. + +

Is FreeTDS thread safe?

+ + +

Different threads may all use separate connections without + interfering with each other. Threads may not share a DBPROCESS or + CS_CONNECTION without controlling access via a mutex.

+ +

Are there plans to implement the OpenServer protocol/library?

+ + +

Not at this point, there is still much work to do on the + client protocol. But, libtdssrv will do the trick for + some applications.

+
+ + +

Problems Running

+ +

With DBD::Sybase, why do I sometimes get an + unexpected 1-column result set?

+ + +

Use a more recent release of FreeTDS. This problem was + corrected with version 0.63.

+ +

Output Parameters

+ + +

I'm not getting my output parameters returned, but I seem + to be doing everything right!

+

That's not a question!

+

Microsoft SQL Server 7 with SP3, and later versions, quietly changed (which is to say, broke) how they respond to queries that execute stored procedures with output parameters. Earlier servers let you send a query like EXECUTE A @P OUTPUT and fetch the output parameter as a special result row (technique varying by library). Newer servers simply don't send back that data. To elicit output parameters from them, you have to use the RPC protocols such as the db-lib dbrpcparam. +

+ +

What does this unknown marker message mean?

+ + +

Most of the time, it means you're not using the right protocol + version. That can happen even if your ./configure + was done correctly. Try setting the TDSVER variable to a + value appropriate for your server: normally 5.0 for + Sybase and 7.0 for Microsoft. If that works, double + check your work. If your freetds.conf file and + configure options were right, but you + needed the environment variable anyway, please post a message to + the list and help us track it down.

+ +

What if I get a connection + refused message?

+ + +

You want to make sure:

+ +
    +
  • your server is running,
  • + +
  • you can connect to it,
  • + +
  • your account has permissions in the database to execute + your query.
  • +
+ +

Steps:

+ +
    +
  1. Try telnet hostmachine port and + see if it's listening. You should get some form of response + from the server (actual text varies by vendor & + version).
  2. + +
  3. +

    Try tsql -H hostmachine -p port -U + username -P password

    + +

    That will connect to the server, bypassing the + freetds.conf file. If it doesn't work, the problem lies + upstream.

  4. + +
  5. +

    Try tsql -S servername -p port -U + username -P password

    + +

    That will connect to the server using freetds.conf. This + allows you to isolate freetds.conf mistakes. man + tsql for more.

  6. + +
  7. Check your ./configure and environment variables. The + --with-tdsver determines what flavor of the TDS + protocol your runs by default; the $TDSVER variable overrides + that default. The following combinations are reasonable; see + the User Guide + for details:
  8. + +
  9. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    VendorVersionTDS Version
    Sybase4.92+ 5.0
    Microsoft6.0, 6.54.2
    Microsoft7.0/20007.0
    +
  10. + +
  11. +

    Edit the PWD file and try make + check. It will call unittests for libtds, ctlib, dblib + and odbc in that order

    +
  12. + +
  13. +

    Compile sqsh and try that + before the more complicated stuff (PHP/Perl). If you can + connect with sqsh, you don't have a FreeTDS + problem.

    +
  14. +
+ +

The Microsoft SQL Server is listening, my configuration and + environment are set up per question 6.1, but logins still + fail.

+ + +

Microsoft supports two security models in three + permutations:

+ +
    +
  1. Windows NT Authentication Mode (Windows NT + Authentication)
  2. + +
  3. Standard Mode (SQL Server Authentication)
  4. + +
  5. Mixed Mode (Windows NT Authentication and SQL Server + Authentication)
  6. +
+ +

"Windows NT Authentication", often called "integrated + security", relies on Microsoft's domain logins, which establish a + user's network security attributes at network login time. When + connecting to the database server, SQL Server accepts an + encrypted password in the login packet, and uses Windows NT + facilities authenticate it, usually via the Primary Domain + Controller (PDC). The server then permits or denies login access + based on the response.

+ +

With traditional "Standard Mode" authentication, usernames and + passwords are stored within SQL Server. They are passed in the + login packet as plaintext, and connection requests are + authenticated without consulting the operating system.

+ +

FreeTDS supports both security models. Domain logins are + recognized by the presence of a backslash (\) character in the + username. See the User Guide for + details.

+ +

My text data are being truncated or are causing my + client to break.

+ +

The text data type is different from char + and varchar types. The maximum data length of a + text column is governed by the textsize + variable on the server. Microsoft claims in their + documentation to use a default textsize of 4000 + characters, but in fact their implementation is inconsistent. + Sometimes text columns are returned with a size of 4 + GB!

+ +

The best solution is to make sure you set textsize to + a reasonable value when establishing a connection. For + example:

+
+
+set textsize 10000
+
+ +

My dates aren't formatted right!

+ + +

Some dates turn out better than others.

+ +

If you think your dates should look like 2001-12-13 + 17:58:55.000, but you're seeing something like Dec 13 + 2001 05:58PM instead (or vice versa), you've bumped into + driver behavior. There's no standard governing the default + character string representation of a datetime + datatype. Different drivers make different choices, and your + driver has chosen a representation for you.

Microsoft's ODBC + driver (which is used by among other things the Query Analyzer + tool) converts datetime to an ISO format. That format + has the advantages of being all numeric: sortable, unambiguous, + and locale-independent. The vendors' db-lib and + ct-lib, in contrast, use the MMM DD YYYY + hh:mm format. + +

If you want to be sure your queries always return dates in a + particular format, don't leave the formatting up to the driver! + Use the convert function. For example:

+ +
+
+1> select convert( varchar(30), getdate(), 120 ) as Now
+2> go
+ Now
+ ------------------------------
+ 2002-07-02 12:36:31
+
+
+ +

As of version 0.60, the default datetime->string conversion + is controlled by the locale.conf file. See the User + Guide for details.

+
+ Updates and comments FreeTDS FAQ Master +
+

+ Valid XHTML 1.0 Transitional +

+ + diff --git b/doc/htdoc/news.html a/doc/htdoc/news.html new file mode 100644 index 0000000..ed0a8a9 --- /dev/null +++ a/doc/htdoc/news.html @@ -0,0 +1,239 @@ + + + + + +FreeTDS.org + + + + + + + + + +
FreeTDS.org +Home  |  +News  |  +Software  |  +Documentation  |  +Support  |  +Contribute +
+
+ + + +

+News and Press +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FreeTDS announces Version 0.63
+
+Version 0.63 is now available. The source tarball is freetds-0.63.tar.gz on Ibiblio. You may wish to read the announcement. (30 April 2005) +
+
+
FreeTDS announces Version 0.63 branch
+
+Version 0.63RC1 is now available in the stable directory on Ibiblio. Enjoy,and please test on your favorite architecture. +(27 November 2004) +
+
+
FreeTDS announces Version 0.62.1
+
+Includes a small but significant fix to token.c. Version 0.62.1 +(15 Jan 2004) +
+
+
FreeTDS announces Version 0.62
+
+In the year since the last release, FreeTDS has seen many improvements. Version 0.62 includes: +
    +
  • UTF-8 support, as well as most other client-side character sets
  • +
  • ODBC 3.0 compliance
  • +
  • many new ODBC functions
  • +
  • cursors, array binding, dynamic SQL, and RPC support in ct-lib
  • +
  • improved network performance through better socket and packet handling.
  • +
  • more Win32 development choices; VMS support
  • +
+(11 Jan 2004) +
+
+
FreeTDS announces Release Candidate 2 for Version 0.62
+
+We are in the process of releasing version 0.62. See main page for the latest release candidate (5 Jan 2004) +
+
+
FreeTDS announces Version 0.61.2
+
+This point release fixes some memory leaks. (3 August 2003) +
+
+
FreeTDS announces Version 0.61.1
+
+This point release offers bugfixes: +
    +
  • Segmentation fault with iODBC
  • +
  • Segmentation fault opening log file in append mode
  • +
  • binding parameters with NULL indicator
  • +
+ (20 May 2003) +
+
+
FreeTDS announces Version 0.61
+
+This release supersedes version 0.60 in all respects. It addresses all known +bugs except one, see README for details. Read the announcement and try out the new features. (1 March 2003) +
+
+
FreeTDS announces Version 0.61 Release Candidate
+
+Try out the new features. (20 February 2003) +
+
+
FreeTDS and PHP in Linux Journal
+
+A recent online article by David Perrin in the Linux Journal describes his good fortune using FreeTDS to connect his PHP-based web server to a Microsoft SQL Server. +
+
+
FreeTDS proudly announces Version 0.60
+
+The new version has better datatype handling and conversion capabilities, better BCP, better compatibility with Microsoft SQL Server 2000. It's just way better. More people have joined the project, and more better things are still in store. Read the announcement and try out the new features. (11 September 2002) +
+
+
FreeTDS and DBD::Sybase in Linux Journal
+
+This month's (April 2002) Linux Journal has an article about using DBD::Sybase and FreeTDS to talk to Microsoft SQL Server by Andrew Trice. +
+
+
FreeTDS.org gets a new look
+
+FreeTDS.org has been redesigned to provide new users an easier time of finding the resources they need to use FreeTDS successfully. Any comments (good or bad) should be directed to the Mailing List. +
+
+
CVS moves to SourceForge
+
+The CVS repository has been moved to the FreeTDS project on SourceForge. The old repository will stay active indefinately for tracking historical changes as the new repository starts with 0.53pre1. Consult the FAQ for details on using the new repository. +
+
+
FreeTDS version 0.53pre1
+
+FreeTDS 0.53pre1 is now available at iBiblio.org and it's mirrors. This release fixes some nasty host lookup bugs with 0.52 and it is recommend for those having troubles connecting with 0.52. This is a tarball-only release; RPM packages will be available with the full 0.53 release. +
+
+
FreeTDS version 0.52
+
+FreeTDS 0.52 is now available at iBiblio.org and it's mirrors. Both the source distribution and RPMs for Linux (i386) are available. Major features include a new configuration file format, much better ODBC support, and bug fixes. An announcement and some release notes are also available. +
+
+
The FreeTDS User Guide
+
+The FreeTDS Users Guide is an effort to provide better documentation for the FreeTDS user community, if it doesn't answer all your questions please submit your solutions so they may be included for the next person. +
+
+
FreeTDS Article on PHPBuilder
+
+PHPBuilder has an article on accessing SQL Server from Linux in which FreeTDS figures prominently. And it even points out some areas for us to improve in. ;-) +
+
+
+ + + diff --git b/doc/htdoc/support.html a/doc/htdoc/support.html new file mode 100644 index 0000000..0f67f31 --- /dev/null +++ a/doc/htdoc/support.html @@ -0,0 +1,53 @@ + + + + + +FreeTDS.org + + + + + + + + + +
FreeTDS.org +Home  |  +News  |  +Software  |  +Documentation  |  +Support  |  +Contribute +
+
+ + + +

+Support +

+ + + + + + + + + + +
 
+The first place you should look to resolve your problem is the documentation +
 
+The next step is to subscribe and post a question to the Mailing List . Please read the Getting Help section of the User Guide to ensure that the folks on the list can isolate and fix your problem. +
 
+Note: I often see people post what are really FreeTDS questions in a variety of forums such as the PHP list, LUG lists, and Usenet groups. Many times these queries go unanswered because no one in those forums knows FreeTDS. Your best bet for getting answers will generally be the FreeTDS mailing list. (I know this seems obvious, but you'd be surprised). +
 
+Blatant commercial plug! +If you are interested in having someone install and configure FreeTDS for you, you can contact Brian Bruns (camber@ais.org), the original author of FreeTDS, who offers consulting, custom programming, and support contracts for FreeTDS. +
 
+ + + diff --git b/doc/txt2man a/doc/txt2man new file mode 100755 index 0000000..ed5a6a4 --- /dev/null +++ a/doc/txt2man @@ -0,0 +1,314 @@ +#!/bin/sh +test "$HOME" = ~ || exec ksh $0 "$@" # try ksh if sh too old (not yet POSIX) + +# Copyright (C) 2001, 2002, 2003 Marc Vertes + +# 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# txt2man-1.4.8 + +usage() +{ +cat << EOT +NAME + txt2man - convert flat ASCII text to man page format +SYNOPSIS + txt2man [-hpTX] [-t mytitle] [-P pname] [-r rel] [-s sect] + [-v vol] [-I txt] [-B txt] [ifile] +DESCRIPTION + txt2man converts the input text into nroff/troff standard man(7) + macros used to format Unix manual pages. Nice pages can be generated + specially for commands (section 1 or 8) or for C functions reference + (sections 2, 3), with the ability to recognize and format command and + function names, flags, types and arguments. + + txt2man is also able to recognize and format sections, paragraphs, + lists (standard, numbered, description, nested), cross references and + literal display blocks. + + If input file ifile is omitted, standard input is used. Result is + displayed on standard output. + + Here is how text patterns are recognized and processed: + Sections These headers are defined by a line in upper case, starting + column 1. If there is one or more leading spaces, a + sub-section will be generated instead. + Paragraphs They must be separated by a blank line, and left aligned. + Tag list The item definition is separated from the item description + by at least 2 blank spaces, even before a new line, if + definition is too long. Definition will be emphasized + by default. + Bullet list + Bullet list items are defined by the first word being "-" + or "*" or "o". + Enumerated list + The first word must be a number followed by a dot. + Literal display blocks + This paragraph type is used to display unmodified text, + for example source code. It must be separated by a blank + line, and be indented. It is primarily used to format + unmodified source code. It will be printed using fixed font + whenever possible (troff). + Cross references + A cross reference (another man page) is defined by a word + followed by a number in parenthesis. + + Special sections: + NAME The function or command name and short description are set in + this section. + SYNOPSIS This section receives a special treatment to identify command + name, flags and arguments, and propagate corresponding + attributes later in the text. If a C like function is recognized + (word immediately followed by an open parenthesis), txt2man will + print function name in bold font, types in normal font, and + variables in italic font. The whole section will be printed using + a fixed font family (courier) whenever possible (troff). + + It is a good practice to embed documentation into source code, by using + comments or constant text variables. txt2man allows to do that, keeping + the document source readable, usable even without further formatting + (i.e. for online help) and easy to write. The result is high quality + and standard complying document. +OPTIONS + -h The option -h displays help. + -P pname Set pname as project name in header. Default to uname -s. + -p Probe title, section name and volume. + -t mytitle Set mytitle as title of generated man page. + -r rel Set rel as project name and release. + -s sect Set sect as section in heading, ususally a value from 1 to 8. + -v vol Set vol as volume name, i.e. "Unix user 's manual". + -I txt Italicize txt in output. Can be specified more than once. + -B txt Emphasize (bold) txt in output. Can be specified more than once. + -T Text result previewing using PAGER, usually more(1). + -X X11 result previewing using gxditview(1). +ENVIRONMENT + PAGER name of paging command, usually more(1), or less(1). If not set + falls back to more(1). +EXAMPLE + Try this command to format this text itself: + + $ txt2man -h 2>&1 | txt2man -T +HINTS + To obtain an overall good formating of output document, keep paragraphs + indented correctly. If you have unwanted bold sections, search for + multiple spaces between words, which are used to identify a tag list + (term followed by a description). Choose also carefully the name of + command line or function parameters, as they will be emphasized each + time they are encountered in the document. +SEE ALSO + man(1), mandoc(7), rman(1), groff(1), more(1), gxditview(1), troff(1). +BUGS + - Automatic probe (-p option) works only if input is a regular file (i.e. + not stdin). +AUTHOR + Marc Vertes +EOT +} + +sys=$(uname -s) +rel= +volume= +section= +title=untitled +doprobe= +itxt= +btxt= +post=cat +while getopts :hpTXr:s:t:v:P:I:B: opt +do + case $opt in + r) rel=$OPTARG;; + t) title=$OPTARG;; + s) section=$OPTARG;; + v) volume=$OPTARG;; + P) sys=$OPTARG;; + p) doprobe=1;; + I) itxt="$OPTARG§$itxt";; + B) btxt=$OPTARG;; + T) post="groff -mandoc -Tlatin1 | ${PAGER:-more}";; + X) post="groff -mandoc -X";; + *) usage; exit;; + esac +done +shift $(($OPTIND - 1)) + +if test "$doprobe" +then + title=${1##*/}; title=${title%.txt} + grep -q '#include ' $1 && + { section=${section:-3}; + volume=${volume:-"$sys Programmer's Manual"}; } || + { section=${section:-1}; + volume=${volume:-"$sys Reference Manual"}; } + # get release from path + rel=$(pwd | sed 's:/.*[^0-9]/::g + s:/.*::g') +fi + +head=".\\\" Text automatically generated by txt2man-1.4.7 +.TH $title $section \"$(date +'%B %d, %Y')\" \"$rel\" \"$volume\"" + +# All tabs converted to spaces +expand $* | +# gawk is needed because use of non standard regexp +gawk --re-interval -v head="$head" -v itxt="$itxt" -v btxt="$btxt" ' +BEGIN { + print head + avar[1] = btxt; avar[2] = itxt + for (k in avar) { + mark = (k == 1 ? "\\fB" : "\\fI") + split(avar[k], tt, "§") + for (i in tt) + if (tt[i] != "") + subwords["\\<" tt[i] "\\>"] = mark tt[i] "\\fP" + for (i in tt) delete tt[i] + } + for (k in avar) delete avar[k] +} +{ + sub(/\.\.\./, "\\.\\.\\.") # to avoid some side effects in regexp + sub(/^ +$/,"") # remove spaces in empty lines +} +/^[[:upper:][:space:]]+$/ { # Section header + if ((in_bd + 0) == 1) { + in_bd = 0 + print ".fam T\n.fi" + } + if (section == "SYNOPSIS") { + print ".fam T\n.fi" + type["SYNOPSIS"] = "" + } + if ($0 ~/^[^[:space:]]/) print ".SH " $0 + else print ".SS" $0 + sub(/^ +/, "") + section = $0 + if (section == "SYNOPSIS") print ".nf\n.fam C" + ls = 0 # line start index + pls = 0 # previous line start index + pnzls = 0 # previous non zero line start index + ni = 0 # indent level + ind[0] = 0 # indent offset table + prevblankline = 0 + next +} +{ # compute line start index, handle start of example display block + pls = ls + if (ls != 0) pnzls = ls + match($0, /[^ ]/) + ls = RSTART + if (pls == 0 && pnzls > 0 && ls > pnzls && $1 !~ /^[0-9\-\*\o]\.*$/) { + # example display block + if (prevblankline == 1) { print ".PP"; prevblankline = 0 } + print ".nf\n.fam C" + in_bd = 1 + eoff = ls + } + if (ls > 0 && ind[0] == 0) ind[0] = ls +} +(in_bd + 0) == 1 { # In example display block + if (ls != 0 && ls < eoff) { # End of litteral display block + in_bd = 0 + print ".fam T\n.fi" + } else { print; next } +} +section == "NAME" { $1 = "\\fB" $1; sub(/ \- /, " \\fP- ") } +section == "SYNOPSIS" { # Identify arguments of fcts and cmds + if (type["SYNOPSIS"] == "") { + if (index($0, "(") == 0 && index($0, ")") == 0 && + index($0, "#include") == 0) + type["SYNOPSIS"] = "cmd" + else + type["SYNOPSIS"] = "fct" + } + if (type["SYNOPSIS"] == "cmd") { # Line is a command line + if ($1 !~ /^\[/) { + b = $1 + sub(/^\*/, "", b) + subwords["\\<" b "\\>"] = "\\fB" b "\\fP" + } + for (i = 2; i <= NF; i++) { + a = $i + gsub(/[\[\]\|]/, "", a) + if (a ~ /^[^\-]/) subwords["\\<" a "\\>"] = "\\fI" a "\\fP" + } + } else { # Line is a C function definition + if ($1 == "typedef") subwords["\\<" $2 "\\>"] = "\\fI" $2 "\\fP" + else if ($1 == "#define") subwords["\\<" $2 "\\>"] = "\\fI" $2 "\\fP" + for (i = 1; i <= NF; i++) + if ($i ~ /[\,\)]/) { + a = $i + sub(/.*\(/, "", a) + gsub(/\W/, "", a) + if (a !~ /^void$/) subwords["\\<" a "\\>"] = "\\fI" a "\\fP" + } + } +} +{ + while ($0 ~ /\w\.\w/) sub(/\./, "_dOt_") # protect dots inside words + for (i = 1; i <= NF; i++) { # identify func calls and cross refs + b = $i + sub(/^\*/, "", b) + if ((a = index(b, ")(")) > 3) { + w = substr(b, 3, a - 3) + subwords["\\<" w "\\>"] = "\\fI" w "\\fP" + } + if ((a = index(b, "(")) > 1) { + w = substr(b, 1, a - 1) + subwords["\\<" w "\\("] = "\\fB" w "\\fP(" + } + } + for (i in subwords) gsub(i, subwords[i]) # word attributes + gsub(/\B\-+\w+(\-\w+)*/, "\\fB&\\fP") # shell options + gsub(/_dOt_/, ".") # unprotect dots inside words + + if (match($0, /[^ ] +/) > 0) { # tag list item + adjust_indent() + tag = substr($0, 1, RSTART) + sub(/^ */, "", tag) + if (RSTART+RLENGTH < length()) $0 = substr($0, RSTART + RLENGTH) + else $0 = "" + print ".TP\n.B" + print tag + prevblankline = 0 + if (NF == 0) next + } else if ($1 == "-"||$1 == "o"||$1 == "*") { # bullet list item + adjust_indent() + print ".IP \\(bu 3" + prevblankline = 0 + $1 = "" + } else if ($1 ~ /^[0-9]+[\).]$/) { # enum list item + adjust_indent() + print ".IP " $1 " 4" + prevblankline = 0 + $1 = "" + } else if (pls == 0) { # new paragraph + adjust_indent() + } else if (NF == 0) { # blank line + prevblankline = 1; next + } else prevblankline = 0 # other + if (prevblankline == 1) { # flush vertical space + print ".PP"; prevblankline = 0 + } + if (section != "SYNOPSIS" || $0 ~ /^ {1,4}/) sub(/ */,"") + print +} +function adjust_indent() +{ + if (ls > ind[ni]) { ind[++ni] = ls; print ".RS" } + else if (ls < ind[ni]) + while (ls < ind[ni]) { ni--; print ".RE" } +} +' | eval $post diff --git b/include/.cvsignore a/include/.cvsignore new file mode 100644 index 0000000..0781079 --- /dev/null +++ a/include/.cvsignore @@ -0,0 +1,10 @@ +Makefile +Makefile.in +tdsver.h +config.h +stamp-h.in +config.h.in +stamp-h +stamp-h1 +tds_sysdep_public.h +freetds_sysconfdir.h diff --git b/misc/freetds_autobuild a/misc/freetds_autobuild new file mode 100755 index 0000000..a78d6f4 --- /dev/null +++ a/misc/freetds_autobuild @@ -0,0 +1,245 @@ +#!/bin/bash + +export PATH="/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/lib/jre/bin:$HOME/bin:$HOME/install/bin" + +. $HOME/.bashrc + +# do not use ccache, not work well woth profile informations +export PATH="/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:$HOME/bin:$HOME/install/bin" + +GROUPDIR=/home/groups/f/fr/freetds/htdocs +# directory to compile +FTDSDIR=freetds82 +# output directory on server +OUTDIR=out +# additional flags for Autogen (current version) +#FLAGS_ADD=--enable-developing +FLAGS_ADD= +# additional flags for Autogen (old version) +FLAGS_ADD_OLD= +WORKDIR=ftds_comp + +upload() +{ + mkdir -p "$HOME/cpp/freetds/html/$1" + rm -rf "$HOME/cpp/freetds/html/$1" + mkdir -p "$HOME/cpp/freetds/html/$1" + cp -r $2 "$HOME/cpp/freetds/html/$1" +# tar zcf - $2 | ssh -p 443 freddy77@shell-ssh.sourceforge.net "cd $GROUPDIR/$1 && rm -rf * && { tar zxf -; find . -type d -print0 | xargs -0 chmod 2775; find . -type f -print0 | xargs -0 chmod 0664; }" +} + +upload_file() +{ + mkdir -p `dirname "$HOME/cpp/freetds/html/$1"` + cp $2 "$HOME/cpp/freetds/html/$1" +# ssh -p 443 freddy77@shell-ssh.sourceforge.net "cd $GROUPDIR && cat - > $1 && chmod 0664 $1" < $2 +} + +save_coverage() +{ + find include/ src/ -name \*.da -o -name \*.gc\* | tar zcf - -T - > covsave.tgz +} + +restore_coverage() +{ + find include/ src/ -name \*.da -o -name \*.gc\* -exec rm {} \; + tar zxf covsave.tgz + rm -f covsave.tgz +} + +handle_exit() +{ + echo Exiting... + cd $HOME/cpp/freetds + rm -f freetds + ln -s "$FTDSDIR" freetds + rm -rf $WORKDIR +} + +read_pwd_fields() +{ + tUID=`grep '^UID=' < PWD | sed 's,^....,,'` + tPWD=`grep '^PWD=' < PWD | sed 's,^....,,'` + tSRV=`grep '^SRV=' < PWD | sed 's,^....,,'` + tDB=`grep '^DB=' < PWD | sed 's,^...,,'` +} + +rm ~/freetds.log /tmp/sql.log + +for param +do + case $param in + --previous) + OUTDIR=out0 + FTDSDIR=freetds64 + FLAGS_ADD="$FLAGS_ADD_OLD" + WORKDIR=ftds_comp_old + ;; + *) + echo 'Option not supported!' 1>&2 + exit 1 + ;; + esac +done + +set -e + +DOMAIN_UID= +DOMAIN_PWD= +MSSQL_PORT= +MSSQL_INSTANCE= +if test -r "$HOME/freetds_autobuild.sh"; then + . "$HOME/freetds_autobuild.sh" +fi + +cd $HOME/cpp/freetds/$FTDSDIR +# cvs up || { sleep 5; cvs up; } || { sleep 5; cvs up; } +cd .. +rm -rf $WORKDIR +trap handle_exit EXIT +cp -rp $FTDSDIR $WORKDIR +rm -f freetds +ln -s $WORKDIR freetds +cd $WORKDIR +find . \( -name \*.bb -o -name \*.bbg -o -name \*.da -o -name \*.gc\* \) -exec rm -f {} \; +rm -rf autom4te.cache doc/doc covtmp coverage DBD-* +cvsclean || true +if test "$(uname -m)" = "x86_64"; then + cp ../DBD-ODBC-1.15_2.tar.gz . +else + cp ../DBD-ODBC-1.13.tar.gz . +fi +cp ../php5.2-latest.tar.bz2 . + +LDFLAGS='-lgcov' CFLAGS='-O0 -pipe -g -fprofile-arcs -ftest-coverage' sh autogen.sh --enable-extra-checks --prefix=$HOME/install --with-odbc-nodm=/usr --with-gnutls $FLAGS_ADD + +# compile, test with mssql server +cp -f ../PWD PWD +read_pwd_fields +make clean +export LD_LIBRARY_PATH=$PWD/src/odbc/.libs/ +rm -rf logs +mkdir logs +./misc/test-auto.sh > logs/log.txt + +if test "$OUTDIR" = "out" -a -r doc/doxy.log; then + fixdoxyres < doc/doxy.log > doc/doxy.html + upload_file "doxy.html" "doc/doxy.html" + if test -d doc/doc/freetds-*/reference; then + (cd doc/doc/freetds-*/reference; upload doxy '*') + fi +fi + +# save logs for debug +rm -f $HOME/log_tds.txt +ln logs/log.txt $HOME/log_tds.txt + +# test Perl +save_coverage +RES=0 +# setting LANG avoid strange characters +LANG=en_US ./misc/test-other.sh --perl-only --verbose >> logs/log.txt || RES=$? +if test $RES != 0; then + echo "Perl test failed" + restore_coverage +fi + +./misc/test-other.sh --php-only >> logs/log.txt || true + +# upload our test results +cd logs +perl -pe "\$_ = '' if \$_ =~ /^2:bcp.c: In function 'bcp_colfmt'|^2:bcp.c:\\d+: warning: suggest parentheses around && within \\|\\|/" < log.txt | ../misc/online.pl +upload "$OUTDIR/test" '*.html' +cd .. + +# test domain password and TDSPORT with service name +if test "$DOMAIN_UID" != ""; then + save_coverage + # using tsql directly with grep do not update coverage informations + echo -e 'select @@version\ngo\nbye' | TDSPORT=ms-sql-s TDSDUMP=stdout ./src/apps/tsql -S $tSRV -U "$DOMAIN_UID" -P "$DOMAIN_PWD" > out.txt || true + if grep -q 'Microsoft Corporation' out.txt; then + echo "domain password ok" + else + echo "domain password failed!" + restore_coverage + fi + rm -f out.txt +fi + +if test "$MSSQL_PORT" != ""; then + save_coverage + # using tsql directly with grep do not update coverage informations + echo -e 'select @@version\ngo\nbye' | ./src/apps/tsql -S "$tSRV:$MSSQL_PORT" -U "$tUID" -P "$tPWD" > out.txt || true + if grep -q 'Microsoft Corporation' out.txt; then + echo "override port ok" + else + echo "override port failed!" + restore_coverage + fi + rm -f out.txt +fi + +if test "$MSSQL_INSTANCE" != ""; then + save_coverage + # using tsql directly with grep do not update coverage informations + echo -e 'select @@version\ngo\nbye' | ./src/apps/tsql -S "$tSRV\\$MSSQL_INSTANCE" -U "$tUID" -P "$tPWD" > out.txt || true + if grep -q 'Microsoft Corporation' out.txt; then + echo "override instance ok" + else + echo "override instance failed!" + restore_coverage + fi + rm -f out.txt +fi + +# do tests with sybase server +cp -f ../PWD.sybase PWD +read_pwd_fields +rm -rf logs +mkdir logs +./misc/test-auto.sh --no-build > logs/log.txt +cd logs +../misc/online.pl < log.txt +upload "$OUTDIR/test2" '*.html' +cd .. + +# do tests with sybase 15 server +if test "$OUTDIR" = "out"; then + cp -f ../PWD.sybase15 PWD + read_pwd_fields + rm -rf logs + mkdir logs + ./misc/test-auto.sh --no-build > logs/log.txt + cd logs + ../misc/online.pl < log.txt + upload "$OUTDIR/test3" '*.html' + cd .. +fi + +# test autodiscovery +if test "$OUTDIR" = "out"; then + save_coverage + # using tsql directly with grep do not update coverage informations + echo -e 'select @@version\ngo\nbye' | TDSVER=0.0 ./src/apps/tsql -S "$tSRV" -U "$tUID" -P "$tPWD" > out.txt || true + if grep -q 'Adaptive Server Enterprise' out.txt; then + echo "autodiscovery ok" + else + echo "autodiscovery failed!" + restore_coverage + fi + rm -f out.txt +fi + +# restore PWD file +cp -f ../PWD PWD + +# build coverage and upload it +rm -rf coverage +./misc/coverage.sh +cd coverage +upload "$OUTDIR/coverage" '*' +cd .. + +# cleanup +rm -f ~/freetds.log /tmp/sql.log covsave.tgz +rm -rf logs diff --git b/misc/test-auto.sh a/misc/test-auto.sh new file mode 100755 index 0000000..14d54e6 --- /dev/null +++ a/misc/test-auto.sh @@ -0,0 +1,103 @@ +#!/bin/sh + +# automatic test and report + +# set -e + +BUILD=1 +CONFIGURE=0 +for param +do + case $param in + --help) + echo $0 [--help] [--no-build] [--configure] + exit 0 + ;; + --no-build) + BUILD=0 + ;; + --configure) + CONFIGURE=1 + ;; + esac +done + +# go to main distro dir +DIR=`dirname $0` +cd "$DIR/.." + +DIR="$PWD/misc" +LANG=C +export LANG + +log () { + echo "@!@!@!@!@!@!@!@!@!@!@!@!@!@!@!@- $1 -@!@!@!@!@!@!@!@!@!@!@!@!@!@!@!@" +} + +# function to save output +output_save () { + COMMENT=$1 + shift + OUT=$1 + shift + log "START $OUT" + classifier "$@" + RES=$? + log "RESULT $RES" + log "END $OUT" +} + +# output informations +XXX=`hostname` +log "INFO HOSTNAME `echo $XXX`" +VER=`gcc --version 2> /dev/null | grep 'GCC'` +log "INFO GCC $VER" +XXX=`uname -a` +log "INFO UNAME `echo $XXX`" +log "INFO DATE `date '+%Y-%m-%d'`" + +MAKE=make +if gmake --help 2> /dev/null > /dev/null; then + MAKE=gmake +fi + +# execute configure +if test $CONFIGURE = 1; then + BUILD=1 + output_save "configuration" conf ./configure --enable-extra-checks $TDS_AUTO_CONFIG + if test $RES != 0; then + echo "error during configure" + exit 1 + fi +fi + +if test $BUILD = 1; then + + echo Making ... + $MAKE clean > /dev/null 2> /dev/null + output_save "make" make $MAKE + if test $RES != 0; then + echo "error during make" + exit 1 + fi + + echo Making tests ... + TESTS_ENVIRONMENT=true + export TESTS_ENVIRONMENT + output_save "make tests" maketest $MAKE check + if test $RES != 0; then + echo "error during make test" + exit 1; + fi +fi + +echo Testing ... +TESTS_ENVIRONMENT="$DIR/full-test.sh" +export TESTS_ENVIRONMENT +$MAKE check 2> /dev/null +if test $? != 0; then + echo "error during make check" + exit 1; +fi + +exit 0 diff --git b/misc/test-dist.sh a/misc/test-dist.sh new file mode 100755 index 0000000..73cbf7f --- /dev/null +++ a/misc/test-dist.sh @@ -0,0 +1,150 @@ +#!/bin/sh + +# This script test that Makefiles are able to produre a good +# distribution +# +# It create a test-dist.log file in the mail directory, you +# can tail this file to see the progress + +# stop on errors +set -e + +for param +do + case $param in + --no-unittests) + TESTS_ENVIRONMENT=true + export TESTS_ENVIRONMENT + ;; + --help) + echo "Usage: $0 [OPTION]..." + echo ' --help this help' + echo ' --no-unittests do not execute unittests' + exit 0 + ;; + *) + echo 'Option not supported!' 1>&2 + exit 1 + ;; + esac +done + +# do not create logs so diskcheck test do not fails +unset TDSDUMP || true + +# set correct directory +DIR=`dirname $0` +cd "$DIR/.." + +# remove old distributions +touch freetds-dummy +find freetds-* -type d ! -perm -200 -exec chmod u+w {} ';' +rm -rf freetds-* + +# save directory +ORIGDIR="$PWD" + +# init log +LOG="$PWD/test-dist.log" +rm -f "$LOG" +echo "log started" >> "$LOG" + +# make distribution +test -f Makefile || sh autogen.sh +make dist +echo "make distribution ok" >> "$LOG" + +# untar to test it, should already contains documentation +DIR=`echo freetds-* | sed s,.tar.gz$,,g` +gunzip -dc freetds-*.tar.gz | tar xf - +test -d "$DIR" +cd "$DIR" +echo "untar ok" >> "$LOG" + +# assure you do not compile documentation again +mkdir fakebin +PATH="$PWD/fakebin:$PATH" +export PATH +cd fakebin +echo "#!/bin/sh +exit 1" > openjade +cp openjade doxygen +# gawk it's used by txt2man +cp openjade gawk +cp openjade autoheader +# perl is used by some perl rules +cp openjade perl +chmod +x openjade doxygen gawk autoheader perl +cd .. +if ! openjade --help; then true; else echo 'succedeed ?'; false; fi +if ! doxygen --help; then true; else echo 'succeeded ?'; false; fi +if ! gawk --help; then true; else echo 'succeeded ?'; false; fi +if ! autoheader --help; then true; else echo 'succeeded ?'; false; fi +if ! perl --help; then true; else echo 'succeeded ?'; false; fi +echo "fakebin ok" >> "$LOG" + +# direct make install (without make all) +mkdir install +INSTALLDIR="$PWD/install" +mkdir build +cd build +# --enable-msdblib --enable-sybase-compat can cause also problems, try to compile with both +../configure --prefix="$INSTALLDIR" --enable-msdblib --enable-sybase-compat --disable-libiconv +# make clean should not cause problems here +make clean +make install +cd .. +echo "direct make install ok" >> "$LOG" + +# cleanup +rm -rf install build + +# again with dist and autogen +mkdir build +cd build +../autogen.sh +make dist +cd .. +rm -rf build +echo "make dist ok" >> "$LOG" + +# test if make clean clean too much +mkdir install +./configure --prefix="$PWD/install" +make clean +make dist + +# finally big test. I hope you have a fast machine :) +cd .. +rm -rf "$DIR" +gunzip -dc freetds-*.tar.gz | tar xf - +cd "$DIR" +./configure +if test ! -e PWD -a -e "$ORIGDIR/../PWD"; then + cp "$ORIGDIR/../PWD" . +fi +if test ! -e PWD -a -e "$ORIGDIR/PWD"; then + cp "$ORIGDIR/PWD" . +fi +make distcheck +echo "make distcheck ok" >> "$LOG" + +# cleanup +cd "$ORIGDIR" +chmod -R 777 "$DIR" +rm -rf "$DIR" + +# check rpm +RPMCMD=rpm +if rpmbuild --help > /dev/null 2>&1; then + RPMCMD=rpmbuild +fi +if $RPMCMD --help > /dev/null 2>&1; then + $RPMCMD -ta freetds-*.tar.gz || exit 1 + echo "rpm test ok" >> "$LOG" +else + echo "rpm test skipped, no rpm detected" >> "$LOG" +fi + +echo "all tests ok!!!" >> "$LOG" + diff --git b/misc/test-other.sh a/misc/test-other.sh new file mode 100755 index 0000000..d20591a --- /dev/null +++ a/misc/test-other.sh @@ -0,0 +1,223 @@ +#!/bin/sh + +# Additional make check test +# check other tools (like Perl and PHP) +# odbc MUST be configured to point to source driver + +# stop on errors +set -e + +verbose=no +do_perl=no +do_php=yes + +# check for perl existence +if perl -e 'exit 0' > /dev/null 2>&1; then + do_perl=yes +fi + +for param +do + case $param in + --verbose) + verbose=yes ;; + --no-perl) + do_perl=no ;; + --no-php) + do_php=no ;; + --perl-only) + do_perl=yes + do_php=no + ;; + --php-only) + do_perl=no + do_php=yes + ;; + *) + echo 'Option not supported!' 1>&2 + exit 1 + ;; + esac +done + +log () { + echo "@!@!@!@!@!@!@!@!@!@!@!@!@!@!@!@- $1 -@!@!@!@!@!@!@!@!@!@!@!@!@!@!@!@" +} + +# set correct directory +DIR=`dirname $0` +cd "$DIR/.." + +# save directory +ORIGDIR="$PWD" + +# init log +LOG="$PWD/test-other.log" +rm -f "$LOG" +echo "log started" >> "$LOG" + +## assure make +#make all +#echo "make all ok" >> "$LOG" + +tUID=`cat PWD | grep '^UID=' | sed 's,^....,,g'` +tPWD=`cat PWD | grep '^PWD=' | sed 's,^....,,g'` +tSRV=`cat PWD | grep '^SRV=' | sed 's,^....,,g'` +tDB=`cat PWD | grep '^DB=' | sed 's,^...,,g'` + +# prepare odbc.ini redirection +rm -f odbc.ini +for f in .libs/libtdsodbc.so .libs/libtdsodbc.sl .libs/libtdsodbc.dll .libs/libtdsodbc.dylib; do + if test -r "$PWD/src/odbc/$f"; then + echo "[$tSRV] +Driver = $PWD/src/odbc/$f +Database = $tDB +Servername = $tSRV + +[xx_$tSRV] +Driver = $PWD/src/odbc/$f +Database = $tDB +Servername = $tSRV" > odbc.ini + ODBCINI="$PWD/odbc.ini" + SYSODBCINI="$PWD/odbc.ini" + export ODBCINI SYSODBCINI + break; + fi +done + +# Perl +if test $do_perl = yes; then + DBI_DSN="dbi:ODBC:$tSRV" + DBI_USER="$tUID" + DBI_PASS="$tPWD" + export DBI_DSN DBI_USER DBI_PASS + # TODO better way + ODBCHOME=/usr + export ODBCHOME + for f in DBD-ODBC-*.tar.gz; do + DIR=`echo "$f" | sed s,.tar.gz$,,g` + echo Testing $DIR + if ! test -d "$DIR"; then + tar zxvf "$DIR.tar.gz" + # try to apply patch for Sybase + cd "$DIR" + { patch -p1 || true ; } <[2]) { ++ if (\$row[2] ne \$_->[2] && (\$dbname ne "sql server" || \$row[2] ne " ") ) { + print "Column C value failed! bind value = \$bind_val, returned values = \$row[0]|\$row[1]|\$row[2]|\$row[3]\\n"; + return undef; + } +EOF + # fix for DBD::ODBC and Perl 5.8.8 + echo "--- DBD-ODBC-1.13.orig/dbdimp.c 2004-11-05 04:19:36.000000000 +0100 ++++ DBD-ODBC-1.13/dbdimp.c 2007-01-16 09:38:20.477774620 +0100 +@@ -2921,11 +2921,11 @@ + * */ + else if (is_inout != phs->is_inout) { + croak(\"Can't rebind or change param %s in/out mode after first bind (%d => %d)\", + phs->name, phs->is_inout, is_inout); + } +- else if (maxlen && maxlen != phs->maxlen) { ++ else if (maxlen && maxlen > phs->maxlen) { + croak(\"Can't change param %s maxlen (%ld->%ld) after first bind\", + phs->name, phs->maxlen, maxlen); + } + + if (!is_inout) { /* normal bind to take a (new) copy of current value */ +" | patch -p1 || true + cd t + { patch -p0 || true ; } <{odbc_async_exec} = 1; + # print "odbc_async_exec is: \$dbh->{odbc_async_exec}\\n"; +- is(\$dbh->{odbc_async_exec}, 1, "test odbc_async_exec attribute set"); ++ is(\$dbh->{odbc_async_exec}, 0, "test odbc_async_exec attribute NOT set"); + + # not sure if this should be a test. May have permissions problems, but it's the only sample + # of the error handler stuff I have. +EOF + cd ../.. + fi + test -d "$DIR" + cd "$DIR" + grep -v 'prompt(' Makefile.PL > Makefile.PL.tmp + cat Makefile.PL.tmp > Makefile.PL + test -r Makefile || LANG=C perl Makefile.PL + LANG=C make clean + RES=0 + log "START DBD::ODBC make" + test -r Makefile || LANG=C classifier perl Makefile.PL || RES=$? + if test $RES = 0; then + LANG=C classifier make || RES=$? + fi + log "RESULT $RES" + log "END DBD::ODBC make" + if test $RES = 0; then + log "START DBD::ODBC test" + if test $verbose = yes; then + LANG=C classifier make test TEST_VERBOSE=1 || RES=$? + else + LANG=C classifier make test || RES=$? + fi + log "RESULT $RES" + log "END DBD::ODBC test" + fi + if test $RES != 0; then + exit $RES + fi + done +fi + +# PHP +cd "$ORIGDIR" +FILE='php5.2-latest.tar.bz2' +if test $do_php = yes -a -f "$FILE"; then + # need to recompile ?? + if test ! -x phpinst/bin/php -o "$FILE" -nt phpinst/bin/php; then + rm -rf php5.2-200* phpinst lib + bunzip2 -c "$FILE" | tar xvf - + DIR=`echo php5.2-200*` + MAINDIR=$PWD + mkdir lib + cp src/dblib/.libs/lib*.s[ol]* lib + cp src/tds/.libs/libtds.a lib +# cp src/tds/.libs/lib*.s[ol]* lib + cd $DIR + CFLAGS='-O0 -pipe' ./configure --prefix=$MAINDIR/phpinst --disable-all --with-mssql=$MAINDIR --with-unixODBC=/usr + make -j4 + make install + cd .. + fi + + cd phptests + echo "" > pwd.inc + + ERR="" + for f in *.php; do + echo Testing PHP script $f + log "START PHP test $f" + RES=0 + ../phpinst/bin/php -q $f 2>&1 || { RES=$?; ERR="$ERR $f"; } + log "RESULT $RES" + log "FILE $PWD/$f" + log "END PHP test $f" + done + if test "$ERR" != ""; then + echo "Some script failed:$ERR" + exit 1 + fi +fi + +echo "all tests ok!!!" >> "$LOG" +exit 0 + diff --git b/mkinstalldirs a/mkinstalldirs index ce6c2d3..4d8662b 100755 --- b/mkinstalldirs +++ a/mkinstalldirs @@ -4,7 +4,7 @@ # Created: 1993-05-16 # Public domain -# $Id: mkinstalldirs,v 1.1.1.1 2001/10/12 23:28:53 brianb Exp $ +# $Id: mkinstalldirs,v 1.1 2001/10/12 23:28:53 brianb Exp $ errstatus=0 diff --git b/phptests/.cvsignore a/phptests/.cvsignore new file mode 100644 index 0000000..03a7a33 --- /dev/null +++ a/phptests/.cvsignore @@ -0,0 +1 @@ +pwd.inc diff --git b/samples/.cvsignore a/samples/.cvsignore new file mode 100644 index 0000000..f24dd77 --- /dev/null +++ a/samples/.cvsignore @@ -0,0 +1,3 @@ +Makefile +Makefile.in +unixodbc.freetds.driver.template diff --git b/samples/odbc_rpc.pl a/samples/odbc_rpc.pl new file mode 100755 index 0000000..cc93942 --- /dev/null +++ a/samples/odbc_rpc.pl @@ -0,0 +1,123 @@ +#!/usr/local/bin/perl +# $Id: odbc_rpc.pl,v 1.7 2006/07/27 19:24:42 jklowden Exp $ +# +# Contributed by James K. Lowden and is hereby placed in +# the public domain. No rights reserved. +# +# This program demonstrates calling the ODBC "dynamic" functions, using +# placeholders and prepared statements. +# +# By default, arguments are bound to type SQL_VARCHAR. If the stored procedure +# uses other types, they may be specified in the form :TYPE:data, where TYPE is one +# of the DBI symbolic constants. If your data happen to begin with a colon, +# prefix the string with ':SQL_VARCHAR:'. +# +# Example: a datetime parameter: ':SQL_DATETIME:2005-04-01 16:46:00' +# (Unfortunately, it appears DBD::ODBC has difficulty with SQL_DATETIME: +# http://www.opensubscriber.com/message/perl-win32-users@listserv.ActiveState.com/108164.html +# +# +# To find the symbolic constants for DBI, perldoc DBI recommends: +# use DBI; +# foreach (@{ $DBI::EXPORT_TAGS{sql_types} }) { +# printf "%s=%d\n", $_, &{"DBI::$_"}; +# } +# + +use DBI qw(:sql_types); +use Getopt::Std; +use File::Basename; + +# Stolen shamelessly from DBI: testerrhandler.pl + +sub err_handler { + my ($state, $msg) = @_; + # Strip out all of the driver ID stuff + $msg =~ s/^(\[[\w\s]*\])+//; + print "===> state: $state msg: $msg\n"; + return 0; +} + +sub setup_error_handler($) +{ my ($dbh) = @_; + + $dbh->{odbc_err_handler} = \&err_handler; + $dbh->{odbc_async_exec} = 1; + print "odbc_async_exec is: $dbh->{odbc_async_exec}\n"; +} + +$program = basename($0); + +Getopt::Std::getopts('U:P:D:d:h', \%opts); + +my ($dsn, $user, $pass, $database); +$dsn = $opts{D}? $opts{D} : "dbi:ODBC:JDBC"; +$user = $opts{U}? $opts{U} : 'guest'; +$pass = $opts{P}? $opts{P} : 'sybase'; + +die qq(Syntax: \t$program [-D dsn] [-U username] [-P password] procedure [arg1[, argn]]\n) + if( $opts{h} || 0 == @ARGV ); + +# Connect +my $dbh = DBI->connect($dsn, $user, $pass, {RaiseError => 0, PrintError => 1, AutoCommit => 1}) + or die "Unable for connect to $dsn $DBI::errstr"; + +setup_error_handler($dbh); + +# Construct an odbc placeholder list like (?, ?, ?) +# for any arguments after $ARGV[0]. +my $placeholders = ''; +if( @ARGV > 1 ) { + my @placeholders = ('?') x (@ARGV - 1); + $placeholders = '(' . join( q(, ), @placeholders ) . ')'; + printf STDERR qq(%d arguments found for procedure "$ARGV[0]"\n), scalar(@placeholders); +} + +# Ready the odbc call +my $sql = "{? = call $ARGV[0] $placeholders}"; +my $sth = $dbh->prepare( $sql ); + +# Bind the return code as "inout". +my $rc; +print STDERR qq(Binding parameter #1, the return code\n); +$sth->bind_param_inout(1, \$rc, SQL_INTEGER); + +# Bind the input parameters (we don't do outputs in this example). +# Placeholder numbers are 1-based; the first "parameter" +# is the return code, $rc, above. +for( my $i=1; $i < @ARGV; $i++ ) { + my $type = SQL_VARCHAR; + my $typename = 'SQL_VARCHAR'; + my $data = $ARGV[$i]; + if( $data =~ /^:([[:upper:]_]+):(.+)/ ) { # parse out the datatype, if any + $typename = $1; + $data = $2; + $type = eval($typename); + warn qq("$typename" will probably cause a "can't rebind parameter" message\n) + if $type == SQL_DATETIME; + } + printf STDERR qq(Binding parameter #%d (%s): "$data"\n), ($i+1), $typename; + $sth->bind_param( 1 + $i, $data, $type ); +} + +print STDERR qq(\nExecuting: "$sth->{Statement}" with parameters '), + join(q(', '), @ARGV[1..$#ARGV]), qq('\n); + +# Execute the SQL and print the (possibly several) results +$rc = $sth->execute; +print STDERR qq(execute returned: '$rc'\n) if $rc; + +$i = 1; +while ( $sth->{Active} ) { + printf "Result #%d:\n", $i++; + my @names = @{$sth->{NAME}}; # print column names for each result set + print '[', join("], [", @{$sth->{NAME}}), "]\n" if @names; + while(@dat = $sth->fetchrow_array) { + print q('), join(q(', '), @dat), qq('\n); + } +} + +$dbh->disconnect(); + +exit 0; + diff --git b/src/.cvsignore a/src/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ a/src/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git b/src/apps/.cvsignore a/src/apps/.cvsignore new file mode 100644 index 0000000..36f7973 --- /dev/null +++ a/src/apps/.cvsignore @@ -0,0 +1,11 @@ +Makefile +Makefile.in +tsql +freebcp +bsqldb +defncopy +.libs +.deps +datacopy +bsqlodbc + diff --git b/src/apps/fisql/.cvsignore a/src/apps/fisql/.cvsignore new file mode 100644 index 0000000..ecef2f6 --- /dev/null +++ a/src/apps/fisql/.cvsignore @@ -0,0 +1,5 @@ +Makefile +Makefile.in +.libs +.deps +fisql diff --git b/src/ctlib/.cvsignore a/src/ctlib/.cvsignore new file mode 100644 index 0000000..aee705c --- /dev/null +++ a/src/ctlib/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +*.lo +*.la +.deps diff --git b/src/ctlib/unittests/.cvsignore a/src/ctlib/unittests/.cvsignore new file mode 100644 index 0000000..4682152 --- /dev/null +++ a/src/ctlib/unittests/.cvsignore @@ -0,0 +1,34 @@ +Makefile +Makefile.in +.deps +.libs +t0001 +t0002 +t0003 +t0004 +t0005 +t0006 +t0007 +t0008 +t0009 +connect_fail +tdsdump.out +ct_options +rpc_ct_setparam +rpc_ct_param +lang_ct_param +get_send_data +cs_diag +array_bind +ct_diagall +ct_diagclient +ct_diagserver +cs_config +cancel +blk_in +blk_out +ct_cursor +ct_cursors +ct_dynamic +blk_in2 + diff --git b/src/dblib/.cvsignore a/src/dblib/.cvsignore new file mode 100644 index 0000000..aee705c --- /dev/null +++ a/src/dblib/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +*.lo +*.la +.deps diff --git b/src/dblib/unittests/.cvsignore a/src/dblib/unittests/.cvsignore new file mode 100644 index 0000000..691f42b --- /dev/null +++ a/src/dblib/unittests/.cvsignore @@ -0,0 +1,48 @@ +Makefile +Makefile.in +.deps +.libs +t0001 +t0002 +t0003 +t0004 +t0005 +t0006 +t0007 +t0008 +t0009 +t0011 +t0012 +t0013 +t0013.out +t0014 +t0014.out +t0015 +t0016 +t0016.out +t0017 +t0018 +t0019 +t0020 +t0021 +t0022 +tdsdump.out +t0023 +t0016.err +t0017.err +t0017.out +rpc +dbmorecmds +bcp +thread +text_buffer +done_handling +timeout +dblib.dsw +dblib.mak +vc6 +hang +null +null2 +setnull + diff --git b/src/odbc/.cvsignore a/src/odbc/.cvsignore new file mode 100644 index 0000000..c9a04fd --- /dev/null +++ a/src/odbc/.cvsignore @@ -0,0 +1,7 @@ +Makefile +Makefile.in +.libs +.deps +*.lo +*.la + diff --git b/src/odbc/checkexport.sh a/src/odbc/checkexport.sh new file mode 100755 index 0000000..142cd4e --- /dev/null +++ a/src/odbc/checkexport.sh @@ -0,0 +1,10 @@ +#!/bin/sh +echo Function not exported by VMS driver +(nm .libs/libtdsodbc.so | grep ' T ' | sed 's,.* T ,,g' | grep '^\(SQL\|ODBC\)'; cat ../../vms/odbc_driver_axp.opt | grep -v '^!' | grep 'SQL' | sed 's,.*SQL\(.*\)=PROCEDURE.*,SQL\1,g') | sort | uniq -u | grep -v ODBCINSTGetProperties + +echo Function not exported by windows driver +(nm .libs/libtdsodbc.so | grep ' T ' | sed 's,.* T ,,g' | grep '^\(SQL\|ODBC\)'; cat ../../win32/FreeTDS.def | grep -v '^;' | grep 'SQL' | sed 's,.*SQL,SQL,g' | perl -pe 's,\r,,g') | sort | uniq -u | grep -v ODBCINSTGetProperties + +echo Function not declared as implemented +(nm .libs/libtdsodbc.so | grep ' T ' | sed 's,.* T ,,g' | grep '^SQL' | perl -pe 'tr/a-z/A-Z/'; cat odbc.c | grep 'X(SQL_API_' | sed 's,.*SQL_API_SQL,SQL,g; s,).*,,g' | sort | uniq) | sort | uniq -u +(nm .libs/libtdsodbc.so | grep ' T ' | sed 's,.* T ,,g' | grep '^SQL' | perl -pe 'tr/a-z/A-Z/'; cat odbc.c | grep '_(SQL_API_' | sed 's,.*SQL_API_SQL,SQL,g; s,).*,,g' | sort | uniq) | sort | uniq -d diff --git b/src/odbc/unittests/.cvsignore a/src/odbc/unittests/.cvsignore new file mode 100644 index 0000000..2da9b2c --- /dev/null +++ a/src/odbc/unittests/.cvsignore @@ -0,0 +1,67 @@ +.libs +Makefile +Makefile.in +t0001 +t0002 +t0003 +t0004 +tdsdump.out +.deps +connect +print +date +norowset +funccall +lang_error +tables +binary_test +moreandcount +earlybind +putdata +params +raiserror +getdata +type +genparams +transaction +preperror +odbc.ini +odbcinst.ini +prepare_results +data +testodbc +error +rebindpar +convert_error +typeinfo +const_params +compute +insert_speed +timeout +array +array_out +cursor1 +cursor2 +scroll +describecol +copydesc +msvc.mak +prepclose +warning +paramcore +rpc +timeout2 +timeout3 +odbc.dsw +odbc.mak +vc6 +connect2 +timeout4 +freeclose +cursor3 +cursor4 +cursor5 +attributes +hidden +blob1 +rowset diff --git b/src/odbc/unittests/rownumber.c a/src/odbc/unittests/rownumber.c new file mode 100644 index 0000000..d2c213f --- /dev/null +++ a/src/odbc/unittests/rownumber.c @@ -0,0 +1,110 @@ +#include "common.h" + +/* Test for SQL_ATTR_ROW_NUMBER */ + +/* + * This works under MS ODBC however I don't know if it's correct... + * TODO make it work and add to Makefile.am + */ + +static char software_version[] = "$Id: rownumber.c,v 1.2 2005/01/14 15:03:12 freddy77 Exp $"; +static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; + +static void +CheckRowNum(int n, int line) +{ + SQLRETURN res; + SQLUINTEGER value; + + res = SQLGetStmtAttr(Statement, SQL_ATTR_ROW_NUMBER, &value, sizeof(value), NULL); + if (res != SQL_SUCCESS) { + if (res == SQL_ERROR && n < 0) + return; + ODBC_REPORT_ERROR("SQLGetStmtAttr failed"); + } + if (value != n) { + fprintf(stderr, "Expected %d rows returned %d line %d\n", n, (int) value, line); + exit(1); + } +} + +#undef CHECK_ROWS +#define CHECK_ROWS(n) CheckRowNum(n,__LINE__) + +static void +NextResults(SQLRETURN expected) +{ + if (SQLMoreResults(Statement) != expected) { + if (expected == SQL_SUCCESS) + fprintf(stderr, "Expected another recordset\n"); + else + fprintf(stderr, "Not expected another recordset\n"); + exit(1); + } +} + +static void +Fetch(SQLRETURN expected) +{ + if (SQLFetch(Statement) != expected) { + if (expected == SQL_SUCCESS) + fprintf(stderr, "Expected another record\n"); + else + fprintf(stderr, "Not expected another record\n"); + exit(1); + } +} + +static void +DoTest() +{ + int n = 0; + static const char query[] = "SELECT * FROM #tmp1 ORDER BY i SELECT * FROM #tmp1 WHERE i < 3 ORDER BY i"; + + /* execute a batch command and check row number */ + if (SQLExecDirect(Statement, (SQLCHAR *) query, SQL_NTS) != SQL_SUCCESS) + ODBC_REPORT_ERROR("Unable to execute direct statement"); + CHECK_ROWS(-1); + printf("Result %d\n", ++n); + Fetch(SQL_SUCCESS); + CHECK_ROWS(0); + Fetch(SQL_SUCCESS); + CHECK_ROWS(0); + Fetch(SQL_SUCCESS); + CHECK_ROWS(0); + Fetch(SQL_NO_DATA); + CHECK_ROWS(-1); + NextResults(SQL_SUCCESS); + CHECK_ROWS(-1); + + printf("Result %d\n", ++n); + Fetch(SQL_SUCCESS); + CHECK_ROWS(0); + Fetch(SQL_SUCCESS); + CHECK_ROWS(0); + Fetch(SQL_NO_DATA); + CHECK_ROWS(-1); + NextResults(SQL_NO_DATA); + CHECK_ROWS(-1); +} + +int +main(int argc, char *argv[]) +{ + use_odbc_version3 = 1; + + Connect(); + + Command(Statement, "create table #tmp1 (i int)"); + Command(Statement, "create table #tmp2 (i int)"); + Command(Statement, "insert into #tmp1 values(1)"); + Command(Statement, "insert into #tmp1 values(2)"); + Command(Statement, "insert into #tmp1 values(5)"); + + DoTest(); + + Disconnect(); + + printf("Done.\n"); + return 0; +} diff --git b/src/pool/.cvsignore a/src/pool/.cvsignore new file mode 100644 index 0000000..7cdd226 --- /dev/null +++ a/src/pool/.cvsignore @@ -0,0 +1,5 @@ +Makefile +Makefile.in +.deps +.libs +tdspool diff --git b/src/pool/stream.c a/src/pool/stream.c new file mode 100644 index 0000000..8823cd9 --- /dev/null +++ a/src/pool/stream.c @@ -0,0 +1,455 @@ +/* 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 + * + */ + +/* + * Name: stream.c + * Description: Controls the result stream processing. + */ + +#if HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include + +#if HAVE_STDLIB_H +#include +#endif /* HAVE_STDLIB_H */ + +#if HAVE_STRING_H +#include +#endif /* HAVE_STDLIB_H */ + +#include "pool.h" +#include "tds.h" + +TDS_RCSID(var, "$Id: stream.c,v 1.25 2007/06/19 13:31:34 freddy77 Exp $"); + +int pool_find_end_token(TDS_POOL_MEMBER * pmbr, const unsigned char *buf, int len); + +struct tmp_col_struct +{ + char *column_name; + struct tmp_col_struct *next; +}; + +/* + * returns 1 if this end token has the final bit set + */ +static int +is_final_token(const unsigned char *buf) +{ + return buf[1] & 0x01 ? 0 : 1; +} + +/* + * computes the number of bytes left to be read from the input stream + * after this packet is completely processed. + * returns 1 if token overruns the current packet, 0 otherwise. + */ +static int +bytes_left(TDS_POOL_MEMBER * pmbr, const unsigned char *buf, int pos, int maxlen, int need) +{ + if (pos + need > maxlen) { + return 1; + } else + return 0; +} + +/* + * attempts to read a fixed length token, returns 1 if successful + * bytes_read is set to the number of bytes read fromt the input stream. + */ +static int +read_fixed_token(TDS_POOL_MEMBER * pmbr, const unsigned char *buf, int maxlen, int *bytes_read) +{ + TDS_SMALLINT sz; + int marker; + int pos = 0; + + if (bytes_left(pmbr, buf, pos, maxlen, 1)) { + *bytes_read = maxlen; + return 0; + } + marker = buf[pos++]; + sz = tds_get_token_size(marker); + if (bytes_left(pmbr, buf, pos, maxlen, sz)) { + *bytes_read = maxlen; + return 0; + } else { + *bytes_read = sz + 1; + return 1; + } +} + +static int +read_variable_token(TDS_POOL_MEMBER * pmbr, const unsigned char *buf, int maxlen, int *bytes_read) +{ + TDS_SMALLINT sz; + int pos = 0; + + if (bytes_left(pmbr, buf, pos, maxlen, 3)) { + *bytes_read = maxlen; + return 0; + } + + /* memcpy(&sz,&buf[1],2); */ + /* FIX ME -- works only in emul little endian mode on bigend boxen */ + sz = buf[1] + buf[2] * 256; + pos += 3; + if (bytes_left(pmbr, buf, pos, maxlen, sz)) { + *bytes_read = maxlen; + return 0; + } else { + *bytes_read = sz + 3; + return 1; + } +} + +static int +read_row(TDS_POOL_MEMBER * pmbr, const unsigned char *buf, int maxlen, int *bytes_read) +{ + TDSCOLUMN *curcol; + TDSRESULTINFO *info; + int i, colsize; + int pos = 1; /* skip marker */ + + info = pmbr->tds->res_info; + + die_if((!info), "Entered read_row() without a res_info structure."); + + for (i = 0; i < info->num_cols; i++) { + curcol = info->columns[i]; + if (!is_fixed_type(curcol->column_type)) { + if (bytes_left(pmbr, buf, pos, maxlen, 1)) { + *bytes_read = maxlen; + return 0; + } + colsize = buf[pos++]; + } else { + colsize = tds_get_size_by_type(curcol->column_type); + } + if (bytes_left(pmbr, buf, pos, maxlen, colsize)) { + *bytes_read = maxlen; + return 0; + } + pos += colsize; + } + + *bytes_read = pos; + + return 1; +} + +static int +read_col_name(TDS_POOL_MEMBER * pmbr, const unsigned char *buf, int maxlen, int *bytes_read) +{ + TDS_SMALLINT hdrsize; + int pos = 0; + int stop = 0, num_cols = 0; + int namelen; + struct tmp_col_struct *head = NULL, *cur = NULL, *prev; + int col; + TDSCOLUMN *curcol; + TDSRESULTINFO *info; + + /* header size */ + if (bytes_left(pmbr, buf, pos, maxlen, 3)) { + *bytes_read = maxlen; + return 0; + } + /* FIX ME -- endian */ + hdrsize = buf[1] + buf[2] * 256; + pos += 3; + + while (!stop) { + prev = cur; + cur = (struct tmp_col_struct *) + malloc(sizeof(struct tmp_col_struct)); + if (prev) + prev->next = cur; + if (!head) + head = cur; + + if (bytes_left(pmbr, buf, pos, maxlen, 1)) { + *bytes_read = maxlen; + return 0; + } + namelen = buf[pos++]; + + + if (bytes_left(pmbr, buf, pos, maxlen, namelen)) { + *bytes_read = maxlen; + return 0; + } + cur->column_name = (char *) malloc(namelen + 1); + strncpy(cur->column_name, (char *) &buf[pos], namelen); + cur->column_name[namelen] = '\0'; + cur->next = NULL; + + pos += namelen; + + num_cols++; + + if (pos >= hdrsize) + stop = 1; + } + + tds_free_all_results(pmbr->tds); + pmbr->tds->res_info = tds_alloc_results(num_cols); + info = pmbr->tds->res_info; + + cur = head; + + for (col = 0; col < info->num_cols; col++) { + curcol = info->columns[col]; + strncpy(curcol->column_name, cur->column_name, sizeof(curcol->column_name)); + /* FIXME ucs2 client and others */ + curcol->column_name[sizeof(curcol->column_name) - 1] = 0; + curcol->column_namelen = strlen(curcol->column_name); + prev = cur; + cur = cur->next; + free(prev->column_name); + free(prev); + } + + + *bytes_read = pos; + return 1; +} + +static int +read_col_info(TDS_POOL_MEMBER * pmbr, const unsigned char *buf, int maxlen, int *bytes_read) +{ + TDS_SMALLINT hdrsize; + int pos = 0; + int col, rest; + TDSCOLUMN *curcol; + TDSRESULTINFO *info; + TDSSOCKET *tds = pmbr->tds; + + /* header size */ + if (bytes_left(pmbr, buf, pos, maxlen, 3)) { + *bytes_read = maxlen; + return 0; + } + /* FIX ME -- endian */ + hdrsize = buf[1] + buf[2] * 256; + pos += 3; + + info = tds->res_info; + for (col = 0; col < info->num_cols; col++) { + curcol = info->columns[col]; + if (bytes_left(pmbr, buf, pos, maxlen, 5)) { + *bytes_read = maxlen; + return 0; + } + pos += 4; + curcol->column_type = buf[pos++]; + + /* FIX ME -- blob types */ + if (!is_fixed_type(curcol->column_type)) { + if (bytes_left(pmbr, buf, pos, maxlen, 1)) { + *bytes_read = maxlen; + return 0; + } + curcol->column_size = buf[pos++]; + } else { + curcol->column_size = tds_get_size_by_type(curcol->column_type); + } + } + + rest = hdrsize + 3 - pos; + if (rest > 0) { + if (bytes_left(pmbr, buf, pos, maxlen, rest)) { + *bytes_read = maxlen; + return 0; + } + fprintf(stderr, "read_col_info: draining %d bytes\n", rest); + pos += rest; + } + *bytes_read = pos; + + return 1; +} + +/* + * TDS 5 style result sets + */ +static int +read_result(TDS_POOL_MEMBER * pmbr, const unsigned char *buf, int maxlen, int *bytes_read) +{ + TDS_SMALLINT hdrsize; + int pos = 0; + int namelen; + int col; + TDSSOCKET *tds = pmbr->tds; + int num_cols; + TDSCOLUMN *curcol; + TDSRESULTINFO *info; + + if (bytes_left(pmbr, buf, pos, maxlen, 3)) { + *bytes_read = maxlen; + return 0; + } + /* FIX ME -- endian */ + hdrsize = buf[1] + buf[2] * 256; + pos += 3; + + /* read number of columns and allocate the columns structure */ + num_cols = buf[pos] + buf[pos+1] * 256; + pos += 2; + + tds_free_all_results(tds); + + tds->res_info = tds_alloc_results(num_cols); + info = pmbr->tds->res_info; + + /* + * loop through the columns populating COLINFO struct from + * server response + */ + + for (col = 0; col < info->num_cols; col++) { + curcol = info->columns[col]; + + namelen = buf[pos++]; + + strncpy(curcol->column_name, (char *) &buf[pos], namelen); + curcol->column_name[namelen] = '\0'; + pos += namelen; + + curcol->column_namelen = namelen; + + pos++; /* flags */ + pos += 4; /* user type */ + + tds_set_column_type(tds, curcol, (int)buf[pos]); + switch(curcol->column_varint_size) { + /* FIX ME - endian */ + case 2: curcol->column_size = buf[pos] + buf[pos+1]*256; break; + case 1: curcol->column_size = buf[pos]; break; + case 0: break; + } + pos+=curcol->column_varint_size; + if (is_numeric_type(curcol->column_type)) + pos+=2; + + /* skip locale information */ + pos += buf[pos]; + } + return tds_alloc_row(info); +} + +/* + * is_end_token processes one token and returns 0 for an incomplete token + * or -1 if this is the END token, and 1 for successful processing of token. + * The number of bytes read from the stream is returned in 'bytes_read'. + */ +static int +pool_is_end_token(TDS_POOL_MEMBER * pmbr, const unsigned char *buf, int maxlen, int *bytes_read) +{ + TDS_SMALLINT sz; + int marker; + int ret; + + if (maxlen == 0) + return 0; + + marker = buf[0]; + sz = tds_get_token_size(marker); + + if (sz) { + ret = read_fixed_token(pmbr, buf, maxlen, bytes_read); + } else if (marker == TDS_ROW_TOKEN) { + ret = read_row(pmbr, buf, maxlen, bytes_read); + } else if (marker == TDS_COLNAME_TOKEN) { + ret = read_col_name(pmbr, buf, maxlen, bytes_read); + } else if (marker == TDS_COLFMT_TOKEN) { + ret = read_col_info(pmbr, buf, maxlen, bytes_read); + } else if (marker == TDS_RESULT_TOKEN) { + ret = read_result(pmbr, buf, maxlen, bytes_read); + } else { + ret = read_variable_token(pmbr, buf, maxlen, bytes_read); + } + + /* fprintf(stderr,"bytes_read = %d\n",*bytes_read); */ + if (!ret) { + return 0; + } + + if (is_end_token(marker)) { + if (is_final_token(buf)) { + /* clean up */ + return -1; + } + } + + return 1; +} + +int +pool_find_end_token(TDS_POOL_MEMBER * pmbr, const unsigned char *buf, int len) +{ + int pos = 0, startpos, ret; + int bytes_read; + int stop = 0; + const unsigned char *curbuf; + unsigned char tmpbuf[PGSIZ + BLOCKSIZ]; + int totlen; + static int last_mark; + + /* + * if we had part of a token left over, copy to tmpbuf + */ + if (pmbr->num_bytes_left) { + /* fprintf(stderr,"%d bytes left from last packet\n",pmbr->num_bytes_left); */ + if (pmbr->num_bytes_left > 2000) { + fprintf(stderr, "marker is %d last mark was %d\n", pmbr->fragment[0], last_mark); + } + memcpy(tmpbuf, pmbr->fragment, pmbr->num_bytes_left); + memcpy(&tmpbuf[pmbr->num_bytes_left], buf, len); + curbuf = tmpbuf; + totlen = len + pmbr->num_bytes_left; + } else { + curbuf = buf; + totlen = len; + } + + do { + startpos = pos; + + ret = pool_is_end_token(pmbr, &curbuf[pos], totlen - pos, &bytes_read); + if (ret <= 0) + stop = 1; + + pos += bytes_read; + } while (!stop); + + if (ret == -1) { + pmbr->num_bytes_left = 0; + return 1; /* found end token */ + } else { + last_mark = buf[0]; + pmbr->num_bytes_left = totlen - startpos; + memcpy(pmbr->fragment, &curbuf[startpos], pmbr->num_bytes_left); + return 0; /* exhausted the stream */ + } +} diff --git b/src/replacements/.cvsignore a/src/replacements/.cvsignore new file mode 100644 index 0000000..aee705c --- /dev/null +++ a/src/replacements/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.libs +*.lo +*.la +.deps diff --git b/src/server/.cvsignore a/src/server/.cvsignore new file mode 100644 index 0000000..276eddd --- /dev/null +++ a/src/server/.cvsignore @@ -0,0 +1,7 @@ +Makefile +Makefile.in +.libs +*.lo +*.la +.deps +tdssrv diff --git b/src/tds/.cvsignore a/src/tds/.cvsignore new file mode 100644 index 0000000..f9b4f83 --- /dev/null +++ a/src/tds/.cvsignore @@ -0,0 +1,11 @@ +Makefile +Makefile.in +.libs +*.lo +*.la +.deps +num_limits.h +sybase_character_sets.h +tds_willconvert.h +encodings.h + diff --git b/src/tds/alternative_character_sets.h a/src/tds/alternative_character_sets.h new file mode 100644 index 0000000..662abd4 --- /dev/null +++ a/src/tds/alternative_character_sets.h @@ -0,0 +1,428 @@ +/* + * Copyright 2003 James K. Lowden + * Redistribution and use in source and binary forms, with or without + * modification, are permitted, provided that redistributions of source + * code retain the above copyright notice. + */ + + /* + * The purpose of this file is to help look up character set names. + * + * Any given encoding may be known by several (usually similar) aliases. + * For example, a system using ASCII encoding may report the character set as + * "ASCII", "US-ASCII", or "ISO646-US", among others. For details on what your system + * uses, you may wish to consult the nl_langinfo(3) manual page. + * + * GNU iconv converts a byte sequence from one encoding to another, but before it can do + * so, it must be told which is which. In the list below, the preferred GNU iconv(3) name + * is on the left and an alias is on the right. It is a simple exercise, left to the reader, + * to write a function that uses these data to look up the canonical name when provided + * an alias. + */ + +#ifndef _ALTERNATIVE_CHARACTER_SETS_H_ +#define _ALTERNATIVE_CHARACTER_SETS_H_ + +/* + * $Id: alternative_character_sets.h,v 1.10 2005/02/26 13:08:32 freddy77 Exp $ + */ + +/* + * This list is sorted alphabetically, except that the most + * commonly used character sets are first. + */ + /* ASCII */ + { "US-ASCII", "US-ASCII" } + , { "US-ASCII", "ANSI_X3.4-1968" } + , { "US-ASCII", "ANSI_X3.4-1986" } + , { "US-ASCII", "ASCII" } + , { "US-ASCII", "CP367" } + , { "US-ASCII", "CSASCII" } + , { "US-ASCII", "IBM367" } + , { "US-ASCII", "ISO-IR-6" } + , { "US-ASCII", "ISO646-US" } + , { "US-ASCII", "ISO_646.IRV:1991" } + , { "US-ASCII", "US" } + , { "US-ASCII", "646" } /* NetBSD default */ + /* ISO_8859-1 */ + , { "ISO-8859-1", "ISO-8859-1" } + , { "ISO-8859-1", "CP819" } + , { "ISO-8859-1", "CSISOLATIN1" } + , { "ISO-8859-1", "IBM819" } + , { "ISO-8859-1", "ISO-IR-100" } + , { "ISO-8859-1", "ISO8859-1" } + , { "ISO-8859-1", "ISO_8859-1" } + , { "ISO-8859-1", "ISO_8859-1:1987" } + , { "ISO-8859-1", "L1" } + , { "ISO-8859-1", "LATIN1" } + , { "ISO-8859-1", "iso81" } + , { "ISO-8859-1", "iso88591" } + /* UCS-2 */ + , { "UCS-2", "UCS-2" } + , { "UCS-2", "CSUNICODE" } + , { "UCS-2", "ISO-10646-UCS-2" } + , { "UCS-2", "UCS2" } + , { "UCS-2", "ucs2" } + , { "UCS-2-INTERNAL", "UCS-2-INTERNAL" } + , { "UCS-2-SWAPPED", "UCS-2-SWAPPED" } + , { "UCS-2BE", "UCS-2BE" } + , { "UCS-2BE", "CSUNICODE11" } + , { "UCS-2BE", "UNICODE-1-1" } + , { "UCS-2BE", "UNICODEBIG" } + , { "UCS-2LE", "UCS-2LE" } + , { "UCS-2LE", "UNICODELITTLE" } + /* UTF-8 */ + , { "UTF-8", "UTF-8" } + , { "UTF-8", "UTF8" } + , { "UTF-8", "utf8" } + + /* Basically alphabetical from here */ + , { "ARMSCII-8", "ARMSCII-8" } + , { "BIG-5", "BIG-5" } + , { "BIG-5", "BIG-FIVE" } + , { "BIG-5", "BIG5" } + , { "BIG-5", "BIGFIVE" } + , { "BIG-5", "CN-BIG5" } + , { "BIG-5", "CSBIG5" } + , { "BIG-5", "big5" } + , { "BIG5-HKSCS", "BIG5-HKSCS" } + , { "BIG5-HKSCS", "BIG5HKSCS" } + , { "C99", "C99" } + , { "CHINESE", "CHINESE" } + , { "CHINESE", "CSISO58GB231280" } + , { "CHINESE", "GB_2312-80" } + , { "CHINESE", "ISO-IR-58" } + , { "CHINESE", "hp15CN" } + , { "CN", "CN" } + , { "CN", "CSISO57GB1988" } + , { "CN", "GB_1988-80" } + , { "CN", "ISO-IR-57" } + , { "CN", "ISO646-CN" } + , { "CN-GB", "CN-GB" } + , { "CN-GB", "CSGB2312" } + , { "CN-GB", "EUC-CN" } + , { "CN-GB", "EUCCN" } + , { "CN-GB", "GB2312" } + , { "CN-GB-ISOIR165", "CN-GB-ISOIR165" } + , { "CN-GB-ISOIR165", "ISO-IR-165" } + , { "CP1133", "CP1133" } + , { "CP1133", "IBM-CP1133" } + , { "CP1250", "CP1250" } + , { "CP1250", "MS-EE" } + , { "CP1250", "WINDOWS-1250" } + , { "CP1250", "cp1250" } + , { "CP1251", "CP1251" } + , { "CP1251", "MS-CYRL" } + , { "CP1251", "WINDOWS-1251" } + , { "CP1251", "cp1251" } + , { "CP1252", "CP1252" } + , { "CP1252", "MS-ANSI" } + , { "CP1252", "WINDOWS-1252" } + , { "CP1252", "cp1252" } + , { "CP1253", "CP1253" } + , { "CP1253", "MS-GREEK" } + , { "CP1253", "WINDOWS-1253" } + , { "CP1253", "cp1253" } + , { "CP1254", "CP1254" } + , { "CP1254", "MS-TURK" } + , { "CP1254", "WINDOWS-1254" } + , { "CP1254", "cp1254" } + , { "CP1255", "CP1255" } + , { "CP1255", "MS-HEBR" } + , { "CP1255", "WINDOWS-1255" } + , { "CP1255", "cp1255" } + , { "CP1256", "CP1256" } + , { "CP1256", "MS-ARAB" } + , { "CP1256", "WINDOWS-1256" } + , { "CP1256", "cp1256" } + , { "CP1257", "CP1257" } + , { "CP1257", "WINBALTRIM" } + , { "CP1257", "WINDOWS-1257" } + , { "CP1257", "cp1257" } + , { "CP1258", "CP1258" } + , { "CP1258", "WINDOWS-1258" } + , { "CP1258", "cp1258" } + , { "CP1361", "CP1361" } + , { "CP1361", "JOHAB" } + , { "CP850", "CP850" } + , { "CP850", "850" } + , { "CP850", "CSPC850MULTILINGUAL" } + , { "CP850", "IBM850" } + , { "CP850", "cp850" } + , { "CP862", "CP862" } + , { "CP862", "862" } + , { "CP862", "CSPC862LATINHEBREW" } + , { "CP862", "IBM862" } + , { "CP862", "cp862" } + , { "CP866", "CP866" } + , { "CP866", "866" } + , { "CP866", "CSIBM866" } + , { "CP866", "IBM866" } + , { "CP866", "cp866" } + , { "CP874", "CP874" } + , { "CP874", "WINDOWS-874" } + , { "CP874", "cp874" } + , { "CP932", "CP932" } + , { "CP936", "CP936" } + , { "CP936", "GBK" } + , { "CP949", "CP949" } + , { "CP949", "UHC" } + , { "CP950", "CP950" } + , { "CP437", "CP437" } + , { "CP437", "cp437" } + , { "CP437", "IBM437" } + , { "EUC-JP", "EUC-JP" } + , { "EUC-JP", "CSEUCPKDFMTJAPANESE" } + , { "EUC-JP", "EUCJP" } + , { "EUC-JP", "EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE"} + , { "EUC-JP", "eucJP" } + , { "EUC-KR", "EUC-KR" } + , { "EUC-KR", "CSEUCKR" } + , { "EUC-KR", "EUCKR" } + , { "EUC-KR", "eucKR" } + , { "EUC-TW", "CSEUCTW" } + , { "EUC-TW", "EUC-TW" } + , { "EUC-TW", "EUCTW" } + , { "EUC-TW", "eucTW" } + , { "GB18030", "GB18030" } + , { "GEORGIAN-ACADEMY", "GEORGIAN-ACADEMY" } + , { "GEORGIAN-PS", "GEORGIAN-PS" } + , { "HZ", "HZ" } + , { "HZ", "HZ-GB-2312" } + , { "ISO-2022-CN", "ISO-2022-CN" } + , { "ISO-2022-CN", "CSISO2022CN" } + , { "ISO-2022-CN-EXT", "ISO-2022-CN-EXT" } + , { "ISO-2022-JP", "ISO-2022-JP" } + , { "ISO-2022-JP", "CSISO2022JP" } + , { "ISO-2022-JP-1", "ISO-2022-JP-1" } + , { "ISO-2022-JP-2", "ISO-2022-JP-2" } + , { "ISO-2022-JP-2", "CSISO2022JP2" } + , { "ISO-2022-KR", "ISO-2022-KR" } + , { "ISO-2022-KR", "CSISO2022KR" } + , { "ISO-8859-10", "ISO-8859-10" } + , { "ISO-8859-10", "CSISOLATIN6" } + , { "ISO-8859-10", "ISO-IR-157" } + , { "ISO-8859-10", "ISO8859-10" } + , { "ISO-8859-10", "ISO_8859-10" } + , { "ISO-8859-10", "ISO_8859-10:1992" } + , { "ISO-8859-10", "L6" } + , { "ISO-8859-10", "LATIN6" } + , { "ISO-8859-13", "ISO-8859-13" } + , { "ISO-8859-13", "ISO-IR-179" } + , { "ISO-8859-13", "ISO_8859-13" } + , { "ISO-8859-13", "L7" } + , { "ISO-8859-13", "LATIN7" } + , { "ISO-8859-14", "ISO-8859-14" } + , { "ISO-8859-14", "ISO-CELTIC" } + , { "ISO-8859-14", "ISO-IR-199" } + , { "ISO-8859-14", "ISO_8859-14" } + , { "ISO-8859-14", "ISO_8859-14:1998" } + , { "ISO-8859-14", "L8" } + , { "ISO-8859-14", "LATIN8" } + , { "ISO-8859-15", "ISO8859-15" } + , { "ISO-8859-15", "ISO-8859-15" } + , { "ISO-8859-15", "ISO-IR-203" } + , { "ISO-8859-15", "ISO_8859-15" } + , { "ISO-8859-15", "ISO_8859-15:1998" } + , { "ISO-8859-15", "iso815" } + , { "ISO-8859-15", "iso885915" } + , { "ISO-8859-16", "ISO-8859-16" } + , { "ISO-8859-16", "ISO-IR-226" } + , { "ISO-8859-16", "ISO_8859-16" } + , { "ISO-8859-16", "ISO_8859-16:2000" } + , { "ISO-8859-2", "ISO-8859-2" } + , { "ISO-8859-2", "CSISOLATIN2" } + , { "ISO-8859-2", "ISO8859-2" } + , { "ISO-8859-2", "ISO-IR-101" } + , { "ISO-8859-2", "ISO_8859-2" } + , { "ISO-8859-2", "ISO_8859-2:1987" } + , { "ISO-8859-2", "L2" } + , { "ISO-8859-2", "LATIN2" } + , { "ISO-8859-2", "iso82" } + , { "ISO-8859-2", "iso88592" } + , { "ISO-8859-3", "ISO-8859-3" } + , { "ISO-8859-3", "CSISOLATIN3" } + , { "ISO-8859-3", "ISO-IR-109" } + , { "ISO-8859-3", "ISO_8859-3" } + , { "ISO-8859-3", "ISO_8859-3:1988" } + , { "ISO-8859-3", "L3" } + , { "ISO-8859-3", "LATIN3" } + , { "ISO-8859-3", "iso83" } + , { "ISO-8859-3", "iso88593" } + , { "ISO-8859-4", "ISO8859-4" } + , { "ISO-8859-4", "CSISOLATIN4" } + , { "ISO-8859-4", "ISO-8859-4" } + , { "ISO-8859-4", "ISO-IR-110" } + , { "ISO-8859-4", "ISO_8859-4" } + , { "ISO-8859-4", "ISO_8859-4:1988" } + , { "ISO-8859-4", "L4" } + , { "ISO-8859-4", "LATIN4" } + , { "ISO-8859-4", "iso84" } + , { "ISO-8859-4", "iso88594" } + , { "ISO-8859-5", "ISO-8859-5" } + , { "ISO-8859-5", "CSISOLATINCYRILLIC" } + , { "ISO-8859-5", "CYRILLIC" } + , { "ISO-8859-5", "ISO8859-5" } + , { "ISO-8859-5", "ISO-IR-144" } + , { "ISO-8859-5", "ISO8859-5" } + , { "ISO-8859-5", "ISO_8859-5" } + , { "ISO-8859-5", "ISO_8859-5:1988" } + , { "ISO-8859-5", "iso85" } + , { "ISO-8859-5", "iso88595" } + , { "ISO-8859-6", "ISO-8859-6" } + , { "ISO-8859-6", "ARABIC" } + , { "ISO-8859-6", "ASMO-708" } + , { "ISO-8859-6", "CSISOLATINARABIC" } + , { "ISO-8859-6", "ECMA-114" } + , { "ISO-8859-6", "ISO-IR-127" } + , { "ISO-8859-6", "ISO8859-6" } + , { "ISO-8859-6", "ISO_8859-6" } + , { "ISO-8859-6", "ISO_8859-6:1987" } + , { "ISO-8859-6", "iso86" } + , { "ISO-8859-6", "iso88596" } + , { "ISO-8859-7", "ISO-8859-7" } + , { "ISO-8859-7", "CSISOLATINGREEK" } + , { "ISO-8859-7", "ECMA-118" } + , { "ISO-8859-7", "ELOT_928" } + , { "ISO-8859-7", "GREEK" } + , { "ISO-8859-7", "GREEK8" } + , { "ISO-8859-7", "ISO-IR-126" } + , { "ISO-8859-7", "ISO8859-7" } + , { "ISO-8859-7", "ISO_8859-7" } + , { "ISO-8859-7", "ISO_8859-7:1987" } + , { "ISO-8859-7", "iso87" } + , { "ISO-8859-7", "iso88597" } + , { "ISO-8859-8", "ISO-8859-8" } + , { "ISO-8859-8", "CSISOLATINHEBREW" } + , { "ISO-8859-8", "HEBREW" } + , { "ISO-8859-8", "ISO8859-8" } + , { "ISO-8859-8", "ISO-IR-138" } + , { "ISO-8859-8", "ISO_8859-8" } + , { "ISO-8859-8", "ISO_8859-8:1988" } + , { "ISO-8859-8", "iso88" } + , { "ISO-8859-8", "iso88598" } + , { "ISO-8859-9", "ISO-8859-9" } + , { "ISO-8859-9", "CSISOLATIN5" } + , { "ISO-8859-9", "ISO-IR-148" } + , { "ISO-8859-9", "ISO8859-9" } + , { "ISO-8859-9", "ISO_8859-9" } + , { "ISO-8859-9", "ISO_8859-9:1989" } + , { "ISO-8859-9", "L5" } + , { "ISO-8859-9", "LATIN5" } + , { "ISO-8859-9", "iso88599" } + , { "ISO-8859-9", "iso89" } + , { "ISO-IR-14", "ISO-IR-14" } + , { "ISO-IR-14", "CSISO14JISC6220RO" } + , { "ISO-IR-14", "ISO646-JP" } + , { "ISO-IR-14", "JIS_C6220-1969-RO" } + , { "ISO-IR-14", "JP" } + , { "ISO-IR-149", "ISO-IR-149" } + , { "ISO-IR-149", "CSKSC56011987" } + , { "ISO-IR-149", "KOREAN" } + , { "ISO-IR-149", "KSC_5601" } + , { "ISO-IR-149", "KS_C_5601-1987" } + , { "ISO-IR-149", "KS_C_5601-1989" } + , { "ISO-IR-159", "ISO-IR-159" } + , { "ISO-IR-159", "CSISO159JISX02121990" } + , { "ISO-IR-159", "JIS_X0212" } + , { "ISO-IR-159", "JIS_X0212-1990" } + , { "ISO-IR-159", "JIS_X0212.1990-0" } + , { "ISO-IR-159", "X0212" } + , { "ISO-IR-166", "ISO-IR-166" } + , { "ISO-IR-166", "TIS-620" } + , { "ISO-IR-166", "TIS620" } + , { "ISO-IR-166", "TIS620-0" } + , { "ISO-IR-166", "TIS620.2529-1" } + , { "ISO-IR-166", "TIS620.2533-0" } + , { "ISO-IR-166", "TIS620.2533-1" } + , { "ISO-IR-166", "thai8" } + , { "ISO-IR-166", "tis620" } + , { "ISO-IR-87", "ISO-IR-87" } + , { "ISO-IR-87", "CSISO87JISX0208" } + , { "ISO-IR-87", "JIS0208" } + , { "ISO-IR-87", "JIS_C6226-1983" } + , { "ISO-IR-87", "JIS_X0208" } + , { "ISO-IR-87", "JIS_X0208-1983" } + , { "ISO-IR-87", "JIS_X0208-1990" } + , { "ISO-IR-87", "X0208" } + , { "JAVA", "JAVA" } + , { "JISX0201-1976", "JISX0201-1976" } + , { "JISX0201-1976", "CSHALFWIDTHKATAKANA" } + , { "JISX0201-1976", "JIS_X0201" } + , { "JISX0201-1976", "X0201" } + , { "KOI8-R", "KOI8-R" } + , { "KOI8-R", "CSKOI8R" } + , { "KOI8-RU", "KOI8-RU" } + , { "KOI8-T", "KOI8-T" } + , { "KOI8-U", "KOI8-U" } + , { "MAC", "MAC" } + , { "MAC", "CSMACINTOSH" } + , { "MAC", "MACINTOSH" } + , { "MAC", "MACROMAN" } + , { "MACARABIC", "MACARABIC" } + , { "MACCENTRALEUROPE", "MACCENTRALEUROPE" } + , { "MACCROATIAN", "MACCROATIAN" } + , { "MACCYRILLIC", "MACCYRILLIC" } + , { "MACGREEK", "MACGREEK" } + , { "MACHEBREW", "MACHEBREW" } + , { "MACICELAND", "MACICELAND" } + , { "MACROMANIA", "MACROMANIA" } + , { "MACTHAI", "MACTHAI" } + , { "MACTURKISH", "MACTURKISH" } + , { "MACUKRAINE", "MACUKRAINE" } + , { "MULELAO-1", "MULELAO-1" } + , { "NEXTSTEP", "NEXTSTEP" } + , { "ROMAN8", "ROMAN8" } + , { "ROMAN8", "CSHPROMAN8" } + , { "ROMAN8", "HP-ROMAN8" } + , { "ROMAN8", "R8" } + , { "ROMAN8", "roma8" } + , { "ROMAN8", "roman8" } + , { "SJIS", "SJIS" } + , { "SJIS", "CSSHIFTJIS" } + , { "SJIS", "MS_KANJI" } + , { "SJIS", "SHIFT-JIS" } + , { "SJIS", "SHIFT_JIS" } + , { "SJIS", "sjis" } + , { "TCVN", "TCVN" } + , { "TCVN", "TCVN-5712" } + , { "TCVN", "TCVN5712-1" } + , { "TCVN", "TCVN5712-1:1993" } + , { "UCS-4", "UCS-4" } + , { "UCS-4", "CSUCS4" } + , { "UCS-4", "ISO-10646-UCS-4" } + , { "UCS-4", "UCS4" } + , { "UCS-4", "ucs4" } + , { "UCS-4-INTERNAL", "UCS-4-INTERNAL" } + , { "UCS-4-SWAPPED", "UCS-4-SWAPPED" } + , { "UCS-4BE", "UCS-4BE" } + , { "UCS-4LE", "UCS-4LE" } + , { "UTF-16", "UTF-16" } + , { "UTF-16", "UTF16" } + , { "UTF-16BE", "UTF-16BE" } + , { "UTF-16LE", "UTF-16LE" } + , { "UTF-32", "UTF-32" } + , { "UTF-32BE", "UTF-32BE" } + , { "UTF-32LE", "UTF-32LE" } + , { "UTF-7", "UTF-7" } + , { "UTF-7", "CSUNICODE11UTF7" } + , { "UTF-7", "UNICODE-1-1-UTF-7" } + , { "UTF-7", "UTF7" } + , { "VISCII", "VISCII" } + , { "VISCII", "CSVISCII" } + , { "VISCII", "VISCII1.1-1" } + + /* + * The following are noted in Tru64 manuals, but + * have no canonical names in FreeTDS + * + * TACTIS TACTIS codeset + * dechanyu DEC Hanyu codeset + * dechanzi DEC Hanzi codeset + * deckanji DEC Kanji codeset + * deckorean DEC Korean codeset + * sdeckanji Super DEC Kanji codeset + */ + + /* no stopper row; add your own */ +#endif diff --git b/src/tds/character_sets.h a/src/tds/character_sets.h new file mode 100644 index 0000000..2f6d1c7 --- /dev/null +++ a/src/tds/character_sets.h @@ -0,0 +1,125 @@ +/* + * These are the canonical names for character sets accepted by GNU iconv. + * See its documentation for the standard it follows. + * + * GNU iconv accepts other character set names, too, and your favorite operating system + * very likely uses still other names to represent the _same_ character set. + * + * Alternative character set names are mapped to these canonical ones in + * alternative_character_sets.h and are accessed with canonical_charset(); + */ + {"ISO-8859-1", 1, 1} + , {"UTF-8", 1, 4} + , {"UCS-2LE", 2, 2} + , {"UCS-2BE", 2, 2} + , {"UCS-2", 2, 2} + , {"US-ASCII", 1, 1} + , {"UCS-4", 4, 4} + , {"UCS-4BE", 4, 4} + , {"UCS-4LE", 4, 4} + , {"UTF-16", 2, 4} + , {"UTF-16BE", 2, 4} + , {"UTF-16LE", 2, 4} + , {"UTF-32", 4, 4} + , {"UTF-32BE", 4, 4} + , {"UTF-32LE", 4, 4} + , {"UTF-7", 1, 4} + , {"UCS-2-INTERNAL", 2, 2} + , {"UCS-2-SWAPPED", 2, 2} + , {"UCS-4-INTERNAL", 4, 4} + , {"UCS-4-SWAPPED", 4, 4} + , {"C99", 1, 1} + , {"JAVA", 1, 1} + , {"ISO-8859-2", 1, 1} + , {"ISO-8859-3", 1, 1} + , {"ISO-8859-4", 1, 1} + , {"ISO-8859-5", 1, 1} + , {"ISO-8859-6", 1, 1} + , {"ISO-8859-7", 1, 1} + , {"ISO-8859-8", 1, 1} + , {"ISO-8859-9", 1, 1} + , {"ISO-8859-10", 1, 1} + , {"ISO-8859-13", 1, 1} + , {"ISO-8859-14", 1, 1} + , {"ISO-8859-15", 1, 1} + , {"ISO-8859-16", 1, 1} + , {"KOI8-R", 1, 1} + , {"KOI8-U", 1, 1} + , {"KOI8-RU", 1, 1} + , {"CP1250", 1, 1} + , {"CP1251", 1, 1} + , {"CP1252", 1, 1} + , {"CP1253", 1, 1} + , {"CP1254", 1, 1} + , {"CP1255", 1, 1} + , {"CP1256", 1, 1} + , {"CP1257", 1, 1} + , {"CP1258", 1, 1} + , {"CP850", 1, 1} + , {"CP862", 1, 1} + , {"CP866", 1, 1} + , {"CP437", 1, 1} + , {"MAC", 1, 1} + , {"MACCENTRALEUROPE", 1, 1} + , {"MACICELAND", 1, 1} + , {"MACCROATIAN", 1, 1} + , {"MACROMANIA", 1, 1} + , {"MACCYRILLIC", 1, 1} + , {"MACUKRAINE", 1, 1} + , {"MACGREEK", 1, 1} + , {"MACTURKISH", 1, 1} + , {"MACHEBREW", 1, 1} + , {"MACARABIC", 1, 1} + , {"MACTHAI", 1, 1} + , {"ROMAN8", 1, 1} + , {"NEXTSTEP", 1, 1} + , {"ARMSCII-8", 1, 1} + , {"GEORGIAN-ACADEMY", 1, 1} + , {"GEORGIAN-PS", 1, 1} + , {"KOI8-T", 1, 1} + , {"MULELAO-1", 1, 1} + , {"CP1133", 1, 1} + , {"ISO-IR-166", 1, 1} + , {"CP874", 1, 1} + , {"CP936", 1, 2} + , {"CN", 1, 1} + , {"CP932", 1, 2} + , {"CN-GB", 1, 2} + , {"CP950", 1, 2} + , {"CP949", 1, 2} + , {"CP1361", 1, 2} + , {"BIG-5", 1, 2} + , {"BIG5-HKSCS", 1, 2} + , {"SJIS", 1, 2} + , {"EUC-KR", 1, 2} + , {"VISCII", 1, 1} + , {"ISO-IR-14", 1, 1} + , {"EUC-JP", 1, 3} + , {"EUC-TW", 1, 4} + , {"ISO-2022-JP", 1, 1} + , {"ISO-2022-KR", 1, 2} + , {"ISO-2022-CN", 1, 4} + , {"ISO-2022-CN-EXT", 1, 4} + , {"ISO-2022-JP-2", 1, 1} + , {"GB18030", 1, 4} + /* + * Beyond this point, I don't know the right answers. + * If you can provide the correct min/max (byte/char) values, please + * correct them if necessary and move them above the stopper row. + * Will the person vetting the last unknown row please turn off the lights? + * --jkl April 2003 + */ + , {"", 0, 0} /* stopper row */ + + , {"TCVN", 1, 1} + , {"JISX0201-1976", 1, 1} + , {"ISO-IR-87", 1, 1} + , {"ISO-IR-159", 1, 1} + , {"CHINESE", 1, 1} + , {"CN-GB-ISOIR165", 1, 1} + , {"ISO-IR-149", 1, 1} + , {"ISO-2022-JP-1", 1, 1} + , {"HZ", 1, 1} + /* stopper row */ + , {"", 0, 0} + diff --git b/src/tds/encodings.pl a/src/tds/encodings.pl new file mode 100755 index 0000000..1017836 --- /dev/null +++ a/src/tds/encodings.pl @@ -0,0 +1,290 @@ +#!/usr/bin/perl +## This file is in the public domain. +use File::Basename; + +$basename = basename($0); +$srcdir = "$ARGV[0]/"; + +# get list of character sets we know about +$filename = "${srcdir}alternative_character_sets.h"; +open ALT, $filename or die qq($basename: could not open "$filename"\n); +while(){ + next unless /^\t[, ] {\s+"(.+?)", "(.+?)"/; + $alternates{$2} = $1; +} +close ALT; + +$alternates{'UTF8'} = 'UTF-8'; +$alternates{'ISO_1'} = 'ISO-8859-1'; +$alternates{'ASCII_8'} = 'ISO-8859-1'; +$alternates{'ISO_1'} = 'ISO-8859-1'; +$alternates{'ISO646'} = 'ANSI_X3.4-1968'; + +$alternates{'MAC_CYR'} = 'MACCYRILLIC'; +#alternates{'MAC_EE'} = ''; +$alternates{'MACTURK'} = 'MACTURKISH'; + +$alternates{'KOI8'} = 'KOI8-R'; + +$filename = "${srcdir}sybase_character_sets.h"; +open(OUT, ">$filename") or die qq($basename: could not open "$filename"\n); +print OUT "/*\n"; +print OUT " * This file produced from $0\n"; +print OUT ' * $Id: encodings.pl,v 1.10.4.1 2008/03/10 10:07:22 freddy77 Exp $', "\n"; +print OUT " */\n"; + +# look up the canonical name +$comma = ' '; +while(){ + next if /^#/; + next if /^\s*$/; + ($name) = split; + $Name = uc $name; + $iconv_name = $alternates{$Name}; + + if( !$iconv_name ) { # try predictable transformations + $Name =~ s/ISO8859(\d{1,2})$/ISO-8859-$1/; + $Name =~ s/ISO(\d{1,2})$/ISO-8859-$1/; + + $iconv_name = $alternates{$Name}; + } + + if( !$iconv_name ) { # try crude transformation + $Name =~ s/[\-\_]+//g; + $iconv_name = $alternates{$Name}; + } + + $name = qq/"$name"/; + if( $iconv_name ) { # found, print element + $iconv_name = qq/"$iconv_name",/; + printf OUT "\t$comma { %20s %-15s }\n", $iconv_name , $name; + } else { # not found, print comment + $iconv_name = qq/"",/; + printf OUT "\t /* %20s %-15s */\n", $iconv_name , $name; + + # grep for similar names, as an aid to the to programmer. + $name =~ s/[\-\_]+//g; + print STDERR $Name.": $name alternative_character_sets.h\n"; + } + $comma = ','; +} +print OUT "\t/* stopper row */\n"; +printf OUT "\t$comma { %20s %-15s }\n", 'NULL,' , 'NULL'; +close(OUT); + + + +print "/*\n"; +$date = localtime; +print " * This file produced from $0 on $date\n"; +print ' * $Id: encodings.pl,v 1.10.4.1 2008/03/10 10:07:22 freddy77 Exp $', "\n"; +print " */\n"; + +%charsets = (); +$filename = "${srcdir}character_sets.h"; +open(IN, "<$filename") or die qq($basename: could not open "$filename"\n); +while() +{ + if (/{.*"(.*)".*,\s*([0-9]+)\s*,\s*([0-9]+)\s*}/) + { + next if !$1; + $charsets{$1} = [$2,$3]; + } +} +close(IN); + +# from all iconv to canonic +%alternates = (); +$filename = "${srcdir}alternative_character_sets.h"; +open(IN, "<$filename") or die qq($basename: could not open "$filename"\n); +while() +{ + if (/{\s*"(.+)"\s*,\s*"(.+)"\s*}/) + { + $alternates{$2} = $1; + } +} +close(IN); + +# from sybase to canonic +%sybase = (); +$filename = "${srcdir}sybase_character_sets.h"; +open(IN, "<$filename") or die qq($basename: could not open "$filename"\n); +while() +{ + if (/{\s*"(.+)"\s*,\s*"(.+)"\s*}/) + { + $sybase{$2} = $alternates{$1}; + } +} +close(IN); + +# give an index to all canonic +%index = (); +$i = 0; +$index{"ISO-8859-1"} = $i++; +$index{"UTF-8"} = $i++; +$index{"UCS-2LE"} = $i++; +$index{"UCS-2BE"} = $i++; +foreach $n (sort grep(!/^(ISO-8859-1|UTF-8|UCS-2LE|UCS-2BE)$/,keys %charsets)) +{ + $index{$n} = $i; + $i++ if $n; +} + +# output all charset +print "static const TDS_ENCODING canonic_charsets[] = {\n"; +$i=0; +foreach $n (sort { $index{$a} <=> $index{$b} } keys %charsets) +{ + my ($a, $b) = @{$charsets{$n}}; + my $index = ($n)? (sprintf "/* %3d */", $i) : "\t"; + printf "\t{%20s,\t$a, $b},\t%s\n", qq/"$n"/, $index; + $i++ if $n; +} +print "\t{\"\",\t0, 0}\n"; +print "};\n\n"; + +# output enumerated charset indexes +print "enum {\n"; +$i=0; +foreach $n (sort { $index{$a} <=> $index{$b} } keys %charsets) +{ + $n =~ tr/-a-z/_A-Z/; + printf "\t%30s =%4d,\n", "TDS_CHARSET_$n", $i++; +} +printf "\t%30s =%4d\n};\n\n", "TDS_NUM_CHARSETS", $i++; + +# output all alias +print "static const CHARACTER_SET_ALIAS iconv_aliases[] = {\n"; +foreach $n (sort keys %alternates) +{ + $a = $index{$alternates{$n}}; + next if ("$a" eq ""); + printf "\t{%25s, %3d },\n", qq/"$n"/, $a; +} +print "\t{NULL,\t0}\n"; +print "};\n\n"; + +# output all sybase +print "static const CHARACTER_SET_ALIAS sybase_aliases[] = {\n"; +foreach $n (sort keys %sybase) +{ + $a = $index{$sybase{$n}}; + next if ("$a" eq ""); + printf "\t{%20s, %3d },\n", qq/"$n"/, $a; +} +print "\t{NULL,\t0}\n"; +print "};\n\n"; + +exit 0; +__DATA__ +#http://www.sybase.com/detail/1,6904,1016214,00.html + +ascii_8 +big5 +big5hk +cp1026 +cp1047 +cp1140 +cp1141 +cp1142 +cp1143 +cp1144 +cp1145 +cp1146 +cp1147 +cp1148 +cp1149 +cp1250 +cp1251 +cp1252 +cp1253 +cp1254 +cp1255 +cp1256 +cp1257 +cp1258 +cp273 +cp277 +cp278 +cp280 +cp284 +cp285 +cp297 +cp420 +cp424 +cp437 +cp500 +cp5026 +cp5026yen +cp5035 +cp5035yen +cp737 +cp775 +cp850 +cp852 +cp855 +cp857 +cp858 +cp860 +cp861 +cp862 +cp863 +cp864 +cp865 +cp866 +cp869 +cp870 +cp871 +cp874 +cp874ibm +cp875 +cp921 +cp923 +cp930 +cp930yen +cp932 +cp932ms +cp933 +cp935 +cp936 +cp937 +cp939 +cp939yen +cp949 +cp950 +cp954 +deckanji +euccns +eucgb +eucjis +eucksc +greek8 +iso10 +iso13 +iso14 +iso15 +iso646 +iso88592 +iso88595 +iso88596 +iso88597 +iso88598 +iso88599 +iso_1 +koi8 +mac +mac_cyr +mac_ee +macgrk2 +macgreek +macthai +macturk +roman8 +roman9 +rcsu +sjis +tis620 +turkish8 +utf8 diff --git b/src/tds/num_limits.pl a/src/tds/num_limits.pl new file mode 100755 index 0000000..a26ff4b --- /dev/null +++ a/src/tds/num_limits.pl @@ -0,0 +1,95 @@ +#!/usr/bin/perl + +# +# $Id: num_limits.pl,v 1.2 2005/08/02 12:09:57 freddy77 Exp $ +# Compute limits table to check numeric typs +# + +use strict; + +# This function convert a number given in textual form ("1000") to a +# packet form (binary packet in groups of selected bit) +sub to_pack($$) +{ + my ($num, $bit) = @_; + my @digits; + + my ($carry, $n, $i, $pos, $bin); + my $out = "\x00" x 32; + $pos = 0; + $bin = ''; + while($num ne '') { + @digits = split('', $num); + $carry = 0; + for $i (0..$#digits) { + $n = $carry * 10 + $digits[$i]; + $digits[$i] = int($n / 2); + $carry = $n & 1; + } + $bin = "$carry$bin"; + vec($out, $pos++, 1) = $carry; + shift @digits if ($digits[0] == 0); + $num = join('', @digits); + } + return reverse unpack($bit == 32 ? 'V' x 8 : 'v' x 16, $out); +} + +# Print a tables for given bits +# This function produce two arrays +# one (limits) store not 0 packet numbers +# the other (limit_indexes) store indexed in first array +sub print_all() +{ + my ($bit) = @_; + my @limits = (); + my @indexes = (); + my $i; + + $indexes[0] = 0; + # compute packet numbers and indexes + # we use 1000... number to reduce number length (lower packet are + # zero for big numbers) + for $i (0..77) { + my @packet = &to_pack("1".('0'x$i), $bit); + $indexes[$i] = $#limits + 1; + while($packet[0] == 0) { + shift @packet; + } + while($packet[0] != 0) { + push @limits, shift @packet; + } + $indexes[$i+1] = $#limits + 1; + } + + # fix indexes to use signed char numbers instead of int + my $adjust = $bit == 32 ? 4 : 6; + printf("#define LIMIT_INDEXES_ADJUST %d\n\n", $adjust); + for $i (0..78) { + my $idx = $indexes[$i]; + $idx = $idx - $adjust * $i; + die ('error compacting indexes') if ($idx < -128 || $idx > 127); + $indexes[$i] = $idx; + } + + # print all + print "static const signed char limit_indexes[79]= {\n"; + for $i (0..78) { + printf("\t%d,\t/* %2d */\n", $indexes[$i], $i); + } + print "};\n\n"; + + print "static const TDS_WORD limits[]= {\n"; + my $format = sprintf("\t0x%%0%dxu,\t/* %%3d */\n", $bit / 4); + for $i (0..$#limits) { + printf($format, $limits[$i], $i); + die ('limit if zero ??') if ($limits[$i] == 0); + } + print "};\n"; +} + +print "#ifndef HAVE_INT64\n"; +&print_all(16); +print "#else\n"; +&print_all(32); +print "#endif\n"; + diff --git b/src/tds/tds_willconvert.pl a/src/tds/tds_willconvert.pl new file mode 100755 index 0000000..a695b51 --- /dev/null +++ a/src/tds/tds_willconvert.pl @@ -0,0 +1,80 @@ +#!perl + +$indent = "\t "; +printf qq(/*** %-67s ***/\n), "Please do not edit this file!"; +printf qq(/*** %-67s ***/\n), "It was generated with 'perl tds_willconvert.pl > tds_willconvert.h'"; +printf qq(/*** %-67s ***/\n), "It is much easier to edit the __DATA__ table than this file. "; +printf qq(/*** %-67s ***/\n), " "; +printf qq(/*** %67s ***/\n\n), "Thank you."; + +while() { + next if /^\s+To\s+$/; + next if /^From/; + if( /^\s+VARCHAR CHAR/ ) { + @to = split; + next; + } + last if /^BOUNDARY/; + + @yn = split; + $from = shift @yn; + $i = 0; + foreach $to (@to) { + last if $to =~ /^BOUNDARY/; + + $yn = $yn[$i]; # default + $yn = 1 if $yn[$i] eq 'T'; + $yn = 0 if $yn[$i] eq 'F'; + $yn = 0 if $yn[$i] eq 't'; # means it should be true, but isn't so far. + + printf "$indent %-30.30s, %s", "{ SYB${from}, SYB${to}", "$yn }\n"; + + $i++; + $indent = "\t,"; + } +} + +__DATA__ + To +From + VARCHAR CHAR TEXT BINARY VARBINARY IMAGE INT1 INT2 INT4 INT8 FLT8 REAL NUMERIC DECIMAL BIT MONEY MONEY4 DATETIME DATETIME4 BOUNDARY SENSITIVITY +VARCHAR T T T T T T T T T T T T T T T T T T T T T +CHAR T T T T T T T T T T T T T T T T T T T T T +TEXT T T T T T T T T T T T T T T T T T T T T T +BINARY T T T T T T T T T T T T T T T T T F F F F +VARBINARY T T T T T T T T T T T T T T T T T F F F F +IMAGE T T T T T T T T T T T T T T T T T F F F F +INT1 T T T T T T T T T T T T T T T T T F F F F +INT2 T T T T T T T T T T T T T T T T T F F F F +INT4 T T T T T T T T T T T T T T T T T F F F F +INT8 T T T T T T T T T T T T T T T T T F F F F +FLT8 T T T T T T T T T T T T T T T T T F F F F +REAL T T T T T T T T T T T T T T T T T F F F F +NUMERIC T T T T T T T T T T T T T T T T T F F F F +DECIMAL T T T T T T T T T T T T T T T T T F F F F +BIT T T T T T T T T T T T T T T T T T F F F F +MONEY T T T T T T T T T T T T T T T T T F F F F +MONEY4 T T T T T T T T T T T T T T T T T F F F F +DATETIME T T T T T T F F F F F F F F F F F T T F F +DATETIME4 T T T T T T F F F F F F F F F F F T T F F +BOUNDARY T T T F F F F F F F F F F F F F F F F T F +SENSITIVITY T T T F F F F F F F F F F F F F F F F F T + + + + + + + + + + + + + + + + + + + diff --git b/src/tds/unittests/.cvsignore a/src/tds/unittests/.cvsignore new file mode 100644 index 0000000..eb6aa08 --- /dev/null +++ a/src/tds/unittests/.cvsignore @@ -0,0 +1,22 @@ +Makefile +Makefile.in +.libs +.deps +t0001 +t0002 +t0003 +t0004 +t0005 +t0006 +t0007 +t0008 +tdsdump.out +dynamic1 +convert +dataread +flags +utf8_1 +utf8_2 +utf8_3 +numeric +iconv_fread diff --git b/src/tds/unittests/flags.c a/src/tds/unittests/flags.c new file mode 100644 index 0000000..5c5f28b --- /dev/null +++ a/src/tds/unittests/flags.c @@ -0,0 +1,168 @@ +/* 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 "common.h" + +#include + +static char software_version[] = "$Id: flags.c,v 1.14 2005/04/14 11:35:47 freddy77 Exp $"; +static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; + +static TDSLOGIN *login; +static TDSSOCKET *tds; + +static void +fatal_error(const char *msg) +{ + fprintf(stderr, "%s\n", msg); + exit(1); +} + +static void +check_flags(TDSCOLUMN * curcol, int n, const char *possible_results) +{ + char msg[256]; + char flags[256]; + int l; + char *all_res = strdup(possible_results); + char *res; + int correct = 0; + + flags[0] = 0; + if (curcol->column_nullable) + strcat(flags, "nullable "); + if (curcol->column_writeable) + strcat(flags, "writable "); + if (curcol->column_identity) + strcat(flags, "identity "); + if (curcol->column_key) + strcat(flags, "key "); + if (curcol->column_hidden) + strcat(flags, "hidden "); + l = strlen(flags); + if (l) + flags[l - 1] = 0; + + /* one result is valid ?? */ + for (res = strtok(all_res, "-"); res; res = strtok(NULL, "-")) + if (strcmp(flags, res) == 0) + correct = 1; + + if (!correct) { + sprintf(msg, "flags:%s\nexpected: %s\nwrong column %d flags", flags, possible_results, n + 1); + fatal_error(msg); + } +} + +static void +test_begin(const char *cmd) +{ + TDS_INT result_type; + + fprintf(stdout, "%s: Testing query\n", cmd); + if (tds_submit_query(tds, cmd) != TDS_SUCCEED) + fatal_error("tds_submit_query() failed"); + + if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) != TDS_SUCCEED) + fatal_error("tds_process_tokens() failed"); + + if (result_type != TDS_ROWFMT_RESULT) + fatal_error("expected row fmt() failed"); + + /* test columns results */ + if (tds->current_results != tds->res_info) + fatal_error("wrong current_results"); +} + +static void +test_end(void) +{ + TDS_INT result_type; + int done_flags; + + if (tds_process_tokens(tds, &result_type, &done_flags, TDS_TOKEN_RESULTS) != TDS_SUCCEED) + fatal_error("tds_process_tokens() failed"); + + if (result_type != TDS_DONE_RESULT) + fatal_error("expected done failed"); + + if (done_flags & TDS_DONE_ERROR) + fatal_error("query failed"); + + if (tds_process_tokens(tds, &result_type, NULL, TDS_TOKEN_RESULTS) != TDS_NO_MORE_RESULTS) + fatal_error("tds_process_tokens() failed"); +} + +int +main(int argc, char **argv) +{ + TDSRESULTINFO *info; + char mymsg[256]; + + fprintf(stdout, "%s: Testing flags from server\n", __FILE__); + if (try_tds_login(&login, &tds, __FILE__, 0) != TDS_SUCCEED) { + fprintf(stderr, "try_tds_login() failed\n"); + return 1; + } + + if (run_query(tds, "create table #tmp1 (i numeric(10,0) identity primary key, b varchar(20) null, c int not null)") != + TDS_SUCCEED) + fatal_error("creating table error"); + + /* TDS 4.2 without FOR BROWSE clause seem to forget flags... */ + if (!IS_TDS42(tds)) { + /* check select of all fields */ + test_begin("select * from #tmp1"); + info = tds->current_results; + + if (info->num_cols != 3) { + sprintf(mymsg,"wrong number of columns returned expected 3 got %d", info->num_cols); + fatal_error(mymsg); + } + + check_flags(info->columns[0], 0, "identity"); + check_flags(info->columns[1], 1, "nullable writable"); + check_flags(info->columns[2], 2, "writable"); + + test_end(); + } + + + /* check select of 2 field */ + test_begin("select c, b from #tmp1 for browse"); + info = tds->current_results; + + if (info->num_cols != 3) + fatal_error("wrong number of columns returned"); + + check_flags(info->columns[0], 0, "writable"); + + if (!IS_TDS42(tds)) { + check_flags(info->columns[1], 1, "nullable writable"); + } else { + check_flags(info->columns[1], 1, "writable-nullable writable"); + } + /* TDS5 return not identity information altough documented.. */ + check_flags(info->columns[2], 2, "writable identity key hidden-writable key hidden"); + + test_end(); + + try_tds_logout(login, tds, 0); + return 0; +} diff --git b/vms/.cvsignore a/vms/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ a/vms/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git b/vms/Makefile.am a/vms/Makefile.am new file mode 100644 index 0000000..fb78fcd --- /dev/null +++ a/vms/Makefile.am @@ -0,0 +1,4 @@ +EXTRA_DIST = config_h.vms configure.com descrip_mms.template \ + getpass.c libodbc.opt odbc_driver_axp.opt README.vms + +clean: diff --git b/win32/.cvsignore a/win32/.cvsignore new file mode 100644 index 0000000..cf35acd --- /dev/null +++ a/win32/.cvsignore @@ -0,0 +1,5 @@ +Makefile +Makefile.in +version.rc +freetds.nsh +setup.res diff --git b/win32/build_dsw.pl a/win32/build_dsw.pl new file mode 100644 index 0000000..a52e303 --- /dev/null +++ a/win32/build_dsw.pl @@ -0,0 +1,217 @@ +#!/usr/bin/env perl + +use strict; + +my ($template, $dsp, $name); + +mkdir('vc6'); + +$template = q|# Microsoft Developer Studio Project File - Name="t0002" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=t0002 - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "t0002.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "t0002.mak" CFG="t0002 - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "t0002 - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "t0002 - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "t0002 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "..\\Release" +# PROP BASE Intermediate_Dir "..\\Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "..\\Release" +# PROP Intermediate_Dir "..\\Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D FREETDS_SRCDIR=\\"..\\" /D DBNTWIN32 /YX /FD /c +# ADD BASE RSC /l 0x410 /d "NDEBUG" +# ADD RSC /l 0x410 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ntwdblib.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "t0002 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "..\\Debug" +# PROP BASE Intermediate_Dir "..\\Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "..\\Debug" +# PROP Intermediate_Dir "..\\Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D FREETDS_SRCDIR=\\"..\\" /D DBNTWIN32 /YX /FD /GZ /c +# ADD BASE RSC /l 0x410 /d "_DEBUG" +# ADD RSC /l 0x410 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ntwdblib.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "t0002 - Win32 Release" +# Name "t0002 - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\common.c +# End Source File +# Begin Source File + +SOURCE=..\t0002.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\common.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project +|; + +my ($dsw, $projects, $fn_out); +my ($executables, $link_cmds, $tests); + +$fn_out = shift @ARGV; + +$projects = ''; +foreach $name (@ARGV) { + $name =~ s/\.exe$//i; + $projects .= qq|############################################################################### + +Project: "$name"=.\\vc6\\$name.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +|; + $dsp = $template; + $dsp =~ s/t0002/$name/g; + $dsp =~ s/\n/\r\n/sg; + open(FILE, ">", "vc6/$name.dsp") or die("creating file"); + print FILE $dsp; + close(FILE); + + $executables .= qq| \\\n\t"\$(OUTDIR)\\$name.exe"|; + $link_cmds .= qq|"\$(OUTDIR)\\$name.exe" : "\$(OUTDIR)" "\$(INTDIR)\\common.obj" "\$(INTDIR)\\$name.obj" + \$(LINK32) \$(LINK32_FLAGS) "\$(INTDIR)\\common.obj" "\$(INTDIR)\\$name.obj" /pdb:"\$(OUTDIR)\\$name.pdb" /out:"\$(OUTDIR)\\$name.exe" + +|; + $tests .= qq|\n\t"\$(OUTDIR)\\$name.exe"|; +} + +$template = qq|Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +$projects +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + +|; + +open(FILE, ">", $fn_out) or die("creating file"); +$template =~ s/\n/\r\n/sg; +print FILE $template; +close(FILE); + +$template = qq|!IF "\$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +OUTDIR=.\\Release +INTDIR=.\\Release + +ALL : $executables + +CLEAN : + -\@erase "\$(INTDIR)\*.obj" + -\@erase "\$(OUTDIR)\*.exe" + +"\$(OUTDIR)" : + if not exist "\$(OUTDIR)/\$(NULL)" mkdir "\$(OUTDIR)" + +CPP=cl.exe +CPP_PROJ=/nologo /MD /W3 /O2 /Ob2 /I "./" /D WIN32 /D NDEBUG /D _CONSOLE /D _MBCS /D FREETDS_SRCDIR=\\"..\\" /D DBNTWIN32 /Fo"\$(INTDIR)\\\\" /Fd"\$(INTDIR)\\\\" /FD /c + +.c{\$(INTDIR)}.obj:: + \$(CPP) \$(CPP_PROJ) \$< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib odbc32.lib ntwdblib.lib /nologo /subsystem:console /incremental:no /machine:I386 + +$link_cmds + +CHECK : $tests +|; + +$fn_out =~ s/\.dsw$/.mak/i; + +open(FILE, ">", $fn_out) or die("creating file"); +$template =~ s/\n/\r\n/sg; +print FILE $template; +close(FILE); diff --git b/win32/dev-cpp/.cvsignore a/win32/dev-cpp/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ a/win32/dev-cpp/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git b/win32/msvc6/.cvsignore a/win32/msvc6/.cvsignore new file mode 100644 index 0000000..282522d --- /dev/null +++ a/win32/msvc6/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in ======== climb down out of branch commit 1a17baae01d07688ee80e21ac0a691acb45e9573 Author: jklowden Date: Wed May 7 22:57:52 2008 +0000 RELEASE 0.82 diff --git b/ChangeLog a/ChangeLog index 5781cc1..6441953 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Wed May 7 18:56:39 EDT 2008 JK Lowden - * configure.ac RELEASE 0.82 - Mon May 5 23:19:57 EDT 2008 JK Lowden * include/cstypes.h src/ctlib/ct.c - applied CS_BIGINT patch from Stephen Degler @@ -145,4 +142,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.35 2008/05/07 22:57:52 jklowden Exp $ +$Id: ChangeLog,v 1.2454.2.34 2008/05/06 03:23:44 jklowden Exp $ diff --git b/configure.ac a/configure.ac index f7c0b99..dc0ecbc 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.11 2008/05/07 22:57:52 jklowden Exp $ +dnl $Id: configure.ac,v 1.29.2.10 2008/03/23 21:04:31 jklowden Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -12,10 +12,10 @@ dnl ------------------------------------------------------------ # ------------------------------------------------------------ # Initialization # ------------------------------------------------------------ -AC_INIT(FreeTDS, 0.82) +AC_INIT(FreeTDS, 0.82RC5) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.11 $) +AC_REVISION($Revision: 1.29.2.10 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) commit e34de1e55c90d279da09b8495a80e1958d26a5e4 Author: jklowden Date: Tue May 6 03:23:44 2008 +0000 applied CS_BIGINT patch from Stephen Degler diff --git b/ChangeLog a/ChangeLog index 6441953..92307e0 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,7 +1,3 @@ -Mon May 5 23:19:57 EDT 2008 JK Lowden - * include/cstypes.h src/ctlib/ct.c - - applied CS_BIGINT patch from Stephen Degler - Wed Apr 30 09:52:39 CET 2008 Frediano Ziglio * src/odbc/odbc.c: - return proper diagnostic for truncation on SQLGetData @@ -142,4 +138,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.34 2008/05/06 03:23:44 jklowden Exp $ +$Id: ChangeLog,v 1.2454.2.33 2008/04/30 14:59:32 freddy77 Exp $ diff --git b/include/cstypes.h a/include/cstypes.h index a224c4f..aa494b1 100644 --- b/include/cstypes.h +++ a/include/cstypes.h @@ -30,37 +30,36 @@ extern "C" #endif #endif -static const char rcsid_cstypes_h[] = "$Id: cstypes.h,v 1.6.4.1 2008/05/06 03:23:45 jklowden Exp $"; +static const char rcsid_cstypes_h[] = "$Id: cstypes.h,v 1.6 2005/09/21 14:46:00 freddy77 Exp $"; static const void *const no_unused_cstypes_h_warn[] = { rcsid_cstypes_h, no_unused_cstypes_h_warn }; -typedef tds_sysdep_int32_type CS_INT; -typedef unsigned tds_sysdep_int32_type CS_UINT; -typedef tds_sysdep_int64_type CS_BIGINT; -typedef unsigned tds_sysdep_int64_type CS_UBIGINT; -typedef tds_sysdep_int16_type CS_SMALLINT; -typedef unsigned tds_sysdep_int16_type 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 tds_sysdep_int32_type 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 unsigned tds_sysdep_int16_type CS_USHORT; -typedef unsigned char CS_BIT; +typedef tds_sysdep_int32_type CS_INT; +typedef unsigned tds_sysdep_int32_type CS_UINT; +typedef tds_sysdep_int16_type CS_SMALLINT; +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 tds_sysdep_int32_type 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 unsigned tds_sysdep_int16_type 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_NUMLEN 33 /* used by roguewave */ #define CS_MAX_MSG 1024 #define CS_SQLSTATE_SIZE 8 #define CS_OBJ_NAME 400 @@ -139,10 +138,6 @@ typedef struct _cs_money4 CS_INT mny4; } CS_MONEY4; -typedef CS_INT CS_DATE; - -typedef CS_INT CS_TIME; - typedef struct _cs_datetime { CS_INT dtdays; diff --git b/src/ctlib/ct.c a/src/ctlib/ct.c index 1a9a035..3e4db22 100644 --- b/src/ctlib/ct.c +++ a/src/ctlib/ct.c @@ -39,7 +39,7 @@ #include "tdsstring.h" #include "replacements.h" -TDS_RCSID(var, "$Id: ct.c,v 1.177.2.1 2008/05/06 03:23:45 jklowden Exp $"); +TDS_RCSID(var, "$Id: ct.c,v 1.177 2007/12/21 15:23:24 freddy77 Exp $"); static char * ct_describe_cmd_state(CS_INT state); @@ -1898,7 +1898,7 @@ _ct_get_client_type(int datatype, int usertype, int size) return CS_CHAR_TYPE; break; case SYBINT8: - return CS_BIGINT_TYPE; + return CS_LONG_TYPE; break; case SYBINT4: return CS_INT_TYPE; @@ -1912,7 +1912,7 @@ _ct_get_client_type(int datatype, int usertype, int size) case SYBINTN: switch (size) { case 8: - return CS_BIGINT_TYPE; + return CS_LONG_TYPE; case 4: return CS_INT_TYPE; case 2: @@ -2015,7 +2015,6 @@ _ct_get_server_type(int datatype) return SYBCHAR; break; case CS_LONG_TYPE: - case CS_BIGINT_TYPE: return SYBINT8; break; case CS_INT_TYPE: commit d07284c21104a86ff53463fe541f6d8374e7f708 Author: freddy77 Date: Wed Apr 30 14:59:32 2008 +0000 return proper diagnostic for truncation on SQLGetData diff --git b/ChangeLog a/ChangeLog index 92307e0..002b6dd 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,7 +1,3 @@ -Wed Apr 30 09:52:39 CET 2008 Frediano Ziglio - * src/odbc/odbc.c: - - return proper diagnostic for truncation on SQLGetData - Sun Mar 23 17:03:48 EDT 2008 JK Lowden * configure.ac RC5 @@ -138,4 +134,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.33 2008/04/30 14:59:32 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.32 2008/03/23 21:04:31 jklowden Exp $ diff --git b/src/odbc/odbc.c a/src/odbc/odbc.c index 4e85254..ffbabe7 100644 --- b/src/odbc/odbc.c +++ a/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.10 2008/04/30 14:59:32 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.9 2008/03/11 08:25:30 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -4651,10 +4651,9 @@ SQLGetData(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgb if (colinfo->column_text_sqlgetdatapos == 0 && cbValueMax > 0) ++colinfo->column_text_sqlgetdatapos; /* not all readed ?? */ - if (colinfo->column_text_sqlgetdatapos < colinfo->column_cur_size) { - odbc_errs_add(&stmt->errs, "01004", "String data, right truncated"); + if (colinfo->column_text_sqlgetdatapos < colinfo->column_cur_size) + /* TODO add diagnostic */ ODBC_RETURN(stmt, SQL_SUCCESS_WITH_INFO); - } } else { colinfo->column_text_sqlgetdatapos = colinfo->column_size; } commit 0e1bfcecb4f65c351c329b2701cd75617c7f576f Author: jklowden Date: Sun Mar 23 21:04:31 2008 +0000 RC5 diff --git b/ChangeLog a/ChangeLog index 002b6dd..83fcda2 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Sun Mar 23 17:03:48 EDT 2008 JK Lowden - * configure.ac RC5 - Sun Mar 23 17:01:13 EDT 2008 JK Lowden * doc/userguide.sgml clarified localization @@ -134,4 +131,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.32 2008/03/23 21:04:31 jklowden Exp $ +$Id: ChangeLog,v 1.2454.2.31 2008/03/23 21:02:51 jklowden Exp $ diff --git b/configure.ac a/configure.ac index dc0ecbc..eab617c 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.10 2008/03/23 21:04:31 jklowden Exp $ +dnl $Id: configure.ac,v 1.29.2.9 2008/03/23 17:29:40 jklowden Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -12,10 +12,10 @@ dnl ------------------------------------------------------------ # ------------------------------------------------------------ # Initialization # ------------------------------------------------------------ -AC_INIT(FreeTDS, 0.82RC5) +AC_INIT(FreeTDS, 0.82RC4) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.10 $) +AC_REVISION($Revision: 1.29.2.9 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) commit 83cb97db3955653def79b6813c3fcfe239c4d76a Author: jklowden Date: Sun Mar 23 21:02:51 2008 +0000 clarified localization diff --git b/ChangeLog a/ChangeLog index 83fcda2..b4885f8 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Sun Mar 23 17:01:13 EDT 2008 JK Lowden - * doc/userguide.sgml clarified localization - Sun Mar 23 13:26:57 EDT 2008 JK Lowden * configure.ac doc/Makefile.am - applied ML patches from Johnny C. Lam for callout locations @@ -131,4 +128,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.31 2008/03/23 21:02:51 jklowden Exp $ +$Id: ChangeLog,v 1.2454.2.30 2008/03/23 17:41:36 jklowden Exp $ diff --git b/doc/userguide.sgml a/doc/userguide.sgml index e2e711f..2a09e0f 100644 --- b/doc/userguide.sgml +++ a/doc/userguide.sgml @@ -5,8 +5,8 @@ ]> - $Date: 2008/03/23 21:02:52 $ - $Revision: 1.110.2.2 $ + $Date: 2008/01/10 20:58:43 $ + $Revision: 1.110.2.1 $ <productname>FreeTDS</productname> User Guide A Guide to Installing, Configuring, and Running FreeTDS @@ -56,9 +56,9 @@ This guide is here for you, and we hope that you will be here for it, that other The version you're reading is: -$Revision: 1.110.2.2 $ -$Date: 2008/03/23 21:02:52 $ -CVS control number $Id: userguide.sgml,v 1.110.2.2 2008/03/23 21:02:52 jklowden Exp $. +$Revision: 1.110.2.1 $ +$Date: 2008/01/10 20:58:43 $ +CVS control number $Id: userguide.sgml,v 1.110.2.1 2008/01/10 20:58:43 jklowden Exp $. can be found on the FreeTDS @@ -568,7 +568,7 @@ url="http://www.madgoat.com">www.madgoat.com). OS X® - As of this writing ($Date: 2008/03/23 21:02:52 $), the regular distribution compiles on OS X. Releases prior to 0.63 either did not compile or required patching. + As of this writing ($Date: 2008/01/10 20:58:43 $), the regular distribution compiles on OS X. Releases prior to 0.63 either did not compile or required patching. Alternative build procedure @@ -928,7 +928,7 @@ It bears mentioning here that prior versions of FreeTDS 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. + ISO-8859-1Valid for ISO 8859-1 character set. See TDS 7.0 for Nonwestern Languages for more information. Makes FreeTDS use iconv to convert to and from the specified character set from UCS-2 in TDS 7.0/8.0. As of 0.62 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. @@ -1029,7 +1029,7 @@ As of 0.62 FreeTDS uses iconv to convert all character data, so there's no need - For more about the wonderful world of FreeTDS logs, see Logging. + For more about the wonder world of FreeTDSlogs, see Logging. Deprecated options</> @@ -1236,7 +1236,7 @@ When you're done, you should see something very like this: <para>If you specify <literal><replaceable>dataserver</replaceable>\<replaceable>instance</replaceable></literal> as dataserver during login, <productname>FreeTDS</productname> will attempt to connect to specified instance. - Only Microsoft SQL Server instances are supported. (This server feature was introduced with SQL Server 2000.) + Only Microsoft SQL Server instances are supported. (This server feature was introduced with SQL Server 2000). </para> <para>Note that other <filename>freetds.conf</> properties still apply. @@ -1249,8 +1249,8 @@ When you're done, you should see something very like this: <sect2 id="tsql"><title><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., db-lib). - tsql can either use or bypass the configuration files. By trying both options, you can usually determine if it's your dataserver that's not responding, or your configuration files that are messed up. + +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-lib). tsql can either use or bypass the configuration files, allowing you to see if it's your dataserver that's not responding, or your configuration files that are messed up. Using freetds.conf: @@ -1263,6 +1263,18 @@ When you're done, you should see something very like this: + Bypassing freetds.conf: + + + tsql + -H hostname + -p port + -U username + -Ppassword + -C + + + Failing to connect with tsql @@ -1288,20 +1300,6 @@ 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. - - Connect with <command>tsql</> using a hostname and port number @@ -1493,7 +1491,7 @@ The following table defines all possible ODBC connection attributes for the -Connection attributes that may appear in <filename>odbc.ini</> +
Connection attributes that may appear in <filename>freetds.conf</> @@ -1748,7 +1746,7 @@ This chapter details some advanced configurations that need expanded explanation 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. 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. +If you are unfamiliar with the terms big endian and little endian, they are terms that come originally from Gulliver's Travels. What they refer to in computer science is the the order in which bytes are stored by a processor. Big endian machines such as Sparc and PowerPC store the most significant byte in the first memory location of a multi-byte integer. Little endian machines 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 and 8.0 will automatically emulate little endian mode regardless of the freetds.conf setting. @@ -1765,16 +1763,16 @@ In this example we want to force connections to a server named mssql - - Localization and <acronym>TDS</> 7.0 + + <acronym>TDS</> 7.0 for Nonwestern Languages -TDS 7.0 uses 2-byte Unicode (technically, UCS-2) 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.) +TDS 7.0 uses 2-byte Unicode (technically, UCS-2) 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. -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, and UCS-2. +Since most Unix tools and languages do not support UCS-2, FreeTDS allows conversion by the client to other character sets using the iconv standard. Background information on Unicode and how it affects FreeTDS can be found in the appendix. 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 between only ISO-8859-1 and UCS-2. -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 replacment). 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 learn what character set the client is using, FreeTDS examines the freetds.conf entry. If it finds nothing there, it assumes the client is using ISO-8859-1. That is generally a safe assumption for western languages such as English or French, but produces garbage for other languages. @@ -1803,9 +1801,10 @@ In this example a server named mssql will return data encoded 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. +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). +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. Extreme care should be taken with testing applications using these encodings. Specifically, many applications do not expect the number of characters returned to exceed the column size (in bytes). On the other hand, support of UTF-8 and UCS-2 is a high priority for the developers. Patches and bug reports in this area are especially welcome. + In the following example, a server named mssql will return data encoded in the UTF-8 character set. @@ -3484,7 +3483,7 @@ But check! No point in trying to use a null pointer. - Typically it's more convenient to have db-lib 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. + Typically it's more convenient to have db-lib convert the data into the desired for. 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 commit a0813f12200d2b5ae6c1a9d0de5a08fc1fe82da4 Author: jklowden Date: Sun Mar 23 17:41:36 2008 +0000 s/calout/callout/ diff --git b/ChangeLog a/ChangeLog index b4885f8..eda4bf6 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,6 @@ Sun Mar 23 13:26:57 EDT 2008 JK Lowden * configure.ac doc/Makefile.am - - applied ML patches from Johnny C. Lam for callout locations + - applied ML patches from Johnny C. Lam for calout locations - and gnutls test. Posted RC4. Wed Mar 12 17:16:17 EDT 2008 JK Lowden @@ -128,4 +128,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.30 2008/03/23 17:41:36 jklowden Exp $ +$Id: ChangeLog,v 1.2454.2.29 2008/03/23 17:29:40 jklowden Exp $ commit b1b46092634032b2eff6d939b3e24cc11332679a Author: jklowden Date: Sun Mar 23 17:29:40 2008 +0000 applied ML patches from Johnny C. Lam for calout locations and gnutls test. Posted RC4. diff --git b/ChangeLog a/ChangeLog index eda4bf6..bb13f4b 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,8 +1,3 @@ -Sun Mar 23 13:26:57 EDT 2008 JK Lowden - * configure.ac doc/Makefile.am - - applied ML patches from Johnny C. Lam for calout locations - - and gnutls test. Posted RC4. - Wed Mar 12 17:16:17 EDT 2008 JK Lowden * posted 0.82RC3 @@ -128,4 +123,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.29 2008/03/23 17:29:40 jklowden Exp $ +$Id: ChangeLog,v 1.2454.2.28 2008/03/12 21:17:28 jklowden Exp $ diff --git b/configure.ac a/configure.ac index eab617c..ddd9ece 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.9 2008/03/23 17:29:40 jklowden Exp $ +dnl $Id: configure.ac,v 1.29.2.8 2008/02/29 08:21:41 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -12,10 +12,10 @@ dnl ------------------------------------------------------------ # ------------------------------------------------------------ # Initialization # ------------------------------------------------------------ -AC_INIT(FreeTDS, 0.82RC4) +AC_INIT(FreeTDS, 0.82RC3) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.9 $) +AC_REVISION($Revision: 1.29.2.8 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -621,7 +621,7 @@ AC_SUBST(ODBCNODMLIBAPP) AC_ARG_WITH(gnutls, AS_HELP_STRING([--with-gnutls], [build with TLS support])) -if test "$with_gnutls" = "yes"; then +if test "$with_gnutls"; then AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if you have GNU tls.]) CPPFLAGS="$CPPFLAGS `libgnutls-config --cflags`" NETWORK_LIBS="$NETWORK_LIBS `libgnutls-config --libs`" diff --git b/doc/Makefile.am a/doc/Makefile.am index 7a3ea51..d416361 100644 --- b/doc/Makefile.am +++ a/doc/Makefile.am @@ -2,7 +2,7 @@ # Converting DocBook to HTML (several small files) # http://www.freebsd.org/tutorials/docproj-primer/x3132.html#AEN3140 -# $Id: Makefile.am,v 1.62.2.1 2008/03/23 17:29:40 jklowden Exp $ +# $Id: Makefile.am,v 1.62 2008/01/08 15:38:23 jklowden Exp $ SHELL = /bin/sh TXT2MAN = $(srcdir)/txt2man @@ -55,8 +55,7 @@ man: $(man_MANS) installdirs: $(mkinstalldirs) $(TARGET_DOCDIR)/userguide \ $(TARGET_DOCDIR)/reference \ - $(TARGET_DOCDIR)/images \ - $(TARGET_DOCDIR)/images/callouts 2>&1 + $(TARGET_DOCDIR)/images 2>&1 MANOPTS = -I 'FreeTDS User Guide' -v 'FreeTDS Utilities' -t $(PRODUCT) -r $(VERSION) @@ -118,8 +117,8 @@ install-data-local: installdirs $(DOCDIR)/reference/index.html $(DOCDIR)/usergui if test -r $(DOCDIR)/reference ; then d=.; else d="$(srcdir)"; fi; \ find $$d/$(DOCDIR)/reference \( -type f -o -type l \) -exec \ $(INSTALL_DATA) {} $(TARGET_DOCDIR)/reference ';' - cd $(srcdir) && find images -name \*.gif -exec \ - $(INSTALL_DATA) {} $(TARGET_DOCDIR)/{} ';' + find $(srcdir)/images -name \*.gif -exec \ + $(INSTALL_DATA) {} $(TARGET_DOCDIR)/images ';' uninstall-local: rm -rf $(TARGET_DOCDIR) commit f011423c84bb8b36e96f749d6501a1f0666c4deb Author: jklowden Date: Wed Mar 12 21:17:28 2008 +0000 RC3 diff --git b/ChangeLog a/ChangeLog index bb13f4b..a674354 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Wed Mar 12 17:16:17 EDT 2008 JK Lowden - * posted 0.82RC3 - Tue Mar 11 09:26:03 CET 2008 Frediano Ziglio * include/tds_sysdep_private.h: win64 portability issue @@ -123,4 +120,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.28 2008/03/12 21:17:28 jklowden Exp $ +$Id: ChangeLog,v 1.2454.2.27 2008/03/11 08:27:34 freddy77 Exp $ commit f67fe7c1c9f694c406f340946c2cbdb8d6b01923 Author: freddy77 Date: Tue Mar 11 08:27:34 2008 +0000 backported small win64 portability issue diff --git b/ChangeLog a/ChangeLog index a674354..355e48c 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Tue Mar 11 09:26:03 CET 2008 Frediano Ziglio - * include/tds_sysdep_private.h: win64 portability issue - Tue Mar 11 09:24:00 CET 2008 Frediano Ziglio * src/odbc/odbc.c: - backported SQL_ATTR_CONNECTION_DEAD support @@ -120,4 +117,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.27 2008/03/11 08:27:34 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.26 2008/03/11 08:25:30 freddy77 Exp $ diff --git b/include/tds_sysdep_private.h a/include/tds_sysdep_private.h index c248cbf..9b6fcb0 100644 --- b/include/tds_sysdep_private.h +++ a/include/tds_sysdep_private.h @@ -20,7 +20,7 @@ #ifndef _tds_sysdep_private_h_ #define _tds_sysdep_private_h_ -/* $Id: tds_sysdep_private.h,v 1.23.2.1 2008/03/11 08:27:35 freddy77 Exp $ */ +/* $Id: tds_sysdep_private.h,v 1.23 2007/01/29 11:02:43 freddy77 Exp $ */ #undef TDS_RCSID #if defined(__GNUC__) && __GNUC__ >= 3 @@ -87,10 +87,6 @@ typedef DWORD pid_t; #define WIN32 1 #endif -#if defined(_WIN64) && !defined(WIN64) -#define WIN64 1 -#endif - #define TDS_SDIR_SEPARATOR "\\" /* use macros to use new style names */ commit f9481de1889b109a825308f443039060008a705a Author: freddy77 Date: Tue Mar 11 08:25:30 2008 +0000 backported SQL_ATTR_CONNECTION_DEAD support diff --git b/ChangeLog a/ChangeLog index 355e48c..3b5da89 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,7 +1,3 @@ -Tue Mar 11 09:24:00 CET 2008 Frediano Ziglio - * src/odbc/odbc.c: - - backported SQL_ATTR_CONNECTION_DEAD support - Mon Mar 10 11:05:50 CET 2008 Frediano Ziglio * .cvsignore: ignore autogenerated * src/odbc/odbc.c: @@ -117,4 +113,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.26 2008/03/11 08:25:30 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.25 2008/03/10 10:07:22 freddy77 Exp $ diff --git b/src/odbc/odbc.c a/src/odbc/odbc.c index ffbabe7..76c3426 100644 --- b/src/odbc/odbc.c +++ a/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.9 2008/03/11 08:25:30 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.8 2008/03/10 10:07:22 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -4469,12 +4469,6 @@ _SQLGetConnectAttr(SQLHDBC hdbc, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTE *((SQLUINTEGER *) Value) = dbc->attr.autocommit; ODBC_RETURN_(dbc); 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; - ODBC_RETURN_(dbc); - break; -#endif case SQL_ATTR_CONNECTION_TIMEOUT: *((SQLUINTEGER *) Value) = dbc->attr.connection_timeout; ODBC_RETURN_(dbc); commit 6c5bf4f21aad2501de55d52988638d873cc6281c Author: freddy77 Date: Mon Mar 10 10:07:22 2008 +0000 fix txn and auto-commit setting diff --git b/.cvsignore a/.cvsignore index d6098e5..c4ca19c 100644 --- b/.cvsignore +++ a/.cvsignore @@ -18,4 +18,3 @@ freetds.spec PWD doxyfile test-dist.log -compile diff --git b/ChangeLog a/ChangeLog index 3b5da89..d11ef26 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,10 +1,3 @@ -Mon Mar 10 11:05:50 CET 2008 Frediano Ziglio - * .cvsignore: ignore autogenerated - * src/odbc/odbc.c: - - tell the truth about transaction levels - - fix setting auto-commit off before connection - * src/tds/encodings.pl: fix a problem with cvs - Fri Feb 29 11:23:13 CET 2008 Frediano Ziglio * src/odbc/unittests/rowset.c: - improved adding test for SQLExtendedFetch @@ -113,4 +106,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.25 2008/03/10 10:07:22 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.24 2008/02/29 10:24:41 freddy77 Exp $ diff --git b/src/odbc/odbc.c a/src/odbc/odbc.c index 76c3426..74e297a 100644 --- b/src/odbc/odbc.c +++ a/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.8 2008/03/10 10:07:22 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.7 2008/02/29 09:23:51 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -224,9 +224,6 @@ change_autocommit(TDS_DBC * dbc, int state) ODBC_RETURN(dbc, SQL_ERROR); } dbc->attr.autocommit = state; - } else { - /* if not connected we will change auto-commit after login */ - dbc->attr.autocommit = state; } ODBC_RETURN_(dbc); } @@ -326,10 +323,6 @@ odbc_connect(TDS_DBC * dbc, TDSCONNECTION * connection) if (IS_TDS7_PLUS(dbc->tds_socket)) dbc->cursor_support = 1; - if (dbc->attr.autocommit != SQL_AUTOCOMMIT_ON) - if (!SQL_SUCCEEDED(change_autocommit(dbc, dbc->attr.autocommit))) - ODBC_RETURN_(dbc); - /* this overwrite any error arrived (wanted behavior, Sybase return error for conversion errors) */ ODBC_RETURN(dbc, SQL_SUCCESS); } @@ -5534,7 +5527,8 @@ _SQLGetInfo(TDS_DBC * dbc, SQLUSMALLINT fInfoType, SQLPOINTER rgbInfoValue, SQLS SIVAL = SQL_TC_ALL; break; case SQL_TXN_ISOLATION_OPTION: - UIVAL = SQL_TXN_READ_COMMITTED; + /* TODO check SQLSetConnectAttr support */ + 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; diff --git b/src/tds/encodings.pl a/src/tds/encodings.pl index 1017836..2346c18 100755 --- b/src/tds/encodings.pl +++ a/src/tds/encodings.pl @@ -30,7 +30,7 @@ $filename = "${srcdir}sybase_character_sets.h"; open(OUT, ">$filename") or die qq($basename: could not open "$filename"\n); print OUT "/*\n"; print OUT " * This file produced from $0\n"; -print OUT ' * $Id: encodings.pl,v 1.10.4.1 2008/03/10 10:07:22 freddy77 Exp $', "\n"; +print OUT ' * $Id: encodings.pl,v 1.10 2005/04/06 06:44:33 jklowden Exp $', "\n"; print OUT " */\n"; # look up the canonical name @@ -64,7 +64,7 @@ while(){ # grep for similar names, as an aid to the to programmer. $name =~ s/[\-\_]+//g; - print STDERR $Name.": $name alternative_character_sets.h\n"; + print STDERR "$Name: $name alternative_character_sets.h\n"; } $comma = ','; } @@ -77,7 +77,7 @@ close(OUT); print "/*\n"; $date = localtime; print " * This file produced from $0 on $date\n"; -print ' * $Id: encodings.pl,v 1.10.4.1 2008/03/10 10:07:22 freddy77 Exp $', "\n"; +print ' * $Id: encodings.pl,v 1.10 2005/04/06 06:44:33 jklowden Exp $', "\n"; print " */\n"; %charsets = (); commit 0efd878ec0e374785a15e46b48cbdd639993979a Author: freddy77 Date: Fri Feb 29 10:24:41 2008 +0000 improved adding test for SQLExtendedFetch diff --git b/ChangeLog a/ChangeLog index d11ef26..1354a3e 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,7 +1,3 @@ -Fri Feb 29 11:23:13 CET 2008 Frediano Ziglio - * src/odbc/unittests/rowset.c: - - improved adding test for SQLExtendedFetch - Fri Feb 29 10:22:14 CET 2008 Frediano Ziglio * src/odbc/odbc.c src/odbc/unittests/.cvsignore: * src/odbc/unittests/Makefile.am src/odbc/unittests/rowset.c(added): @@ -106,4 +102,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.24 2008/02/29 10:24:41 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.23 2008/02/29 09:23:51 freddy77 Exp $ diff --git b/src/odbc/unittests/rowset.c a/src/odbc/unittests/rowset.c index e1f2e78..d2c23ea 100644 --- b/src/odbc/unittests/rowset.c +++ a/src/odbc/unittests/rowset.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: rowset.c,v 1.1.2.2 2008/02/29 10:24:41 freddy77 Exp $"; +static char software_version[] = "$Id: rowset.c,v 1.1.2.1 2008/02/29 09:23:51 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHK(func,params) \ @@ -44,67 +44,25 @@ test_err(int n) 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]; - SQLRETURN rc; use_odbc_version3 = 1; Connect(); - /* initial value should be 1 */ CHK(SQLGetStmtAttr, (Statement, SQL_ROWSET_SIZE, &len, sizeof(len), NULL)); if (len != 1) { fprintf(stderr, "len should be 1\n"); Disconnect(); return 1; } - - /* check invalid parameter values */ + test_err(-123); test_err(-1); test_err(0); - /* set some correct values */ CHK(SQLSetStmtAttr, (Statement, SQL_ROWSET_SIZE, (SQLPOINTER) int2ptr(2), 0)); CHK(SQLSetStmtAttr, (Statement, SQL_ROWSET_SIZE, (SQLPOINTER) int2ptr(1), 0)); - /* now check that SQLExtendedFetch works as expected */ - Command(Statement, "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); - Command(Statement, sql); - } - - ResetStatement(); - CHK(SQLSetStmtOption, (Statement, SQL_ATTR_CURSOR_TYPE, SQL_CURSOR_DYNAMIC)); - rc = CommandWithResult(Statement, "SELECT * FROM #rowset ORDER BY n"); - if (!SQL_SUCCEEDED(rc)) - ODBC_REPORT_ERROR("SQLExecDirect error"); - - CHK(SQLBindCol, (Statement, 2, SQL_C_CHAR, buf, sizeof(buf), &len)); - - row_count = 0xdeadbeef; - memset(statuses, 0x55, sizeof(statuses)); - CHK(SQLExtendedFetch, (Statement, SQL_FETCH_NEXT, 1, &row_count, statuses)); - - if (row_count != 1 || statuses[0] != SQL_ROW_SUCCESS || strcmp(buf, "aaaaaaaaa") != 0) { - fprintf(stderr, "Invalid result\n"); - Disconnect(); - return 1; - } - Disconnect(); printf("Done.\n"); commit 15a4a82830ba9c69cacf7290678494d10d4834e7 Author: freddy77 Date: Fri Feb 29 09:23:51 2008 +0000 fix SQL_ROWSET_SIZE diff --git b/ChangeLog a/ChangeLog index 1354a3e..3b6ca5e 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,8 +1,3 @@ -Fri Feb 29 10:22:14 CET 2008 Frediano Ziglio - * src/odbc/odbc.c src/odbc/unittests/.cvsignore: - * src/odbc/unittests/Makefile.am src/odbc/unittests/rowset.c(added): - - fix SQL_ROWSET_SIZE - Fri Feb 29 09:20:07 CET 2008 Frediano Ziglio * configure.ac: avoid version clash @@ -102,4 +97,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.23 2008/02/29 09:23:51 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.22 2008/02/29 08:21:41 freddy77 Exp $ diff --git b/src/odbc/odbc.c a/src/odbc/odbc.c index 74e297a..8d564a4 100644 --- b/src/odbc/odbc.c +++ a/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.7 2008/02/29 09:23:51 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.6 2008/02/27 16:08:57 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -1472,7 +1472,8 @@ _SQLAllocStmt(SQLHDBC hdbc, SQLHSTMT FAR * phstmt) stmt->attr.simulate_cursor = SQL_SC_NON_UNIQUE; stmt->attr.use_bookmarks = SQL_UB_OFF; - stmt->sql_rowset_size = 1; + /* is not the same of using APD sql_desc_bind_type */ + stmt->sql_rowset_size = SQL_BIND_BY_COLUMN; stmt->row_count = TDS_NO_COUNT; stmt->row_status = NOT_IN_ROW; @@ -6175,10 +6176,6 @@ _SQLSetStmtAttr(SQLHSTMT hstmt, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLIN 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); - ODBC_RETURN(stmt, SQL_ERROR); - } stmt->sql_rowset_size = ui; break; default: diff --git b/src/odbc/unittests/.cvsignore a/src/odbc/unittests/.cvsignore index 2da9b2c..d7c663e 100644 --- b/src/odbc/unittests/.cvsignore +++ a/src/odbc/unittests/.cvsignore @@ -64,4 +64,3 @@ cursor5 attributes hidden blob1 -rowset diff --git b/src/odbc/unittests/Makefile.am a/src/odbc/unittests/Makefile.am index f6a4a35..8146c2a 100644 --- b/src/odbc/unittests/Makefile.am +++ a/src/odbc/unittests/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.68.2.3 2008/02/29 09:23:51 freddy77 Exp $ +# $Id: Makefile.am,v 1.68.2.2 2008/01/10 13:22:19 freddy77 Exp $ TESTS = \ t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT)\ t0004$(EXEEXT) connect$(EXEEXT) print$(EXEEXT)\ @@ -20,8 +20,7 @@ TESTS = \ paramcore$(EXEEXT) timeout2$(EXEEXT) timeout3$(EXEEXT) \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ - attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) \ - rowset$(EXEEXT) + attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) check_PROGRAMS = $(TESTS) @@ -80,7 +79,6 @@ cursor5_SOURCES = cursor5.c common.c common.h attributes_SOURCES = attributes.c common.c common.h hidden_SOURCES = hidden.c common.c common.h blob1_SOURCES = blob1.c common.c common.h -rowset_SOURCES = rowset.c common.c common.h AM_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) -DFREETDS_SRCDIR=\"$(srcdir)\" if MINGW32 diff --git b/src/odbc/unittests/rowset.c a/src/odbc/unittests/rowset.c deleted file mode 100644 index d2c23ea..0000000 --- b/src/odbc/unittests/rowset.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "common.h" - -static char software_version[] = "$Id: rowset.c,v 1.1.2.1 2008/02/29 09:23:51 freddy77 Exp $"; -static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; - -#define CHK(func,params) \ - if (func params != SQL_SUCCESS) \ - ODBC_REPORT_ERROR(#func) - -static char odbc_err[256]; -static char odbc_sqlstate[6]; - -static void -ReadError(void) -{ - memset(odbc_err, 0, sizeof(odbc_err)); - memset(odbc_sqlstate, 0, sizeof(odbc_sqlstate)); - if (!SQL_SUCCEEDED(SQLGetDiagRec(SQL_HANDLE_STMT, Statement, 1, (SQLCHAR *) odbc_sqlstate, NULL, (SQLCHAR *) odbc_err, sizeof(odbc_err), NULL))) { - printf("SQLGetDiagRec should not fail\n"); - exit(1); - } - printf("Message: '%s' %s\n", odbc_sqlstate, odbc_err); -} - -static void -test_err(int n) -{ - SQLRETURN rc; - - rc = SQLSetStmtAttr(Statement, SQL_ROWSET_SIZE, (SQLPOINTER) int2ptr(n), 0); - if (rc != SQL_ERROR) { - fprintf(stderr, "SQLSetStmtAttr should fail\n"); - Disconnect(); - exit(1); - } - ReadError(); - if (strcmp(odbc_sqlstate, "HY024") != 0) { - fprintf(stderr, "Unexpected sql state returned\n"); - Disconnect(); - exit(1); - } -} - -int -main(int argc, char *argv[]) -{ - SQLLEN len; - - use_odbc_version3 = 1; - Connect(); - - CHK(SQLGetStmtAttr, (Statement, SQL_ROWSET_SIZE, &len, sizeof(len), NULL)); - if (len != 1) { - fprintf(stderr, "len should be 1\n"); - Disconnect(); - return 1; - } - - test_err(-123); - test_err(-1); - test_err(0); - - CHK(SQLSetStmtAttr, (Statement, SQL_ROWSET_SIZE, (SQLPOINTER) int2ptr(2), 0)); - CHK(SQLSetStmtAttr, (Statement, SQL_ROWSET_SIZE, (SQLPOINTER) int2ptr(1), 0)); - - Disconnect(); - - printf("Done.\n"); - return 0; -} commit bba9b941d3a9e054583667f355f8dd49ed6ed8d0 Author: freddy77 Date: Fri Feb 29 08:21:41 2008 +0000 avoid version clash diff --git b/ChangeLog a/ChangeLog index 3b6ca5e..fd93f61 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Fri Feb 29 09:20:07 CET 2008 Frediano Ziglio - * configure.ac: avoid version clash - Thu Feb 28 18:21:50 EST 2008 JK Lowden * vms/configure.com turn off iconv by default @@ -97,4 +94,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.22 2008/02/29 08:21:41 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.21 2008/02/28 23:22:43 jklowden Exp $ diff --git b/configure.ac a/configure.ac index ddd9ece..adad2d2 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.8 2008/02/29 08:21:41 freddy77 Exp $ +dnl $Id: configure.ac,v 1.29.2.7 2008/02/15 10:48:25 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -12,10 +12,10 @@ dnl ------------------------------------------------------------ # ------------------------------------------------------------ # Initialization # ------------------------------------------------------------ -AC_INIT(FreeTDS, 0.82RC3) +AC_INIT(FreeTDS, 0.82RC2) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.8 $) +AC_REVISION($Revision: 1.29.2.7 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) commit 9a04187a9fef3e2cfed6d32d27e332fbe04c5feb Author: jklowden Date: Thu Feb 28 23:22:43 2008 +0000 turn off iconv by default diff --git b/ChangeLog a/ChangeLog index fd93f61..7ca0b8d 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Thu Feb 28 18:21:50 EST 2008 JK Lowden - * vms/configure.com turn off iconv by default - Thu Feb 28 17:32:33 EST 2008 JK Lowden * posted 0.82RC2 @@ -94,4 +91,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.21 2008/02/28 23:22:43 jklowden Exp $ +$Id: ChangeLog,v 1.2454.2.20 2008/02/28 22:53:49 jklowden Exp $ diff --git b/vms/configure.com a/vms/configure.com index 3f0d02a..37b59b3 100644 --- b/vms/configure.com +++ a/vms/configure.com @@ -16,7 +16,7 @@ $! 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: configure.com,v 1.5.4.1 2008/02/28 23:22:43 jklowden Exp $ +$! $Id: configure.com,v 1.5 2005/12/29 10:24:34 freddy77 Exp $ $! $! CONFIGURE.COM -- run from top level source directory as @[.vms]configure $! @@ -38,9 +38,7 @@ $! 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. "" - +$ IF 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. "" commit ccb100b3638d3d6adfad27d95555eee2536b112a Author: jklowden Date: Thu Feb 28 22:53:49 2008 +0000 released RC2 diff --git b/ChangeLog a/ChangeLog index 7ca0b8d..5944acd 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Thu Feb 28 17:32:33 EST 2008 JK Lowden - * posted 0.82RC2 - Wed Feb 27 17:06:22 CET 2008 Frediano Ziglio * src/odbc/odbc.c: - SQLExecDirect/SQLExecute return SQL_SUCCESS instead of SQL_NO_DATA @@ -91,4 +88,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.20 2008/02/28 22:53:49 jklowden Exp $ +$Id: ChangeLog,v 1.2454.2.19 2008/02/27 16:08:40 freddy77 Exp $ commit b4ea3901405b132255a63b9d9786948a393cad02 Author: freddy77 Date: Wed Feb 27 16:08:40 2008 +0000 SQLExecDirect/SQLExecute return SQL_SUCCESS instead of SQL_NO_DATA diff --git b/ChangeLog a/ChangeLog index 5944acd..58ee2df 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,7 +1,3 @@ -Wed Feb 27 17:06:22 CET 2008 Frediano Ziglio - * src/odbc/odbc.c: - - SQLExecDirect/SQLExecute return SQL_SUCCESS instead of SQL_NO_DATA - Fri Feb 15 11:47:38 CET 2008 Frediano Ziglio * configure.ac: fix nasty problem with HP-UX @@ -88,4 +84,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.19 2008/02/27 16:08:40 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.18 2008/02/15 10:48:24 freddy77 Exp $ diff --git b/src/odbc/odbc.c a/src/odbc/odbc.c index 8d564a4..a639c4c 100644 --- b/src/odbc/odbc.c +++ a/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.6 2008/02/27 16:08:57 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.5 2008/01/29 10:14:29 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -3179,6 +3179,9 @@ _SQLExecute(TDS_STMT * stmt) case TDS_CMD_DONE: if (stmt->dbc->current_statement == stmt) stmt->dbc->current_statement = NULL; + if (stmt->errs.lastrc == SQL_SUCCESS && stmt->dbc->env->attr.odbc_version == SQL_OV_ODBC3 + && stmt->row_count == TDS_NO_COUNT && !stmt->cursor) + ODBC_RETURN(stmt, SQL_NO_DATA); break; case TDS_CMD_FAIL: commit 133d01873224b00eb74ba5db2d614780b841fa05 Author: freddy77 Date: Fri Feb 15 10:48:24 2008 +0000 fix an ABI problem under HP-UX diff --git b/ChangeLog a/ChangeLog index 58ee2df..3349c0f 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Fri Feb 15 11:47:38 CET 2008 Frediano Ziglio - * configure.ac: fix nasty problem with HP-UX - Tue Feb 12 16:41:02 CET 2008 Frediano Ziglio * src/apps/bsqlodbc.c: fix memory error * src/tds/query.c: remove possible buffer underflow @@ -84,4 +81,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.18 2008/02/15 10:48:24 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.17 2008/02/12 15:41:51 freddy77 Exp $ diff --git b/configure.ac a/configure.ac index adad2d2..318611d 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.7 2008/02/15 10:48:25 freddy77 Exp $ +dnl $Id: configure.ac,v 1.29.2.6 2008/01/27 10:41:21 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -15,7 +15,7 @@ dnl ------------------------------------------------------------ AC_INIT(FreeTDS, 0.82RC2) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.7 $) +AC_REVISION($Revision: 1.29.2.6 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -47,6 +47,7 @@ case $host in netdb_reentrant=yes ;; *-*-hpux11*) + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" netdb_reentrant=yes ;; *-*-cygwin*) @@ -150,27 +151,6 @@ case $host in fi 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) - if test "$enable_krb5" = "yes" ; then - 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 - fi - - AM_CONDITIONAL(MINGW32, false) - ;; *) AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(gethostbyname, nsl) commit 32afc4af2cd25dafb6df4d2d53e2594229f49c6e Author: freddy77 Date: Tue Feb 12 15:41:51 2008 +0000 fix possible memory errors diff --git b/ChangeLog a/ChangeLog index 3349c0f..34b8f87 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,7 +1,3 @@ -Tue Feb 12 16:41:02 CET 2008 Frediano Ziglio - * src/apps/bsqlodbc.c: fix memory error - * src/tds/query.c: remove possible buffer underflow - Wed Feb 06 09:48:32 CET 2008 Frediano Ziglio * src/tds/unittests/t0007.c: test more data @@ -81,4 +77,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.17 2008/02/12 15:41:51 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.16 2008/02/06 08:49:44 freddy77 Exp $ diff --git b/src/apps/bsqlodbc.c a/src/apps/bsqlodbc.c index 5a6cc42..1050550 100644 --- b/src/apps/bsqlodbc.c +++ a/src/apps/bsqlodbc.c @@ -50,7 +50,7 @@ #include #include "replacements.h" -static char software_version[] = "$Id: bsqlodbc.c,v 1.9.2.1 2008/02/12 15:41:51 freddy77 Exp $"; +static char software_version[] = "$Id: bsqlodbc.c,v 1.9 2007/11/26 06:25:57 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static char * next_query(void); @@ -354,8 +354,7 @@ next_query() 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; diff --git b/src/tds/query.c a/src/tds/query.c index 3996aef..8ef57f7 100644 --- b/src/tds/query.c +++ a/src/tds/query.c @@ -46,7 +46,7 @@ #include -TDS_RCSID(var, "$Id: query.c,v 1.217.2.1 2008/02/12 15:41:51 freddy77 Exp $"); +TDS_RCSID(var, "$Id: query.c,v 1.217 2008/01/05 11:24:40 freddy77 Exp $"); static void tds_put_params(TDSSOCKET * tds, TDSPARAMINFO * info, int flags); static void tds7_put_query_params(TDSSOCKET * tds, const char *query, int query_len); @@ -577,7 +577,7 @@ tds_next_placeholder_ucs2le(const char *start, const char *end, int named) case '?': return p; case '@': - if (named && !isalnum((unsigned char) prev)) + if (named && !isalnum(prev)) return p; default: p += 2; @@ -849,7 +849,7 @@ tds7_build_param_def_from_params(TDSSOCKET * tds, const char* query, size_t quer 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]))) + if (!id_end[1] && (id_end[0] != '_' && id_end[1] != '#' && !isalnum(id_end[0]))) break; ids[i].p = e; ids[i].len = id_end - e; commit 0f12f08f4f3231c3785f43c913cb98e8ff0d8207 Author: freddy77 Date: Wed Feb 6 08:49:44 2008 +0000 more conversions tests diff --git b/ChangeLog a/ChangeLog index 34b8f87..2441480 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Wed Feb 06 09:48:32 CET 2008 Frediano Ziglio - * src/tds/unittests/t0007.c: test more data - Mon Feb 04 08:54:29 CET 2008 Frediano Ziglio * src/tds/convert.c: fix memory leak @@ -77,4 +74,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.16 2008/02/06 08:49:44 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.15 2008/02/04 07:55:39 freddy77 Exp $ diff --git b/src/tds/unittests/t0007.c a/src/tds/unittests/t0007.c index 4f1479a..d867fbe 100644 --- b/src/tds/unittests/t0007.c +++ a/src/tds/unittests/t0007.c @@ -20,7 +20,7 @@ #include "common.h" #include -static char software_version[] = "$Id: t0007.c,v 1.14.2.1 2008/02/06 08:49:44 freddy77 Exp $"; +static char software_version[] = "$Id: t0007.c,v 1.14 2006/06/08 08:19:05 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static TDSCONTEXT ctx; @@ -39,7 +39,6 @@ test0(const char *src, int len, int dsttype, const char *result) if (res < 0) strcpy(buf, "error"); else { - buf[0] = 0; switch (dsttype) { case SYBINT1: sprintf(buf, "%d", cr.ti); @@ -50,9 +49,6 @@ test0(const char *src, int len, int dsttype, const char *result) case SYBINT4: sprintf(buf, "%d", cr.i); break; - case SYBINT8: - sprintf(buf, "0x%08x%08x", (unsigned int) ((cr.bi >> 32) & 0xfffffffflu), (unsigned int) (cr.bi & 0xfffffffflu)); - break; case SYBUNIQUE: sprintf(buf, "%08X-%04X-%04X-%02X%02X%02X%02X" "%02X%02X%02X%02X", @@ -96,42 +92,9 @@ main(int argc, char **argv) test("123", SYBINT1, "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("+", 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(" - 1234 a", SYBINT8, "error"); - test("", SYBINT8, "0x0000000000000000"); - test(" ", SYBINT8, "0x0000000000000000"); - test(" 123", SYBINT8, "0x000000000000007b"); - test(" 123 ", SYBINT8, "0x000000000000007b"); - test(" + 123 ", SYBINT8, "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 */ printf("overflow checks...\n"); - test("9223372036854775807", SYBINT8, "0x7fffffffffffffff"); - test("9223372036854775808", SYBINT8, "error"); - test("-9223372036854775808", SYBINT8, "0x8000000000000000"); - test("-9223372036854775809", SYBINT8, "error"); test("2147483647", SYBINT4, "2147483647"); test("2147483648", SYBINT4, "error"); test("-2147483648", SYBINT4, "-2147483648"); @@ -158,7 +121,6 @@ main(int argc, char **argv) /* test not terminated string */ test0("1234", 2, SYBINT4, "12"); - test0("123456", 4, SYBINT8, "0x00000000000004d2"); /* some test for unique */ printf("unique type...\n"); commit 66996076495c6cb0f369d4a082180d465ea8c35e Author: freddy77 Date: Mon Feb 4 07:55:39 2008 +0000 fix silly memory leak diff --git b/ChangeLog a/ChangeLog index 2441480..b0130db 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Mon Feb 04 08:54:29 CET 2008 Frediano Ziglio - * src/tds/convert.c: fix memory leak - Tue Jan 29 11:12:44 CET 2008 Frediano Ziglio * src/odbc/convert_tds2sql.c src/odbc/odbc.c src/odbc/odbc_util.c: * src/odbc/unittests/getdata.c: @@ -74,4 +71,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.15 2008/02/04 07:55:39 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.14 2008/01/29 10:14:23 freddy77 Exp $ diff --git b/src/tds/convert.c a/src/tds/convert.c index fa03c47..fa8dbd1 100644 --- b/src/tds/convert.c +++ a/src/tds/convert.c @@ -64,7 +64,7 @@ #include #endif -TDS_RCSID(var, "$Id: convert.c,v 1.179.2.1 2008/02/04 07:55:39 freddy77 Exp $"); +TDS_RCSID(var, "$Id: convert.c,v 1.179 2007/12/31 10:06:50 freddy77 Exp $"); typedef unsigned short utf16_t; @@ -1958,7 +1958,6 @@ string_to_datetime(const char *instr, int desttype, CONV_RESULT * cr) 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; } commit 8cfd82525fd0f902afb5e7894c709df0ea437cf9 Author: freddy77 Date: Tue Jan 29 10:14:23 2008 +0000 handle errors from convert_tds2sql diff --git b/ChangeLog a/ChangeLog index b0130db..6ea3faa 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,8 +1,3 @@ -Tue Jan 29 11:12:44 CET 2008 Frediano Ziglio - * src/odbc/convert_tds2sql.c src/odbc/odbc.c src/odbc/odbc_util.c: - * src/odbc/unittests/getdata.c: - - backported fix for error handling in SQLGetData/SQLFetch - Sun Jan 27 11:40:32 CET 2008 Frediano Ziglio * configure.ac src/apps/Makefile.am: - backported fix for bsqlodbc dependency @@ -71,4 +66,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.14 2008/01/29 10:14:23 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.13 2008/01/27 10:41:21 freddy77 Exp $ diff --git b/src/odbc/convert_tds2sql.c a/src/odbc/convert_tds2sql.c index cc7bc7d..04e0b8a 100644 --- b/src/odbc/convert_tds2sql.c +++ a/src/odbc/convert_tds2sql.c @@ -39,7 +39,7 @@ #include #endif -TDS_RCSID(var, "$Id: convert_tds2sql.c,v 1.49.2.1 2008/01/29 10:14:28 freddy77 Exp $"); +TDS_RCSID(var, "$Id: convert_tds2sql.c,v 1.49 2007/05/25 09:10:10 freddy77 Exp $"); TDS_INT convert_tds2sql(TDSCONTEXT * context, int srctype, TDS_CHAR * src, TDS_UINT srclen, int desttype, TDS_CHAR * dest, SQLULEN destlen, @@ -56,7 +56,7 @@ convert_tds2sql(TDSCONTEXT * context, int srctype, TDS_CHAR * src, TDS_UINT srcl TIMESTAMP_STRUCT *tssp; SQL_NUMERIC_STRUCT *num; - int ret = TDS_CONVERT_FAIL; + int ret = TDS_FAIL; int i, cplen; tdsdump_log(TDS_DBG_FUNC, "convert_tds2sql: src is %d dest = %d\n", srctype, desttype); @@ -89,7 +89,7 @@ convert_tds2sql(TDSCONTEXT * context, int srctype, TDS_CHAR * src, TDS_UINT srcl } else { /* if destlen == 0 we return only length */ if (destlen != 0) - ret = TDS_CONVERT_FAIL; + ret = TDS_FAIL; } return ret; } @@ -143,7 +143,7 @@ convert_tds2sql(TDSCONTEXT * context, int srctype, TDS_CHAR * src, TDS_UINT srcl } else { /* if destlen == 0 we return only length */ if (destlen != 0) - ret = TDS_CONVERT_FAIL; + ret = TDS_FAIL; } break; diff --git b/src/odbc/odbc.c a/src/odbc/odbc.c index a639c4c..1e3c3a8 100644 --- b/src/odbc/odbc.c +++ a/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.5 2008/01/29 10:14:29 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.4 2008/01/27 10:41:23 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -3340,28 +3340,6 @@ odbc_process_tokens(TDS_STMT * stmt, unsigned flag) } } -static void -odbc_convert_err_set(struct _sql_errors *errs, TDS_INT err) -{ - 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; - } -} - /* * - handle correctly SQLGetData (for forward cursors accept only row_size == 1 * for other types application must use SQLSetPos) @@ -3596,7 +3574,6 @@ _SQLFetch(TDS_STMT * stmt, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset) len = convert_tds2sql(context, tds_get_conversion_type(colinfo->column_type, colinfo->column_size), src, srclen, c_type, data_ptr, drec_ard->sql_desc_octet_length, drec_ard); if (len < 0) { - odbc_convert_err_set(&stmt->errs, len); row_status = SQL_ROW_ERROR; break; } @@ -4614,19 +4591,10 @@ SQLGetData(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgb nSybType = tds_get_conversion_type(colinfo->column_type, colinfo->column_size); 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_RETURN(stmt, SQL_ERROR); - } - fCType = stmt->ard->records[icol - 1].sql_desc_concise_type; - } assert(fCType); *pcbValue = convert_tds2sql(context, nSybType, src, srclen, fCType, (TDS_CHAR *) rgbValue, cbValueMax, NULL); - if (*pcbValue < 0) { - odbc_convert_err_set(&stmt->errs, *pcbValue); + if (*pcbValue < 0) ODBC_RETURN(stmt, SQL_ERROR); - } if (is_variable_type(colinfo->column_type) && (fCType == SQL_C_CHAR || fCType == SQL_C_BINARY)) { /* calc how many bytes was readed */ diff --git b/src/odbc/odbc_util.c a/src/odbc/odbc_util.c index bd73130..fb38d5b 100644 --- b/src/odbc/odbc_util.c +++ a/src/odbc/odbc_util.c @@ -38,7 +38,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc_util.c,v 1.94.2.1 2008/01/29 10:14:31 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc_util.c,v 1.94 2007/06/19 13:31:34 freddy77 Exp $"); /** * \ingroup odbc_api @@ -140,7 +140,7 @@ odbc_set_return_status(struct _hstmt *stmt, unsigned int n_row) len = convert_tds2sql(context, SYBINT4, (TDS_CHAR *) & tds->ret_status, sizeof(TDS_INT), drec->sql_desc_concise_type, (void *) data_ptr, drec->sql_desc_octet_length, NULL); - if (len < 0) + if (TDS_FAIL == len) return /* SQL_ERROR */ ; if (drec->sql_desc_indicator_ptr) LEN(drec->sql_desc_indicator_ptr) = 0; diff --git b/src/odbc/unittests/getdata.c a/src/odbc/unittests/getdata.c index 0c2d112..eead6e0 100644 --- b/src/odbc/unittests/getdata.c +++ a/src/odbc/unittests/getdata.c @@ -1,54 +1,15 @@ #include "common.h" -static char software_version[] = "$Id: getdata.c,v 1.4.2.1 2008/01/29 10:14:31 freddy77 Exp $"; +static char software_version[] = "$Id: getdata.c,v 1.4 2007/08/07 09:20:32 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; -static char odbc_err[256]; -static char odbc_sqlstate[6]; - -static void -ReadError(void) -{ - memset(odbc_err, 0, sizeof(odbc_err)); - memset(odbc_sqlstate, 0, sizeof(odbc_sqlstate)); - if (!SQL_SUCCEEDED(SQLGetDiagRec(SQL_HANDLE_STMT, Statement, 1, (SQLCHAR *) odbc_sqlstate, NULL, (SQLCHAR *) odbc_err, sizeof(odbc_err), NULL))) { - printf("SQLGetDiagRec should not fail\n"); - exit(1); - } - printf("Message: '%s' %s\n", odbc_sqlstate, odbc_err); -} - -static void -test_err(const char *data, int c_type, const char *state) -{ - char sql[128]; - SQLRETURN rc; - SQLLEN ind; - const unsigned int buf_size = 128; - char *buf = (char *) malloc(buf_size); - - sprintf(sql, "SELECT '%s'", data); - Command(Statement, sql); - SQLFetch(Statement); - rc = SQLGetData(Statement, 1, c_type, buf, buf_size, &ind); - free(buf); - if (rc != SQL_ERROR) - ODBC_REPORT_ERROR("SQLGetData error expected"); - ReadError(); - if (strcmp(odbc_sqlstate, state) != 0) { - fprintf(stderr, "Unexpected sql state returned\n"); - Disconnect(); - exit(1); - } - ResetStatement(); -} - int main(int argc, char *argv[]) { char buf[16]; SQLINTEGER int_buf; SQLLEN len; + int ms_db = 0; Connect(); @@ -129,24 +90,14 @@ main(int argc, char *argv[]) ResetStatement(); + ms_db = db_is_microsoft(); + Disconnect(); - use_odbc_version3 = 1; - Connect(); + if (ms_db) { + use_odbc_version3 = 1; + Connect(); - /* test error from SQLGetData */ - /* wrong constant */ - 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, int */ - test_err("prova 123", SQL_C_TIMESTAMP, "22018"); - /* overflow */ - test_err("1234567890123456789", SQL_C_LONG, "22003"); - - if (db_is_microsoft()) { Command(Statement, "SELECT CONVERT(TEXT,'')"); if (SQLFetch(Statement) != SQL_SUCCESS) @@ -163,9 +114,9 @@ main(int argc, char *argv[]) if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 1, NULL) != SQL_NO_DATA) ODBC_REPORT_ERROR("invalid return from SQLGetData"); - } - Disconnect(); + Disconnect(); + } printf("Done.\n"); return 0; commit 41c2785bfcd95cb9da5c6d42446b60687c1cbff1 Author: freddy77 Date: Sun Jan 27 10:41:21 2008 +0000 backported fix for SQLCancel and bsqlodbc dependency diff --git b/ChangeLog a/ChangeLog index 6ea3faa..92f275a 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,9 +1,3 @@ -Sun Jan 27 11:40:32 CET 2008 Frediano Ziglio - * configure.ac src/apps/Makefile.am: - - backported fix for bsqlodbc dependency - * include/tdsodbc.h src/odbc/odbc.c src/tds/token.c: - - backported fix for SQLCancel - Wed Jan 23 9:48:19 CET 2008 Frediano Ziglio * configure.ac include/tds_sysdep_public.h.in: * src/ctlib/unittests/cancel.c src/dblib/unittests/timeout.c: @@ -66,4 +60,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.13 2008/01/27 10:41:21 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.12 2008/01/23 08:50:15 freddy77 Exp $ diff --git b/configure.ac a/configure.ac index 318611d..b8eef11 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.6 2008/01/27 10:41:21 freddy77 Exp $ +dnl $Id: configure.ac,v 1.29.2.5 2008/01/23 08:50:16 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -15,7 +15,7 @@ dnl ------------------------------------------------------------ AC_INIT(FreeTDS, 0.82RC2) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.6 $) +AC_REVISION($Revision: 1.29.2.5 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -476,7 +476,6 @@ if test "$with_odbc_nodm"; then # Can't use ODBCLIB/LDFLAGS variables since they are used in building # other directories. ODBCNODMLIB="-L.. -ltdsodbc" - ODBCNODMLIBAPP="-L../odbc -ltdsodbc" odbc=true fi @@ -597,7 +596,6 @@ AC_SUBST(ODBC_INC) AC_SUBST(ODBCLIB) AC_SUBST(ODBCINSTLIB) AC_SUBST(ODBCNODMLIB) -AC_SUBST(ODBCNODMLIBAPP) AC_ARG_WITH(gnutls, AS_HELP_STRING([--with-gnutls], [build with TLS support])) diff --git b/include/tdsodbc.h a/include/tdsodbc.h index 733647b..59fdfc1 100644 --- b/include/tdsodbc.h +++ a/include/tdsodbc.h @@ -66,7 +66,7 @@ extern "C" #endif #endif -/* $Id: tdsodbc.h,v 1.103.2.1 2008/01/27 10:41:22 freddy77 Exp $ */ +/* $Id: tdsodbc.h,v 1.103 2007/11/26 18:12:30 freddy77 Exp $ */ #if defined(__GNUC__) && __GNUC__ >= 4 #pragma GCC visibility push(hidden) @@ -370,7 +370,6 @@ struct _hstmt int special_row; /* do NOT free cursor, free from socket or attach to connection */ TDSCURSOR *cursor; - unsigned char cancel_sent; }; typedef struct _henv TDS_ENV; diff --git b/src/apps/Makefile.am a/src/apps/Makefile.am index 447d9b8..cfa03ac 100644 --- b/src/apps/Makefile.am +++ a/src/apps/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.25.2.1 2008/01/27 10:41:22 freddy77 Exp $ +# $Id: Makefile.am,v 1.25 2008/01/01 23:09:46 freddy77 Exp $ AM_CPPFLAGS = -I$(top_srcdir)/include @@ -28,8 +28,9 @@ bsqldb_LDADD = ../dblib/libsybdb.la \ $(NETWORK_LIBS) if ODBC -bsqlodbc_LDADD = $(ODBCLIB) $(ODBCNODMLIBAPP) \ - ../replacements/libreplacements.la $(NETWORK_LIBS) +bsqlodbc_LDADD = ../odbc/libtdsodbc.la \ + ../replacements/libreplacements.la \ + $(ODBCLIB) $(NETWORK_LIBS) bsqlodbc_CPPFLAGS = $(ODBC_INC) $(AM_CPPFLAGS) endif diff --git b/src/odbc/odbc.c a/src/odbc/odbc.c index 1e3c3a8..c8dc89f 100644 --- b/src/odbc/odbc.c +++ a/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.4 2008/01/27 10:41:23 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.3 2008/01/13 20:39:27 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -562,7 +562,6 @@ odbc_lock_statement(TDS_STMT* stmt) tds->query_timeout = (stmt->attr.query_timeout != DEFAULT_QUERY_TIMEOUT) ? stmt->attr.query_timeout : stmt->dbc->default_query_timeout; stmt->dbc->current_statement = stmt; - stmt->cancel_sent = 0; return 1; } @@ -1583,7 +1582,6 @@ SQLCancel(SQLHSTMT hstmt) /* FIXME test current statement */ - stmt->cancel_sent = 1; if (tds_send_cancel(tds) == TDS_FAIL) { ODBC_SAFE_ERROR(stmt); ODBC_RETURN(stmt, SQL_ERROR); @@ -1594,9 +1592,7 @@ SQLCancel(SQLHSTMT hstmt) ODBC_RETURN(stmt, SQL_ERROR); } - /* only if we processed cancel reset statement */ - if (stmt->dbc->current_statement && stmt->dbc->current_statement == stmt && tds->state == TDS_IDLE) - stmt->dbc->current_statement = NULL; + stmt->dbc->current_statement = NULL; ODBC_RETURN_(stmt); } @@ -2029,12 +2025,6 @@ odbc_errmsg_handler(const TDSCONTEXT * ctx, TDSSOCKET * tds, TDSMESSAGE * msg) tdsdump_log(TDS_DBG_INFO1, "in timeout\n"); if (tds && (dbc = (TDS_DBC *) tds->parent) && dbc->current_statement) { TDS_STMT *stmt = dbc->current_statement; - /* cancel sent, handling interrupt */ - if (tds->in_cancel && stmt->cancel_sent) { - stmt->cancel_sent = 0; - tdsdump_log(TDS_DBG_INFO1, "returning from timeout\n"); - return TDS_INT_TIMEOUT; - } if (!tds->in_cancel) odbc_errs_add(&stmt->errs, "HYT00", "Timeout expired"); stmt->errs.lastrc = SQL_ERROR; diff --git b/src/tds/token.c a/src/tds/token.c index 7b4a707..0c80a00 100644 --- b/src/tds/token.c +++ a/src/tds/token.c @@ -42,7 +42,7 @@ #include #endif -TDS_RCSID(var, "$Id: token.c,v 1.343.2.1 2008/01/27 10:41:23 freddy77 Exp $"); +TDS_RCSID(var, "$Id: token.c,v 1.343 2007/12/28 23:00:18 jklowden Exp $"); static int tds_process_msg(TDSSOCKET * tds, int marker); static int tds_process_compute_result(TDSSOCKET * tds); @@ -2238,7 +2238,7 @@ tds_process_end(TDSSOCKET * tds, int marker, int *flags_parm) if (IS_TDSDEAD(tds)) return TDS_FAIL; - return was_cancelled ? TDS_CANCELLED : TDS_SUCCEED; + return TDS_SUCCEED; } /** commit 85d6fdfb184c7048ad79253274cab05f4a70652c Author: freddy77 Date: Fri Jan 25 11:05:24 2008 +0000 merged diff --git b/src/dblib/unittests/timeout.c a/src/dblib/unittests/timeout.c index ea1bd05..a3ef6f4 100644 --- b/src/dblib/unittests/timeout.c +++ a/src/dblib/unittests/timeout.c @@ -7,7 +7,7 @@ #include "common.h" #include -static char software_version[] = "$Id: timeout.c,v 1.3.2.2 2008/01/25 11:05:24 freddy77 Exp $"; +static char software_version[] = "$Id: timeout.c,v 1.3.2.1 2008/01/23 08:50:16 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int ntimeouts = 0, ncancels = 0; commit 8b4057dfd4929f7a201865c3f2af2509285233af Author: freddy77 Date: Wed Jan 23 08:50:15 2008 +0000 portability fixes for win64 diff --git b/ChangeLog a/ChangeLog index 92f275a..5fda0d4 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,9 +1,3 @@ -Wed Jan 23 9:48:19 CET 2008 Frediano Ziglio - * configure.ac include/tds_sysdep_public.h.in: - * src/ctlib/unittests/cancel.c src/dblib/unittests/timeout.c: - * win32/tds_sysdep_public.h win32/winlogin.c win32/winsetup.c: - - backport portability fixes for win64 - Sun Jan 13 21:38:02 CET 2008 Frediano Ziglio * src/odbc/odbc.c: backported cancel error set @@ -60,4 +54,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.12 2008/01/23 08:50:15 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.11 2008/01/13 20:39:27 freddy77 Exp $ diff --git b/configure.ac a/configure.ac index b8eef11..f4d877a 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.5 2008/01/23 08:50:16 freddy77 Exp $ +dnl $Id: configure.ac,v 1.29.2.4 2008/01/13 20:37:59 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -15,7 +15,7 @@ dnl ------------------------------------------------------------ AC_INIT(FreeTDS, 0.82RC2) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.5 $) +AC_REVISION($Revision: 1.29.2.4 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -142,9 +142,7 @@ 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/libwsock32.a; then + if test -r /usr/lib/w32api/libwsock32.a; then LIBS="-L/usr/lib/w32api -lwsock32" else LIBS="-lwsock32" @@ -383,7 +381,7 @@ TDS_NULL_IS_ZERO AC_CHECK_FUNCS([vsnprintf _vsnprintf gettimeofday \ nl_langinfo locale_charset setenv putenv \ getuid getpwuid getpwuid_r fstat alarm fork \ -gethrtime localtime_r setitimer]) +gethrtime localtime_r]) OLD_LIBS="$LIBS" LIBS="$LIBS $NETWORK_LIBS" AC_CHECK_FUNCS([inet_ntoa_r getipnodebyaddr getipnodebyname \ diff --git b/include/tds_sysdep_public.h.in a/include/tds_sysdep_public.h.in index 6e78da6..4ab78fb 100644 --- b/include/tds_sysdep_public.h.in +++ a/include/tds_sysdep_public.h.in @@ -20,7 +20,7 @@ #ifndef _tds_sysdep_public_h_ #define _tds_sysdep_public_h_ -/* $Id: tds_sysdep_public.h.in,v 1.11.2.1 2008/01/23 08:50:16 freddy77 Exp $ */ +/* $Id: tds_sysdep_public.h.in,v 1.11 2006/04/12 13:54:10 freddy77 Exp $ */ #ifdef __cplusplus extern "C" @@ -37,11 +37,7 @@ extern "C" #define tds_sysdep_int64_type __int64 /* 64-bit int */ #define tds_sysdep_real32_type float /* 32-bit real */ #define tds_sysdep_real64_type double /* 64-bit real */ -#if !defined(WIN64) && !defined(_WIN64) -#define tds_sysdep_intptr_type int /* 32-bit int */ -#else -#define tds_sysdep_intptr_type __int64 /* 64-bit int */ -#endif +#define tds_sysdep_intptr_type int /* 32-bit int */ #endif /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) */ #ifndef tds_sysdep_int16_type diff --git b/src/ctlib/unittests/cancel.c a/src/ctlib/unittests/cancel.c index c1767ec..09f3a1a 100644 --- b/src/ctlib/unittests/cancel.c +++ a/src/ctlib/unittests/cancel.c @@ -10,10 +10,10 @@ #include #include "common.h" -static char software_version[] = "$Id: cancel.c,v 1.11.2.1 2008/01/23 08:50:16 freddy77 Exp $"; +static char software_version[] = "$Id: cancel.c,v 1.11 2006/06/15 12:17:47 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; -#if defined(HAVE_ALARM) && defined(HAVE_SETITIMER) +#ifdef HAVE_ALARM /* protos */ int do_fetch(CS_COMMAND * cmd, int *cnt); diff --git b/src/dblib/unittests/timeout.c a/src/dblib/unittests/timeout.c index a3ef6f4..736f968 100644 --- b/src/dblib/unittests/timeout.c +++ a/src/dblib/unittests/timeout.c @@ -7,7 +7,7 @@ #include "common.h" #include -static char software_version[] = "$Id: timeout.c,v 1.3.2.1 2008/01/23 08:50:16 freddy77 Exp $"; +static char software_version[] = "$Id: timeout.c,v 1.3 2007/12/04 02:06:38 jklowden Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int ntimeouts = 0, ncancels = 0; @@ -29,7 +29,7 @@ timeout_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char return INT_CANCEL; if (dberr == SYBETIME) { - fprintf(stderr, "%d timeouts received in %ld seconds, ", ++ntimeouts, (long int) (time(NULL) - start_time)); + fprintf(stderr, "%d timeouts received in %ld seconds, ", ++ntimeouts, time(NULL) - start_time); if (ntimeouts > max_timeouts) { if (++ncancels > 1) { fprintf(stderr, "could not timeout cleanly, breaking connection\n"); @@ -73,14 +73,14 @@ timeout_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char int chkintr(DBPROCESS * dbproc) { - printf("in chkintr, %ld seconds elapsed\n", (long int) (time(NULL) - start_time)); + printf("in chkintr, %ld seconds elapsed\n", time(NULL) - start_time); return FALSE; } int hndlintr(DBPROCESS * dbproc) { - printf("in hndlintr, %ld seconds elapsed\n", (long int) (time(NULL) - start_time)); + printf("in hndlintr, %ld seconds elapsed\n", time(NULL) - start_time); return INT_CONTINUE; } diff --git b/win32/tds_sysdep_public.h a/win32/tds_sysdep_public.h index 9d7f815..048c409 100644 --- b/win32/tds_sysdep_public.h +++ a/win32/tds_sysdep_public.h @@ -20,7 +20,7 @@ #ifndef _tds_sysdep_public_h_ #define _tds_sysdep_public_h_ -static char rcsid_tds_sysdep_public_h[] = "$Id: tds_sysdep_public.h,v 1.5.6.1 2008/01/23 08:50:17 freddy77 Exp $"; +static char rcsid_tds_sysdep_public_h[] = "$Id: tds_sysdep_public.h,v 1.5 2004/02/03 19:28:12 jklowden Exp $"; static void *no_unused_tds_sysdep_public_h_warn[] = { rcsid_tds_sysdep_public_h, no_unused_tds_sysdep_public_h_warn }; #ifdef __cplusplus @@ -34,23 +34,12 @@ extern "C" #define tds_sysdep_int64_type __int64 /* 64-bit int */ #define tds_sysdep_real32_type float /* 32-bit real */ #define tds_sysdep_real64_type double /* 64-bit real */ -#if !defined(WIN64) && !defined(_WIN64) #define tds_sysdep_intptr_type int /* 32-bit int */ -#else -#define tds_sysdep_intptr_type __int64 /* 64-bit int */ -#endif typedef SOCKET TDS_SYS_SOCKET; #ifndef TDS_IS_SOCKET_INVALID #define TDS_IS_SOCKET_INVALID(s) ((s) == INVALID_SOCKET) #endif -#if !defined(MSDBLIB) && !defined(SYBDBLIB) -#define SYBDBLIB 1 -#endif -#if defined(MSDBLIB) && defined(SYBDBLIB) -#error MSDBLIB and SYBDBLIB cannot both be defined -#endif - #ifdef __cplusplus } #endif diff --git b/win32/winlogin.c a/win32/winlogin.c index 9e5969d..4a2c2aa 100644 --- b/win32/winlogin.c +++ a/win32/winlogin.c @@ -88,14 +88,6 @@ get_desktop_file(const char *file) 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 @@ -115,7 +107,7 @@ LoginDlgProc(HWND hDlg, UINT message, WPARAM wParam, /* */ case WM_INITDIALOG: /* lParam points to the TDSCONNECTION */ connection = (TDSCONNECTION *) lParam; - SetWindowUserData(hDlg, lParam); + SetWindowLong(hDlg, GWL_USERDATA, lParam); /* copy info from TDSCONNECTION to the dialog */ SendDlgItemMessage(hDlg, IDC_LOGINSERVER, WM_SETTEXT, 0, (LPARAM) tds_dstr_cstr(&connection->server_name)); @@ -130,7 +122,7 @@ LoginDlgProc(HWND hDlg, UINT message, WPARAM wParam, /* */ case WM_COMMAND: /* Dialog's user data points to TDSCONNECTION */ - connection = (TDSCONNECTION *) GetWindowUserData(hDlg); + connection = (TDSCONNECTION *) GetWindowLong(hDlg, GWL_USERDATA); /* The wParam indicates which button was pressed */ if (LOWORD(wParam) == IDCANCEL) { diff --git b/win32/winsetup.c a/win32/winsetup.c index e33dc76..20585f0 100644 --- b/win32/winsetup.c +++ a/win32/winsetup.c @@ -192,13 +192,6 @@ validate(DSNINFO * di) 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 @@ -223,7 +216,7 @@ DSNDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: /* lParam points to the DSNINFO */ di = (DSNINFO *) lParam; - SetWindowUserData(hDlg, lParam); + SetWindowLong(hDlg, GWL_USERDATA, lParam); /* Stuff legal protocol names into IDC_PROTOCOL */ for (i = 0; protocols[i]; i++) { @@ -243,7 +236,7 @@ DSNDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_COMMAND: /* Dialog's user data points to DSNINFO */ - di = (DSNINFO *) GetWindowUserData(hDlg); + di = (DSNINFO *) GetWindowLong(hDlg, GWL_USERDATA); /* The wParam indicates which button was pressed */ if (LOWORD(wParam) == IDCANCEL) { commit d9abbc45b533464c7d5305d8f36cbd2269d1ad73 Author: freddy77 Date: Sun Jan 13 20:39:27 2008 +0000 backported cancel error set diff --git b/ChangeLog a/ChangeLog index 5fda0d4..403a684 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Sun Jan 13 21:38:02 CET 2008 Frediano Ziglio - * src/odbc/odbc.c: backported cancel error set - Sun Jan 13 21:36:56 CET 2008 Frediano Ziglio * configure.ac: add missing tests for heavy loads backport @@ -54,4 +51,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.11 2008/01/13 20:39:27 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.10 2008/01/13 20:37:59 freddy77 Exp $ diff --git b/src/odbc/odbc.c a/src/odbc/odbc.c index c8dc89f..60c8e00 100644 --- b/src/odbc/odbc.c +++ a/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.3 2008/01/13 20:39:27 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.2 2008/01/10 13:13:46 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -3260,7 +3260,6 @@ odbc_process_tokens(TDS_STMT * stmt, unsigned flag) case TDS_NO_MORE_RESULTS: return TDS_CMD_DONE; case TDS_CANCELLED: - odbc_errs_add(&stmt->errs, "HY008", NULL); case TDS_FAIL: return TDS_CMD_FAIL; } @@ -4188,8 +4187,6 @@ SQLPrepare(SQLHSTMT hstmt, SQLCHAR FAR * szSqlStr, SQLINTEGER cbSqlStr) continue; case TDS_NO_MORE_RESULTS: break; - case TDS_CANCELLED: - odbc_errs_add(&stmt->errs, "HY008", NULL); default: stmt->errs.lastrc = SQL_ERROR; break; @@ -4591,7 +4588,7 @@ SQLGetData(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgb int readed = cbValueMax; /* FIXME test on destination char ??? */ - if (stmt->dbc->env->attr.output_nts != SQL_FALSE && fCType == SQL_C_CHAR && readed > 0) + if (stmt->dbc->env->attr.output_nts != SQL_FALSE && fCType == SQL_C_CHAR /* is_char_type(nSybType) */ && readed > 0) --readed; if (readed > *pcbValue) readed = *pcbValue; @@ -5686,9 +5683,6 @@ SQLGetTypeInfo(SQLHSTMT hstmt, SQLSMALLINT fSqlType) if (n >= varchar_pos && varchar_pos > 0) goto redo; break; - case TDS_CANCELLED: - odbc_errs_add(&stmt->errs, "HY008", NULL); - break; } if (!tds->current_results) break; commit ac9fc48b5f019af9b5bf4b41c8193acf821a1525 Author: freddy77 Date: Sun Jan 13 20:37:59 2008 +0000 Add missing tests diff --git b/ChangeLog a/ChangeLog index 403a684..9ce0774 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Sun Jan 13 21:36:56 CET 2008 Frediano Ziglio - * configure.ac: add missing tests for heavy loads backport - Sat Jan 12 1:21:09 CET 2008 Frediano Ziglio * src/odbc/unittests/blob1.c: small fix for 64bit * src/tds/net.c: fix for heavy loads @@ -51,4 +48,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.10 2008/01/13 20:37:59 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.9 2008/01/12 00:21:39 freddy77 Exp $ diff --git b/configure.ac a/configure.ac index f4d877a..d9bfaec 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.4 2008/01/13 20:37:59 freddy77 Exp $ +dnl $Id: configure.ac,v 1.29.2.3 2008/01/11 12:46:52 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -15,7 +15,7 @@ dnl ------------------------------------------------------------ AC_INIT(FreeTDS, 0.82RC2) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.4 $) +AC_REVISION($Revision: 1.29.2.3 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -217,8 +217,7 @@ AC_CHECK_MEMBERS([struct tm.__tm_zone],,,[#include #include <$ac_cv_struct_tm> ]) AC_CHECK_HEADERS([unistd.h errno.h wchar.h sys/time.h sys/types.h \ -sys/param.h sys/stat.h sys/wait.h limits.h locale.h odbcss.h readpassphrase.h \ -signal.h libgen.h poll.h]) +sys/param.h sys/stat.h sys/wait.h limits.h locale.h odbcss.h readpassphrase.h signal.h libgen.h]) if test $tds_mingw = no; then AC_CHECK_HEADERS([sys/socket.h arpa/inet.h netdb.h netinet/in.h \ netinet/tcp.h paths.h sys/ioctl.h langinfo.h]) @@ -385,7 +384,7 @@ gethrtime localtime_r]) OLD_LIBS="$LIBS" LIBS="$LIBS $NETWORK_LIBS" AC_CHECK_FUNCS([inet_ntoa_r getipnodebyaddr getipnodebyname \ -getaddrinfo getnameinfo inet_ntop gethostname poll]) +getaddrinfo getnameinfo inet_ntop gethostname]) LIBS="$OLD_LIBS" AC_REPLACE_FUNCS([asprintf vasprintf atoll strtok_r readpassphrase \ strlcpy strlcat basename]) commit 606c262bc5a4513a67789f3186207869c6ba2c6b Author: freddy77 Date: Sun Jan 13 20:36:05 2008 +0000 update version diff --git b/misc/freetds_autobuild a/misc/freetds_autobuild index a78d6f4..7217a27 100755 --- b/misc/freetds_autobuild +++ a/misc/freetds_autobuild @@ -9,7 +9,7 @@ export PATH="/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:$HOME GROUPDIR=/home/groups/f/fr/freetds/htdocs # directory to compile -FTDSDIR=freetds82 +FTDSDIR=freetds65 # output directory on server OUTDIR=out # additional flags for Autogen (current version) commit 09c5cdaf1cc430a40dd58b9915f769953e92cdbf Author: freddy77 Date: Sat Jan 12 00:21:39 2008 +0000 fix for heavy load on server diff --git b/ChangeLog a/ChangeLog index 9ce0774..5cd7d29 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,7 +1,3 @@ -Sat Jan 12 1:21:09 CET 2008 Frediano Ziglio - * src/odbc/unittests/blob1.c: small fix for 64bit - * src/tds/net.c: fix for heavy loads - Fri Jan 11 13:46:32 CET 2008 Frediano Ziglio * configure.ac src/apps/tsql.c: backport fix for MacOSX @@ -48,4 +44,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.9 2008/01/12 00:21:39 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.8 2008/01/11 12:46:52 freddy77 Exp $ diff --git b/src/odbc/unittests/blob1.c a/src/odbc/unittests/blob1.c index e5d0344..0ac14c0 100755 --- b/src/odbc/unittests/blob1.c +++ a/src/odbc/unittests/blob1.c @@ -3,7 +3,7 @@ #include "common.h" -static char software_version[] = "$Id: blob1.c,v 1.1.2.5 2008/01/12 00:21:39 freddy77 Exp $"; +static char software_version[] = "$Id: blob1.c,v 1.1.2.4 2008/01/11 12:44:39 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -101,11 +101,11 @@ main(int argc, char **argv) int i; int key; - SQLLEN vind0; + SQLINTEGER vind0; char buf1[NBYTES]; - SQLLEN vind1; + SQLINTEGER vind1; char buf2[NBYTES]; - SQLLEN vind2; + SQLINTEGER vind2; int cnt = 2; use_odbc_version3 = 1; diff --git b/src/tds/net.c a/src/tds/net.c index 62c0705..c551127 100644 --- b/src/tds/net.c +++ a/src/tds/net.c @@ -82,10 +82,6 @@ #include #endif /* HAVE_SELECT_H */ -#if HAVE_POLL_H -#include -#endif /* HAVE_POLL_H */ - #include "tds.h" #include "tdsstring.h" #include "replacements.h" @@ -103,23 +99,9 @@ #include #endif -TDS_RCSID(var, "$Id: net.c,v 1.71.2.1 2008/01/12 00:21:39 freddy77 Exp $"); +TDS_RCSID(var, "$Id: net.c,v 1.71 2007/12/12 06:27:38 freddy77 Exp $"); -#undef USE_POLL -#if defined(HAVE_POLL_H) && defined(HAVE_POLL) -# define USE_POLL 1 -# define TDSSELREAD POLLIN -# define TDSSELWRITE POLLOUT -/* error is always returned */ -# define TDSSELERR 0 -#else -# define USE_POLL 0 -# define TDSSELREAD 1 -# define TDSSELWRITE 2 -# define TDSSELERR 4 -#endif - -static int tds_select(TDSSOCKET * tds, unsigned tds_sel, int timeout_seconds); +static int tds_select(TDSSOCKET * tds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, int timeout_seconds); /** @@ -261,6 +243,8 @@ tds_open_socket(TDSSOCKET * tds, const char *ip_addr, unsigned int port, int tim if (retval == 0) { tdsdump_log(TDS_DBG_INFO2, "connection established\n"); } else { + fd_set fds; + tdsdump_log(TDS_DBG_ERROR, "tds_open_socket: connect(2) returned \"%s\"\n", strerror(sock_errno)); #if DEBUGGING_CONNECTING_PROBLEM if (sock_errno != ECONNREFUSED && sock_errno != ENETUNREACH && sock_errno != EINPROGRESS) { @@ -280,7 +264,8 @@ tds_open_socket(TDSSOCKET * tds, const char *ip_addr, unsigned int port, int tim if (sock_errno != TDSSOCK_EINPROGRESS) goto not_available; - if (tds_select(tds, TDSSELWRITE|TDSSELERR, timeout) <= 0) { + FD_ZERO(&fds); + if (tds_select(tds, NULL, &fds, &fds, timeout) <= 0) { tds_error = TDSESOCK; goto not_available; } @@ -335,39 +320,13 @@ tds_close_socket(TDSSOCKET * tds) * This function does not call tdserror or close the socket because it can't know the context in which it's being called. */ static int -tds_select(TDSSOCKET * tds, unsigned tds_sel, int timeout_seconds) +tds_select(TDSSOCKET * tds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, int timeout_seconds) { int rc, seconds; unsigned int poll_seconds; -#if !USE_POLL - fd_set fds[3]; - fd_set *readfds = NULL, *writefds = NULL, *exceptfds = NULL; -#endif assert(tds != NULL); assert(timeout_seconds >= 0); - -#if !USE_POLL -#if !defined(WIN32) && defined(FD_SETSIZE) - if (tds->s >= FD_SETSIZE) { - sock_errno = EINVAL; - return -1; - } -#endif - if ((tds_sel & TDSSELREAD) != 0) { - FD_ZERO(&fds[0]); - readfds = &fds[0]; - } - if ((tds_sel & TDSSELWRITE) != 0) { - FD_ZERO(&fds[1]); - writefds = &fds[1]; - } - if ((tds_sel & TDSSELERR) != 0) { - FD_ZERO(&fds[2]); - exceptfds = &fds[2]; - } -#endif - /* * The select loop. * If an interrupt handler is installed, we iterate once per second, @@ -385,16 +344,8 @@ tds_select(TDSSOCKET * tds, unsigned tds_sel, int timeout_seconds) */ poll_seconds = (tds->tds_ctx && tds->tds_ctx->int_handler)? 1 : timeout_seconds; for (seconds = timeout_seconds; timeout_seconds == 0 || seconds > 0; seconds -= poll_seconds) { -#if USE_POLL - struct pollfd fd; - int timeout = poll_seconds ? poll_seconds * 1000 : -1; - - fd.fd = tds->s; - fd.events = tds_sel; - fd.revents = 0; - rc = poll(&fd, 1, timeout); -#else struct timeval tv, *ptv = poll_seconds? &tv : NULL; + tv.tv_sec = poll_seconds; tv.tv_usec = 0; @@ -406,7 +357,6 @@ tds_select(TDSSOCKET * tds, unsigned tds_sel, int timeout_seconds) FD_SET(tds->s, exceptfds); rc = select(tds->s + 1, readfds, writefds, exceptfds, ptv); -#endif if (rc > 0 ) { return rc; @@ -471,6 +421,7 @@ static int tds_goodread(TDSSOCKET * tds, unsigned char *buf, int buflen, unsigned char unfinished) { int rc, got = 0; + fd_set rfds; if (buf == NULL || buflen < 1 || tds == NULL) return 0; @@ -481,19 +432,23 @@ tds_goodread(TDSSOCKET * tds, unsigned char *buf, int buflen, unsigned char unfi if (IS_TDSDEAD(tds)) return -1; - if ((len = tds_select(tds, TDSSELREAD, tds->query_timeout)) > 0) { + FD_ZERO(&rfds); + if ((len = tds_select(tds, &rfds, NULL, NULL, tds->query_timeout)) > 0) { + len = 0; + if (FD_ISSET(tds->s, &rfds)) { #ifndef MSG_NOSIGNAL - len = READSOCKET(tds->s, buf + got, buflen); + len = READSOCKET(tds->s, buf + got, buflen); #else - len = recv(tds->s, buf + got, buflen, MSG_NOSIGNAL); + len = recv(tds->s, buf + got, buflen, MSG_NOSIGNAL); #endif - if (len < 0 && sock_errno == EAGAIN) - continue; - /* detect connection close */ - if (len <= 0) { - tdserror(tds->tds_ctx, tds, len == 0 ? TDSESEOF : TDSEREAD, sock_errno); - tds_close_socket(tds); - return -1; + if (len < 0 && sock_errno == EAGAIN) + continue; + /* detect connection close */ + if (len <= 0) { + tdserror(tds->tds_ctx, tds, len == 0 ? TDSESEOF : TDSEREAD, sock_errno); + tds_close_socket(tds); + return -1; + } } } else if (len < 0) { if (sock_errno == EAGAIN) /* shouldn't happen, but OK */ @@ -685,30 +640,35 @@ tds_goodwrite(TDSSOCKET * tds, const unsigned char *p, int len, unsigned char la { int remaining = len; int nput, rc, err=0; + fd_set fds; /* Fix of SIGSEGV when FD_SET() called with negative fd (Sergey A. Cherukhin, 23/09/2005) */ if (TDS_IS_SOCKET_INVALID(tds->s)) return -1; while (remaining > 0) { - if ((rc = tds_select(tds, TDSSELWRITE, tds->query_timeout)) > 0) { + FD_ZERO(&fds); + if ((rc = tds_select(tds, NULL, &fds, NULL, tds->query_timeout)) > 0) { + nput = 0; + if (FD_ISSET(tds->s, &fds)) { #ifdef USE_MSGMORE - nput = send(tds->s, p, remaining, last ? MSG_NOSIGNAL : MSG_NOSIGNAL|MSG_MORE); - /* In case the kernel does not support MSG_MORE, try again without it */ - if (nput < 0 && errno == EINVAL && !last) - nput = send(tds->s, p, remaining, MSG_NOSIGNAL); + nput = send(tds->s, p, remaining, last ? MSG_NOSIGNAL : MSG_NOSIGNAL|MSG_MORE); + /* In case the kernel does not support MSG_MORE, try again without it */ + if (nput < 0 && errno == EINVAL && !last) + nput = send(tds->s, p, remaining, MSG_NOSIGNAL); #elif !defined(MSG_NOSIGNAL) - nput = WRITESOCKET(tds->s, p, remaining); + nput = WRITESOCKET(tds->s, p, remaining); #else - nput = send(tds->s, p, remaining, MSG_NOSIGNAL); + nput = send(tds->s, p, remaining, MSG_NOSIGNAL); #endif - if (nput < 0 && sock_errno == EAGAIN) - continue; - /* detect connection close */ - if (nput <= 0) { - tdserror(tds->tds_ctx, tds, nput == 0 ? TDSESEOF : TDSEWRIT, sock_errno); - tds_close_socket(tds); - return -1; + if (nput < 0 && sock_errno == EAGAIN) + continue; + /* detect connection close */ + if (nput <= 0) { + tdserror(tds->tds_ctx, tds, nput == 0 ? TDSESEOF : TDSEWRIT, sock_errno); + tds_close_socket(tds); + return -1; + } } } else if (rc < 0) { if (sock_errno == EAGAIN) /* shouldn't happen, but OK, retry */ @@ -821,12 +781,8 @@ tds7_get_instance_port(const char *ip_addr, const char *instance) int num_try; struct sockaddr_in sin; ioctl_nonblocking_t ioctl_nonblocking; -#if USE_POLL - struct pollfd fd; -#else struct timeval selecttimeout; fd_set fds; -#endif int retval; TDS_SYS_SOCKET s; char msg[1024]; @@ -850,15 +806,6 @@ tds7_get_instance_port(const char *ip_addr, const char *instance) return 0; } -#if !USE_POLL -#if !defined(WIN32) && defined(FD_SETSIZE) - if (s >= FD_SETSIZE) { - sock_errno = EINVAL; - return 0; - } -#endif -#endif - /* * on cluster environment is possible that reply packet came from * different IP so do not filter by ip with connect @@ -881,20 +828,12 @@ tds7_get_instance_port(const char *ip_addr, const char *instance) tds_strlcpy(msg + 1, instance, sizeof(msg) - 1); sendto(s, msg, strlen(msg) + 1, 0, (struct sockaddr *) &sin, sizeof(sin)); -#if USE_POLL - fd.fd = s; - fd.events = POLLIN; - fd.revents = 0; - - retval = poll(&fd, 1, 1000); -#else FD_ZERO(&fds); FD_SET(s, &fds); selecttimeout.tv_sec = 1; selecttimeout.tv_usec = 0; retval = select(s + 1, &fds, NULL, NULL, &selecttimeout); -#endif /* on interrupt ignore */ if (retval < 0 && sock_errno == TDSSOCK_EINTR) commit 385bf5239dbd89559c437b8a7252ee88ba9b4a5f Author: freddy77 Date: Fri Jan 11 12:46:52 2008 +0000 backport fix for MacOSX diff --git b/ChangeLog a/ChangeLog index 5cd7d29..851bd0f 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Fri Jan 11 13:46:32 CET 2008 Frediano Ziglio - * configure.ac src/apps/tsql.c: backport fix for MacOSX - Fri Jan 11 13:43:08 CET 2008 Frediano Ziglio * src/odbc/unittests/blob1.c: backport fix for Sybase @@ -44,4 +41,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.8 2008/01/11 12:46:52 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.7 2008/01/11 12:44:39 freddy77 Exp $ diff --git b/configure.ac a/configure.ac index d9bfaec..1b9cc43 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.3 2008/01/11 12:46:52 freddy77 Exp $ +dnl $Id: configure.ac,v 1.29.2.2 2008/01/11 06:48:38 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -15,7 +15,7 @@ dnl ------------------------------------------------------------ AC_INIT(FreeTDS, 0.82RC2) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.3 $) +AC_REVISION($Revision: 1.29.2.2 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -178,24 +178,7 @@ if test $tds_mingw = no; then 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" LIBS="$OLDLIBS" AC_SUBST(READLINE_LIBS) diff --git b/src/apps/tsql.c a/src/apps/tsql.c index 2081212..6a04027 100644 --- b/src/apps/tsql.c +++ a/src/apps/tsql.c @@ -85,7 +85,7 @@ #include "tdsconvert.h" #include "replacements.h" -TDS_RCSID(var, "$Id: tsql.c,v 1.112.2.1 2008/01/11 12:46:52 freddy77 Exp $"); +TDS_RCSID(var, "$Id: tsql.c,v 1.112 2007/12/23 21:12:02 jklowden Exp $"); enum { @@ -683,7 +683,7 @@ main(int argc, char **argv) mybuf[0] = '\0'; buflen = 0; -#if defined(HAVE_READLINE) && HAVE_RL_INHIBIT_COMPLETION +#ifdef HAVE_READLINE rl_inhibit_completion = 1; #endif commit 9c10c557cb4e0955466b37dd61879563ef447c99 Author: freddy77 Date: Fri Jan 11 12:44:39 2008 +0000 backported fix for Sybase diff --git b/ChangeLog a/ChangeLog index 851bd0f..c9b46cc 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Fri Jan 11 13:43:08 CET 2008 Frediano Ziglio - * src/odbc/unittests/blob1.c: backport fix for Sybase - Fri Jan 11 9:32:44 CET 2008 Frediano Ziglio * src/odbc/unittests/blob1.c src/odbc/unittests/cursor3.c: * src/odbc/unittests/cursor4.c src/odbc/unittests/cursor5.c: @@ -41,4 +38,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.7 2008/01/11 12:44:39 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.6 2008/01/11 08:33:18 freddy77 Exp $ diff --git b/src/odbc/unittests/blob1.c a/src/odbc/unittests/blob1.c index 0ac14c0..dfa8319 100755 --- b/src/odbc/unittests/blob1.c +++ a/src/odbc/unittests/blob1.c @@ -3,7 +3,7 @@ #include "common.h" -static char software_version[] = "$Id: blob1.c,v 1.1.2.4 2008/01/11 12:44:39 freddy77 Exp $"; +static char software_version[] = "$Id: blob1.c,v 1.1.2.3 2008/01/11 08:33:18 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -167,7 +167,7 @@ main(int argc, char **argv) } - /* Now fetch rows ... */ + /* No fetch rows ... */ for (i = 0; i < cnt; i++) { @@ -175,12 +175,10 @@ main(int argc, char **argv) rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt); CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle StmtH"); - if (db_is_microsoft()) { - rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); - rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); - } + rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); + rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "SELECT t, b, v FROM #tt WHERE k = ?", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPrepare"); commit f42f2399b3c5dd1e67f36dda7702be5b81310ca8 Author: freddy77 Date: Fri Jan 11 08:33:18 2008 +0000 merged changes for tests diff --git b/ChangeLog a/ChangeLog index c9b46cc..30783d8 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,9 +1,3 @@ -Fri Jan 11 9:32:44 CET 2008 Frediano Ziglio - * src/odbc/unittests/blob1.c src/odbc/unittests/cursor3.c: - * src/odbc/unittests/cursor4.c src/odbc/unittests/cursor5.c: - * src/odbc/unittests/hidden.c: - - merged changes for tests - Fri Jan 11 7:48:23 CET 2008 Frediano Ziglio * configure.ac: avoid clash @@ -38,4 +32,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.6 2008/01/11 08:33:18 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.5 2008/01/11 06:48:37 freddy77 Exp $ diff --git b/src/odbc/unittests/blob1.c a/src/odbc/unittests/blob1.c index dfa8319..b8c45b0 100755 --- b/src/odbc/unittests/blob1.c +++ a/src/odbc/unittests/blob1.c @@ -3,7 +3,7 @@ #include "common.h" -static char software_version[] = "$Id: blob1.c,v 1.1.2.3 2008/01/11 08:33:18 freddy77 Exp $"; +static char software_version[] = "$Id: blob1.c,v 1.1.2.2 2008/01/10 13:13:46 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -111,7 +111,8 @@ main(int argc, char **argv) use_odbc_version3 = 1; Connect(); - Command(Statement, "CREATE TABLE #tt ( k INT, t TEXT, b IMAGE, v INT )"); + Command(Statement, "IF OBJECT_ID('tt') IS NOT NULL DROP TABLE tt"); + Command(Statement, "CREATE TABLE tt ( k INT, t TEXT, b IMAGE, v INT )"); /* Insert rows ... */ @@ -121,7 +122,7 @@ main(int argc, char **argv) rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt); CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle StmtH"); - rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "INSERT INTO #tt VALUES ( ?, ?, ?, ? )", SQL_NTS); + rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "insert into tt values ( ?, ?, ?, ? )", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPrepare"); SQLBindParameter(m_hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &key, 0, &vind0); @@ -180,7 +181,7 @@ main(int argc, char **argv) rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); - rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "SELECT t, b, v FROM #tt WHERE k = ?", SQL_NTS); + rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "SELECT t, b, v FROM tt WHERE k = ?", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPrepare"); SQLBindParameter(m_hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &i, 0, &vind0); diff --git b/src/odbc/unittests/cursor3.c a/src/odbc/unittests/cursor3.c index 18c2f1d..791783a 100644 --- b/src/odbc/unittests/cursor3.c +++ a/src/odbc/unittests/cursor3.c @@ -1,7 +1,7 @@ /* Tests 2 active statements */ #include "common.h" -static char software_version[] = "$Id: cursor3.c,v 1.3.2.1 2008/01/11 08:33:18 freddy77 Exp $"; +static char software_version[] = "$Id: cursor3.c,v 1.3 2007/12/21 10:39:10 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static SQLHDBC m_hdbc; @@ -69,11 +69,12 @@ main(int argc, char **argv) m_hdbc = Connection; - exec_direct(1, "CREATE TABLE #t1 ( k INT, c VARCHAR(20))"); - exec_direct(1, "INSERT INTO #t1 VALUES (1, 'aaa')"); - exec_direct(1, "INSERT INTO #t1 VALUES (2, 'bbbbb')"); - exec_direct(1, "INSERT INTO #t1 VALUES (3, 'ccccccccc')"); - exec_direct(1, "INSERT INTO #t1 VALUES (4, 'dd')"); + exec_direct(0, "DROP TABLE t1"); + exec_direct(1, "CREATE TABLE t1 ( k INT, c VARCHAR(20))"); + exec_direct(1, "INSERT INTO t1 VALUES (1, 'aaa')"); + exec_direct(1, "INSERT INTO t1 VALUES (2, 'bbbbb')"); + exec_direct(1, "INSERT INTO t1 VALUES (3, 'ccccccccc')"); + exec_direct(1, "INSERT INTO t1 VALUES (4, 'dd')"); m_hstmt1 = NULL; rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt1); @@ -113,10 +114,10 @@ main(int argc, char **argv) rcode = SQLSetCursorName(m_hstmt2, (SQLCHAR *) "c2", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SetCursorName c2"); - rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM #t1", SQL_NTS); + rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM t1", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "Prepare 1"); - rcode = SQLPrepare(m_hstmt2, (SQLCHAR *) "SELECT * FROM #t1", SQL_NTS); + rcode = SQLPrepare(m_hstmt2, (SQLCHAR *) "SELECT * FROM t1", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "Prepare 2"); rcode = SQLExecute(m_hstmt1); @@ -151,6 +152,8 @@ main(int argc, char **argv) rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt2); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SQLFreeHandle 2"); + exec_direct(1, "DROP TABLE t1"); + Disconnect(); return 0; diff --git b/src/odbc/unittests/cursor4.c a/src/odbc/unittests/cursor4.c index 58c249d..b352644 100755 --- b/src/odbc/unittests/cursor4.c +++ a/src/odbc/unittests/cursor4.c @@ -5,7 +5,7 @@ #include "common.h" -static char software_version[] = "$Id: cursor4.c,v 1.3.2.1 2008/01/11 08:33:18 freddy77 Exp $"; +static char software_version[] = "$Id: cursor4.c,v 1.3 2007/12/21 10:39:10 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static SQLHDBC m_hdbc; @@ -72,8 +72,9 @@ main(int argc, char **argv) m_hdbc = Connection; - exec_direct(1, "CREATE TABLE #t1 ( k INT, c VARCHAR(20))"); - exec_direct(1, "INSERT INTO #t1 VALUES (1, 'aaa')"); + exec_direct(0, "DROP TABLE t1"); + exec_direct(1, "CREATE TABLE t1 ( k INT, c VARCHAR(20))"); + exec_direct(1, "INSERT INTO t1 VALUES (1, 'aaa')"); m_hstmt1 = NULL; rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt1); @@ -85,7 +86,7 @@ main(int argc, char **argv) rcode = SQLSetCursorName(m_hstmt1, (SQLCHAR *) "c112", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SetCursorName c112"); - rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM #t1 FOR UPDATE", SQL_NTS); + rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM t1 FOR UPDATE", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "Prepare 2"); exec_direct(1, "BEGIN TRANSACTION"); @@ -96,14 +97,14 @@ main(int argc, char **argv) rcode = SQLFetch(m_hstmt1); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLFetch 1"); - exec_direct(1, "UPDATE #t1 SET c = 'xxx' WHERE CURRENT OF c112"); + exec_direct(1, "UPDATE t1 SET c = 'xxx' WHERE CURRENT OF c112"); rcode = SQLCloseCursor(m_hstmt1); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLCloseCursor 2"); exec_direct(1, "COMMIT TRANSACTION"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "SELECT c FROM #t1 WHERE k = 1", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "SELECT c FROM t1 WHERE k = 1", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 2"); rcode = SQLFetch(m_hstmt1); @@ -117,6 +118,8 @@ main(int argc, char **argv) rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt1); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLFreeHandle 1"); + exec_direct(1, "DROP TABLE t1"); + Disconnect(); return 0; diff --git b/src/odbc/unittests/cursor5.c a/src/odbc/unittests/cursor5.c index 5e73dc6..c7be7e4 100755 --- b/src/odbc/unittests/cursor5.c +++ a/src/odbc/unittests/cursor5.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: cursor5.c,v 1.2.2.1 2008/01/11 08:33:18 freddy77 Exp $"; +static char software_version[] = "$Id: cursor5.c,v 1.2 2007/12/21 10:39:10 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -76,14 +76,15 @@ main(int argc, char **argv) rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt2); CHECK_RCODE(SQL_HANDLE_DBC, m_hdbc, "SQLAllocHandle StmtH 2"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "create table #mytab1 (k int, c char(30))", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "drop table mytab1", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "create table mytab1 (k int, c char(30))", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.1"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into #mytab1 values (1,'aaa')", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into mytab1 values (1,'aaa')", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.2"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into #mytab1 values (2,'bbb')", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into mytab1 values (2,'bbb')", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.3"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into #mytab1 values (3,'ccc')", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into mytab1 values (3,'ccc')", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.4"); /* @@ -94,7 +95,7 @@ main(int argc, char **argv) rcode = SQLSetStmtAttr(m_hstmt2, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, SQL_IS_UINTEGER); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SQLSetStmtAttr 1"); - rcode = SQLPrepare(m_hstmt2, (SQLCHAR *) "select k, c from #mytab1 order by k", SQL_NTS); + rcode = SQLPrepare(m_hstmt2, (SQLCHAR *) "select k, c from mytab1 order by k", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SQLPrepare 3"); rcode = SQLBindCol(m_hstmt2, 1, SQL_C_LONG, &v_int_3, 0, &v_ind_3_1); @@ -125,6 +126,9 @@ main(int argc, char **argv) rcode = SQLCloseCursor(m_hstmt2); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SQLCloseCursor StmtH 2"); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "drop table mytab1", SQL_NTS); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.3"); + rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt1); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLFreeHandle StmtH 1"); diff --git b/src/odbc/unittests/hidden.c a/src/odbc/unittests/hidden.c index ad75433..66be442 100755 --- b/src/odbc/unittests/hidden.c +++ a/src/odbc/unittests/hidden.c @@ -3,7 +3,7 @@ #include "common.h" -static char software_version[] = "$Id: hidden.c,v 1.1.2.2 2008/01/11 08:33:18 freddy77 Exp $"; +static char software_version[] = "$Id: hidden.c,v 1.1.2.1 2008/01/10 08:52:46 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -70,7 +70,6 @@ main(int argc, char **argv) /* test hidden column with cursors*/ CheckCursor(); - m_hstmt1 = Statement; rcode = SQLSetStmtAttr(m_hstmt1, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); commit 4e976741808d4e336d864d45da07626ae502ce69 Author: freddy77 Date: Fri Jan 11 06:48:37 2008 +0000 avoid version clash diff --git b/ChangeLog a/ChangeLog index 30783d8..fbe59e4 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Fri Jan 11 7:48:23 CET 2008 Frediano Ziglio - * configure.ac: avoid clash - Thu Jan 10 15:55:32 EST 2008 JK Lowden * INSTALL.CVS NEWS README TODO ChangeLog-0.82 * ChangeLog doc/userguide.sgml documentation updates @@ -32,4 +29,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2454.2.5 2008/01/11 06:48:37 freddy77 Exp $ +$Id: ChangeLog,v 1.2454.2.4 2008/01/10 20:58:42 jklowden Exp $ diff --git b/configure.ac a/configure.ac index 1b9cc43..d2d0fed 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.2 2008/01/11 06:48:38 freddy77 Exp $ +dnl $Id: configure.ac,v 1.29.2.1 2008/01/09 06:50:55 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -12,10 +12,10 @@ dnl ------------------------------------------------------------ # ------------------------------------------------------------ # Initialization # ------------------------------------------------------------ -AC_INIT(FreeTDS, 0.82RC2) +AC_INIT(FreeTDS, 0.82RC1) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.2 $) +AC_REVISION($Revision: 1.29.2.1 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) commit ea5b7edd6dbc01f152e91e23bf80070355bfe0dc Author: jklowden Date: Thu Jan 10 20:58:42 2008 +0000 documentation updates diff --git b/ChangeLog a/ChangeLog index fbe59e4..d054e6f 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,32 +1,49 @@ -Thu Jan 10 15:55:32 EST 2008 JK Lowden - * INSTALL.CVS NEWS README TODO ChangeLog-0.82 - * ChangeLog doc/userguide.sgml documentation updates - -Thu Jan 10 17:04:15 CET 2008 Frediano Ziglio - * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: - * src/odbc/unittests/cancel.c(added): - - add test for SQLCancel - -Thu Jan 10 16:28:44 CET 2008 Frediano Ziglio - * src/odbc/unittests/blob1.c src/odbc/unittests/cursor3.c: - * src/odbc/unittests/cursor4.c src/odbc/unittests/cursor5.c: - - use temporary tables - -Thu Jan 10 16:25:19 CET 2008 Frediano Ziglio - * doc/README.releasing misc/freetds_autobuild: updates - -Thu Jan 10 14:10:28 CET 2008 Frediano Ziglio +Thu Jan 10 14:12:32 CET 2008 Frediano Ziglio * src/odbc/odbc.c src/odbc/unittests/.cvsignore: * src/odbc/unittests/Makefile.am src/odbc/unittests/blob1.c(added): - fix problem with SQLGetData and blobs -Thu Jan 10 09:46:41 CET 2008 Frediano Ziglio +Thu Jan 10 09:51:23 CET 2008 Frediano Ziglio * TODO src/odbc/odbc.c src/odbc/unittests/.cvsignore: * src/odbc/unittests/Makefile.am: - small fix for hidden fields (ignore them entirely) -Wed Jan 9 19:54:43 EST 2008 JK Lowden - * ChangeLog truncated because of release - * ChangeLog-0.82 added because of release - -$Id: ChangeLog,v 1.2454.2.4 2008/01/10 20:58:42 jklowden Exp $ +Wed Jan 9 7:50:39 CET 2008 Frediano Ziglio + * configure.ac: preparing 0.82 + +Tue Jan 8 10:31:43 EST 2008 JK Lowden + * doc/Makefile.am added freetds.conf.5 + * src/dblib/bcp.c applied BCPKEEPIDENTIY patch from [email] + +Tue Jan 8 14:28:09 CET 2008 Frediano Ziglio + * NEWS doc/README.releasing doc/userguide.sgml: + - updates for new release + +Tue Jan 8 10:33:26 CET 2008 Frediano Ziglio + * src/odbc/unittests/genparams.c: relax for no-dm + +Mon Jan 7 19:32:20 CET 2008 Frediano Ziglio + * src/odbc/sql2tds.c src/odbc/unittests/genparams.c: + - fix millisecond round off for TIMESTAMP + - improve genparams test to catch this problem + - make genparams works with MS ODBC + +Mon Jan 7 15:04:18 CET 2008 Frediano Ziglio + * include/tdssrv.h src/server/login.c src/server/server.c: + * src/server/unittest.c: + - small improves + * src/pool/user.c: style update + +Sun Jan 6 11:48:17 CET 2008 Frediano Ziglio + * src/odbc/odbc.c: even SQLExecDirect support parameters! + * src/odbc/unittests/genparams.c: improve + +Sat Jan 5 12:23:21 CET 2008 Frediano Ziglio + * src/tds/query.c: + - add parameterized flag calling sp_cursoropen if needed + +Wed Jan 2 00:08:45 CET 2008 Frediano Ziglio + * configure.ac src/apps/Makefile.am: + - remove GNU style + * src/dblib/dblib.c: make it compile + diff --git b/ChangeLog-0.82 a/ChangeLog-0.82 deleted file mode 100644 index cc4cbea..0000000 --- b/ChangeLog-0.82 +++ /dev/null @@ -1,2289 +0,0 @@ -Tue Jan 8 10:31:43 EST 2008 JK Lowden - * doc/Makefile.am added freetds.conf.5 - * src/dblib/bcp.c applied BCPKEEPIDENTIY patch - - from Jonathan Olson - -Tue Jan 8 14:28:09 CET 2008 Frediano Ziglio - * NEWS doc/README.releasing doc/userguide.sgml: - - updates for new release - -Tue Jan 8 10:33:26 CET 2008 Frediano Ziglio - * src/odbc/unittests/genparams.c: relax for no-dm - -Mon Jan 7 19:32:20 CET 2008 Frediano Ziglio - * src/odbc/sql2tds.c src/odbc/unittests/genparams.c: - - fix millisecond round off for TIMESTAMP - - improve genparams test to catch this problem - - make genparams works with MS ODBC - -Mon Jan 7 15:04:18 CET 2008 Frediano Ziglio - * include/tdssrv.h src/server/login.c src/server/server.c: - * src/server/unittest.c: - - small improves - * src/pool/user.c: style update - -Sun Jan 6 11:48:17 CET 2008 Frediano Ziglio - * src/odbc/odbc.c: even SQLExecDirect support parameters! - * src/odbc/unittests/genparams.c: improve - -Sat Jan 5 12:23:21 CET 2008 Frediano Ziglio - * src/tds/query.c: - - add parameterized flag calling sp_cursoropen if needed - -Wed Jan 2 00:08:45 CET 2008 Frediano Ziglio - * configure.ac src/apps/Makefile.am: - - remove GNU style - * src/dblib/dblib.c: make it compile - - -Mon Dec 31 15:05:16 EST 2007 JK Lowden - * src/dblib/dblib.c fixed DBPRPAD, maybe - -Mon Dec 31 11:29:50 CET 2007 Frediano Ziglio - * misc/test-other.sh src/odbc/odbc.c: - - relax test for cursor - -Mon Dec 31 11:06:13 CET 2007 Frediano Ziglio - * src/ctlib/blk.c src/odbc/unittests/attributes.c: - * src/odbc/unittests/describecol.c src/tds/convert.c: - * src/tds/login.c src/tds/mem.c: - - minor signed/unsigned fixes - * src/dblib/bcp.c: minor performance improve - * src/dblib/dblib.c: fix date portability - -Fri Dec 28 17:57:08 EST 2007 JK Lowden - * src/tds/token.c minor change - * src/tds/convert.c simpler tds_strftime - * src/dblib/unittests/done_handling.c no spurious messages - -Wed Dec 28 15:11:48 CET 2007 Frediano Ziglio - * doc/userguide.sgml: accepted patch #1854381 - -Wed Dec 28 14:44:16 CET 2007 Frediano Ziglio - * misc/freetds_autobuild misc/test-other.sh: - - make amd64 works - * misc/test-auto.sh: add --help option - * src/tds/convert.c: - - fix overflow in tds_convert_char - - minor fixes for tds_strftime - -Thu Dec 27 14:43:14 CET 2007 Frediano Ziglio - * doc/.cvsignore: ignore autogenerated - * include/tds.h src/replacements/vasprintf.c src/tds/convert.c: - * src/tds/login.c src/tds/query.c src/tds/read.c: - - remove some warnings - -Thu Dec 27 11:20:55 CET 2007 Frediano Ziglio - * src/odbc/unittests/common.c: make unixODBC happy - * win32/config.h: define TDS_I64_FORMAT - -Thu Dec 27 10:19:58 CET 2007 Frediano Ziglio - * src/dblib/buffering.h: - - remove warning if compiled with NDEBUG defined - -Wed Dec 26 21:57:12 CET 2007 Frediano Ziglio - * src/odbc/unittests/attributes.c: make it works - -Wed Dec 26 19:44:47 CET 2007 Frediano Ziglio - * doc/freetds.conf.5: typo fix - * src/ctlib/unittests/common.c: make tests compile - * src/odbc/odbc.c: add diagnostic for truncate - -Tue Dec 25 00:55:02 EST 2007 JK Lowden - * freetds.conf doc/Makefile.am doc/freetds.conf.5 (added) - - shortened default freetds.conf and moved documentation - - to a proper man page. Merry Christmas! - -Mon Dec 24 11:34:58 CET 2007 Frediano Ziglio - * include/tds.h: removed unused fields - -Sun Dec 23 16:08:29 EST 2007 JK Lowden - * src/apps/tsql.c - * src/ctlib/cs.c src/ctlib/unittests/common.c - * src/dblib/dblib.c - * src/tds/config.c src/tds/unittests/convert.c - - added STD_DATETIME_FMT to allow for WIN32 shortcomings - -Fri Dec 21 16:20:03 CET 2007 Frediano Ziglio - * include/tds.h src/ctlib/ct.c src/odbc/odbc.c src/tds/query.c: - - make odbc cursor test work using sp_cursoropen with parameters - -Fri Dec 21 11:38:47 CET 2007 Frediano Ziglio - * src/odbc/unittests/common.c src/odbc/unittests/common.h: - * src/odbc/unittests/cursor3.c src/odbc/unittests/cursor4.c: - * src/odbc/unittests/cursor5.c: - - cursor tests should work - -Fri Dec 21 10:05:12 CET 2007 Frediano Ziglio - * configure.ac include/replacements.h src/replacements/vasprintf.c: - * win32/config.h: - - applied modified patch #1848920 - -Thu Dec 20 22:56:34 CET 2007 Frediano Ziglio - * src/dblib/dblib.c src/dblib/unittests/common.h: - * src/dblib/unittests/setnull.c src/dblib/unittests/thread.c: - - remove warnings - -Thu Dec 20 17:46:03 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: - - improve cursor attribute setting - - fix a small issue with unixODBC and 64 bit - -Wed Dec 19 16:08:17 CET 2007 Frediano Ziglio - * src/odbc/unittests/cursor3.c src/odbc/unittests/cursor4.c: - - remove warnings - -Wed Dec 19 15:35:22 CET 2007 Frediano Ziglio - * src/odbc/unittests/attributes.c(added) src/odbc/unittests/attributes.in(added): - * src/odbc/unittests/Makefile.am: add a test for statement attributes - * src/odbc/unittests/describecol.c: fix possible core - -Tue Dec 18 09:09:27 CET 2007 Frediano Ziglio - * src/odbc/unittests/Makefile.am src/odbc/unittests/cursor3.c(added): - * src/odbc/unittests/cursor4.c(added) src/odbc/unittests/cursor5.c(added): - - merged test from Sebastien FLAESCH - -Sun Dec 16 19:08:38 EST 2007 JK Lowden - * doc/api_status.txt - - set useless db-lib functions' status to 'never' - -Sun Dec 16 16:58:35 EST 2007 JK Lowden - * doc/Makefile.am doc/bsqlodbc.txt doc/osql.txt - * doc/userguide.sgml - - updated for next release - -Fri Dec 14 11:23:08 CET 2007 Frediano Ziglio - * misc/test-other.sh: fix some strange echo portability - * src/dblib/unittests/null.c src/dblib/unittests/null2.c: - - make ignore less verbose - -Thu Dec 13 23:45:55 EST 2007 JK Lowden - * src/apps/Makefile.am build bsqlodbc out-of-tree - * src/dblib/unittests/null.c prettier & correct, passes - -Thu Dec 13 21:12:20 CET 2007 Frediano Ziglio - * src/dblib/buffering.h: fix null2 - -Thu Dec 13 19:04:35 CET 2007 Frediano Ziglio - * src/apps/Makefile.am: - - fix bsqlodbc compile if not standard sql.h path - -Wed Dec 12 07:27:07 CET 2007 Frediano Ziglio - * src/tds/net.c: fix for 64bit - -Tue Dec 11 11:09:52 CET 2007 Frediano Ziglio - * doc/userguide.sgml: remove warning - * misc/freetds_autobuild: fix if password empty - -Tue Dec 11 00:02:16 EST 2007 JK Lowden - * doc/userguide.sgml minor touchups - * src/dblib/dblib.c src/dblib/unittests/setnull.c - - unittests/setnull.c passes. - -Mon Dec 10 14:05:06 CET 2007 Frediano Ziglio - * src/tds/convert.c: remove warning - -Mon Dec 10 00:08:45 EST 2007 JK Lowden - * doc/Makefile.am doc/userguide.sgml some improvements - doc/grep_sample_code doc/images/caution.gif - doc/images/warning.gif - doc/images/callouts/1.gif doc/images/callouts/2.gif - doc/images/callouts/3.gif doc/images/callouts/4.gif - doc/images/callouts/5.gif doc/images/callouts/6.gif - doc/images/callouts/7.gif doc/images/callouts/8.gif - doc/images/callouts/9.gif doc/images/callouts/10.gif - - added from http://tldp.org/LDP/abs/images/ - -Sun Dec 9 19:51:11 EST 2007 JK Lowden - * doc/userguide.sgml added tenderfoot tutorial - -Fri Dec 7 00:26:01 EST 2007 JK Lowden - * include/tds.h src/dblib/dblib.c - * src/dblib/dbutil.c src/tds/util.c - - pass errno via tdserror. - -Thu Dec 6 21:41:23 EST 2007 JK Lowden - * src/tds/convert.c tds_willconvert returns size - -Thu Dec 6 21:32:13 CET 2007 Frediano Ziglio - * src/dblib/dblib.c: fix for 64bit machines - * src/dblib/unittests/setnull.c: improve - -Thu Dec 6 19:59:59 CET 2007 Frediano Ziglio - * configure.ac include/replacements.h src/apps/bsqldb.c: - * src/dblib/unittests/setnull.c: - - use basename from MingW if available - * src/dblib/dblib.c: fix malloc portability problem - -Thu Dec 6 10:18:54 CET 2007 Frediano Ziglio - * src/dblib/rpc.c src/dblib/unittests/setnull.c: - - fix compile problems - -Thu Dec 6 01:00:42 EST 2007 JK Lowden - * src/dblib/buffering.h src/dblib/dblib.c: - - dbgetnull tolerates negative varlen, looks pretty good - -Wed Dec 5 10:38:55 EST 2007 JK Lowden - * src/dblib/dblib.c: - - t0011 passes but copy_data_to_host_var likely wrong - -Tue Dec 4 20:19:38 EST 2007 JK Lowden - * include/dblib.h src/dblib/buffering.h src/dblib/dblib.c: - - removed _db_set_null and associated mallocs - - dblib/unittest/t0011.c failing mysteriously - -Mon Dec 3 23:18:55 EST 2007 JK Lowden - * src/dblib/dblib.c src/dblib/unittests/setnull.c: - - corrected dbsetnull() - -Mon Dec 3 18:45:22 EST 2007 JK Lowden - * src/apps/bsqldb.c - * src/dblib/bcp.c src/dblib/dblib.c src/dblib/unittests/rpc.c - * src/dblib/unittests/setnull.c src/dblib/unittests/t0001.c - * src/dblib/unittests/t0002.c src/dblib/unittests/t0003.c - * src/dblib/unittests/t0004.c src/dblib/unittests/t0005.c - * src/dblib/unittests/t0006.c src/dblib/unittests/t0007.c - * src/dblib/unittests/t0008.c src/dblib/unittests/t0011.c - * src/dblib/unittests/t0015.c src/dblib/unittests/t0018.c - * src/dblib/unittests/t0023.c src/dblib/unittests/text_buffer.c - * src/dblib/unittests/thread.c src/dblib/unittests/timeout.c: - - dbbind uses zero, not -1 to indicate sufficient space. - -Mon Dec 3 17:57:54 EST 2007 JK Lowden - * src/dblib/bcp.c: don't cast malloc and don't assume it worked. - -Mon Dec 3 19:54:53 CET 2007 Frediano Ziglio - * src/odbc/Makefile.am: remove GNU make pattern - -Mon Dec 3 15:35:45 CET 2007 Frediano Ziglio - * src/dblib/dblib.c: - - do not call dbcolptr for compute result but call new dbacolptr - - dbcolptr return TDSCOLUMN* to optimize it - -Mon Dec 3 11:53:56 CET 2007 Frediano Ziglio - * src/dblib/dblib.c: remove a warning - -Mon Dec 3 10:18:39 CET 2007 Frediano Ziglio - * src/dblib/dblib.c src/dblib/unittests/.cvsignore: - * src/dblib/unittests/Makefile.am src/dblib/unittests/setnull.c(added): - - add a test for setnull - -Sun Dec 2 17:58:40 EST 2007 JK Lowden - * doc/api_status.txt - * include/dblib.h include/sybdb.h include/tds.h - * src/ctlib/blk.c src/dblib/bcp.c src/dblib/dblib.c - - full implementation of dbsetnull(). - - Replaced _DB_GETCOLINFO macro with dbcolptr(). - -Sat Dec 1 14:05:54 EST 2007 JK Lowden - * src/dblib/bcp.c src/dblib/unittests/null.c - - correct TDS 5.0 bcp offset table calcuation in presence of NULLs. - -Fri Nov 30 09:54:46 CET 2007 Frediano Ziglio - * src/dblib/unittests/common.c: missing new line - -Thu Nov 29 09:03:32 CET 2007 Frediano Ziglio - * src/dblib/unittests/null2.c: improve - -Wed Nov 28 15:15:43 CET 2007 Frediano Ziglio - * configure.ac: - - include windows.h under windows - - include sql.h directly to avoid MingW problems - * include/dblib.h src/dblib/bcp.c src/dblib/dblib.c src/dblib/rpc.c: - - avoid core checking for parameters if argument are expected - * src/dblib/unittests/null.c src/dblib/unittests/null2.c: - - avoid invalid references to deallocated stack - -Wed Nov 28 09:48:50 CET 2007 Frediano Ziglio - * src/dblib/bcp.c: remove warnings - -Wed Nov 28 00:27:36 EST 2007 JK Lowden - * src/dblib/bcp.c fixed TDS 5.0 null-column bug, cf. ML - * doc/tds.html Added BCP, made 4.01 strict, validated. - -Tue Nov 27 16:12:56 CET 2007 Frediano Ziglio - * src/dblib/unittests/Makefile.am src/dblib/unittests/null2.c(added): - - test dbbind/dbnullbind with NULLs - * src/dblib/unittests/null.c: add note - -Tue Nov 27 13:37:35 CET 2007 Frediano Ziglio - * src/dblib/unittests/t0001.c src/dblib/unittests/t0022.c: - - compile with Sybase libraries - * src/dblib/unittests/t0008.c: more verbose - -Mon Nov 26 21:02:57 CET 2007 Frediano Ziglio - * src/odbc/unittests/array_out.c: fix silly core - -Mon Nov 26 19:11:12 CET 2007 Frediano Ziglio - * configure.ac include/tdsodbc.h src/odbc/odbc.c: - * src/odbc/unittests/array_out.c src/odbc/unittests/common.h: - * src/odbc/unittests/describecol.c src/odbc/unittests/freeclose.c: - * src/odbc/unittests/insert_speed.c src/odbc/unittests/timeout.c: - * src/odbc/unittests/timeout3.c src/odbc/unittests/type.c: - - minor fixes for 64bit - -Mon Nov 26 16:47:34 CET 2007 Frediano Ziglio - * configure.ac src/apps/fisql/fisql.c: - - do not use functions not availables - -Mon Nov 26 09:43:03 EST 2007 JK Lowden - * src/dblib/bcp.c src/tds/unittests/iconv_fread.c - - small changes - -Mon Nov 26 09:51:21 CET 2007 Frediano Ziglio - * src/dblib/unittests/bcp.c: fix printf - -Mon Nov 26 07:24:43 CET 2007 Frediano Ziglio - * src/odbc/unittests/array.c src/odbc/unittests/array_out.c: - * src/odbc/unittests/const_params.c src/odbc/unittests/cursor1.c: - * src/odbc/unittests/describecol.c src/odbc/unittests/freeclose.c: - * src/odbc/unittests/insert_speed.c src/odbc/unittests/raiserror.c: - * src/odbc/unittests/rpc.c src/odbc/unittests/scroll.c: - * src/tds/challenge.c: - - fix minor issues with 64bit - -Thu Nov 22 09:43:58 CET 2007 Frediano Ziglio - * configure.ac src/ctlib/Makefile.am src/dblib/Makefile.am: - * src/odbc/Makefile.am: - - do not filter symbols under MacOsX (avoid libtool problems) - -Wed Nov 21 11:31:37 EST 2007 JK Lowden - * src/ctlib/blk.c: correctly test result of cs_convert - * src/dblib/rpc.c: minor edits - * src/dblib/unittests/bcp.c src/dblib/unittests/bcp.h: - - test works for TDS 7.0. - -Tue Nov 20 23:08:15 EST 2007 JK Lowden - * src/dblib/bcp.c src/dblib/unittests/bcp.c: - * src/dblib/dblib.c src/tds/convert.c src/tds/net.c: - - small changes - -Thu Nov 15 14:32:50 CET 2007 Frediano Ziglio - * src/dblib/unittests/.cvsignore src/dblib/dblib.c: - * src/dblib/unittests/Makefile.am src/dblib/unittests/null.c: - - fix problem with empty string and TEXT - - add a test to test empty/NULL behavior of dbdatlen/dbdata - -Thu Nov 15 10:18:40 CET 2007 Frediano Ziglio - * src/tds/login.c: return error if no username given and no Kerberos - -Tue Nov 13 10:13:06 CET 2007 Frediano Ziglio - * include/tds.h src/tds/challenge.c src/tds/gssapi.c: - * src/tds/login.c src/tds/token.c: - - port ntlm to new authentication code - - move all ntlm stuff to challenge.c - -Mon Nov 12 17:15:03 EST 2007 JK Lowden - * include/sybdb.h src/dblib/bcp.c - * src/dblib/dblib.c src/dblib/dbutil.c - * src/dblib/rpc.c - * src/tds/log.c src/tds/login.c - - trying to convince Doxygen not to ignore functions, - - e.g. dbinit - -Mon Nov 12 13:38:04 EST 2007 JK Lowden - * include/dblib.h src/dblib/dbutil.c - * src/dblib/dblib.c src/dblib/rpc.c src/dblib/bcp.c - - added DBDEAD test to all public functions - -Mon Nov 12 14:32:53 CET 2007 Frediano Ziglio - * configure.ac: cleanup - * src/tds/gssapi.c: compute fqdn name in service name - -Mon Nov 12 12:34:14 CET 2007 Frediano Ziglio - * configure.ac include/tds.h src/tds/gssapi.c: - * src/tds/login.c src/tds/mem.c src/tds/token.c: - - new TDSAUTHENTICATION structure - - new --enable-krb5 to enable Kerberos authentication - (disable by default) - -Fri Nov 09 11:29:21 CET 2007 Frediano Ziglio - * src/apps/tsql.c: remove some leaks - -Mon Nov 05 11:05:34 CET 2007 Frediano Ziglio - * src/apps/tsql.c: use pipes to avoid infinite counter - -Mon Nov 05 09:29:54 CET 2007 Frediano Ziglio - * src/tds/login.c: fix log avoidance for long logins - -Sun Nov 04 09:16:08 CET 2007 Frediano Ziglio - * src/tds/gssapi.c: small cleanup - -Sat Nov 03 14:31:40 CET 2007 Frediano Ziglio - * include/tds.h src/tds/config.c src/tds/mem.c: - - add server_host_name to TDSCONNECTION - * src/tds/gssapi.c: some improves - -Fri Nov 02 11:33:16 CET 2007 Frediano Ziglio - * src/tds/gssapi.c: add small comment - -Tue Oct 30 16:45:41 CET 2007 Frediano Ziglio - * src/tds/Makefile.am src/tds/gssapi.c src/tds/login.c: - - include developing code for GSSAPI - -Tue Oct 30 16:36:29 CET 2007 Frediano Ziglio - * include/tds.h src/tds/login.c src/ctlib/ct.c src/tds/read.c: - * src/tds/token.c: - - finish merging tds9 code as developing - -Tue Oct 30 16:02:04 CET 2007 Frediano Ziglio - * include/tdsodbc.h src/odbc/odbc.c: - - make odbc row_count 64bit - -Tue Oct 30 13:14:00 CET 2007 Frediano Ziglio - * src/tds/config.c src/tds/query.c: - - more merge for tds9 - -Tue Oct 30 11:31:30 CET 2007 Frediano Ziglio - * include/tds.h src/ctlib/blk.c src/dblib/bcp.c: - * src/server/server.c src/tds/token.c: - - merge partially tds9 patch - -Tue Oct 30 11:15:20 CET 2007 Frediano Ziglio - * src/tds/net.c: - - avoid wrong assert if error and tdserror called - * src/tds/query.c: limit data length to maximun allowed - -Wed Oct 24 17:55:56 EDT 2007 JK Lowden - * include/sqldb.h define dbfreelogin - * src/dblib/unittests/common.h add commentary - -Tue Oct 23 19:41:03 EDT 2007 JK Lowden - * src/tds/net.c src/tds/util.c - - ct-lib seems OK with EINTR (sqsh works) but db-lib - - applications get a weird message. - -Tue Oct 23 18:08:00 EDT 2007 JK Lowden - * src/tds/net.c - - return from tds_select as if timed out on EINTR. - - sqsh still unhappy when ^C pressed on long-running query. - -Thu Oct 18 16:48:23 CET 2007 Frediano Ziglio - * src/dblib/dblib.c: fix core - -Thu Oct 18 13:49:51 CET 2007 Frediano Ziglio - * src/tds/query.c src/tds/token.c: - - more free(NULL) - -Tue Oct 16 16:59:06 CET 2007 Frediano Ziglio - * src/apps/tsql.c src/ctlib/blk.c src/ctlib/cs.c src/ctlib/ct.c: - * src/dblib/bcp.c src/dblib/dblib.c src/dblib/rpc.c: - * src/dblib/unittests/rpc.c src/odbc/error.c src/odbc/odbc.c: - * src/odbc/sql2tds.c src/odbc/unittests/binary_test.c: - * src/pool/config.c src/tds/locale.c src/tds/login.c: - * src/tds/mem.c src/tds/query.c src/tds/token.c: - * src/tds/vstrbuild.c src/tds/unittests/dataread.c: - - do not check for free(NULL) - -Wed Oct 10 13:59:37 EDT 2007 JK Lowden - * src/apps/tsql.c - - added some error checking for malloc/realloc, more needed - -Tue Oct 09 13:40:24 CET 2007 Frediano Ziglio - * src/tds/mem.c: fix small memory leak - -Mon Sep 24 13:12:47 CET 2007 Frediano Ziglio - * src/tds/query.c: limit size preparing queries - -Mon Sep 24 12:01:46 CET 2007 Frediano Ziglio - * src/server/query.c src/server/server.c: - - small server improve - -Thu Sep 20 17:32:15 CET 2007 Frediano Ziglio - * include/sybdb.h src/dblib/dblib.c src/dblib/dbopen.c: - - apply constify patch #1786200 - -Thu Sep 20 17:02:20 CET 2007 Frediano Ziglio - * src/apps/tsql.c: do not strip empty lines - -Mon Sep 17 17:22:32 EDT 2007 JK Lowden - * src/dblib/bcp.c correct freebcp -L behavior - * src/tds/net.c TDSECONN on no socket failure - * src/tds/util.c change iconv messages - -Mon Sep 17 17:52:09 CET 2007 Frediano Ziglio - * doc/tds.html: update for tds9 - * src/server/login.c: remove warning - -Mon Sep 17 12:13:03 CET 2007 Frediano Ziglio - * src/apps/tsql.c: - - improve for very large query (from 9.2 to 0.3 seconds on my - test machine) - -Mon Sep 17 10:42:45 CET 2007 Frediano Ziglio - * doc/tds.html: update - * src/ctlib/unittests/get_send_data.c: small fix - * include/sybdb.h src/dblib/dblib.c src/dblib/unittests/t0022.c: - - small update for future tds9 - * src/pool/main.c src/pool/user.c src/server/login.c: - - improve portability and possible remote leakage - -Thu Sep 13 12:42:08 CET 2007 Frediano Ziglio - * src/odbc/unittests/freeclose.c: - - make it works even if login is quite long - -Thu Sep 13 08:57:26 CET 2007 Frediano Ziglio - * src/tds/unittests/dynamic1.c: use tds_set_param_type - -Thu Sep 06 13:15:54 CET 2007 Frediano Ziglio - * doc/tds.html: update for tds9 - * src/tds/read.c: work if initial in_pos is != 0 - -Sat Aug 25 12:32:01 CET 2007 Frediano Ziglio - * include/tdsodbc.h src/odbc/error.c src/odbc/odbc.c: - - use ODBC_API instead of SQL_API to allow combined compile - -Fri Aug 24 11:50:03 CET 2007 Frediano Ziglio - * include/tds.h src/ctlib/blk.c src/dblib/bcp.c src/tds/login.c: - * src/tds/query.c src/tds/token.c: - - small changes for TDS 9.0 - -Mon Aug 16 10:09:42 CET 2007 Frediano Ziglio - * src/ctlib/unittests/Makefile.am src/dblib/unittests/Makefile.am: - * src/odbc/unittests/Makefile.am src/tds/net.c: - * src/tds/unittests/Makefile.am: - - remove other warnings - -Mon Aug 16 08:29:38 CET 2007 Frediano Ziglio - * src/tds/unittests/convert.c win32/initnet.c: - - remove some warnings compiling with MingW - -Sat Aug 11 08:51:45 CET 2007 Frediano Ziglio - * src/dblib/dblib.c vms/config_h.vms vms/descrip_mms.template: - - applied Craig A. Berry patch #1772080 for VMS systems - -Fri Aug 10 11:17:32 CET 2007 Frediano Ziglio - * NEWS: updated - -Fri Aug 10 11:14:19 CET 2007 Frediano Ziglio - * win32/dev-cpp/Makefile.win: add missing file - -Thu Aug 09 14:52:45 CET 2007 Frediano Ziglio - * src/tds/net.c: small fixes - -Thu Aug 09 10:26:51 CET 2007 Frediano Ziglio - * doc/userguide.sgml: document port override syntax - -Thu Aug 09 09:49:34 CET 2007 Frediano Ziglio - * doc/htdoc/basic_jdbc_question.html doc/htdoc/contrib.html: - * doc/htdoc/docs.html doc/htdoc/index.html doc/htdoc/news.html: - * doc/htdoc/software.html doc/htdoc/support.html: - * doc/htdoc/vague_jdbc_question.html doc/htdoc/which_api.html: - - make xhtml compatible - -Wed Aug 08 15:24:16 CET 2007 Frediano Ziglio - * configure.ac src/odbc/Makefile.am win32/version.rc.in: - - fix odbc cross compile using MingW - -Wed Aug 08 11:34:40 CET 2007 Frediano Ziglio - * misc/freetds_autobuild: - - improved adding test for server:port and server\instance case - -Wed Aug 08 11:10:36 CET 2007 Frediano Ziglio - * src/tds/config.c: fix bug #1759652 (cannot use server\INSTANCE) - -Tue Aug 07 15:34:34 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: improve cursor updates - * src/odbc/unittests/cursor1.c: improved and fixed - -Tue Aug 07 11:55:53 CET 2007 Frediano Ziglio - * src/tds/query.c: use table name for update - -Tue Aug 07 11:19:33 CET 2007 Frediano Ziglio - * include/tds.h src/odbc/odbc.c src/odbc/unittests/getdata.c: - - fix bug #1758831 - - additional fixes and checks for SQLGetData - -Tue Aug 07 10:29:55 CET 2007 Frediano Ziglio - * doc/userguide.sgml: update links - -Fri Aug 03 13:15:42 CET 2007 Frediano Ziglio - * src/tds/config.c: lookup server name correctly for instances - -Thu Aug 02 13:31:45 CET 2007 Frediano Ziglio - * include/sqlfront.h: small compatiblity improve with ms - -Fri Jul 13 18:56:56 CET 2007 Frediano Ziglio - * src/odbc/unittests/getdata.c: portability fix - -Thu Jul 12 16:31:05 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: fix for SQLGetData using empty fields - * src/odbc/unittests/getdata.c: - - improve test to catch previous problem - -Sat Jul 07 19:55:30 CET 2007 Frediano Ziglio - * m4/sprintf_i64_format.m4: improve portability - -Sat Jul 07 19:09:59 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: - - check cbValueMax in SQLGetData even if DM present - -Tue Jul 03 17:12:04 CET 2007 Frediano Ziglio - * src/odbc/unittests/compute.c src/odbc/unittests/tables.c: - * src/odbc/unittests/typeinfo.c: - - relax test for Sybase - * src/tds/token.c: fix length computation - -Tue Jul 03 15:37:03 CET 2007 Frediano Ziglio - * include/tds.h src/ctlib/blk.c src/dblib/bcp.c src/dblib/dblib.c: - * src/odbc/odbc.c src/tds/mem.c src/tds/token.c: - - add table_column_name to read real column name (if available), - read from wire and use when needed - -Sun Jul 01 12:10:31 CET 2007 Frediano Ziglio - * include/tdsstring.h src/odbc/connectparams.c: - * src/odbc/descriptor.c src/odbc/odbc.c src/tds/config.c: - * src/tds/tdsstring.c: - - added tds_dstr_dup to duplicate DSTR - - use tds_dstr_dup - - improve tds_dstr_set - -Wed Jun 27 16:51:30 CET 2007 Frediano Ziglio - * doc/tds.html: add Column Info token - * src/odbc/unittests/timeout2.c: portability fix - -Mon Jun 25 11:47:14 CET 2007 Frediano Ziglio - * doc/api_status.txt include/cspublic.h include/ctlib.h: - * src/ctlib/cs.c src/ctlib/ct.c: - - applied patch #1729392, it adds support for ctlib locale - -Mon Jun 25 10:20:00 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: review cursors - -Thu Jun 21 09:19:32 CET 2007 Frediano Ziglio - * misc/freetds_autobuild: test for Sybase 15 - * src/odbc/unittests/data.c: bigint for Sybase - * src/tds/data.c src/tds/mem.c src/tds/read.c src/tds/tds_checks.c: - - add support for Sybase bigint - - do not check decault capabilities if not necessary - -Tue Jun 19 15:30:12 CET 2007 Frediano Ziglio - * include/tds.h src/ctlib/ct.c src/odbc/odbc_util.c: - * src/pool/stream.c src/tds/data.c src/tds/net.c: - * src/tds/tds_checks.c src/tds/tds_checks.h src/tds/token.c: - - fix problem with Sybase LONGCHAR - -Tue Jun 19 14:06:55 CET 2007 Frediano Ziglio - * src/ctlib/unittests/t0007.c src/odbc/unittests/prepare_results.c: - - more verbose - - fix for possible Sybase conversion - * src/odbc/odbc.c: additional check if no dm - -Mon Jun 18 15:20:00 CET 2007 Frediano Ziglio - * src/tds/convert.c: - - patch #1736289 for bcp/bulk insert problem - -Mon Jun 18 14:02:45 CET 2007 Frediano Ziglio - * src/apps/tsql.c src/tds/locale.c: - - use correct charset based on locale - -Mon Jun 18 13:58:34 CET 2007 Frediano Ziglio - * src/odbc/unittests/genparams.c: remove warning - -Sun Jun 17 19:38:27 CET 2007 Frediano Ziglio - * src/odbc/unittests/freeclose.c src/odbc/unittests/timeout3.c: - - fix small thread problem - - fix possible deadlock - -Sun Jun 17 09:45:55 CET 2007 Frediano Ziglio - * src/odbc/unittests/freeclose.c src/odbc/unittests/genparams.c: - - fix thread and small portability - -Sun Jun 17 09:08:03 CET 2007 Frediano Ziglio - * include/dblib.h src/dblib/buffering.h src/dblib/dblib.c: - - patch #1717123 for dbsetnull implementation (removed warnings) - -Sun Jun 17 08:16:50 CET 2007 Frediano Ziglio - * src/apps/tsql.c: - - patch #1703363 for delimiters (modified) - -Wed Jun 13 09:26:00 CET 2007 Frediano Ziglio - * src/apps/fisql/fisql.c: compile even if readline is not available - -Mon Jun 4 17:09:03 EDT 2007 JK Lowden - * src/apps/Makefile.am skip bsqlodb if ODBC disabled - -Mon Jun 04 10:03:25 CET 2007 Frediano Ziglio - * src/dblib/unittests/.cvsignore src/dblib/unittests/Makefile.am: - * src/dblib/unittests/hang.c(added) src/tds/net.c: - - fix problem with tds_select (detected by Perception Technologies) - -Fri Jun 01 10:52:46 CET 2007 Frediano Ziglio - * src/tds/token.c: avoid overflow leading to memory errors - -Thu May 31 17:02:43 CET 2007 Frediano Ziglio - * src/tds/net.c: - - fixes, partially from Brent of Perception Technologies Ltd - -Thu May 31 10:54:14 EDT 2007 JK Lowden - * TODO add recent potential bug reports - -Thu May 31 14:21:35 CET 2007 Frediano Ziglio - * m4/ac_nullzero.m4: fix cross compile test - -Wed May 30 09:55:52 CET 2007 Frediano Ziglio - * src/tds/threadsafe.c: - - implement gethostbyname_r with getaddrinfo (for UnixWare 7 and others) - -Tue May 29 10:48:45 CET 2007 Frediano Ziglio - * configure.ac win32/config.h: cleanup - -Fri May 25 11:07:04 CET 2007 Frediano Ziglio - * src/odbc/convert_tds2sql.c: - - remove a FIXME - * src/odbc/odbc.c: - - fix bug #1716594 ("SQLFreeStmt with SQL_CLOSE shouldn't - unprepare statement") - * src/odbc/unittests/Makefile.am src/odbc/unittests/freeclose.c(added) - * src/odbc/unittests/.cvsignore: - - add a test for bug #1716594 - -Mon May 21 14:01:13 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: - - fix cursor updates, this undo part of change of src/odbc/odbc.c - from 1.331 to 1.332, log: - Wed Jul 21 16:50:11 CET 2004 - : some fix for SQLFetch and multiple rows - but tests works - * src/odbc/unittests/cursor1.c: improve - -Mon May 21 10:40:40 CET 2007 Frediano Ziglio - * src/odbc/unittests/cursor1.c: improve test - -Thu May 17 12:32:33 CET 2007 Frediano Ziglio - * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_checks.c: - * src/odbc/odbc_util.c: - - avoid core - - fix and check invalid values of num_param_rows and curr_param_row - -Thu May 17 09:18:19 CET 2007 Frediano Ziglio - * src/odbc/unittests/warning.c: improve and comments - -Wed May 16 14:23:00 CET 2007 Frediano Ziglio - * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_util.c: - * src/odbc/sql2tds.c: - - support row binding in RPC - - reuse new odbc_get_octet_len - -Wed May 16 14:23:00 CET 2007 Frediano Ziglio - * misc/freetds_autobuild: minor updates - -Mon May 14 16:04:08 CET 2007 Frediano Ziglio - * src/tds/login.c: remove copy error - -Mon May 14 10:16:37 CET 2007 Frediano Ziglio - * src/tds/login.c src/tds/mem.c src/tds/token.c src/tds/util.c: - - give proper errors on protocol autodiscovery - -Wed May 09 10:31:56 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: finish ODBC timeout - -Fri May 03 14:54:58 CET 2007 Frediano Ziglio - * src/odbc/unittests/const_params.c: - - reset statement to be sure to cleanup - -Wed May 02 16:54:13 CET 2007 Frediano Ziglio - * include/tdsodbc.h src/odbc/odbc.c: - - use query timeout from freetds.conf - -Mon Apr 30 15:14:08 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: use default linkage for static functions - -Mon Apr 30 15:02:27 CET 2007 Frediano Ziglio - * src/ctlib/blk.c: fix strange link error using gcc 4.1 - -Mon Apr 23 09:56:05 CET 2007 Frediano Ziglio - * src/tds/net.c: fix portability issue - -Fri Apr 20 15:26:15 CET 2007 Frediano Ziglio - * src/odbc/unittests/cursor1.c src/odbc/unittests/cursor2.c: - * src/odbc/unittests/scroll.c: - - make valgrind more happy if Sybase is used - -Fri Apr 20 11:13:40 CET 2007 Frediano Ziglio - * src/odbc/odbc.c src/odbc/unittests/Makefile.am: - * src/odbc/unittests/timeout4.c(added): - - add a test for timeout - - fix timeout on prepare (not detected) - - fix timeout if connection broken - -Thu Apr 19 11:11:55 CET 2007 Frediano Ziglio - * src/odbc/unittests/cursor1.c src/odbc/unittests/cursor2.c: - * src/odbc/unittests/scroll.c: - - give only warning for Sybase - -Thu Apr 19 10:45:15 CET 2007 Frediano Ziglio - * include/tdsodbc.h src/odbc/odbc.c: - - say we not still support cursors for sybase - -Wed Apr 18 16:28:29 CET 2007 Frediano Ziglio - * TODO.freddy include/tdsodbc.h src/odbc/odbc.c: - * src/odbc/odbc_util.c src/odbc/prepare_query.c src/odbc/sql2tds.c: - - fix cursor updates - -Mon Apr 16 22:08:07 EDT 2007 JK Lowden - * src/apps/bsqlodbc.c ODBC3 conformant - -Sun Apr 15 10:01:36 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: fix leak - -Fri Apr 13 17:27:20 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: cursor update - -Fri Apr 13 17:22:25 CET 2007 Frediano Ziglio - * include/tds.h src/tds/query.c: - - add cursor update to libTDS - -Fri Apr 13 10:08:07 CET 2007 Frediano Ziglio - * src/apps/bsqlodbc.c: - - catch all error - - fix some memory problems - -Thu Apr 12 15:33:15 CET 2007 Frediano Ziglio - * src/odbc/unittests/funccall.c: - - add test from ML - -Thu Apr 12 15:07:09 CET 2007 Frediano Ziglio - * freetds.spec.in: fix odbc directory - * src/dblib/unittests/Makefile.am: fix for make distcheck - * src/odbc/unittests/raiserror.c src/odbc/unittests/warning.c: - - relax if dm used - -Thu Apr 12 09:47:39 CET 2007 Frediano Ziglio - * src/odbc/odbc.c src/odbc/unittests/copydesc.c: - - test and fix a problem with SQLAllocHandle - * src/odbc/unittests/connect2.c: add test for not existing dbs - -Thu Apr 12 09:05:56 CET 2007 Frediano Ziglio - * src/ctlib/unittests/array_bind.c src/ctlib/unittests/ct_diagall.c: - * src/ctlib/unittests/ct_diagclient.c: - - fix buffer overflow leading in core - -Wed Apr 11 14:55:32 CET 2007 Frediano Ziglio - * src/dblib/unittests/common.c src/odbc/unittests/common.c: - - remove warning compiling with MingW - -Wed Apr 11 13:52:50 CET 2007 Frediano Ziglio - * src/odbc/connectparams.c src/odbc/odbc.c: - * src/odbc/unittests/connect2.c: - - finish and fix test for change_database - -Wed Apr 11 11:47:08 CET 2007 Frediano Ziglio - * src/odbc/unittests/connect2.c: fix test - * src/odbc/unittests/describecol.in: relax test - -Wed Apr 11 09:09:13 CET 2007 Frediano Ziglio - * src/odbc/unittests/connect2.c src/odbc/unittests/Makefile.am: - - add a test for change_database - -Tue Apr 10 16:00:47 CET 2007 Frediano Ziglio - * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_util.c: - - fixes for describecol test - -Tue Apr 10 15:16:28 CET 2007 Frediano Ziglio - * misc/coverage.sh: remove system files - * src/odbc/unittests/describecol.in: relax test - -Fri Apr 06 10:52:25 CET 2007 Frediano Ziglio - * include/tdssrv.h src/server/login.c src/server/unittest.c: - - remove warning - -Fri Apr 06 10:29:31 CET 2007 Frediano Ziglio - * NEWS src/odbc/unittests/funccall.c src/tds/mem.c: - * src/tds/query.c: - - added some notes - -Thu Apr 05 16:16:47 CET 2007 Frediano Ziglio - * INSTALL INSTALL.CVS NEWS README doc/userguide.sgml: - - merge from 0.64 - -Wed Apr 04 13:39:27 CET 2007 Frediano Ziglio - * NEWS: updated - -Wed Apr 04 11:53:20 CET 2007 Frediano Ziglio - * include/tds.h include/tdsodbc.h src/ctlib/ct.c src/dblib/rpc.c: - * src/odbc/prepare_query.c src/odbc/sql2tds.c src/tds/mem.c: - * src/tds/token.c src/tds/unittests/dynamic1.c: - - removed unused paramter from tds_alloc_param_data - - fix possible problem in prepare_rpc - -Wed Apr 04 11:39:12 CET 2007 Frediano Ziglio - * vms/descrip_mms.template: add log.c - * src/server/query.c: use constants - -Wed Apr 04 09:14:47 CET 2007 Frediano Ziglio - * doc/userguide.sgml: improve slow check - -Tue Apr 03 16:23:17 CET 2007 Frediano Ziglio - * win32/dev-cpp/FreeTDS.dev win32/dev-cpp/Makefile.win: - - updated adding log.c - -Mon Apr 02 17:06:43 CET 2007 Frediano Ziglio - * doc/userguide.sgml: add encryption parameter - -Thu Mar 29 16:32:50 CET 2007 Frediano Ziglio - * src/ctlib/blk.c: initial fix for bcp state - -Thu Mar 29 16:25:24 CET 2007 Frediano Ziglio - * include/tds.h src/server/login.c src/tds/config.c: - * src/tds/login.c: - - added encryption setting in freetds.conf - -Thu Mar 29 12:17:34 CET 2007 Frediano Ziglio - * configure.ac: check includes for ODBC - -Thu Mar 29 09:44:11 CET 2007 Frediano Ziglio - * src/odbc/unittests/genparams.c: add test for money - -Wed Mar 28 14:43:34 CET 2007 Frediano Ziglio - * freetds.spec.in src/odbc/unittests/Makefile.am: - - fix test-dist test - -Mon Mar 26 13:27:51 CET 2007 Frediano Ziglio - * src/dblib/unittests/.cvsignore src/dblib/unittests/Makefile.am: - * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: - * win32/build_dsw.pl: - - distribute projects for vc6 unittests - -Mon Mar 26 10:05:47 CET 2007 Frediano Ziglio - * doc/htdoc/news.html: validate page - -Sun Mar 24 09:23:21 CET 2007 Frediano Ziglio - * src/apps/bsqlodbc.c: - - avoid dangerous casts - -Tue Mar 20 16:24:26 CET 2007 Frediano Ziglio - * src/replacements/gettimeofday.c src/apps/datacopy.c: - - remove warning - -Mon Mar 19 11:01:05 CET 2007 Frediano Ziglio - * include/replacements.h: fix warning for win32 - -Sun Mar 18 12:37:47 CET 2007 Frediano Ziglio - * src/dblib/unittests/common.c src/odbc/unittests/timeout2.c: - * src/odbc/unittests/timeout3.c: - - fix cross-compile for win32 - -Sun Mar 18 12:09:57 CET 2007 Frediano Ziglio - * src/apps/Makefile.am src/apps/bsqlodbc.c src/apps/tsql.c: - * src/apps/fisql/Makefile.am win32/winsetup.c: - - fix cross-compile for win32 - -Fri Mar 16 16:32:08 CET 2007 Frediano Ziglio - * include/Makefile.am src/tds/Makefile.am: - - full libTDS privatization - * src/server/unittest.c: use mnemonic - -Wed Mar 14 17:18:23 CET 2007 Frediano Ziglio - * doc/tds.html: update - * include/tdssrv.h src/pool/user.c src/server/login.c: - * src/server/query.c src/server/server.c src/server/unittest.c: - - update server stuff, at least login works - * src/tds/tdsstring.c: fix possible mising NUL terminator - * src/apps/tsql.c: fix wrong error handler result - -Wed Mar 14 09:47:24 CET 2007 Frediano Ziglio - * doc/tds.html include/tds.h: update documentation - -Tue Mar 13 17:24:54 CET 2007 Frediano Ziglio - * include/tds.h src/pool/user.c src/server/login.c: - * src/server/unittest.c src/tds/login.c src/tds/query.c: - - use mnemonic for packet types - -Tue Mar 13 16:45:54 CET 2007 Frediano Ziglio - * doc/tds.html: added known tokens - -Tue Mar 13 14:18:03 CET 2007 Frediano Ziglio - * doc/tds.html: updated from code - -Mon Mar 12 14:27:14 CET 2007 Frediano Ziglio - * include/ctlib.h include/dblib.h include/des.h include/md4.h: - * include/md5.h include/replacements.h include/tdsiconv.h: - * include/tdsstring.h include/replacements/readpassphrase.h: - * src/server/Makefile.am: - - privatize functions using gcc visibility if available - - privatize server library - -Mon Mar 12 13:31:32 CET 2007 Frediano Ziglio - * src/ctlib/unittests/blk_in2.c(added) src/ctlib/unittests/Makefile.am: - - added test from ML to test cancel and bulk together - -Mon Mar 12 10:52:12 CET 2007 Frediano Ziglio - * doc/tds.html: improved, added types - -Fri Feb 16 14:52:10 CET 2007 Frediano Ziglio - * include/tds.h: improve documentation - -Mon Feb 12 14:29:53 EST 2007 Nick Castellano - * src/dblib/dblib.c: Increase size of dbprrow() conversion buffer to 8K. - -Mon Feb 12 10:53:54 CET 2007 Frediano Ziglio - * src/odbc/unittests/timeout3.c: - - use thread instead of fork - -Wed Feb 7 01:11:27 EST 2007 JK Lowden - * src/apps/bsqlodbc.c don't exit on SQL_SUCCESS_WITH_INFO - -Wed Feb 7 00:04:15 EST 2007 JK Lowden - * src/apps/bsqldb.c exit noisily on severe errors - * src/dblib/dblib.c src/tds/token.c - - fix timeout with buffering problem per yesterday's ML. - -Tue Feb 6 17:14:50 EST 2007 Nick Castellano - * src/dblib/dblib.c: - - Sybase docs for dbsqlok() says: "If the command buffer contains - multiple commands, a run-time error will not cause dbsqlok to - fail. Instead, failure will occur with the dbresults call that - processes the command causing the run-time error." - * src/apps/fisql/fisql.c: - - Correct result set processing. - -Tue Feb 6 14:11:02 EST 2007 Nick Castellano - * src/dblib/dblib.c: Don't print or store column separator after final result column - -Tue Feb 06 10:18:00 CET 2007 Frediano Ziglio - * configure.ac src/odbc/Makefile.am: - - use -module option only for darwin - -Tue Feb 06 09:53:14 CET 2007 Frediano Ziglio - * src/apps/bsqlodbc.c: - - make more functions static - - remove warning - * src/tds/net.c: remove warning - -Mon Feb 5 21:48:58 EST 2007 JK Lowden - * src/apps/Makefile.am src/apps/bsqlodbc.c src/apps/osql - - added bsqlodbc as general batch script processor. - -Mon Feb 05 09:41:02 CET 2007 Frediano Ziglio - * misc/test-other.sh phptests/null.php: - - fixed PHP check, updated test to PHP 5.2 - -Fri Feb 02 11:51:19 CET 2007 Frediano Ziglio - * configure.ac src/odbc/odbc.c src/odbc/unittests/.cvsignore: - * src/odbc/unittests/Makefile.am src/odbc/unittests/timeout3.c(added): - - added a test for connection timeout - - fix timeout connection in odbc - -Mon Jan 29 12:02:39 CET 2007 Frediano Ziglio - * include/tds_sysdep_private.h src/apps/fisql/fisql.c: - * src/tds/net.c: - - remove some warnings - -Fri Jan 26 18:19:57 CET 2007 Frediano Ziglio - * src/apps/fisql/fisql.c: - - remove warning - - reuse malloc - - fix compile error including config.h - * src/dblib/dblib.c: remove warning - -Fri Jan 26 18:06:44 CET 2007 Frediano Ziglio - * src/odbc/error.c src/odbc/odbc.c: - - remove warning compiling - -Wed Jan 24 14:14:55 EST 2007 Nick Castellano - * doc/fisql.txt: compute rows in fisql work now, remove BUGS entry - -Wed Jan 24 14:11:56 EST 2007 Nick Castellano - * src/apps/fisql/fisql.c: indent - -Wed Jan 24 14:08:09 EST 2007 Nick Castellano - * src/apps/fisql/fisql.c: good enough compute layout - -Wed Jan 24 12:24:30 EST 2007 Nick Castellano - * src/apps/fisql/fisql.c: almost correct compute layout - -Wed Jan 24 11:32:56 EST 2007 Nick Castellano - * src/apps/fisql/fisql.c: minor compute layout fixes, still more to do - -Tue Jan 23 17:15:33 EST 2007 Nick Castellano - * src/apps/fisql/fisql.c: better compute results, layout needs fixing - -Tue Jan 23 11:24:40 EST 2007 Nick Castellano - * src/dblib/dblib.c: fix off-by-one bug in dbbylist() - -Mon Jan 22 15:54:02 EST 2007 Nick Castellano - * src/apps/fisql/fisql.c: fix :r with unreadable file - -Mon Jan 22 15:50:31 EST 2007 Nick Castellano - * src/dblib/dblib.c: print line separator after compute results - -Mon Jan 22 00:56:12 EST 2007 JK Lowden - * src/odbc/connectparams.c src/odbc/error.c - * src/odbc/odbc.c - - added log entry for API functions - * src/odbc/unittests/common.c always use '/' separator - -Sat Jan 20 15:24:03 EST 2007 JK Lowden - * include/dblib.h include/sybdb.h src/dblib/dblib.c - - moved DBOPTION to dblib.h and removed unused members. - -Sat Jan 20 01:29:36 EST 2007 JK Lowden - * doc/defncopy.txt doc/fisql.txt cleanup formatting - * src/apps/bsqldb.c src/dblib/dblib.c fix compute row headers - -Sat Jan 20 01:30:22 EST 2007 Nick Castellano - * ChangeLog src/apps/fisql/edit.c src/apps/fisql/edit.h - * src/apps/fisql/fisql.c src/apps/fisql/handlers.c - * src/apps/fisql/handlers.h src/apps/fisql/interrupt.c - * src/apps/fisql/interrupt.h src/apps/fisql/terminal.c - * src/apps/fisql/terminal.h: - - Fix my name and the program name - -Sat Jan 20 01:20:39 EST 2007 Nick Castellano - * src/apps/fisql/fisql.c: - - Be slightly less stupid about compute rows. - -Sat Jan 20 00:54:57 EST 2007 Nick Castellano - * src/dblib/dblib.c: - - do not return bogus nul character in dbgetchar() - -Sat Jan 20 00:35:45 EST 2007 Nick Castellano - * src/dblib/dblib.c: - - dbspr*() functions get nul termination not line termination - -Fri Jan 19 22:39:00 EST 2007 Nick Castellano - * doc/fisql.txt: restore compute rows BUGS entry. - -Fri Jan 19 14:05:13 EST 2007 Nick Castellano - * src/apps/fisql/fisql.c: - - Provide xmalloc() and xrealloc() instead of relying on - libreadline for these. - -Fri Jan 19 13:47:42 EST 2007 Nick Castellano - * src/apps/fisql/Makefile.am - * src/apps/fisql/fisql.c - * src/apps/fisql/xgetpass.c(removed) - * src/apps/fisql/xgetpass.h(removed): - - use readpassphrase() in fisql application. - -Fri Jan 19 13:31:31 EST 2007 Nick Castellano - * src/apps/fisql/edit.c src/apps/fisql/fisql.c - * src/apps/fisql/handlers.c src/apps/fisql/handlers.h - * src/apps/fisql/interrupt.c src/apps/fisql/interrupt.h - * src/apps/fisql/terminal.c src/apps/fisql/terminal.h - * src/apps/fisql/xgetpass.c: - - Indent fisql to standard FreeTDS coding style - -Fri Jan 19 13:19:04 EST 2007 Nick Castellano - * src/apps/fisql/fisql.c: remove obsolete code - -Fri Jan 19 13:12:56 EST 2007 Nick Castellano - * doc/fisql.txt: fisql now works, update doc - -Fri Jan 19 13:01:53 EST 2007 Nick Castellano - * .cvsignore doc/.cvsignore: clean up - -Fri Jan 19 12:45:27 EST 2007 Nick Castellano - * src/dblib/dblib.c: fix dbspr1row(), fisql now works - -Fri Jan 19 11:17:13 EST 2007 JK Lowden - * doc/fisql.txt - * src/apps/fisql/edit.c src/apps/fisql/edit.h - * src/apps/fisql/handlers.c src/apps/fisql/handlers.h - * src/apps/fisql/interrupt.c src/apps/fisql/interrupt.h - * src/apps/fisql/terminal.c src/apps/fisql/terminal.h - * src/apps/fisql/xgetpass.c src/apps/fisql/xgetpass.h - * src/apps/fisql/fisql.c - - Added notice of copyright and GPL license - -Thu Jan 18 23:55:17 EST 2007 JK Lowden - * doc/Makefile.am doc/fisql.txt added man page for fisql - * src/apps/fisql/fisql.c fixed discarding const warnings - * doc/api_status.txt include/sybdb.h src/dblib/dblib.c - - added dbgettime() - -Thu Jan 18 17:57:52 EST 2007 Nick Castellano - * AUTHORS: credit myself as a contributor - -Thu Jan 18 17:50:18 EST 2007 Nick Castellano - * src/dblib/dblib.c: - - fix dbprrow() to print character data correctly - - fix dbprrow() to not loop endlessly on aggregate rows - -Thu Jan 18 08:57:10 CET 2007 Frediano Ziglio - * src/tds/unittests/utf8_2.c: fix error handler - -Wed Jan 17 09:48:45 CET 2007 Frediano Ziglio - * src/apps/fisql/fisql.c: use mkstemp instead of mktemp - * src/tds/util.c: cleanup - -Tue Jan 16 16:30:42 EDT 2007 Nick Castellano - * configure.ac - * src/apps/Makefile.am - * src/apps/fisql: contribute free DB-Libary isql application - -Tue Jan 16 09:57:35 CET 2007 Frediano Ziglio - * src/tds/util.c: fix messages - -Tue Jan 16 09:48:43 CET 2007 Frediano Ziglio - * misc/test-other.sh: fix problem with Perl 5.8.8 - * src/dblib/dblib.c: fix possible thread problem - -Tue Jan 16 00:28:28 EST 2007 JK Lowden - * include/dblib.h src/dblib/bcp.c - * src/dblib/dblib.c src/dblib/unittests/rpc.c - - support variadic form of dbperror - -Mon Jan 15 14:40:35 EST 2007 JK Lowden - * src/dblib/unittests/common.c - * src/dblib/unittests/rpc.c - * src/dblib/unittests/t0004.c - * src/dblib/unittests/t0005.c - * src/dblib/unittests/t0007.c - * src/dblib/unittests/t0019.c - * src/dblib/unittests/t0020.c - - fail if an unanticipated message/error is received - -Sun Jan 14 23:16:17 EST 2007 JK Lowden - * src/tds/config.c src/tds/login.c - - began work on autodetecting the server's TDSVER - - works with libtds, not db-lib - -Sun Jan 14 20:38:25 EST 2007 JK Lowden - * include/dblib.h include/tds.h - * src/dblib/dblib.c src/dblib/dbutil.c - * src/dblib/unittests/t0001.c src/dblib/unittests/t0012.c - * src/dblib/unittests/timeout.c - * src/tds/net.c TODO - - timeout unit test also works with dbsetinterrupt - -Sat Jan 13 17:09:05 EST 2007 JK Lowden - * src/dblib/unittests/timeout.c added - * src/dblib/dblib.c - * src/dblib/unittests/Makefile.am src/dblib/unittests/t0001.c - * src/tds/login.c src/tds/query.c src/tds/util.c - - new timeout unit test works. - -Fri Jan 12 14:28:32 CET 2007 Frediano Ziglio - * src/odbc/odbc.c: update code to new libTDS timeout code - * src/tds/net.c: handle send/recv errors - * src/tds/util.c: fix msgno if error not found in table - -Thu Jan 11 10:49:52 EST 2007 JK Lowden - * src/apps/osql - - fixed incorrect report when drivername is not a file - -Tue Jan 09 22:44:08 CET 2007 Frediano Ziglio - * src/apps/tsql.c: fix option problem - -Tue Jan 9 00:16:46 EST 2007 JK Lowden - * src/tds/net.c simpler tds_select, thanks Frediano - -Sun Jan 7 10:45:23 EST 2007 JK Lowden - * src/ctlib/ctutil.c works with tdserror() - -Sun Jan 7 00:41:19 EST 2007 JK Lowden - * include/tds.h - * src/dblib/dblib.c src/dblib/dbutil.c - * src/tds/net.c src/tds/query.c - * src/tds/token.c src/tds/util.c - - implement new timeout strategy using tds_select() and - - calling the client library's error handler (via tdserror). - - db-lib no worse than before, others not yet tested. - -Fri Jan 05 14:08:53 CET 2007 Frediano Ziglio - * include/tds.h src/tds/token.c: new token - * src/tds/util.c: optimize - -Fri Jan 5 02:08:54 EST 2007 JK Lowden - * include/tds.h src/tds/net.c src/tds/util.c - - begin new timeout strategy, not done. - -Thu Jan 4 18:47:46 EST 2007 JK Lowden - * doc/bsqldb.txt src/apps/bsqldb.c nicer headers - * doc/osql.txt src/apps/osql allow ini location override - -Tue Jan 2 15:42:09 EST 2007 JK Lowden - * include/dblib.h include/tds.h - * src/apps/tsql.c - * src/dblib/dblib.c src/dblib/dbutil.c - * src/tds/iconv.c src/tds/login.c src/tds/net.c - * src/tds/token.c src/tds/util.c - - replace tds_client_msg with tdserror() - -Mon Jan 01 12:56:50 CET 2007 Frediano Ziglio - * src/dblib/dblib.c src/tds/query.c: - - remove some warning compiling with SUN compiler - - Happy New Year - -Fri Dec 29 20:43:55 CET 2006 Frediano Ziglio - * src/tds/mem.c: remove warning and optimize - -Fri Dec 29 20:42:41 CET 2006 Frediano Ziglio - * src/apps/tsql.c: remove warnings - -Fri Dec 29 20:05:00 CET 2006 Frediano Ziglio - * include/tdsodbc.h: cleanup - -Fri Dec 29 20:03:30 CET 2006 Frediano Ziglio - * src/ctlib/unittests/rpc_ct_param.c: - * src/ctlib/unittests/rpc_ct_setparam.c src/odbc/odbc.c: - - remove warnings - -Fri Dec 29 17:18:42 CET 2006 Frediano Ziglio - * configure.ac src/tds/log.c: - - use localtime_r if available - -Fri Dec 29 10:06:56 CET 2006 Frediano Ziglio - * src/tds/log.c: - - avoid locking if no logging - -Tue Dec 26 15:57:38 CET 2006 Frediano Ziglio - * include/tds.h src/ctlib/unittests/array_bind.c: - * src/ctlib/unittests/ct_diagall.c: - * src/ctlib/unittests/get_send_data.c: - * src/ctlib/unittests/lang_ct_param.c: - * src/dblib/bcp.c src/dblib/dblib.c: - * src/dblib/dbutil.c src/dblib/rpc.c: - * src/dblib/xact.c src/dblib/unittests/common.h: - * src/dblib/unittests/t0016.c src/odbc/connectparams.c: - * src/odbc/descriptor.c src/odbc/error.c: - * src/odbc/odbc.c src/odbc/odbc_checks.c: - * src/odbc/prepare_query.c src/odbc/unittests/common.h: - * src/odbc/unittests/describecol.c src/pool/config.c: - * src/pool/main.c src/pool/member.c src/pool/stream.c: - * src/pool/user.c src/pool/util.c: - * src/replacements/readpassphrase.c: - * src/replacements/strtok_r.c src/replacements/vasprintf.c: - * src/server/login.c src/server/unittest.c: - * src/tds/config.c src/tds/convert.c src/tds/data.c: - * src/tds/getmac.c src/tds/iconv.c src/tds/locale.c: - * src/tds/login.c src/tds/net.c src/tds/numeric.c: - * src/tds/tds_checks.c src/tds/tdsstring.c src/tds/threadsafe.c: - * src/tds/write.c src/tds/unittests/common.h win32/winlogin.c: - * win32/winsetup.c: - - include stdarg.h always before stdio.h to fix portability - issues defining va_list - -Tue Dec 26 13:54:25 CET 2006 Frediano Ziglio - * src/tds/Makefile.am src/tds/util.c src/tds/log.c (added): - - separate log stuff - -Sun Dec 24 12:40:19 CET 2006 Frediano Ziglio - * src/odbc/descriptor.c: cleanup - -Fri Dec 22 09:34:37 CET 2006 Frediano Ziglio - * src/tds/convert.c: fix typo error - -Mon Dec 21 14:07:55 CET 2006 Frediano Ziglio - * src/tds/iconv.c: use cp1252 instead of iso8859-1 for mssql - -Wed Dec 20 22:47:36 EST 2006 JK Lowden - * src/tds/iconv.c src/tds/token.c log server charset changes - * src/tds/unittests/convert.c permit varbinary - -Mon Dec 18 10:50:34 CET 2006 Frediano Ziglio - * src/tds/Makefile.am: distribute enum_cap.h - -Fri Dec 15 14:41:14 EST 2006 JK Lowden - * src/tds/tds_willconvert.pl allow varbinary - -Thu Dec 14 22:18:16 EST 2006 JK Lowden - * src/tds/mem.c src/tds/unittests/t0001.c - - Added tds_capability_set and enumerated capabilities - * src/tds/enum_cap.h added - -Tue Dec 12 08:45:12 CET 2006 Frediano Ziglio - * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_util.c: - - improve describecol test - -Sun Dec 10 16:04:02 EST 2006 JK Lowden - * doc/htdoc/faq.html minor fixes - * src/apps/tsql.c send *sybase* charset name in login record - * src/tds/net.c src/tds/read.c a little less logging - -Thu Dec 7 17:06:50 CET 2006 Frediano Ziglio - * src/tds/token.c: make get_send_data works - -Tue Dec 5 11:42:04 CET 2006 Frediano Ziglio - * src/odbc/unittests/funccall.c: add a test - -Fri Dec 1 16:45:59 EST 2006 JK Lowden - * include/sybdb.h src/dblib/bcp.c src/apps/freebcp.c - - Changed freetbcp batch-copied information messages to - - match the output of Sybase's bcp utility. - -Wed Nov 29 15:46:38 EST 2006 JK Lowden - * src/apps/tsql.c fixed broken "go" option handling. - -Tue Nov 28 11:52:27 EST 2006 JK Lowden - * src/apps/tsql.c fix -o option code - * src/tds/net.c reorganize tds_open_socket() - -Mon Nov 27 18:31:18 EST 2006 JK Lowden - * src/tds/net.c more detailed log of connect(2) - -Sun Nov 26 15:26:31 EST 2006 JK Lowden - * src/apps/tsql.c added connection timer feedback - * src/tds/login.c src/tds/net.c slightly better logging - -Thu Nov 23 09:43:00 CET 2006 Frediano Ziglio - * src/odbc/unittests/genparams.c: - - fix possible problem with very remote servers - -Thu Oct 26 15:09:48 EDT 2006 JK Lowden - * src/dblib/dbutil.c log error message from server - * src/tds/net.c log TDS version - -Thu Oct 26 14:26:27 EDT 2006 JK Lowden - * src/dblib/unittests/common.c src/dblib/unittests/common.h - * src/dblib/unittests/t0001.c - - corrected command-line option handling - -Sat Oct 21 16:42:08 EDT 2006 JK Lowden - * src/dblib/dblib.c src/dblib/unittests/t0022.c: - - dbresults succeeds if metadata or only return status is - - present, cf. ML yesterday. - -Sat Oct 21 14:22:44 CET 2006 Frediano Ziglio - * autogen.sh: fix some portability issues - -Wed Oct 18 21:38:57 CET 2006 Frediano Ziglio - * src/odbc/odbc.c src/odbc/unittests/tables.c: - - fix problem with mssql2005 and SQLTables - -Mon Oct 16 09:48:31 CET 2006 Frediano Ziglio - * src/tds/net.c: reduce system calls required - -Thu Oct 12 11:19:02 CET 2006 Frediano Ziglio - * src/tds/token.c: - - fix wrong assert - - return correctly RETURNSTATUS under Sybase - -Wed Oct 11 16:37:04 CET 2006 Frediano Ziglio - * src/tds/token.c: fix wrong assert using numerics - -Tue Oct 10 15:52:22 EDT 2006 JK Lowden - * doc/osql.txt clarified - -Fri Oct 6 17:08:43 EDT 2006 JK Lowden - * src/apps/freebcp.c src/apps/freebcp.h doc/freebcp.txt - - applied -0 patch from ML - - by Constantin Vasilyev - -Wed Oct 4 19:46:29 EDT 2006 JK Lowden - * src/apps/freebcp.c - - applied -P from stdin patch - - from ML Constantin Vasilyev - -Wed Oct 4 17:36:43 EDT 2006 JK Lowden - * src/apps/osql GNU sed does not support -E - -Wed Oct 4 14:48:20 EDT 2006 JK Lowden - * doc/Makefile.am doc/osql.txt added osql man page - -Wed Oct 4 14:12:25 EDT 2006 JK Lowden - * src/apps/Makefile.am add osql as installable script - -Tue Oct 3 15:40:12 EDT 2006 JK Lowden - * src/dblib/bcp.c test fwrite(3) correctly - -Tue Sep 26 16:57:42 EDT 2006 JK Lowden - * src/dblib/bcp.c src/dblib/dblib.c - * src/tds/convert.c src/tds/net.c src/tds/token.c - - added more user-level error checking, checking against - - known list of db-lib error messages - * src/apps/osql added - -Wed Sep 13 13:55:24 CET 2006 Frediano Ziglio - * samples/Makefile.am samples/unixodbc.freetds.driver.template.in: - - add Setup entry to unixODBC template - - unixODBC templates are not executables - -Wed Sep 13 13:52:40 CET 2006 Frediano Ziglio - * src/tds/mem.c: enable wide table - -Wed Sep 13 11:47:27 CET 2006 Frediano Ziglio - * src/tds/token.c: - - fix really broken tds5_process_result - -Fri Sep 08 11:58:24 CET 2006 Frediano Ziglio - * configure.ac src/tds/threadsafe.c: - - fix threadsafe problem on NetBSD - -Fri Sep 08 11:17:55 CET 2006 Frediano Ziglio - * include/tds.h src/tds/token.c: make splint a bit more happy - * src/odbc/odbc.c: small 64bit improvements - -Thu Sep 07 23:10:29 CET 2006 Frediano Ziglio - * src/odbc/sql2tds.c: fix paramset (Levente Tamási) - -Fri Sep 1 10:34:20 CET 2006 Frediano Ziglio - * include/tds.h include/tdsstring.h src/ctlib/ct.c: - * src/odbc/connectparams.c src/odbc/odbc.c src/server/login.c: - * src/tds/config.c src/tds/tdsstring.c: - - add dstr_size to DSTR - - add tds_dstr_alloc, tds_dstr_setlen, tds_dstr_buf - -Wed Aug 30 13:58:56 CET 2006 Frediano Ziglio - * include/tds.h src/tds/challenge.c src/tds/login.c: - - make tds_answer_challenge return flags - - tds_dstr fix - * src/dblib/dblib.c: small fix - * src/odbc/odbc.c: constification - * src/tds/query.c: - - some static functions rename - - do not convert string in tds7_build_param_def_from_query - * src/tds/threadsafe.c: cleanup - -Mon Aug 28 09:36:32 CET 2006 Frediano Ziglio - * include/cspublic.h: - - applied Norbert Sendetzky patch for ctlib compatibility - -Fri Aug 25 11:03:40 CET 2006 Frediano Ziglio - * src/dblib/unittests/Makefile.am src/dblib/unittests/t0017.c: - * src/dblib/unittests/t0017.in.be(added): - - fix big endian problem with t0017 test - -Fri Aug 25 09:17:37 CET 2006 Frediano Ziglio - * src/apps/tsql.c: remove 1024 char limit on tsql_readline - -Thu Aug 24 21:18:48 CET 2006 Frediano Ziglio - * src/apps/tsql.c: applied Christos Zoulas patch for no-tty - -Thu Aug 24 16:29:17 CET 2006 Frediano Ziglio - * include/sybdb.h src/dblib/dblib.c: - - do not change compatibility - * src/tds/config.c: small optimization - -Thu Aug 24 11:37:15 CET 2006 Frediano Ziglio - * m4/sprintf_i64_format.m4: fix 64bit problem for LP64 - -Thu Aug 24 11:17:26 CET 2006 Frediano Ziglio - * include/tds_sysdep_private.h src/apps/tsql.c src/ctlib/Makefile.am: - * src/dblib/Makefile.am src/tds/net.c win32/initnet.c: - * win32/winsetup.c win32/dev-cpp/FreeTDS.dev: - * win32/dev-cpp/Makefile.win win32/msvc6/FreeTDS.dsp: - - initialize socket library on win32 - -Thu Aug 24 08:32:07 CET 2006 Frediano Ziglio - * src/apps/tsql.c: - - do not print return status if quiet (patch from Christos Zoulas) - -Wed Aug 23 21:43:50 CET 2006 Frediano Ziglio - * doc/tsql.txt: applied Christos Zoulas updates - * doc/txt2man: updated - -Wed Aug 23 17:16:10 CET 2006 Frediano Ziglio - * src/tds/net.c: - - clean error before reading SO_ERROR, some system need this - * src/tds/util.c src/ctlib/ct.c: cross compile fixes - -Wed Aug 23 16:25:25 CET 2006 Frediano Ziglio - * m4/ac_tds_func_which_getpwuid_r.m4 m4/sprintf_i64_format.m4: - * configure.ac src/ctlib/cs.c src/apps/tsql.c: - * src/replacements/asprintf.c src/tds/query.c: - - fixes some cross compile issues with hp-ux - -Mon Aug 21 11:08:37 CET 2006 Frediano Ziglio - * src/dblib/dblib.c: remove small buffer overflow - -Thu Aug 17 11:13:40 CET 2006 Frediano Ziglio - * configure.ac include/tds.h src/dblib/unittests/Makefile.am: - * src/tds/net.c src/tds/query.c src/tds/token.c src/tds/util.c: - * m4/acx_pthread.m4(added): - - timeout more precise and use monotonic clock if available - - check pthread support more deeply - -Wed Aug 16 13:04:48 CET 2006 Frediano Ziglio - * src/tds/net.c: cleanup, fix possible problem under Linux - * src/tds/read.c: avoid invalid in_pos value on tds_peek - -Mon Aug 14 19:12:58 CET 2006 Frediano Ziglio - * src/ctlib/blk.c src/dblib/bcp.c src/dblib/dblib.c: - * src/dblib/unittests/common.c: - - fix warnings compiling with SUN cc - * src/dblib/unittests/thread.c: make error more verbose - -Sun Aug 13 15:02:40 CET 2006 Frediano Ziglio - * src/odbc/odbc.c src/odbc/unittests/data.c: - * src/odbc/unittests/transaction.c: - - fix minor issues with 64-bit machines - -Thu Aug 10 10:10:30 CET 2006 Frediano Ziglio - * src/ctlib/ct.c: fix possible buffer overflow - * src/replacements/gettimeofday.c: add comment - * src/tds/threadsafe.c: better and simple win implementation - * vms/descrip_mms.template win32/config.h: - * win32/dev-cpp/FreeTDS.dev win32/msvc6/libTDS.dsp: - - update build file - -Tue Aug 08 19:14:32 CET 2006 Frediano Ziglio - * doc/htdoc/index.html: update link - * src/tds/query.c: add comment - -Tue Aug 08 16:42:39 CET 2006 Frediano Ziglio - * src/tds/query.c src/tds/util.c: - - fix timeout problem setting correctly query_start_time - -Tue Aug 08 14:43:50 CET 2006 Frediano Ziglio - * src/odbc/unittests/Makefile.am: - * src/odbc/unittests/timeout2.c(added): - - added a test for timeout problem (cf "Query Time Out" on ML) - -Mon Aug 07 21:37:39 CET 2006 Frediano Ziglio - * include/tdsstring.h src/odbc/odbc_util.c: - * src/replacements/iconv.c src/tds/challenge.c: - * src/tds/config.c src/tds/convert.c: - * src/tds/iconv.c src/tds/mem.c src/tds/net.c: - * src/tds/query.c src/tds/read.c src/tds/tdsstring.c: - * src/tds/token.c src/tds/write.c: - - updated doxygen comments - -Sun Aug 06 17:54:11 CET 2006 Frediano Ziglio - * freetds.spec.in: fix rpm build on suse - -Thu Aug 03 20:30:07 CET 2006 Frediano Ziglio - * NEWS include/tds.h src/ctlib/ct.c src/odbc/odbc.c: - * src/tds/mem.c src/tds/query.c src/tds/tds_checks.c: - * src/tds/token.c src/tds/util.c: - - use reference counting for TDSCURSOR to avoid memory errors - -Thu Aug 03 10:32:37 CET 2006 Frediano Ziglio - * src/tds/unittests/iconv_fread.c(added): - * src/tds/iconv.c src/tds/unittests/.cvsignore: - * src/tds/unittests/Makefile.am: - - fix tds_iconv_fread and add a test for it - -Mon Jul 31 13:27:53 EDT 2006 JK Lowden - * src/dblib/bcp.c - - proper error message for using bcp with TDS version 4.2 - -Mon Jul 31 13:23:44 EDT 2006 JK Lowden - * include/sybdb.h src/dblib/dblib.c - - proper error message for using bcp with TDS version 4.2 - -Thu Jul 27 15:22:27 EDT 2006 JK Lowden - * samples/odbc_rpc.pl use fetchrow_array - * src/tds/unittests/Makefile.am include parent directory - -Tue Jul 25 10:16:45 CET 2006 Frediano Ziglio - * configure.ac m4/ac_nullzero.m4: add test for portability - -Tue Jul 25 10:10:22 CET 2006 Frediano Ziglio - * src/odbc/unittests/paramcore.c: updated - -Mon Jul 24 11:39:13 CET 2006 Frediano Ziglio - * src/odbc/unittests/prepclose.c: - - test with SQLExecDirect - -Mon Jul 17 15:18:48 CET 2006 Frediano Ziglio - * src/dblib/unittests/build_dsw.pl(removed): - * win32/build_dsw.pl(added) src/dblib/unittests/Makefile.am: - * src/odbc/unittests/Makefile.am: - - add a Makefile target to build projects for msvc6 - -Thu Jul 13 10:20:45 CET 2006 Frediano Ziglio - * include/tdsodbc.h src/odbc/odbc.c src/odbc/unittests/moreandcount.c: - - remove next_row_count, now useless... rpc.c works the same - -Wed Jul 12 13:23:43 EDT 2006 JK Lowden - * src/odbc/odbc.c src/tds/token.c: - - use TDS_NO_COUNT instead of bad rows_affected for next_row_count. - - src/odbc/unittests/rpc.c now works - -Wed Jul 12 16:15:14 CET 2006 Frediano Ziglio - * misc/test-other.sh: add file log - * src/odbc/unittests/rpc.c: fix uninitialized error - -Tue Jul 11 17:52:43 EDT 2006 JK Lowden - * src/odbc/odbc.c src/odbc/unittests/rpc.c: - - Better logging - -Tue Jul 11 17:28:34 CET 2006 Frediano Ziglio - * src/dblib/unittests/done_handling.c: improve - -Tue Jul 11 17:27:26 CET 2006 Frediano Ziglio - * src/odbc/unittests/paramcore.c: - - fix compatibility with sybase - -Tue Jul 11 11:56:53 CET 2006 Frediano Ziglio - * misc/online.pl: generate more friendly names - -Mon Jul 10 17:07:00 EDT 2006 JK Lowden - * src/tds/token.c src/dblib/dblib.c src/dblib/unittests/rpc.c - - dbresults does not return on DONEPROC - -Sun Jul 09 12:52:45 CET 2006 Frediano Ziglio - * doc/Makefile.am: fix compatibility problem - * src/odbc/unittests/rpc.c: fix warning - -Fri Jul 7 19:08:44 EDT 2006 JK Lowden - * include/sybdb.h src/dblib/dblib.c src/tds/token.c: - - Better logging - -Wed Jul 05 14:45:08 CET 2006 Frediano Ziglio - * src/dblib/unittests/Makefile.am src/dblib/unittests/bcp.c: - * src/dblib/unittests/common.c src/dblib/unittests/common.h: - * src/dblib/unittests/dbmorecmds.c: - * src/dblib/unittests/done_handling.c: - * src/dblib/unittests/rpc.c src/dblib/unittests/t0001.c: - * src/dblib/unittests/t0002.c src/dblib/unittests/t0003.c: - * src/dblib/unittests/t0004.c src/dblib/unittests/t0005.c: - * src/dblib/unittests/t0006.c src/dblib/unittests/t0007.c: - * src/dblib/unittests/t0008.c src/dblib/unittests/t0009.c: - * src/dblib/unittests/t0011.c src/dblib/unittests/t0012.c: - * src/dblib/unittests/t0013.c src/dblib/unittests/t0014.c: - * src/dblib/unittests/t0015.c src/dblib/unittests/t0016.c: - * src/dblib/unittests/t0017.c src/dblib/unittests/t0018.c: - * src/dblib/unittests/t0019.c src/dblib/unittests/t0020.c: - * src/dblib/unittests/t0021.c src/dblib/unittests/t0022.c: - * src/dblib/unittests/t0023.c src/dblib/unittests/text_buffer.c: - * src/dblib/unittests/thread.c: - * src/dblib/unittests/build_dsw.pl(added): - - put include stuff in common.h - - fix compile with ms dblib - - simplify testing under windows creating project files - -Wed Jul 5 18:29:21 EDT 2006 JK Lowden - * src/dblib/dblib.c src/dblib/rpc.c: - - removed nonprintable characters from TDSDUMP log - -Wed Jul 5 15:43:24 EDT 2006 JK Lowden - * src/dblib/unittests/rpc.c src/odbc/unittests/rpc.c: - - more thorough tests, currently fail - -Tue Jul 04 17:13:08 CET 2006 Frediano Ziglio - * src/odbc/unittests/Makefile.am: - * src/odbc/unittests/paramcore.c(added): - * src/odbc/unittests/.cvsignore src/odbc/sql2tds.c: - - test for core using SQLBindParameter, small fix - -Mon Jul 03 13:09:40 CET 2006 Frediano Ziglio - * src/odbc/odbc.c: - - assure there is always an error when SQL_ERROR is returned - - fix warning - -Fri Jun 30 10:31:49 EDT 2006 JK Lowden - * src/odbc/sql2tds.c assert good pointer in case user passed NULL - * src/odbc/unittests/Makefile.am src/odbc/unittests/rpc.c - - added new unit test, similar to that used in dblib. - -Thu Jun 29 17:05:35 CET 2006 Frediano Ziglio - * NEWS src/tds/challenge.c: - - fix small buffer overflow - - reuse buffer - -Thu Jun 29 14:07:42 CET 2006 Frediano Ziglio - * include/tds.h src/tds/Makefile.am src/tds/challenge.c: - * src/tds/login.c src/tds/token.c: - - add NTLM2 Session Response support - -Tue Jun 27 15:47:46 CET 2006 Frediano Ziglio - * src/dblib/unittests/done_handling.c: - - improve - - update style - - fix typo - -Mon Jun 26 16:10:02 CET 2006 Frediano Ziglio - * phptests/rpc2.php(added): - - test from Ellert van Koperen (cf "SP parameters" and - http://kb.vankoperen.nl/freetds-problems.html) - -Sun Jun 25 10:12:48 CET 2006 Frediano Ziglio - * src/odbc/unittests/warning.c: - - tested - - fix portability problem with former Sybase db - - test returned warning - -Sun Jun 25 09:50:00 CET 2006 Frediano Ziglio - * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: - * src/odbc/unittests/warning.c(added): - - added warning test from John K. Hohm (cf - "Warning return as copy of last result row" on ML) - * src/odbc/unittests/describecol.c: compile fix - -Wed Jun 21 17:03:55 CET 2006 Frediano Ziglio - * src/odbc/unittests/describecol.c: - * src/odbc/unittests/describecol.in(added): - - rewrote describecol test - -Wed Jun 21 09:26:02 CET 2006 Frediano Ziglio - * src/odbc/odbc.c: improve column_length - * src/odbc/odbc_util.c: fix for odbc_sql_to_displaysize - * src/tds/iconv.c: invalid iconv_t is only -1, not NULL - -Tue Jun 20 17:52:19 EDT 2006 Nick Castellano - * src/odbc/unittests/array_out.c: - - rename variable to avoid libc symbol conflict - -Tue Jun 20 14:38:03 CET 2006 Frediano Ziglio - * src/tds/convert.c: use macro in sprintf - -Tue Jun 20 14:34:03 CET 2006 Frediano Ziglio - * src/tds/mem.c: small macro to allocate columns - -Tue Jun 20 14:33:09 CET 2006 Frediano Ziglio - * src/odbc/unittests/describecol.c: improved a lot - -Tue Jun 20 11:15:16 CET 2006 Frediano Ziglio - * src/odbc/odbc.c: catch error better - -Mon Jun 19 10:38:36 CET 2006 Frediano Ziglio - * freetds.spec.in misc/test-other.sh src/apps/Makefile.am: - * src/ctlib/Makefile.am src/dblib/Makefile.am src/odbc/Makefile.am: - * src/server/Makefile.am src/tds/Makefile.am: - * src/tds/unittests/Makefile.am: - - do not make libTDS shared library any more - -Mon Jun 19 09:57:23 CET 2006 Frediano Ziglio - * src/ctlib/ct.c src/odbc/sql2tds.c src/odbc/unittests/data.c: - * src/server/unittest.c: - - remove warning compiling with gcc4 - -Thu Jun 15 14:15:24 CET 2006 Frediano Ziglio - * configure.ac src/ctlib/unittests/cancel.c: - * src/dblib/unittests/common.c src/odbc/Makefile.am: - * src/replacements/readpassphrase.c: - - finished cross mingw32 - -Wed Jun 14 17:34:56 CET 2006 Frediano Ziglio - * src/odbc/convert_tds2sql.c: fix for date format - -Wed Jun 14 17:29:13 CET 2006 Frediano Ziglio - * configure.ac: add function - * src/apps/Makefile.am src/dblib/unittests/Makefile.am: - * src/dblib/unittests/bcp.c src/odbc/unittests/Makefile.am: - * src/replacements/Makefile.am src/replacements/gettimeofday.c: - * src/tds/unittests/Makefile.am: - - more fixes for cross mingw32 - -Wed Jun 14 13:26:42 CET 2006 Frediano Ziglio - * include/tds_sysdep_private.h src/apps/Makefile.am: - - fix for cross mingw32 - * src/odbc/unittests/describecol.c: report more clearly problems - -Tue Jun 13 20:17:16 CET 2006 Frediano Ziglio - * src/odbc/unittests/common.h src/server/unittest.c: - - small fixes for cross mingw - -Tue Jun 13 14:38:34 CET 2006 Frediano Ziglio - * src/odbc/unittests/prepclose.c(added) configure.ac: - * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: - - add test to test error closing connection on SQLPrepare - -Mon Jun 12 22:02:57 CET 2006 Frediano Ziglio - * m4/sprintf_i64_format.m4: fix for cross mingw32 - -Mon Jun 12 21:52:24 CET 2006 Frediano Ziglio - * src/odbc/sql2tds.c: fix for possible uninitialized variable - -Mon Jun 12 21:48:15 CET 2006 Frediano Ziglio - * src/apps/datacopy.c src/apps/freebcp.c src/apps/freebcp.h: - * src/pool/main.c src/pool/pool.h: - - fix some issues cross compiling for mingw32 - -Mon Jun 12 16:55:59 CET 2006 Frediano Ziglio - * src/odbc/unittests/data.c: add test for date to char - -Fri Jun 9 14:33:31 EDT 2006 Nick Castellano - * src/apps/tsql.c: inhibit readline tab completion in tsql - -Fri Jun 09 11:50:55 EDT 2006 Nick Castellano - * locales.conf: use same date format as Sybase in default and en_US - -Thu Jun 08 10:18:50 CET 2006 Frediano Ziglio - * src/tds/unittests/t0007.c: - - improved to detect possible date problems - -Wed Jun 07 14:37:56 EDT 2006 Nick Castellano - * src/tds/convert.c: correctly convert dates in January - -Tue Jun 06 12:02:10 CET 2006 Frediano Ziglio - * configure.ac src/tds/config.c: - - fix tsql -C for sybase compatibility - -Tue Jun 06 11:32:24 CET 2006 Frediano Ziglio - * src/tds/mem.c: use calloc instead of malloc/memset - -Mon Jun 05 13:42:24 CET 2006 Frediano Ziglio - * src/ctlib/ct.c src/tds/token.c: - - style and cleanup - -Mon May 29 13:38:05 CET 2006 Frediano Ziglio - * m4/sprintf_i64_format.m4: fix quoting - -Mon May 29 12:58:38 CET 2006 Frediano Ziglio - * NEWS include/tds.h src/tds/token.c: - - make tds_alloc_get_string static - -Mon May 15 17:11:54 CET 2006 Frediano Ziglio - * src/odbc/odbc.c: - - applied fixes from Charlene Herring (cf. "Problems when - using odbc : SQLPutData, SQLExecDirect,Decimals" 2006/05/14 - -Sun May 14 14:34:04 CET 2006 Frediano Ziglio - * src/odbc/descriptor.c: fix memory error - -Sat May 13 10:49:40 CET 2006 Frediano Ziglio - * src/odbc/unittests/copydesc.c: improve - -Mon May 08 11:38:30 CET 2006 Frediano Ziglio - * src/odbc/descriptor.c src/odbc/unittests/Makefile.am: - * src/odbc/unittests/copydesc.c(added): add test for SQLCopyDesc - -Fri Apr 21 17:10:00 CET 2006 Frediano Ziglio - * src/odbc/sql2tds.c: use new tds_convert types - -Fri Apr 21 09:45:56 CET 2006 Frediano Ziglio - * doc/htdoc/faq.html: fix html compatibility - -Thu Apr 20 12:10:28 CET 2006 Frediano Ziglio - * src/ctlib/unittests/ct_dynamic.c: remove leak in test - -Tue Apr 17 19:47:57 CET 2006 Frediano Ziglio - * src/ctlib/ct.c: fix double free - -Mon Apr 17 10:51:09 CET 2006 Frediano Ziglio - * src/odbc/convert_tds2sql.c src/odbc/prepare_query.c: - - use new conversion style in ODBC - -Sun Apr 16 10:11:32 CET 2006 Frediano Ziglio - * include/tds.h src/tds/locale.c src/tds/mem.c: - - TDSLOCALE changes to keep ABI - -Sat Apr 15 10:18:29 CET 2006 Frediano Ziglio - * include/tdsconvert.h * src/tds/convert.c: - - add new type of conversion for copy optimizations - -Sat Apr 15 10:02:20 CET 2006 Frediano Ziglio - * src/odbc/unittests/describecol.c: fix for older Sybase versions - * src/tds/config.c: optimize option read - -Sat Apr 15 09:03:34 CET 2006 Frediano Ziglio - * src/odbc/unittests/describecol.c: remove warning - -Fri Apr 14 15:22:02 CET 2006 Frediano Ziglio - * src/odbc/unittests/describecol.c: - - improved - -Fri Apr 14 13:55:09 CET 2006 Frediano Ziglio - * src/odbc/unittests/describecol.c: - - add test for precision returned by SQLDescribeCol - -Wed Apr 12 21:41:51 CET 2006 Frediano Ziglio - * locales.conf: fix charset typo - * doc/userguide.sgml: fix attributes for locales.conf - -Wed Apr 12 15:53:18 CET 2006 Frediano Ziglio - * include/tds.h include/tds_sysdep_private.h: - * include/tds_sysdep_public.h.in include/tdsconvert.h: - * include/tdsver.h.in: - - avoid ident strings in all objects - * m4/sprintf_i64_format.m4: add Ld format - -Tue Apr 11 16:33:41 CET 2006 Frediano Ziglio - * include/tds_sysdep_public.h.in include/tdsver.h.in: - - small constification - -Tue Apr 11 13:51:43 CET 2006 Frediano Ziglio - * src/odbc/unittests/connect.c: do not fail if not FreeTDS - * src/odbc/unittests/raiserror.c: more verbose - -Mon Apr 10 18:14:17 EDT 2006 JK Lowden - * include/tds.h src/apps/tsql.c src/tds/config.c - - report sysconfdir with tsql -C - -Mon Apr 10 11:59:53 CET 2006 Frediano Ziglio - * src/odbc/odbc.c: cleanup - -Fri Apr 07 09:38:45 CET 2006 Frediano Ziglio - * misc/test-other.sh: update to php 5.1 - * phptests/nextres.php: a bit more verbose - -Thu Apr 06 11:37:45 CET 2006 Frediano Ziglio - * misc/coverage.sh: less verbose - * src/dblib/bcp.c: small change - -Wed Apr 05 08:42:54 CET 2006 Frediano Ziglio - * misc/full-test.sh: cleanup - * misc/test-auto.sh: allow configuration - * misc/test-other.sh: make output suitable for online.pl - * src/apps/tsql.c: - - improve documentation - - fix problem for multiple options - * src/odbc/odbc.c src/tds/token.c: avoid void message to application - -Wed Apr 05 07:09:32 CET 2006 Frediano Ziglio - * src/odbc/odbc.c: remove some warnings - -Wed Mar 29 18:25:54 CET 2006 Frediano Ziglio - * m4/ac_caolan_func_which_gethostbyname_r.m4: - * m4/ac_have_inaddr_none.m4 m4/ac_have_malloc_options.m4: - * m4/ac_raf_func_which_getservbyname_r.m4: - * m4/ac_tds_func_which_gethostbyaddr_r.m4: - * m4/ac_tds_func_which_getpwuid_r.m4: - * m4/ac_tds_func_which_localtime_r.m4: - * m4/ax_cflags_gcc_option.m4 m4/lib-link.m4: - * m4/sprintf_i64_format.m4 m4/type_socklen_t.m4: - - quote as necessary - -Mon Mar 27 19:01:05 EST 2006 JK Lowden - * configure.ac - * m4/ac_caolan_func_which_gethostbyname_r.m4 - * m4/ac_have_inaddr_none.m4 - * m4/ac_have_malloc_options.m4 - * m4/ac_raf_func_which_getservbyname_r.m4 - * m4/ac_tds_func_which_gethostbyaddr_r.m4 - * m4/ac_tds_func_which_getpwuid_r.m4 - * m4/ac_tds_func_which_localtime_r.m4 - * m4/ax_cflags_gcc_option.m4 - * m4/sprintf_i64_format.m4 - * m4/type_socklen_t.m4 - * src/ctlib/unittests/Makefile.am - * src/dblib/unittests/Makefile.am - * src/odbc/unittests/Makefile.am - * src/tds/unittests/Makefile.am - - removed/updated obsolete autoconf macros - * m4/am_iconv.m4 removed - * m4/README.iconv - * m4/iconv.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 - - added from GNU libiconv - -Mon Mar 27 09:48:56 EST 2006 JK Lowden - * doc/htdoc/index.html corrected nightly test link - -Mon Mar 27 10:17:42 CET 2006 Frediano Ziglio - * src/dblib/rpc.c: allow again null for fixed types - -Mon Mar 27 02:20:16 EST 2006 JK Lowden - * configure.ac m4/am_iconv.m4 m4/check_openssl.m4 - * src/apps/Makefile.am src/ctlib/Makefile.am src/dblib/Makefile.am - * src/odbc/Makefile.am src/pool/Makefile.am src/replacements/Makefile.am - * src/server/Makefile.am src/tds/Makefile.am - - modernized autotool contructs - * configure.in removed - -Sun Mar 26 19:01:43 CET 2006 Frediano Ziglio - * src/odbc/prepare_query.c: - - fixed constant parameters after mssql 2005 patch - -Fri Mar 24 16:47:26 EST 2006 JK Lowden - * configure.in removed, is now configure.ac - * acinclude.m4 removed, added m4 directory - * Makefile.am include m4 directory - * m4/ac_caolan_func_which_gethostbyname_r.m4 m4/ac_have_inaddr_none.m4 - * m4/ac_have_malloc_options.m4 m4/ac_raf_func_which_getservbyname_r.m4 - * m4/ac_tds_func_which_gethostbyaddr_r.m4 - * m4/ac_tds_func_which_getpwuid_r.m4 - * m4/ac_tds_func_which_localtime_r.m4 m4/am_iconv.m4 - * m4/check_openssl.m4 m4/sprintf_i64_format.m4 m4/type_socklen_t.m4 - - Split acinclude.m4 into one macro defintion per file. - * m4/ax_cflags_gcc_option.m4 - - Check for gcc features e.g. the declaration-after-statement warning. - -Fri Mar 24 13:03:36 EST 2006 JK Lowden - * doc/htdoc/docs.html doc/htdoc/index.html updated - -Fri Mar 24 12:36:02 EST 2006 JK Lowden - * doc/htdoc/software.html fixed broken links added link to RC - -Fri Mar 24 16:27:27 CET 2006 Frediano Ziglio - * misc/full-test.sh misc/test-auto.sh misc/full-test-ol.sh(removed): - - use an "online" version for test - -Thu Mar 23 15:53:45 CET 2006 Frediano Ziglio - * src/odbc/sql2tds.c src/odbc/unittests/earlybind.c: - * src/odbc/unittests/norowset.c src/odbc/unittests/t0004.c: - * src/odbc/unittests/tables.c src/tds/data.c src/tds/tds_checks.c: - - fixes for mssql 2005 - -Thu Mar 23 13:48:23 CET 2006 Frediano Ziglio - * src/tds/query.c: partially fix problem with mssql2k5 - -Thu Mar 23 11:44:32 CET 2006 Frediano Ziglio - * misc/full-test-ol.sh misc/online.pl misc/test-auto.sh: - - changed online.pl with James hints - - enable Valgrind tests using online check - -Tue Mar 21 15:24:04 CET 2006 Frediano Ziglio - * src/odbc/unittests/cursor2.c(aded) src/odbc/unittests/Makefile.am: - - added test to check errors using cursor on no row statement - -Tue Mar 21 13:22:07 CET 2006 Frediano Ziglio - * src/odbc/native.c: - - applied patch from Richard Krehbiel (cf "ODBC datetime literal issue") - -Tue Mar 21 08:49:44 CET 2006 Frediano Ziglio - * configure.in src/dblib/dblib.c: - - fix declaration after statements - -Mon Mar 20 15:28:25 CET 2006 Frediano Ziglio - * src/dblib/bcp.c: fix error in bcp_colfmt - -Mon Mar 20 15:00:45 CET 2006 Frediano Ziglio - * src/dblib/bcp.c src/dblib/dblib.c src/dblib/rpc.c: - - remove some double checks - - return correct values from CHECK_PARAMETER - - fix some possible core if dbproc == NULL - -Mon Mar 20 09:42:55 CET 2006 Frediano Ziglio - * misc/full-test.sh: added timeout - -Sun Mar 19 18:34:47 CET 2006 Frediano Ziglio - * misc/test-auto.sh: fix typo in header - * src/dblib/dblib.c: remove double checks - -Sun Mar 19 18:33:14 CET 2006 Frediano Ziglio - * src/odbc/unittests/genparams.c src/odbc/unittests/transaction.c: - - remove warnings on 64bit int - -Sun Mar 19 09:27:09 EST 2006 JK Lowden - * src/dblib/bcp.c src/dblib/dblib.c more logging repairs - -Sat Mar 18 12:34:02 EST 2006 JK Lowden - * include/dblib.h src/dblib/bcp.c - - validate parameters. Unable to run unittest due to down server. - -Sat Mar 18 01:27:32 EST 2006 JK Lowden - * include/dblib.h src/dblib/dblib.c src/dblib/rpc.c - - test parameters for all public functions (except bcp) - -Fri Mar 17 01:35:17 EST 2006 JK Lowden - * src/dblib/dblib.c src/dblib/rpc.c - - added a TDSDUMP log entry for every public function - -Thu Mar 16 09:59:25 EST 2006 JK Lowden - * TODO add rpc error messages - * src/apps/bsqldb.c exit if severity > 10 - -Wed Mar 15 00:41:11 EST 2006 JK Lowden - * doc/freebcp.txt The freebcp manpage was seriously out of date. - * src/apps/freebcp.c give better error message. - -Thu Mar 9 14:33:37 CET 2006 Frediano Ziglio - * include/tdsodbc.h src/odbc/odbc.c: - - add cursor_type to connection attributes (required for DBD::ODBC) - - removed small TODO on error report - -Mon Mar 6 12:55:10 CET 2006 Frediano Ziglio - * include/tds.h src/ctlib/ct.c src/odbc/connectparams.c: - * src/pool/util.c src/server/login.c src/server/unittest.c: - * src/tds/config.c src/tds/login.c src/tds/mem.c: - - renamed host_name field to client_host_name - - optimize way strings are allocated - -Fri Feb 24 15:04:35 EST 2006 JK Lowden - * src/tds/config.c src/tds/login.c: - - nicer TDSDUMPCONFIG output, including a recap - -Sun Feb 19 14:56:15 CET 2006 Frediano Ziglio - * src/odbc/odbc.c: fix wrong declaration - -Thu Feb 16 08:30:00 CET 2006 Frediano Ziglio - * src/odbc/unittests/scroll.c src/odbc/unittests/raiserror.c: - * src/odbc/unittests/cursor1.c: - - remove warning compiling with gcc4 - * misc/test-other.sh: fix problem with DBD:ODBC test - -Mon Feb 13 17:11:30 CET 2006 Frediano Ziglio - * src/odbc/unittests/genparams.c: add BIGINT type to test - -Wed Feb 8 10:48:36 CET 2006 Frediano Ziglio - * include/tdsodbc.h src/odbc/error.c src/odbc/odbc.c: - * vms/odbc_driver_axp.opt win32/FreeTDS.def: - - start cursor stuff for odbc - - added SQLSetScrollOptions - * src/odbc/unittests/scroll.c: support more fetch types - -Tue Feb 7 15:42:56 CET 2006 Frediano Ziglio - * include/tds.h src/tds/query.c src/ctlib/ct.c NEWS: - - improve cursor support - -Tue Feb 7 14:22:50 CET 2006 Frediano Ziglio - * src/odbc/unittests/scroll.c(added): - * src/odbc/unittests/.cvsignore: - * src/odbc/unittests/Makefile.am: - * src/odbc/unittests/cursor1.c: - - add scroll test for cursor - - build msvc project for odbc unittests - * src/dblib/unittests/Makefile.am: add done_handling test - -Mon Feb 6 16:50:05 CET 2006 Frediano Ziglio - * include/sybdb.h src/apps/freebcp.c src/dblib/bcp.c: - - implemented BCPKEEPIDENTITY for bcp_control - - make freebcp do not depend on dblib internals - -Mon Feb 6 16:44:27 CET 2006 Frediano Ziglio - * src/odbc/unittests/.cvsignore src/odbc/unittests/cursor1.c: - - update cursor1 test - -Thu Feb 2 15:33:21 CET 2006 Frediano Ziglio - * NEWS: updated - * src/odbc/odbc.c vms/odbc_driver_axp.opt win32/FreeTDS.def: - - compile SQLSetPos function - * src/odbc/unittests/Makefile.am src/odbc/unittests/cursor1.c(added): - - added a test for cursors (do not work...) - -Tue Jan 31 14:27:51 CET 2006 Frediano Ziglio - * src/apps/freebcp.c src/dblib/bcp.c: - - fix broken charcater conversion - - use calloc instead of malloc/memset - - support 64bit file on win32 - -Tue Jan 31 09:59:28 CET 2006 Frediano Ziglio - * src/dblib/dblib.c: do more argument check - -Mon Jan 30 16:29:20 CET 2006 Frediano Ziglio - * src/ctlib/unittests/blk_out.c src/ctlib/unittests/ct_cursor.c: - * src/ctlib/unittests/ct_cursors.c src/ctlib/unittests/ct_dynamic.c: - * src/dblib/unittests/t0005.c src/dblib/unittests/t0014.c: - * src/dblib/unittests/t0022.c src/dblib/unittests/thread.c: - - reduce false errors - -Sat Jan 28 15:49:55 CET 2006 Frediano Ziglio - * src/dblib/bcp.c: - - update row allocation using new row_free - - fix native format - - correctly check and handle EOF - - change _bcp_build_bcp_record to direct send row (renamed to - _bcp_send_bcp_record) - - write error file only if needed - * src/dblib/unittests/t0016.c: improved - * src/dblib/unittests/t0016.in: - - make input same of output - * src/dblib/unittests/t0017.c: get all data - * src/tds/mem.c: reset pointer just freed - -Sat Jan 28 09:39:10 CET 2006 Frediano Ziglio - * src/dblib/unittests/t0017.c: reformat output - -Fri Jan 27 14:34:09 EST 2006 JK Lowden - * src/dblib/bcp.c recognize EOF errors from _bcp_read_hostfile - -Fri Jan 27 10:43:54 EST 2006 JK Lowden - * src/dblib/unittests/t0017.c better feedback - -Thu Jan 26 13:58:51 CET 2006 Frediano Ziglio - * src/apps/freebcp.c src/apps/freebcp.h: - - support for NUL in terminators - -Wed Jan 25 15:33:20 CET 2006 Frediano Ziglio - * src/dblib/bcp.c: fix return test for fseeko - -Wed Jan 25 15:01:51 CET 2006 Frediano Ziglio - * acinclude.m4 configure.in src/tds/numeric.c: - - use 64bit sprintf format if available - * misc/test-other.sh: redirect odbc to compiled driver - -Tue Jan 24 16:01:41 CET 2006 Frediano Ziglio - * NEWS include/tds.h src/apps/tsql.c src/ctlib/blk.c: - * src/ctlib/ct.c src/dblib/bcp.c src/dblib/buffering.h: - * src/dblib/dblib.c src/dblib/rpc.c src/odbc/odbc.c: - * src/odbc/odbc_util.c src/odbc/prepare_query.c: - * src/odbc/sql2tds.c src/pool/stream.c src/server/server.c: - * src/tds/mem.c src/tds/query.c src/tds/tds_checks.c: - * src/tds/token.c src/tds/unittests/dataread.c: - * src/tds/unittests/dynamic1.c src/tds/unittests/t0002.c: - * src/tds/unittests/t0004.c src/tds/unittests/t0005.c: - * src/tds/unittests/t0006.c src/tds/unittests/utf8_1.c: - * src/tds/unittests/utf8_2.c: - - use direct pointer column_data instead of old column_offset - -Mon Jan 23 17:30:38 EST 2006 JK Lowden - * src/apps/bsqldb.c bind to printable width, not column size - -Mon Jan 23 14:04:44 CET 2006 Frediano Ziglio - * configure.in: start developing 0.65 version -$Id: ChangeLog-0.82,v 1.1.2.2 2008/01/10 20:58:43 jklowden Exp $ diff --git b/INSTALL.CVS a/INSTALL.CVS index c23f6b7..d42c3aa 100644 --- b/INSTALL.CVS +++ a/INSTALL.CVS @@ -16,9 +16,9 @@ connecting to the CVS server. Then follow these steps: Autotool versions that work: $ (autoconf --version; automake --version; libtool --version) |grep GNU - autoconf (GNU Autoconf) 2.60 - automake (GNU automake) 1.9.6 - ltmain.sh (GNU libtool) 1.5.18 (1.1220.2.245 2005/05/16 08:55:27) + autoconf (GNU Autoconf) 2.59 + automake (GNU automake) 1.9.5 + ltmain.sh (GNU libtool) 1.5.14 (1.1220.2.195 2005/02/12 12:12:33) The above are used to generate the distributions. You may get away with older versions, as far back as 2.53 for autoconf. @@ -44,10 +44,10 @@ connecting to the CVS server. Then follow these steps: +++ -You are not required to rely on SourceForge's anonymous CVS server, which at +You are not required to rely on Source Forge's anonymous CVS server, which at the present time (July 2004) runs up to 1 hour behind the development server. You can fetch the CVS tarball (the basis for a CVS server, not a snapshot) from -SourceForge at: +Source Forge at: http://cvs.sourceforge.net/cvstarballs/freetds-cvsroot.tar.bz2 @@ -62,4 +62,4 @@ the CVS tree via rsync: $ rsync -av rsync://freetds.cvs.sourceforge.net/cvsroot/freetds/* . -- -$Id: INSTALL.CVS,v 1.7.2.1 2008/01/10 20:58:43 jklowden Exp $ +$Id: INSTALL.CVS,v 1.7 2007/04/05 14:17:05 freddy77 Exp $ diff --git b/NEWS a/NEWS index fd44001..851fbce 100644 --- b/NEWS +++ a/NEWS @@ -1,63 +1,33 @@ -$Id: NEWS,v 1.43.2.1 2008/01/10 20:58:43 jklowden Exp $ - -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 +$Id: NEWS,v 1.43 2008/01/08 13:29:40 freddy77 Exp $ +* 0.82 +- support NUL characters inside terminators in freebcp +- cursors under ODBC (mssql) - NTLM2 session response -- read table and real column name from wire -- experimental Kerberos support using gssapi +- lot of update to TDS protocol documentation - some optimizations for GCC4 - optimized conversions avoiding some memory copy - minor improves to server stuff -- improved MingW compile (even cross one) +- add row termination and column termination option to tsql +- improve locale stuff on ctlib + added cs_loc_alloc, cs_loc_drop, cs_locale implementations +- improve MingW compile (even cross one) +- implement dbsetnull on dblib +- improve dblib error reporting and check - more verbose log for dblib and odbc +- fix rpc parameter on dblib, now php works correctly - many test added 1 test for libTDS 1 test for ctlib 3 tests for dblib 13 tests for odbc +- fix database setting on odbc +- fix timeout stuff +- return always an error if odbc return SQL_ERROR +- fix SQLGetData result +- add freetds.conf option for encryption +- add protocol version discovery +- read table and real column name from wire +- experimental Kerberos support using gssapi libTDS API changes - tds_add_row_column_size removed @@ -68,7 +38,7 @@ libTDS API changes - 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 +- make tds_alloc_get_string static - removed tds_free_cursor - added TDSCURSOR->ref_count - added tds_cursor_deallocated and tds_release_cursor to handle @@ -78,8 +48,8 @@ libTDS API changes 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 +- change DSTR type +- error handler cannot return TDS_INT_EXIT (no more defined) - removed TDSSOCKET->query_timeout_func TDSSOCKET->query_timeout_param, TDSSOCKET->query_start_time - changed TDSLOGIN->host_name to client_host_name @@ -113,6 +83,7 @@ libTDS API changes - 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 diff --git b/README a/README index 2de3e4c..33da879 100644 --- b/README +++ a/README @@ -1,11 +1,12 @@ -README for FreeTDS 0.82 -Thusday 10 January 2008 +$Id: README,v 1.11 2007/04/05 14:17:05 freddy77 Exp $ +README for FreeTDS 0.64 +Saturday 1 July 2006 -* to build FreeTDS read the file INSTALL or - the FreeTDS Users Guide (doc/userguide.tgz) and +* to build FreeTDS read the file INSTALL, +* see also the FreeTDS Users Guide, http://www.freetds.org/userguide/ -FreeTDS is a free implementation of Sybase's db-lib, +FreeTDS is a free (open source) implementation of Sybase's db-lib, ct-lib, and ODBC libraries. FreeTDS builds and runs on every flavor of unix-like systems we've heard of, as well as Win32 (with or without Cygwin), VMS, and Mac OS X. Failure to build on your system is probably @@ -26,8 +27,60 @@ TODO The roadmap, such as it is Also, doc/api_status.txt shows which functions are implemented. -For details on what's new in this version, see NEWS. For unbearable -detail, see ChangeLog-0.82. +************************************ +** Warning regarding Sybase 12.5! ** +************************************ + +Do Not Use TDS version 4.2 to connect to Sybase 12.5. Please! + +While we don't like to put the bad news first, neither do we want you to +hurt your server. We know that our implementation of TDS 4.2 gives +Sybase 12.5 a bad case of heartburn. In short: it crashes the server. + +We don't know what it is about our version of TDS 4.2 that Sybase 12.5 +doesn't like, and we'd like to figure it out eventually. But in the +meanwhile, until we can find the problem and fix it, please don't use +that combination. Unless you want to help us test it, that is. + +FreeTDS 0.63 works fine with Sybase 12.5 if you use TDS version 5.0. + +If you are using Sybase 12.5 and anything above is not clear to you, +please see the User Guide. If it is still not clear after that, please +write to the FreeTDS mailing list. We'd rather answer your questions +while your server is still running. + +Thank you. We return now to your regularly scheduled README, already in +progress. + +New in this version +=================== + +ct-lib +------ + +Ct-lib now sports bcp and cursors. The largest missing feature is now +placeholder support compatible with Perl's DBD::Sybase. + +ODBC +---- + +ODBC continues to be improved. It is now compatible with OpenOffice.org, for +example, and even works with Oracle's OTL libary. It has better 64-bit +support. + +Applications +------------ + +This version includes two new applications, bsqldb and defncopy. See their man +pages for details. + +etc. +---- + +Naturally, there have been other improvements as well. This version compiles +and runs better than its predecessors. + + Documentation ============= @@ -86,6 +139,3 @@ 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. - -$Id: README,v 1.11.2.1 2008/01/10 20:58:43 jklowden Exp $ - diff --git b/TODO a/TODO index 9b7c295..6b770b4 100644 --- b/TODO +++ a/TODO @@ -4,11 +4,11 @@ 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. +anyone else can post a patch to Source Forge. In this way we can communicate with each other about the project's priorities and needs. -To Do List $Id: TODO,v 1.165.2.1 2008/01/10 20:58:43 jklowden Exp $ +To Do List $Id: TODO,v 1.165 2007/12/26 20:56:00 freddy77 Exp $ ------------ Bug? ML 2007-05-30 "dbsqlexec() never returns" @@ -30,13 +30,20 @@ Broken: Work in progress: +Postponed to 0.65 version . log and call error handler on problems with tds_iconv_init(). . iconv - support string conversions for Sybase + - add test for locale_charset() to configure.in. Use it if available + instead of nl_langinfo, because it implies we're using GNU iconv . add doc/htdoc/Makefile with "publish" target to commit cvs and update freetds.org . drop txt2man from cvs, skip building man pages without it. . be able to disable iconv for BCP (see Sybase documentation) +. userguide + - update table of working configurations + server (vendor, version, platform) - client (freetds version, platform) + - protocol - charsets - date For future versions (in priority order within library): All: @@ -52,6 +59,7 @@ For future versions (in priority order within library): . Add missing constants needed for python and verify working . Add missing constants needed for Gnome-DB and verify working . conversion from ucs2 to utf8, provide for 2+ bytes/character +. tdsping program for testing purposes . Finish off the TDS dissector for ethereal . more solid. handle out of memory conditions (started, we must test all allocation and all function that return allocated data and be able to @@ -73,8 +81,8 @@ For future versions (in priority order within library): (too complicate, see ctlib bulk, cf "bulk copy and row buffer") . improve cursor support on dblib and ctlib . support for VARIANT type (requested one time, 2003-8-1) -. support for NT named pipe (requested long ago for mssql6.5 server, only - for completeness). If the reader knows a library to handle named pipes +. support for NT named pipe (requested many time ago for mssql6.5 server, only + for completeness). If anybody knows a library to handle named pipes compatible with LGPL please tell us. . read on partial packet, do not wait entire one . detect if realloc/free accepts NULL pointers (in configure.in) @@ -123,14 +131,6 @@ For future versions (in priority order within library): . report error just before returning SQL_ERROR from inner function? . 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: all binding types (input and output) . test: descriptors work - ODBC 2 type returned (datetime) diff --git b/doc/userguide.sgml a/doc/userguide.sgml index 2a09e0f..d26bb2e 100644 --- b/doc/userguide.sgml +++ a/doc/userguide.sgml @@ -5,8 +5,8 @@ ]> - $Date: 2008/01/10 20:58:43 $ - $Revision: 1.110.2.1 $ + $Date: 2008/01/08 13:29:40 $ + $Revision: 1.110 $ <productname>FreeTDS</productname> User Guide A Guide to Installing, Configuring, and Running FreeTDS @@ -26,7 +26,6 @@ 2005 2006 2007 - 2008 Brian Bruns and James K. Lowden @@ -56,9 +55,9 @@ This guide is here for you, and we hope that you will be here for it, that other The version you're reading is: -$Revision: 1.110.2.1 $ -$Date: 2008/01/10 20:58:43 $ -CVS control number $Id: userguide.sgml,v 1.110.2.1 2008/01/10 20:58:43 jklowden Exp $. +$Revision: 1.110 $ +$Date: 2008/01/08 13:29:40 $ +CVS control number $Id: userguide.sgml,v 1.110 2008/01/08 13:29:40 freddy77 Exp $. can be found on the FreeTDS @@ -202,7 +201,7 @@ project on SourceForge. It is a fork of the Status -The db-lib and ct-lib 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. That is not to say that these drivers are complete; they're not. But they faithfully implement a useful — and widely used — subset of their APIs. +The db-lib and ct-lib 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. That is not to say that these drivers are complete; they're not. But they faithfully implement an important subset of their APIs, enough to be useful. This 0.64 version boasts support for server-side cursors in ct-lib. In addition to the core db-lib API, FreeTDS includes a full implementation of db-lib's bcp functions, as well as freebcp, a replacement for Sybase's bcp utility. @@ -568,7 +567,7 @@ url="http://www.madgoat.com">www.madgoat.com). OS X® - As of this writing ($Date: 2008/01/10 20:58:43 $), the regular distribution compiles on OS X. Releases prior to 0.63 either did not compile or required patching. + As of this writing ($Date: 2008/01/08 13:29:40 $), the regular distribution compiles on OS X. Releases prior to 0.63 either did not compile or required patching. Alternative build procedure @@ -942,7 +941,8 @@ As of 0.62 FreeTDS uses iconv to convert all character data, so there's no need instance instance name none - Name of Microsoft SQL Server instance to connect to. The port will be detected automatically. + Name of Microsoft SQL Server instance to connect to. The port will be detected automatically. + This requires an extra round-trip with server and may thus slightly delay making the connection. debug flags @@ -1512,7 +1512,7 @@ The following table defines all possible ODBC connection attributes for the 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. + Hostname of a server. Used in an ODBC-only configuration. As of version 0.64 you can specify a Microsoft SQL Server instance in the form of server\instance. Port commit b8d8661289abc8745b33e8e24da31decdf21c1bd Author: freddy77 Date: Thu Jan 10 13:22:19 2008 +0000 fix SQLGetData problem diff --git b/src/odbc/unittests/Makefile.am a/src/odbc/unittests/Makefile.am index 8146c2a..8f38676 100644 --- b/src/odbc/unittests/Makefile.am +++ a/src/odbc/unittests/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.68.2.2 2008/01/10 13:22:19 freddy77 Exp $ +# $Id: Makefile.am,v 1.68.2.1 2008/01/10 08:52:46 freddy77 Exp $ TESTS = \ t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT)\ t0004$(EXEEXT) connect$(EXEEXT) print$(EXEEXT)\ @@ -20,7 +20,7 @@ TESTS = \ paramcore$(EXEEXT) timeout2$(EXEEXT) timeout3$(EXEEXT) \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ - attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) + attributes$(EXEEXT) hidden$(EXEEXT) check_PROGRAMS = $(TESTS) @@ -78,7 +78,6 @@ cursor4_SOURCES = cursor4.c common.c common.h cursor5_SOURCES = cursor5.c common.c common.h attributes_SOURCES = attributes.c common.c common.h hidden_SOURCES = hidden.c common.c common.h -blob1_SOURCES = blob1.c common.c common.h AM_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) -DFREETDS_SRCDIR=\"$(srcdir)\" if MINGW32 commit 9fbbe664420fa49e8611bfede300a90dd293229e Author: freddy77 Date: Thu Jan 10 13:13:46 2008 +0000 fix SQLGetData problem diff --git b/ChangeLog a/ChangeLog index d054e6f..ecb6523 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,8 +1,3 @@ -Thu Jan 10 14:12:32 CET 2008 Frediano Ziglio - * src/odbc/odbc.c src/odbc/unittests/.cvsignore: - * src/odbc/unittests/Makefile.am src/odbc/unittests/blob1.c(added): - - fix problem with SQLGetData and blobs - Thu Jan 10 09:51:23 CET 2008 Frediano Ziglio * TODO src/odbc/odbc.c src/odbc/unittests/.cvsignore: * src/odbc/unittests/Makefile.am: diff --git b/src/odbc/odbc.c a/src/odbc/odbc.c index 60c8e00..7d33b27 100644 --- b/src/odbc/odbc.c +++ a/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.2 2008/01/10 13:13:46 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.1 2008/01/10 08:52:45 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -4583,12 +4583,12 @@ SQLGetData(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgb if (*pcbValue < 0) ODBC_RETURN(stmt, SQL_ERROR); - if (is_variable_type(colinfo->column_type) && (fCType == SQL_C_CHAR || fCType == SQL_C_BINARY)) { + if (is_variable_type(colinfo->column_type)) { /* calc how many bytes was readed */ int readed = cbValueMax; /* FIXME test on destination char ??? */ - if (stmt->dbc->env->attr.output_nts != SQL_FALSE && fCType == SQL_C_CHAR /* is_char_type(nSybType) */ && readed > 0) + if (stmt->dbc->env->attr.output_nts != SQL_FALSE && is_char_type(nSybType) && readed > 0) --readed; if (readed > *pcbValue) readed = *pcbValue; diff --git b/src/odbc/unittests/.cvsignore a/src/odbc/unittests/.cvsignore index d7c663e..1316adb 100644 --- b/src/odbc/unittests/.cvsignore +++ a/src/odbc/unittests/.cvsignore @@ -63,4 +63,3 @@ cursor4 cursor5 attributes hidden -blob1 diff --git b/src/odbc/unittests/blob1.c a/src/odbc/unittests/blob1.c deleted file mode 100755 index b8c45b0..0000000 --- b/src/odbc/unittests/blob1.c +++ /dev/null @@ -1,224 +0,0 @@ -/* Testing large objects */ -/* Test from Sebastien Flaesch */ - -#include "common.h" - -static char software_version[] = "$Id: blob1.c,v 1.1.2.2 2008/01/10 13:13:46 freddy77 Exp $"; -static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; - -#define CHECK_RCODE(t,h,m) \ - if ( rcode != SQL_SUCCESS && rcode != SQL_SUCCESS_WITH_INFO && rcode != SQL_NO_DATA && rcode != SQL_NEED_DATA ) { \ - fprintf(stderr,"Error %d at: %s\n",rcode,m); \ - getErrorInfo(t,h); \ - exit(1); \ - } - -#define NBYTES 10000 - -static int failed = 0; - -static void -getErrorInfo(SQLSMALLINT sqlhdltype, SQLHANDLE sqlhandle) -{ - SQLRETURN rcode = 0; - SQLCHAR sqlstate[SQL_SQLSTATE_SIZE + 1]; - SQLINTEGER naterror = 0; - SQLCHAR msgtext[SQL_MAX_MESSAGE_LENGTH + 1]; - SQLSMALLINT msgtextl = 0; - - rcode = SQLGetDiagRec((SQLSMALLINT) sqlhdltype, - (SQLHANDLE) sqlhandle, - (SQLSMALLINT) 1, - (SQLCHAR *) sqlstate, - (SQLINTEGER *) & naterror, - (SQLCHAR *) msgtext, (SQLSMALLINT) sizeof(msgtext), (SQLSMALLINT *) & msgtextl); - fprintf(stderr, "Diagnostic info:\n"); - fprintf(stderr, " SQL State: %s\n", (char *) sqlstate); - fprintf(stderr, " SQL code : %d\n", (int) naterror); - fprintf(stderr, " Message : %s\n", (char *) msgtext); -} - -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 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 -readBlob(SQLHSTMT * stmth, SQLUSMALLINT pos) -{ - SQLRETURN rcode; - char buf[4096]; - SQLLEN len, total = 0; - int i = 0; - int check; - - printf(">> readBlob field %d\n", pos); - while (1) { - i++; - rcode = SQLGetData(stmth, pos, SQL_C_BINARY, (SQLPOINTER) buf, (SQLINTEGER) sizeof(buf), &len); - if (!SQL_SUCCEEDED(rcode) || len <= 0) - break; - if (len > (SQLLEN) sizeof(buf)) - len = (SQLLEN) sizeof(buf); - printf(">> step %d: %d bytes readed\n", i, (int) len); - if (pos == 1) - check = check_chars(buf, len, 123 + total, 1); - else - check = check_chars(buf, len, 987 + total, 25); - if (!check) { - fprintf(stderr, "Wrong buffer content\n"); - failed = 1; - } - total += len; - } - printf(">> total bytes read = %d \n", (int) total); - if (total != 10000) - failed = 1; - return rcode; -} - -int -main(int argc, char **argv) -{ - SQLRETURN rcode; - SQLHSTMT m_hstmt = NULL; - int i; - - int key; - SQLINTEGER vind0; - char buf1[NBYTES]; - SQLINTEGER vind1; - char buf2[NBYTES]; - SQLINTEGER vind2; - int cnt = 2; - - use_odbc_version3 = 1; - Connect(); - - Command(Statement, "IF OBJECT_ID('tt') IS NOT NULL DROP TABLE tt"); - Command(Statement, "CREATE TABLE tt ( k INT, t TEXT, b IMAGE, v INT )"); - - /* Insert rows ... */ - - for (i = 0; i < cnt; i++) { - - m_hstmt = NULL; - rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt); - CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle StmtH"); - - rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "insert into tt values ( ?, ?, ?, ? )", SQL_NTS); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPrepare"); - - SQLBindParameter(m_hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &key, 0, &vind0); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindParameter 1"); - - SQLBindParameter(m_hstmt, 2, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARCHAR, 0x10000000, 0, buf1, 0, &vind1); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindParameter 2"); - - SQLBindParameter(m_hstmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, 0x10000000, 0, buf2, 0, &vind2); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindParameter 3"); - - SQLBindParameter(m_hstmt, 4, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &key, 0, &vind0); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindParameter 4"); - - key = i; - vind0 = 0; - - fill_chars(buf1, NBYTES, 123, 1); - vind1 = SQL_LEN_DATA_AT_EXEC(NBYTES); - - fill_chars(buf2, NBYTES, 987, 25); - vind2 = SQL_LEN_DATA_AT_EXEC(NBYTES); - - printf(">> insert... %d\n", i); - rcode = SQLExecute(m_hstmt); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLExecute StmtH"); - while (rcode == SQL_NEED_DATA) { - char *p; - - rcode = SQLParamData(m_hstmt, (SQLPOINTER) & p); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLParamData StmtH"); - printf(">> SQLParamData: ptr = %p rcode = %d\n", (void *) p, rcode); - if (rcode == SQL_NEED_DATA) { - SQLRETURN rcode = SQLPutData(m_hstmt, p, NBYTES); - - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPutData StmtH"); - printf(">> param %p: total bytes written = %d\n", (void *) p, NBYTES); - } - } - - rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLFreeHandle StmtH"); - - } - - /* No fetch rows ... */ - - for (i = 0; i < cnt; i++) { - - m_hstmt = NULL; - rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt); - CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle StmtH"); - - rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); - rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); - - rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "SELECT t, b, v FROM tt WHERE k = ?", SQL_NTS); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPrepare"); - - SQLBindParameter(m_hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &i, 0, &vind0); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindParameter 1"); - - SQLBindCol(m_hstmt, 1, SQL_C_BINARY, NULL, 0, &vind1); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindCol 2"); - SQLBindCol(m_hstmt, 2, SQL_C_BINARY, NULL, 0, &vind2); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindCol 3"); - SQLBindCol(m_hstmt, 3, SQL_C_LONG, &key, 0, &vind0); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindCol 1"); - - vind0 = 0; - vind1 = SQL_DATA_AT_EXEC; - vind2 = SQL_DATA_AT_EXEC; - - rcode = SQLExecute(m_hstmt); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLExecute StmtH"); - - rcode = SQLFetchScroll(m_hstmt, SQL_FETCH_NEXT, 0); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLFetchScroll StmtH"); - printf(">> fetch... %d rcode = %d\n", i, rcode); - - rcode = readBlob(m_hstmt, 1); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "readBlob 1"); - rcode = readBlob(m_hstmt, 2); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "readBlob 2"); - - rcode = SQLCloseCursor(m_hstmt); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLCloseCursor StmtH"); - - rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLFreeHandle StmtH"); - } - - Disconnect(); - - return failed ? 1 : 0; -} - commit d3d27cd44a61133054de7ee4fa93690d4245c6a1 Author: freddy77 Date: Thu Jan 10 13:11:08 2008 +0000 file blob1.c was added on branch BRANCH0_82 on 2008-01-10 13:13:46 +0000 commit 0b60151b80495fbe39b6b027189a871f889ea980 Author: freddy77 Date: Thu Jan 10 08:52:45 2008 +0000 fix SQLNumResultCols() is wrong (+1) problem diff --git b/ChangeLog a/ChangeLog index ecb6523..edcfcba 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,8 +1,3 @@ -Thu Jan 10 09:51:23 CET 2008 Frediano Ziglio - * TODO src/odbc/odbc.c src/odbc/unittests/.cvsignore: - * src/odbc/unittests/Makefile.am: - - small fix for hidden fields (ignore them entirely) - Wed Jan 9 7:50:39 CET 2008 Frediano Ziglio * configure.ac: preparing 0.82 diff --git b/src/odbc/odbc.c a/src/odbc/odbc.c index 7d33b27..7180d23 100644 --- b/src/odbc/odbc.c +++ a/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464.2.1 2008/01/10 08:52:45 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.464 2008/01/06 10:48:43 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -2652,7 +2652,7 @@ odbc_ird_check(TDS_STMT * stmt) return; /* check columns number */ - assert(ird->header.sql_desc_count <= cols || ird->header.sql_desc_count == 0); + assert(ird->header.sql_desc_count == cols || ird->header.sql_desc_count == 0); /* check all columns */ @@ -2717,10 +2717,6 @@ odbc_populate_ird(TDS_STMT * stmt) 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) { odbc_errs_add(&stmt->errs, "HY001", NULL); return SQL_ERROR; diff --git b/src/odbc/unittests/.cvsignore a/src/odbc/unittests/.cvsignore index 1316adb..d6eea5a 100644 --- b/src/odbc/unittests/.cvsignore +++ a/src/odbc/unittests/.cvsignore @@ -62,4 +62,3 @@ cursor3 cursor4 cursor5 attributes -hidden diff --git b/src/odbc/unittests/Makefile.am a/src/odbc/unittests/Makefile.am index 8f38676..e68b0a4 100644 --- b/src/odbc/unittests/Makefile.am +++ a/src/odbc/unittests/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.68.2.1 2008/01/10 08:52:46 freddy77 Exp $ +# $Id: Makefile.am,v 1.68 2007/12/19 14:36:05 freddy77 Exp $ TESTS = \ t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT)\ t0004$(EXEEXT) connect$(EXEEXT) print$(EXEEXT)\ @@ -20,7 +20,7 @@ TESTS = \ paramcore$(EXEEXT) timeout2$(EXEEXT) timeout3$(EXEEXT) \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ - attributes$(EXEEXT) hidden$(EXEEXT) + attributes$(EXEEXT) check_PROGRAMS = $(TESTS) @@ -77,7 +77,6 @@ cursor3_SOURCES = cursor3.c common.c common.h cursor4_SOURCES = cursor4.c common.c common.h cursor5_SOURCES = cursor5.c common.c common.h attributes_SOURCES = attributes.c common.c common.h -hidden_SOURCES = hidden.c common.c common.h AM_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) -DFREETDS_SRCDIR=\"$(srcdir)\" if MINGW32 diff --git b/src/odbc/unittests/hidden.c a/src/odbc/unittests/hidden.c deleted file mode 100755 index 66be442..0000000 --- b/src/odbc/unittests/hidden.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Testing result column numbers having hidden columns */ -/* Test from Sebastien Flaesch */ - -#include "common.h" - -static char software_version[] = "$Id: hidden.c,v 1.1.2.1 2008/01/10 08:52:46 freddy77 Exp $"; -static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; - -#define CHECK_RCODE(t,h,m) \ - if ( rcode != SQL_NO_DATA \ - && rcode != SQL_SUCCESS \ - && rcode != SQL_SUCCESS_WITH_INFO \ - && rcode != SQL_NEED_DATA ) { \ - fprintf(stderr,"Error %d at: %s\n",rcode,m); \ - getErrorInfo(t,h); \ - exit(1); \ - } - -static void -getErrorInfo(SQLSMALLINT sqlhdltype, SQLHANDLE sqlhandle) -{ - SQLRETURN rcode = 0; - SQLCHAR sqlstate[SQL_SQLSTATE_SIZE + 1]; - SQLINTEGER naterror = 0; - SQLCHAR msgtext[SQL_MAX_MESSAGE_LENGTH + 1]; - SQLSMALLINT msgtextl = 0; - - rcode = SQLGetDiagRec((SQLSMALLINT) sqlhdltype, - (SQLHANDLE) sqlhandle, - (SQLSMALLINT) 1, - (SQLCHAR *) sqlstate, - (SQLINTEGER *) & naterror, - (SQLCHAR *) msgtext, (SQLSMALLINT) sizeof(msgtext), (SQLSMALLINT *) & msgtextl); - fprintf(stderr, "Diagnostic info:\n"); - fprintf(stderr, " SQL State: %s\n", (char *) sqlstate); - fprintf(stderr, " SQL code : %d\n", (int) naterror); - fprintf(stderr, " Message : %s\n", (char *) msgtext); -} - -int -main(int argc, char **argv) -{ - SQLRETURN rcode; - SQLHSTMT m_hstmt1; - SQLSMALLINT cnt = 0; - int failed = 0; - - use_odbc_version3 = 1; - Connect(); - - Command(Statement, "CREATE TABLE #t1 ( k INT, c CHAR(10), vc VARCHAR(10) )"); - Command(Statement, "CREATE TABLE #tmp1 (i NUMERIC(10,0) IDENTITY PRIMARY KEY, b VARCHAR(20) NULL, c INT NOT NULL)"); - - /* test hidden column with FOR BROWSE */ - ResetStatement(); - - m_hstmt1 = Statement; - - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "SELECT c, b FROM #tmp1", SQL_NTS); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect"); - - rcode = SQLNumResultCols(m_hstmt1, &cnt); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLNumResultCols 1"); - - if (cnt != 2) { - fprintf(stderr, "Wrong number of columns in result set: %d\n", (int) cnt); - failed = 1; - } - ResetStatement(); - - /* test hidden column with cursors*/ - CheckCursor(); - - rcode = SQLSetStmtAttr(m_hstmt1, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); - rcode = SQLSetStmtAttr(m_hstmt1, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); - - rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM #t1", SQL_NTS); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLPrepare 1"); - - rcode = SQLExecute(m_hstmt1); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecute 1"); - - rcode = SQLNumResultCols(m_hstmt1, &cnt); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLNumResultCols 1"); - - if (cnt != 3) { - fprintf(stderr, "Wrong number of columns in result set: %d\n", (int) cnt); - failed = 1; - } - - Disconnect(); - - return failed ? 1: 0; -} commit bf3e39dbca6bef460127ccd1e1d8995e4594dfe9 Author: jklowden Date: Thu Jan 10 01:01:38 2008 +0000 file ChangeLog-0.82 was added on branch BRANCH0_82 on 2008-01-10 20:58:43 +0000 commit 298297ad5f7523d814293426ece4eb93b68e2304 Author: freddy77 Date: Wed Jan 9 06:50:55 2008 +0000 start preparing release diff --git b/ChangeLog a/ChangeLog index edcfcba..69bc581 100644 --- b/ChangeLog +++ a/ChangeLog @@ -1,6 +1,3 @@ -Wed Jan 9 7:50:39 CET 2008 Frediano Ziglio - * configure.ac: preparing 0.82 - Tue Jan 8 10:31:43 EST 2008 JK Lowden * doc/Makefile.am added freetds.conf.5 * src/dblib/bcp.c applied BCPKEEPIDENTIY patch from [email] diff --git b/configure.ac a/configure.ac index d2d0fed..2ba93f3 100644 --- b/configure.ac +++ a/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29.2.1 2008/01/09 06:50:55 freddy77 Exp $ +dnl $Id: configure.ac,v 1.29 2008/01/01 23:09:46 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -12,10 +12,10 @@ dnl ------------------------------------------------------------ # ------------------------------------------------------------ # Initialization # ------------------------------------------------------------ -AC_INIT(FreeTDS, 0.82RC1) +AC_INIT(FreeTDS, 0.65.dev.esyscmd(echo -n $(date +"%Y%m%d"))) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29.2.1 $) +AC_REVISION($Revision: 1.29 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) ======== fast forward to latest commit a6da12218e249babe568d2879324e4ac80b5f8db Author: freddy77 Date: Wed Jan 9 06:51:45 2008 +0000 avoid clash diff --git a/configure.ac b/configure.ac index 2ba93f3..96ec6c5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.29 2008/01/01 23:09:46 freddy77 Exp $ +dnl $Id: configure.ac,v 1.30 2008/01/09 06:51:45 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -12,10 +12,10 @@ dnl ------------------------------------------------------------ # ------------------------------------------------------------ # Initialization # ------------------------------------------------------------ -AC_INIT(FreeTDS, 0.65.dev.esyscmd(echo -n $(date +"%Y%m%d"))) +AC_INIT(FreeTDS, 0.83.dev.esyscmd(echo -n $(date +"%Y%m%d"))) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.29 $) +AC_REVISION($Revision: 1.30 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) commit 1d1d90ef07268fa4a231f07390ae1677a83e0a33 Author: jklowden Date: Thu Jan 10 01:01:31 2008 +0000 truncated because of release diff --git a/ChangeLog b/ChangeLog index 69bc581..ad8d878 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,36 +1,5 @@ -Tue Jan 8 10:31:43 EST 2008 JK Lowden - * doc/Makefile.am added freetds.conf.5 - * src/dblib/bcp.c applied BCPKEEPIDENTIY patch from [email] - -Tue Jan 8 14:28:09 CET 2008 Frediano Ziglio - * NEWS doc/README.releasing doc/userguide.sgml: - - updates for new release - -Tue Jan 8 10:33:26 CET 2008 Frediano Ziglio - * src/odbc/unittests/genparams.c: relax for no-dm - -Mon Jan 7 19:32:20 CET 2008 Frediano Ziglio - * src/odbc/sql2tds.c src/odbc/unittests/genparams.c: - - fix millisecond round off for TIMESTAMP - - improve genparams test to catch this problem - - make genparams works with MS ODBC - -Mon Jan 7 15:04:18 CET 2008 Frediano Ziglio - * include/tdssrv.h src/server/login.c src/server/server.c: - * src/server/unittest.c: - - small improves - * src/pool/user.c: style update - -Sun Jan 6 11:48:17 CET 2008 Frediano Ziglio - * src/odbc/odbc.c: even SQLExecDirect support parameters! - * src/odbc/unittests/genparams.c: improve - -Sat Jan 5 12:23:21 CET 2008 Frediano Ziglio - * src/tds/query.c: - - add parameterized flag calling sp_cursoropen if needed - -Wed Jan 2 00:08:45 CET 2008 Frediano Ziglio - * configure.ac src/apps/Makefile.am: - - remove GNU style - * src/dblib/dblib.c: make it compile - +Wed Jan 9 19:54:43 EST 2008 JK Lowden + * ChangeLog truncated because of release + - ChangeLog-0.82 added because of release + +$Id: ChangeLog,v 1.2455 2008/01/10 01:01:31 jklowden Exp $ commit 2b04c9b9720eec10e4822ebfb479bec00de49492 Author: jklowden Date: Thu Jan 10 01:01:38 2008 +0000 ChangeLog-0.82 added because of release diff --git a/ChangeLog-0.82 b/ChangeLog-0.82 new file mode 100644 index 0000000..c17b0cf --- /dev/null +++ b/ChangeLog-0.82 @@ -0,0 +1,2289 @@ +Tue Jan 8 10:31:43 EST 2008 JK Lowden + * doc/Makefile.am added freetds.conf.5 + * src/dblib/bcp.c applied BCPKEEPIDENTIY patch + - from Jonathan Olson + +Tue Jan 8 14:28:09 CET 2008 Frediano Ziglio + * NEWS doc/README.releasing doc/userguide.sgml: + - updates for new release + +Tue Jan 8 10:33:26 CET 2008 Frediano Ziglio + * src/odbc/unittests/genparams.c: relax for no-dm + +Mon Jan 7 19:32:20 CET 2008 Frediano Ziglio + * src/odbc/sql2tds.c src/odbc/unittests/genparams.c: + - fix millisecond round off for TIMESTAMP + - improve genparams test to catch this problem + - make genparams works with MS ODBC + +Mon Jan 7 15:04:18 CET 2008 Frediano Ziglio + * include/tdssrv.h src/server/login.c src/server/server.c: + * src/server/unittest.c: + - small improves + * src/pool/user.c: style update + +Sun Jan 6 11:48:17 CET 2008 Frediano Ziglio + * src/odbc/odbc.c: even SQLExecDirect support parameters! + * src/odbc/unittests/genparams.c: improve + +Sat Jan 5 12:23:21 CET 2008 Frediano Ziglio + * src/tds/query.c: + - add parameterized flag calling sp_cursoropen if needed + +Wed Jan 2 00:08:45 CET 2008 Frediano Ziglio + * configure.ac src/apps/Makefile.am: + - remove GNU style + * src/dblib/dblib.c: make it compile + + +Mon Dec 31 15:05:16 EST 2007 JK Lowden + * src/dblib/dblib.c fixed DBPRPAD, maybe + +Mon Dec 31 11:29:50 CET 2007 Frediano Ziglio + * misc/test-other.sh src/odbc/odbc.c: + - relax test for cursor + +Mon Dec 31 11:06:13 CET 2007 Frediano Ziglio + * src/ctlib/blk.c src/odbc/unittests/attributes.c: + * src/odbc/unittests/describecol.c src/tds/convert.c: + * src/tds/login.c src/tds/mem.c: + - minor signed/unsigned fixes + * src/dblib/bcp.c: minor performance improve + * src/dblib/dblib.c: fix date portability + +Fri Dec 28 17:57:08 EST 2007 JK Lowden + * src/tds/token.c minor change + * src/tds/convert.c simpler tds_strftime + * src/dblib/unittests/done_handling.c no spurious messages + +Wed Dec 28 15:11:48 CET 2007 Frediano Ziglio + * doc/userguide.sgml: accepted patch #1854381 + +Wed Dec 28 14:44:16 CET 2007 Frediano Ziglio + * misc/freetds_autobuild misc/test-other.sh: + - make amd64 works + * misc/test-auto.sh: add --help option + * src/tds/convert.c: + - fix overflow in tds_convert_char + - minor fixes for tds_strftime + +Thu Dec 27 14:43:14 CET 2007 Frediano Ziglio + * doc/.cvsignore: ignore autogenerated + * include/tds.h src/replacements/vasprintf.c src/tds/convert.c: + * src/tds/login.c src/tds/query.c src/tds/read.c: + - remove some warnings + +Thu Dec 27 11:20:55 CET 2007 Frediano Ziglio + * src/odbc/unittests/common.c: make unixODBC happy + * win32/config.h: define TDS_I64_FORMAT + +Thu Dec 27 10:19:58 CET 2007 Frediano Ziglio + * src/dblib/buffering.h: + - remove warning if compiled with NDEBUG defined + +Wed Dec 26 21:57:12 CET 2007 Frediano Ziglio + * src/odbc/unittests/attributes.c: make it works + +Wed Dec 26 19:44:47 CET 2007 Frediano Ziglio + * doc/freetds.conf.5: typo fix + * src/ctlib/unittests/common.c: make tests compile + * src/odbc/odbc.c: add diagnostic for truncate + +Tue Dec 25 00:55:02 EST 2007 JK Lowden + * freetds.conf doc/Makefile.am doc/freetds.conf.5 (added) + - shortened default freetds.conf and moved documentation + - to a proper man page. Merry Christmas! + +Mon Dec 24 11:34:58 CET 2007 Frediano Ziglio + * include/tds.h: removed unused fields + +Sun Dec 23 16:08:29 EST 2007 JK Lowden + * src/apps/tsql.c + * src/ctlib/cs.c src/ctlib/unittests/common.c + * src/dblib/dblib.c + * src/tds/config.c src/tds/unittests/convert.c + - added STD_DATETIME_FMT to allow for WIN32 shortcomings + +Fri Dec 21 16:20:03 CET 2007 Frediano Ziglio + * include/tds.h src/ctlib/ct.c src/odbc/odbc.c src/tds/query.c: + - make odbc cursor test work using sp_cursoropen with parameters + +Fri Dec 21 11:38:47 CET 2007 Frediano Ziglio + * src/odbc/unittests/common.c src/odbc/unittests/common.h: + * src/odbc/unittests/cursor3.c src/odbc/unittests/cursor4.c: + * src/odbc/unittests/cursor5.c: + - cursor tests should work + +Fri Dec 21 10:05:12 CET 2007 Frediano Ziglio + * configure.ac include/replacements.h src/replacements/vasprintf.c: + * win32/config.h: + - applied modified patch #1848920 + +Thu Dec 20 22:56:34 CET 2007 Frediano Ziglio + * src/dblib/dblib.c src/dblib/unittests/common.h: + * src/dblib/unittests/setnull.c src/dblib/unittests/thread.c: + - remove warnings + +Thu Dec 20 17:46:03 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: + - improve cursor attribute setting + - fix a small issue with unixODBC and 64 bit + +Wed Dec 19 16:08:17 CET 2007 Frediano Ziglio + * src/odbc/unittests/cursor3.c src/odbc/unittests/cursor4.c: + - remove warnings + +Wed Dec 19 15:35:22 CET 2007 Frediano Ziglio + * src/odbc/unittests/attributes.c(added) src/odbc/unittests/attributes.in(added): + * src/odbc/unittests/Makefile.am: add a test for statement attributes + * src/odbc/unittests/describecol.c: fix possible core + +Tue Dec 18 09:09:27 CET 2007 Frediano Ziglio + * src/odbc/unittests/Makefile.am src/odbc/unittests/cursor3.c(added): + * src/odbc/unittests/cursor4.c(added) src/odbc/unittests/cursor5.c(added): + - merged test from Sebastien FLAESCH + +Sun Dec 16 19:08:38 EST 2007 JK Lowden + * doc/api_status.txt + - set useless db-lib functions' status to 'never' + +Sun Dec 16 16:58:35 EST 2007 JK Lowden + * doc/Makefile.am doc/bsqlodbc.txt doc/osql.txt + * doc/userguide.sgml + - updated for next release + +Fri Dec 14 11:23:08 CET 2007 Frediano Ziglio + * misc/test-other.sh: fix some strange echo portability + * src/dblib/unittests/null.c src/dblib/unittests/null2.c: + - make ignore less verbose + +Thu Dec 13 23:45:55 EST 2007 JK Lowden + * src/apps/Makefile.am build bsqlodbc out-of-tree + * src/dblib/unittests/null.c prettier & correct, passes + +Thu Dec 13 21:12:20 CET 2007 Frediano Ziglio + * src/dblib/buffering.h: fix null2 + +Thu Dec 13 19:04:35 CET 2007 Frediano Ziglio + * src/apps/Makefile.am: + - fix bsqlodbc compile if not standard sql.h path + +Wed Dec 12 07:27:07 CET 2007 Frediano Ziglio + * src/tds/net.c: fix for 64bit + +Tue Dec 11 11:09:52 CET 2007 Frediano Ziglio + * doc/userguide.sgml: remove warning + * misc/freetds_autobuild: fix if password empty + +Tue Dec 11 00:02:16 EST 2007 JK Lowden + * doc/userguide.sgml minor touchups + * src/dblib/dblib.c src/dblib/unittests/setnull.c + - unittests/setnull.c passes. + +Mon Dec 10 14:05:06 CET 2007 Frediano Ziglio + * src/tds/convert.c: remove warning + +Mon Dec 10 00:08:45 EST 2007 JK Lowden + * doc/Makefile.am doc/userguide.sgml some improvements + doc/grep_sample_code doc/images/caution.gif + doc/images/warning.gif + doc/images/callouts/1.gif doc/images/callouts/2.gif + doc/images/callouts/3.gif doc/images/callouts/4.gif + doc/images/callouts/5.gif doc/images/callouts/6.gif + doc/images/callouts/7.gif doc/images/callouts/8.gif + doc/images/callouts/9.gif doc/images/callouts/10.gif + - added from http://tldp.org/LDP/abs/images/ + +Sun Dec 9 19:51:11 EST 2007 JK Lowden + * doc/userguide.sgml added tenderfoot tutorial + +Fri Dec 7 00:26:01 EST 2007 JK Lowden + * include/tds.h src/dblib/dblib.c + * src/dblib/dbutil.c src/tds/util.c + - pass errno via tdserror. + +Thu Dec 6 21:41:23 EST 2007 JK Lowden + * src/tds/convert.c tds_willconvert returns size + +Thu Dec 6 21:32:13 CET 2007 Frediano Ziglio + * src/dblib/dblib.c: fix for 64bit machines + * src/dblib/unittests/setnull.c: improve + +Thu Dec 6 19:59:59 CET 2007 Frediano Ziglio + * configure.ac include/replacements.h src/apps/bsqldb.c: + * src/dblib/unittests/setnull.c: + - use basename from MingW if available + * src/dblib/dblib.c: fix malloc portability problem + +Thu Dec 6 10:18:54 CET 2007 Frediano Ziglio + * src/dblib/rpc.c src/dblib/unittests/setnull.c: + - fix compile problems + +Thu Dec 6 01:00:42 EST 2007 JK Lowden + * src/dblib/buffering.h src/dblib/dblib.c: + - dbgetnull tolerates negative varlen, looks pretty good + +Wed Dec 5 10:38:55 EST 2007 JK Lowden + * src/dblib/dblib.c: + - t0011 passes but copy_data_to_host_var likely wrong + +Tue Dec 4 20:19:38 EST 2007 JK Lowden + * include/dblib.h src/dblib/buffering.h src/dblib/dblib.c: + - removed _db_set_null and associated mallocs + - dblib/unittest/t0011.c failing mysteriously + +Mon Dec 3 23:18:55 EST 2007 JK Lowden + * src/dblib/dblib.c src/dblib/unittests/setnull.c: + - corrected dbsetnull() + +Mon Dec 3 18:45:22 EST 2007 JK Lowden + * src/apps/bsqldb.c + * src/dblib/bcp.c src/dblib/dblib.c src/dblib/unittests/rpc.c + * src/dblib/unittests/setnull.c src/dblib/unittests/t0001.c + * src/dblib/unittests/t0002.c src/dblib/unittests/t0003.c + * src/dblib/unittests/t0004.c src/dblib/unittests/t0005.c + * src/dblib/unittests/t0006.c src/dblib/unittests/t0007.c + * src/dblib/unittests/t0008.c src/dblib/unittests/t0011.c + * src/dblib/unittests/t0015.c src/dblib/unittests/t0018.c + * src/dblib/unittests/t0023.c src/dblib/unittests/text_buffer.c + * src/dblib/unittests/thread.c src/dblib/unittests/timeout.c: + - dbbind uses zero, not -1 to indicate sufficient space. + +Mon Dec 3 17:57:54 EST 2007 JK Lowden + * src/dblib/bcp.c: don't cast malloc and don't assume it worked. + +Mon Dec 3 19:54:53 CET 2007 Frediano Ziglio + * src/odbc/Makefile.am: remove GNU make pattern + +Mon Dec 3 15:35:45 CET 2007 Frediano Ziglio + * src/dblib/dblib.c: + - do not call dbcolptr for compute result but call new dbacolptr + - dbcolptr return TDSCOLUMN* to optimize it + +Mon Dec 3 11:53:56 CET 2007 Frediano Ziglio + * src/dblib/dblib.c: remove a warning + +Mon Dec 3 10:18:39 CET 2007 Frediano Ziglio + * src/dblib/dblib.c src/dblib/unittests/.cvsignore: + * src/dblib/unittests/Makefile.am src/dblib/unittests/setnull.c(added): + - add a test for setnull + +Sun Dec 2 17:58:40 EST 2007 JK Lowden + * doc/api_status.txt + * include/dblib.h include/sybdb.h include/tds.h + * src/ctlib/blk.c src/dblib/bcp.c src/dblib/dblib.c + - full implementation of dbsetnull(). + - Replaced _DB_GETCOLINFO macro with dbcolptr(). + +Sat Dec 1 14:05:54 EST 2007 JK Lowden + * src/dblib/bcp.c src/dblib/unittests/null.c + - correct TDS 5.0 bcp offset table calcuation in presence of NULLs. + +Fri Nov 30 09:54:46 CET 2007 Frediano Ziglio + * src/dblib/unittests/common.c: missing new line + +Thu Nov 29 09:03:32 CET 2007 Frediano Ziglio + * src/dblib/unittests/null2.c: improve + +Wed Nov 28 15:15:43 CET 2007 Frediano Ziglio + * configure.ac: + - include windows.h under windows + - include sql.h directly to avoid MingW problems + * include/dblib.h src/dblib/bcp.c src/dblib/dblib.c src/dblib/rpc.c: + - avoid core checking for parameters if argument are expected + * src/dblib/unittests/null.c src/dblib/unittests/null2.c: + - avoid invalid references to deallocated stack + +Wed Nov 28 09:48:50 CET 2007 Frediano Ziglio + * src/dblib/bcp.c: remove warnings + +Wed Nov 28 00:27:36 EST 2007 JK Lowden + * src/dblib/bcp.c fixed TDS 5.0 null-column bug, cf. ML + * doc/tds.html Added BCP, made 4.01 strict, validated. + +Tue Nov 27 16:12:56 CET 2007 Frediano Ziglio + * src/dblib/unittests/Makefile.am src/dblib/unittests/null2.c(added): + - test dbbind/dbnullbind with NULLs + * src/dblib/unittests/null.c: add note + +Tue Nov 27 13:37:35 CET 2007 Frediano Ziglio + * src/dblib/unittests/t0001.c src/dblib/unittests/t0022.c: + - compile with Sybase libraries + * src/dblib/unittests/t0008.c: more verbose + +Mon Nov 26 21:02:57 CET 2007 Frediano Ziglio + * src/odbc/unittests/array_out.c: fix silly core + +Mon Nov 26 19:11:12 CET 2007 Frediano Ziglio + * configure.ac include/tdsodbc.h src/odbc/odbc.c: + * src/odbc/unittests/array_out.c src/odbc/unittests/common.h: + * src/odbc/unittests/describecol.c src/odbc/unittests/freeclose.c: + * src/odbc/unittests/insert_speed.c src/odbc/unittests/timeout.c: + * src/odbc/unittests/timeout3.c src/odbc/unittests/type.c: + - minor fixes for 64bit + +Mon Nov 26 16:47:34 CET 2007 Frediano Ziglio + * configure.ac src/apps/fisql/fisql.c: + - do not use functions not availables + +Mon Nov 26 09:43:03 EST 2007 JK Lowden + * src/dblib/bcp.c src/tds/unittests/iconv_fread.c + - small changes + +Mon Nov 26 09:51:21 CET 2007 Frediano Ziglio + * src/dblib/unittests/bcp.c: fix printf + +Mon Nov 26 07:24:43 CET 2007 Frediano Ziglio + * src/odbc/unittests/array.c src/odbc/unittests/array_out.c: + * src/odbc/unittests/const_params.c src/odbc/unittests/cursor1.c: + * src/odbc/unittests/describecol.c src/odbc/unittests/freeclose.c: + * src/odbc/unittests/insert_speed.c src/odbc/unittests/raiserror.c: + * src/odbc/unittests/rpc.c src/odbc/unittests/scroll.c: + * src/tds/challenge.c: + - fix minor issues with 64bit + +Thu Nov 22 09:43:58 CET 2007 Frediano Ziglio + * configure.ac src/ctlib/Makefile.am src/dblib/Makefile.am: + * src/odbc/Makefile.am: + - do not filter symbols under MacOsX (avoid libtool problems) + +Wed Nov 21 11:31:37 EST 2007 JK Lowden + * src/ctlib/blk.c: correctly test result of cs_convert + * src/dblib/rpc.c: minor edits + * src/dblib/unittests/bcp.c src/dblib/unittests/bcp.h: + - test works for TDS 7.0. + +Tue Nov 20 23:08:15 EST 2007 JK Lowden + * src/dblib/bcp.c src/dblib/unittests/bcp.c: + * src/dblib/dblib.c src/tds/convert.c src/tds/net.c: + - small changes + +Thu Nov 15 14:32:50 CET 2007 Frediano Ziglio + * src/dblib/unittests/.cvsignore src/dblib/dblib.c: + * src/dblib/unittests/Makefile.am src/dblib/unittests/null.c: + - fix problem with empty string and TEXT + - add a test to test empty/NULL behavior of dbdatlen/dbdata + +Thu Nov 15 10:18:40 CET 2007 Frediano Ziglio + * src/tds/login.c: return error if no username given and no Kerberos + +Tue Nov 13 10:13:06 CET 2007 Frediano Ziglio + * include/tds.h src/tds/challenge.c src/tds/gssapi.c: + * src/tds/login.c src/tds/token.c: + - port ntlm to new authentication code + - move all ntlm stuff to challenge.c + +Mon Nov 12 17:15:03 EST 2007 JK Lowden + * include/sybdb.h src/dblib/bcp.c + * src/dblib/dblib.c src/dblib/dbutil.c + * src/dblib/rpc.c + * src/tds/log.c src/tds/login.c + - trying to convince Doxygen not to ignore functions, + - e.g. dbinit + +Mon Nov 12 13:38:04 EST 2007 JK Lowden + * include/dblib.h src/dblib/dbutil.c + * src/dblib/dblib.c src/dblib/rpc.c src/dblib/bcp.c + - added DBDEAD test to all public functions + +Mon Nov 12 14:32:53 CET 2007 Frediano Ziglio + * configure.ac: cleanup + * src/tds/gssapi.c: compute fqdn name in service name + +Mon Nov 12 12:34:14 CET 2007 Frediano Ziglio + * configure.ac include/tds.h src/tds/gssapi.c: + * src/tds/login.c src/tds/mem.c src/tds/token.c: + - new TDSAUTHENTICATION structure + - new --enable-krb5 to enable Kerberos authentication + (disable by default) + +Fri Nov 09 11:29:21 CET 2007 Frediano Ziglio + * src/apps/tsql.c: remove some leaks + +Mon Nov 05 11:05:34 CET 2007 Frediano Ziglio + * src/apps/tsql.c: use pipes to avoid infinite counter + +Mon Nov 05 09:29:54 CET 2007 Frediano Ziglio + * src/tds/login.c: fix log avoidance for long logins + +Sun Nov 04 09:16:08 CET 2007 Frediano Ziglio + * src/tds/gssapi.c: small cleanup + +Sat Nov 03 14:31:40 CET 2007 Frediano Ziglio + * include/tds.h src/tds/config.c src/tds/mem.c: + - add server_host_name to TDSCONNECTION + * src/tds/gssapi.c: some improves + +Fri Nov 02 11:33:16 CET 2007 Frediano Ziglio + * src/tds/gssapi.c: add small comment + +Tue Oct 30 16:45:41 CET 2007 Frediano Ziglio + * src/tds/Makefile.am src/tds/gssapi.c src/tds/login.c: + - include developing code for GSSAPI + +Tue Oct 30 16:36:29 CET 2007 Frediano Ziglio + * include/tds.h src/tds/login.c src/ctlib/ct.c src/tds/read.c: + * src/tds/token.c: + - finish merging tds9 code as developing + +Tue Oct 30 16:02:04 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c: + - make odbc row_count 64bit + +Tue Oct 30 13:14:00 CET 2007 Frediano Ziglio + * src/tds/config.c src/tds/query.c: + - more merge for tds9 + +Tue Oct 30 11:31:30 CET 2007 Frediano Ziglio + * include/tds.h src/ctlib/blk.c src/dblib/bcp.c: + * src/server/server.c src/tds/token.c: + - merge partially tds9 patch + +Tue Oct 30 11:15:20 CET 2007 Frediano Ziglio + * src/tds/net.c: + - avoid wrong assert if error and tdserror called + * src/tds/query.c: limit data length to maximun allowed + +Wed Oct 24 17:55:56 EDT 2007 JK Lowden + * include/sqldb.h define dbfreelogin + * src/dblib/unittests/common.h add commentary + +Tue Oct 23 19:41:03 EDT 2007 JK Lowden + * src/tds/net.c src/tds/util.c + - ct-lib seems OK with EINTR (sqsh works) but db-lib + - applications get a weird message. + +Tue Oct 23 18:08:00 EDT 2007 JK Lowden + * src/tds/net.c + - return from tds_select as if timed out on EINTR. + - sqsh still unhappy when ^C pressed on long-running query. + +Thu Oct 18 16:48:23 CET 2007 Frediano Ziglio + * src/dblib/dblib.c: fix core + +Thu Oct 18 13:49:51 CET 2007 Frediano Ziglio + * src/tds/query.c src/tds/token.c: + - more free(NULL) + +Tue Oct 16 16:59:06 CET 2007 Frediano Ziglio + * src/apps/tsql.c src/ctlib/blk.c src/ctlib/cs.c src/ctlib/ct.c: + * src/dblib/bcp.c src/dblib/dblib.c src/dblib/rpc.c: + * src/dblib/unittests/rpc.c src/odbc/error.c src/odbc/odbc.c: + * src/odbc/sql2tds.c src/odbc/unittests/binary_test.c: + * src/pool/config.c src/tds/locale.c src/tds/login.c: + * src/tds/mem.c src/tds/query.c src/tds/token.c: + * src/tds/vstrbuild.c src/tds/unittests/dataread.c: + - do not check for free(NULL) + +Wed Oct 10 13:59:37 EDT 2007 JK Lowden + * src/apps/tsql.c + - added some error checking for malloc/realloc, more needed + +Tue Oct 09 13:40:24 CET 2007 Frediano Ziglio + * src/tds/mem.c: fix small memory leak + +Mon Sep 24 13:12:47 CET 2007 Frediano Ziglio + * src/tds/query.c: limit size preparing queries + +Mon Sep 24 12:01:46 CET 2007 Frediano Ziglio + * src/server/query.c src/server/server.c: + - small server improve + +Thu Sep 20 17:32:15 CET 2007 Frediano Ziglio + * include/sybdb.h src/dblib/dblib.c src/dblib/dbopen.c: + - apply constify patch #1786200 + +Thu Sep 20 17:02:20 CET 2007 Frediano Ziglio + * src/apps/tsql.c: do not strip empty lines + +Mon Sep 17 17:22:32 EDT 2007 JK Lowden + * src/dblib/bcp.c correct freebcp -L behavior + * src/tds/net.c TDSECONN on no socket failure + * src/tds/util.c change iconv messages + +Mon Sep 17 17:52:09 CET 2007 Frediano Ziglio + * doc/tds.html: update for tds9 + * src/server/login.c: remove warning + +Mon Sep 17 12:13:03 CET 2007 Frediano Ziglio + * src/apps/tsql.c: + - improve for very large query (from 9.2 to 0.3 seconds on my + test machine) + +Mon Sep 17 10:42:45 CET 2007 Frediano Ziglio + * doc/tds.html: update + * src/ctlib/unittests/get_send_data.c: small fix + * include/sybdb.h src/dblib/dblib.c src/dblib/unittests/t0022.c: + - small update for future tds9 + * src/pool/main.c src/pool/user.c src/server/login.c: + - improve portability and possible remote leakage + +Thu Sep 13 12:42:08 CET 2007 Frediano Ziglio + * src/odbc/unittests/freeclose.c: + - make it works even if login is quite long + +Thu Sep 13 08:57:26 CET 2007 Frediano Ziglio + * src/tds/unittests/dynamic1.c: use tds_set_param_type + +Thu Sep 06 13:15:54 CET 2007 Frediano Ziglio + * doc/tds.html: update for tds9 + * src/tds/read.c: work if initial in_pos is != 0 + +Sat Aug 25 12:32:01 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/error.c src/odbc/odbc.c: + - use ODBC_API instead of SQL_API to allow combined compile + +Fri Aug 24 11:50:03 CET 2007 Frediano Ziglio + * include/tds.h src/ctlib/blk.c src/dblib/bcp.c src/tds/login.c: + * src/tds/query.c src/tds/token.c: + - small changes for TDS 9.0 + +Mon Aug 16 10:09:42 CET 2007 Frediano Ziglio + * src/ctlib/unittests/Makefile.am src/dblib/unittests/Makefile.am: + * src/odbc/unittests/Makefile.am src/tds/net.c: + * src/tds/unittests/Makefile.am: + - remove other warnings + +Mon Aug 16 08:29:38 CET 2007 Frediano Ziglio + * src/tds/unittests/convert.c win32/initnet.c: + - remove some warnings compiling with MingW + +Sat Aug 11 08:51:45 CET 2007 Frediano Ziglio + * src/dblib/dblib.c vms/config_h.vms vms/descrip_mms.template: + - applied Craig A. Berry patch #1772080 for VMS systems + +Fri Aug 10 11:17:32 CET 2007 Frediano Ziglio + * NEWS: updated + +Fri Aug 10 11:14:19 CET 2007 Frediano Ziglio + * win32/dev-cpp/Makefile.win: add missing file + +Thu Aug 09 14:52:45 CET 2007 Frediano Ziglio + * src/tds/net.c: small fixes + +Thu Aug 09 10:26:51 CET 2007 Frediano Ziglio + * doc/userguide.sgml: document port override syntax + +Thu Aug 09 09:49:34 CET 2007 Frediano Ziglio + * doc/htdoc/basic_jdbc_question.html doc/htdoc/contrib.html: + * doc/htdoc/docs.html doc/htdoc/index.html doc/htdoc/news.html: + * doc/htdoc/software.html doc/htdoc/support.html: + * doc/htdoc/vague_jdbc_question.html doc/htdoc/which_api.html: + - make xhtml compatible + +Wed Aug 08 15:24:16 CET 2007 Frediano Ziglio + * configure.ac src/odbc/Makefile.am win32/version.rc.in: + - fix odbc cross compile using MingW + +Wed Aug 08 11:34:40 CET 2007 Frediano Ziglio + * misc/freetds_autobuild: + - improved adding test for server:port and server\instance case + +Wed Aug 08 11:10:36 CET 2007 Frediano Ziglio + * src/tds/config.c: fix bug #1759652 (cannot use server\INSTANCE) + +Tue Aug 07 15:34:34 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: improve cursor updates + * src/odbc/unittests/cursor1.c: improved and fixed + +Tue Aug 07 11:55:53 CET 2007 Frediano Ziglio + * src/tds/query.c: use table name for update + +Tue Aug 07 11:19:33 CET 2007 Frediano Ziglio + * include/tds.h src/odbc/odbc.c src/odbc/unittests/getdata.c: + - fix bug #1758831 + - additional fixes and checks for SQLGetData + +Tue Aug 07 10:29:55 CET 2007 Frediano Ziglio + * doc/userguide.sgml: update links + +Fri Aug 03 13:15:42 CET 2007 Frediano Ziglio + * src/tds/config.c: lookup server name correctly for instances + +Thu Aug 02 13:31:45 CET 2007 Frediano Ziglio + * include/sqlfront.h: small compatiblity improve with ms + +Fri Jul 13 18:56:56 CET 2007 Frediano Ziglio + * src/odbc/unittests/getdata.c: portability fix + +Thu Jul 12 16:31:05 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: fix for SQLGetData using empty fields + * src/odbc/unittests/getdata.c: + - improve test to catch previous problem + +Sat Jul 07 19:55:30 CET 2007 Frediano Ziglio + * m4/sprintf_i64_format.m4: improve portability + +Sat Jul 07 19:09:59 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: + - check cbValueMax in SQLGetData even if DM present + +Tue Jul 03 17:12:04 CET 2007 Frediano Ziglio + * src/odbc/unittests/compute.c src/odbc/unittests/tables.c: + * src/odbc/unittests/typeinfo.c: + - relax test for Sybase + * src/tds/token.c: fix length computation + +Tue Jul 03 15:37:03 CET 2007 Frediano Ziglio + * include/tds.h src/ctlib/blk.c src/dblib/bcp.c src/dblib/dblib.c: + * src/odbc/odbc.c src/tds/mem.c src/tds/token.c: + - add table_column_name to read real column name (if available), + read from wire and use when needed + +Sun Jul 01 12:10:31 CET 2007 Frediano Ziglio + * include/tdsstring.h src/odbc/connectparams.c: + * src/odbc/descriptor.c src/odbc/odbc.c src/tds/config.c: + * src/tds/tdsstring.c: + - added tds_dstr_dup to duplicate DSTR + - use tds_dstr_dup + - improve tds_dstr_set + +Wed Jun 27 16:51:30 CET 2007 Frediano Ziglio + * doc/tds.html: add Column Info token + * src/odbc/unittests/timeout2.c: portability fix + +Mon Jun 25 11:47:14 CET 2007 Frediano Ziglio + * doc/api_status.txt include/cspublic.h include/ctlib.h: + * src/ctlib/cs.c src/ctlib/ct.c: + - applied patch #1729392, it adds support for ctlib locale + +Mon Jun 25 10:20:00 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: review cursors + +Thu Jun 21 09:19:32 CET 2007 Frediano Ziglio + * misc/freetds_autobuild: test for Sybase 15 + * src/odbc/unittests/data.c: bigint for Sybase + * src/tds/data.c src/tds/mem.c src/tds/read.c src/tds/tds_checks.c: + - add support for Sybase bigint + - do not check decault capabilities if not necessary + +Tue Jun 19 15:30:12 CET 2007 Frediano Ziglio + * include/tds.h src/ctlib/ct.c src/odbc/odbc_util.c: + * src/pool/stream.c src/tds/data.c src/tds/net.c: + * src/tds/tds_checks.c src/tds/tds_checks.h src/tds/token.c: + - fix problem with Sybase LONGCHAR + +Tue Jun 19 14:06:55 CET 2007 Frediano Ziglio + * src/ctlib/unittests/t0007.c src/odbc/unittests/prepare_results.c: + - more verbose + - fix for possible Sybase conversion + * src/odbc/odbc.c: additional check if no dm + +Mon Jun 18 15:20:00 CET 2007 Frediano Ziglio + * src/tds/convert.c: + - patch #1736289 for bcp/bulk insert problem + +Mon Jun 18 14:02:45 CET 2007 Frediano Ziglio + * src/apps/tsql.c src/tds/locale.c: + - use correct charset based on locale + +Mon Jun 18 13:58:34 CET 2007 Frediano Ziglio + * src/odbc/unittests/genparams.c: remove warning + +Sun Jun 17 19:38:27 CET 2007 Frediano Ziglio + * src/odbc/unittests/freeclose.c src/odbc/unittests/timeout3.c: + - fix small thread problem + - fix possible deadlock + +Sun Jun 17 09:45:55 CET 2007 Frediano Ziglio + * src/odbc/unittests/freeclose.c src/odbc/unittests/genparams.c: + - fix thread and small portability + +Sun Jun 17 09:08:03 CET 2007 Frediano Ziglio + * include/dblib.h src/dblib/buffering.h src/dblib/dblib.c: + - patch #1717123 for dbsetnull implementation (removed warnings) + +Sun Jun 17 08:16:50 CET 2007 Frediano Ziglio + * src/apps/tsql.c: + - patch #1703363 for delimiters (modified) + +Wed Jun 13 09:26:00 CET 2007 Frediano Ziglio + * src/apps/fisql/fisql.c: compile even if readline is not available + +Mon Jun 4 17:09:03 EDT 2007 JK Lowden + * src/apps/Makefile.am skip bsqlodb if ODBC disabled + +Mon Jun 04 10:03:25 CET 2007 Frediano Ziglio + * src/dblib/unittests/.cvsignore src/dblib/unittests/Makefile.am: + * src/dblib/unittests/hang.c(added) src/tds/net.c: + - fix problem with tds_select (detected by Perception Technologies) + +Fri Jun 01 10:52:46 CET 2007 Frediano Ziglio + * src/tds/token.c: avoid overflow leading to memory errors + +Thu May 31 17:02:43 CET 2007 Frediano Ziglio + * src/tds/net.c: + - fixes, partially from Brent of Perception Technologies Ltd + +Thu May 31 10:54:14 EDT 2007 JK Lowden + * TODO add recent potential bug reports + +Thu May 31 14:21:35 CET 2007 Frediano Ziglio + * m4/ac_nullzero.m4: fix cross compile test + +Wed May 30 09:55:52 CET 2007 Frediano Ziglio + * src/tds/threadsafe.c: + - implement gethostbyname_r with getaddrinfo (for UnixWare 7 and others) + +Tue May 29 10:48:45 CET 2007 Frediano Ziglio + * configure.ac win32/config.h: cleanup + +Fri May 25 11:07:04 CET 2007 Frediano Ziglio + * src/odbc/convert_tds2sql.c: + - remove a FIXME + * src/odbc/odbc.c: + - fix bug #1716594 ("SQLFreeStmt with SQL_CLOSE shouldn't + unprepare statement") + * src/odbc/unittests/Makefile.am src/odbc/unittests/freeclose.c(added) + * src/odbc/unittests/.cvsignore: + - add a test for bug #1716594 + +Mon May 21 14:01:13 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: + - fix cursor updates, this undo part of change of src/odbc/odbc.c + from 1.331 to 1.332, log: + Wed Jul 21 16:50:11 CET 2004 + : some fix for SQLFetch and multiple rows + but tests works + * src/odbc/unittests/cursor1.c: improve + +Mon May 21 10:40:40 CET 2007 Frediano Ziglio + * src/odbc/unittests/cursor1.c: improve test + +Thu May 17 12:32:33 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_checks.c: + * src/odbc/odbc_util.c: + - avoid core + - fix and check invalid values of num_param_rows and curr_param_row + +Thu May 17 09:18:19 CET 2007 Frediano Ziglio + * src/odbc/unittests/warning.c: improve and comments + +Wed May 16 14:23:00 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_util.c: + * src/odbc/sql2tds.c: + - support row binding in RPC + - reuse new odbc_get_octet_len + +Wed May 16 14:23:00 CET 2007 Frediano Ziglio + * misc/freetds_autobuild: minor updates + +Mon May 14 16:04:08 CET 2007 Frediano Ziglio + * src/tds/login.c: remove copy error + +Mon May 14 10:16:37 CET 2007 Frediano Ziglio + * src/tds/login.c src/tds/mem.c src/tds/token.c src/tds/util.c: + - give proper errors on protocol autodiscovery + +Wed May 09 10:31:56 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: finish ODBC timeout + +Fri May 03 14:54:58 CET 2007 Frediano Ziglio + * src/odbc/unittests/const_params.c: + - reset statement to be sure to cleanup + +Wed May 02 16:54:13 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c: + - use query timeout from freetds.conf + +Mon Apr 30 15:14:08 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: use default linkage for static functions + +Mon Apr 30 15:02:27 CET 2007 Frediano Ziglio + * src/ctlib/blk.c: fix strange link error using gcc 4.1 + +Mon Apr 23 09:56:05 CET 2007 Frediano Ziglio + * src/tds/net.c: fix portability issue + +Fri Apr 20 15:26:15 CET 2007 Frediano Ziglio + * src/odbc/unittests/cursor1.c src/odbc/unittests/cursor2.c: + * src/odbc/unittests/scroll.c: + - make valgrind more happy if Sybase is used + +Fri Apr 20 11:13:40 CET 2007 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/Makefile.am: + * src/odbc/unittests/timeout4.c(added): + - add a test for timeout + - fix timeout on prepare (not detected) + - fix timeout if connection broken + +Thu Apr 19 11:11:55 CET 2007 Frediano Ziglio + * src/odbc/unittests/cursor1.c src/odbc/unittests/cursor2.c: + * src/odbc/unittests/scroll.c: + - give only warning for Sybase + +Thu Apr 19 10:45:15 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c: + - say we not still support cursors for sybase + +Wed Apr 18 16:28:29 CET 2007 Frediano Ziglio + * TODO.freddy include/tdsodbc.h src/odbc/odbc.c: + * src/odbc/odbc_util.c src/odbc/prepare_query.c src/odbc/sql2tds.c: + - fix cursor updates + +Mon Apr 16 22:08:07 EDT 2007 JK Lowden + * src/apps/bsqlodbc.c ODBC3 conformant + +Sun Apr 15 10:01:36 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: fix leak + +Fri Apr 13 17:27:20 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: cursor update + +Fri Apr 13 17:22:25 CET 2007 Frediano Ziglio + * include/tds.h src/tds/query.c: + - add cursor update to libTDS + +Fri Apr 13 10:08:07 CET 2007 Frediano Ziglio + * src/apps/bsqlodbc.c: + - catch all error + - fix some memory problems + +Thu Apr 12 15:33:15 CET 2007 Frediano Ziglio + * src/odbc/unittests/funccall.c: + - add test from ML + +Thu Apr 12 15:07:09 CET 2007 Frediano Ziglio + * freetds.spec.in: fix odbc directory + * src/dblib/unittests/Makefile.am: fix for make distcheck + * src/odbc/unittests/raiserror.c src/odbc/unittests/warning.c: + - relax if dm used + +Thu Apr 12 09:47:39 CET 2007 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/copydesc.c: + - test and fix a problem with SQLAllocHandle + * src/odbc/unittests/connect2.c: add test for not existing dbs + +Thu Apr 12 09:05:56 CET 2007 Frediano Ziglio + * src/ctlib/unittests/array_bind.c src/ctlib/unittests/ct_diagall.c: + * src/ctlib/unittests/ct_diagclient.c: + - fix buffer overflow leading in core + +Wed Apr 11 14:55:32 CET 2007 Frediano Ziglio + * src/dblib/unittests/common.c src/odbc/unittests/common.c: + - remove warning compiling with MingW + +Wed Apr 11 13:52:50 CET 2007 Frediano Ziglio + * src/odbc/connectparams.c src/odbc/odbc.c: + * src/odbc/unittests/connect2.c: + - finish and fix test for change_database + +Wed Apr 11 11:47:08 CET 2007 Frediano Ziglio + * src/odbc/unittests/connect2.c: fix test + * src/odbc/unittests/describecol.in: relax test + +Wed Apr 11 09:09:13 CET 2007 Frediano Ziglio + * src/odbc/unittests/connect2.c src/odbc/unittests/Makefile.am: + - add a test for change_database + +Tue Apr 10 16:00:47 CET 2007 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_util.c: + - fixes for describecol test + +Tue Apr 10 15:16:28 CET 2007 Frediano Ziglio + * misc/coverage.sh: remove system files + * src/odbc/unittests/describecol.in: relax test + +Fri Apr 06 10:52:25 CET 2007 Frediano Ziglio + * include/tdssrv.h src/server/login.c src/server/unittest.c: + - remove warning + +Fri Apr 06 10:29:31 CET 2007 Frediano Ziglio + * NEWS src/odbc/unittests/funccall.c src/tds/mem.c: + * src/tds/query.c: + - added some notes + +Thu Apr 05 16:16:47 CET 2007 Frediano Ziglio + * INSTALL INSTALL.CVS NEWS README doc/userguide.sgml: + - merge from 0.64 + +Wed Apr 04 13:39:27 CET 2007 Frediano Ziglio + * NEWS: updated + +Wed Apr 04 11:53:20 CET 2007 Frediano Ziglio + * include/tds.h include/tdsodbc.h src/ctlib/ct.c src/dblib/rpc.c: + * src/odbc/prepare_query.c src/odbc/sql2tds.c src/tds/mem.c: + * src/tds/token.c src/tds/unittests/dynamic1.c: + - removed unused paramter from tds_alloc_param_data + - fix possible problem in prepare_rpc + +Wed Apr 04 11:39:12 CET 2007 Frediano Ziglio + * vms/descrip_mms.template: add log.c + * src/server/query.c: use constants + +Wed Apr 04 09:14:47 CET 2007 Frediano Ziglio + * doc/userguide.sgml: improve slow check + +Tue Apr 03 16:23:17 CET 2007 Frediano Ziglio + * win32/dev-cpp/FreeTDS.dev win32/dev-cpp/Makefile.win: + - updated adding log.c + +Mon Apr 02 17:06:43 CET 2007 Frediano Ziglio + * doc/userguide.sgml: add encryption parameter + +Thu Mar 29 16:32:50 CET 2007 Frediano Ziglio + * src/ctlib/blk.c: initial fix for bcp state + +Thu Mar 29 16:25:24 CET 2007 Frediano Ziglio + * include/tds.h src/server/login.c src/tds/config.c: + * src/tds/login.c: + - added encryption setting in freetds.conf + +Thu Mar 29 12:17:34 CET 2007 Frediano Ziglio + * configure.ac: check includes for ODBC + +Thu Mar 29 09:44:11 CET 2007 Frediano Ziglio + * src/odbc/unittests/genparams.c: add test for money + +Wed Mar 28 14:43:34 CET 2007 Frediano Ziglio + * freetds.spec.in src/odbc/unittests/Makefile.am: + - fix test-dist test + +Mon Mar 26 13:27:51 CET 2007 Frediano Ziglio + * src/dblib/unittests/.cvsignore src/dblib/unittests/Makefile.am: + * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: + * win32/build_dsw.pl: + - distribute projects for vc6 unittests + +Mon Mar 26 10:05:47 CET 2007 Frediano Ziglio + * doc/htdoc/news.html: validate page + +Sun Mar 24 09:23:21 CET 2007 Frediano Ziglio + * src/apps/bsqlodbc.c: + - avoid dangerous casts + +Tue Mar 20 16:24:26 CET 2007 Frediano Ziglio + * src/replacements/gettimeofday.c src/apps/datacopy.c: + - remove warning + +Mon Mar 19 11:01:05 CET 2007 Frediano Ziglio + * include/replacements.h: fix warning for win32 + +Sun Mar 18 12:37:47 CET 2007 Frediano Ziglio + * src/dblib/unittests/common.c src/odbc/unittests/timeout2.c: + * src/odbc/unittests/timeout3.c: + - fix cross-compile for win32 + +Sun Mar 18 12:09:57 CET 2007 Frediano Ziglio + * src/apps/Makefile.am src/apps/bsqlodbc.c src/apps/tsql.c: + * src/apps/fisql/Makefile.am win32/winsetup.c: + - fix cross-compile for win32 + +Fri Mar 16 16:32:08 CET 2007 Frediano Ziglio + * include/Makefile.am src/tds/Makefile.am: + - full libTDS privatization + * src/server/unittest.c: use mnemonic + +Wed Mar 14 17:18:23 CET 2007 Frediano Ziglio + * doc/tds.html: update + * include/tdssrv.h src/pool/user.c src/server/login.c: + * src/server/query.c src/server/server.c src/server/unittest.c: + - update server stuff, at least login works + * src/tds/tdsstring.c: fix possible mising NUL terminator + * src/apps/tsql.c: fix wrong error handler result + +Wed Mar 14 09:47:24 CET 2007 Frediano Ziglio + * doc/tds.html include/tds.h: update documentation + +Tue Mar 13 17:24:54 CET 2007 Frediano Ziglio + * include/tds.h src/pool/user.c src/server/login.c: + * src/server/unittest.c src/tds/login.c src/tds/query.c: + - use mnemonic for packet types + +Tue Mar 13 16:45:54 CET 2007 Frediano Ziglio + * doc/tds.html: added known tokens + +Tue Mar 13 14:18:03 CET 2007 Frediano Ziglio + * doc/tds.html: updated from code + +Mon Mar 12 14:27:14 CET 2007 Frediano Ziglio + * include/ctlib.h include/dblib.h include/des.h include/md4.h: + * include/md5.h include/replacements.h include/tdsiconv.h: + * include/tdsstring.h include/replacements/readpassphrase.h: + * src/server/Makefile.am: + - privatize functions using gcc visibility if available + - privatize server library + +Mon Mar 12 13:31:32 CET 2007 Frediano Ziglio + * src/ctlib/unittests/blk_in2.c(added) src/ctlib/unittests/Makefile.am: + - added test from ML to test cancel and bulk together + +Mon Mar 12 10:52:12 CET 2007 Frediano Ziglio + * doc/tds.html: improved, added types + +Fri Feb 16 14:52:10 CET 2007 Frediano Ziglio + * include/tds.h: improve documentation + +Mon Feb 12 14:29:53 EST 2007 Nick Castellano + * src/dblib/dblib.c: Increase size of dbprrow() conversion buffer to 8K. + +Mon Feb 12 10:53:54 CET 2007 Frediano Ziglio + * src/odbc/unittests/timeout3.c: + - use thread instead of fork + +Wed Feb 7 01:11:27 EST 2007 JK Lowden + * src/apps/bsqlodbc.c don't exit on SQL_SUCCESS_WITH_INFO + +Wed Feb 7 00:04:15 EST 2007 JK Lowden + * src/apps/bsqldb.c exit noisily on severe errors + * src/dblib/dblib.c src/tds/token.c + - fix timeout with buffering problem per yesterday's ML. + +Tue Feb 6 17:14:50 EST 2007 Nick Castellano + * src/dblib/dblib.c: + - Sybase docs for dbsqlok() says: "If the command buffer contains + multiple commands, a run-time error will not cause dbsqlok to + fail. Instead, failure will occur with the dbresults call that + processes the command causing the run-time error." + * src/apps/fisql/fisql.c: + - Correct result set processing. + +Tue Feb 6 14:11:02 EST 2007 Nick Castellano + * src/dblib/dblib.c: Don't print or store column separator after final result column + +Tue Feb 06 10:18:00 CET 2007 Frediano Ziglio + * configure.ac src/odbc/Makefile.am: + - use -module option only for darwin + +Tue Feb 06 09:53:14 CET 2007 Frediano Ziglio + * src/apps/bsqlodbc.c: + - make more functions static + - remove warning + * src/tds/net.c: remove warning + +Mon Feb 5 21:48:58 EST 2007 JK Lowden + * src/apps/Makefile.am src/apps/bsqlodbc.c src/apps/osql + - added bsqlodbc as general batch script processor. + +Mon Feb 05 09:41:02 CET 2007 Frediano Ziglio + * misc/test-other.sh phptests/null.php: + - fixed PHP check, updated test to PHP 5.2 + +Fri Feb 02 11:51:19 CET 2007 Frediano Ziglio + * configure.ac src/odbc/odbc.c src/odbc/unittests/.cvsignore: + * src/odbc/unittests/Makefile.am src/odbc/unittests/timeout3.c(added): + - added a test for connection timeout + - fix timeout connection in odbc + +Mon Jan 29 12:02:39 CET 2007 Frediano Ziglio + * include/tds_sysdep_private.h src/apps/fisql/fisql.c: + * src/tds/net.c: + - remove some warnings + +Fri Jan 26 18:19:57 CET 2007 Frediano Ziglio + * src/apps/fisql/fisql.c: + - remove warning + - reuse malloc + - fix compile error including config.h + * src/dblib/dblib.c: remove warning + +Fri Jan 26 18:06:44 CET 2007 Frediano Ziglio + * src/odbc/error.c src/odbc/odbc.c: + - remove warning compiling + +Wed Jan 24 14:14:55 EST 2007 Nick Castellano + * doc/fisql.txt: compute rows in fisql work now, remove BUGS entry + +Wed Jan 24 14:11:56 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: indent + +Wed Jan 24 14:08:09 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: good enough compute layout + +Wed Jan 24 12:24:30 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: almost correct compute layout + +Wed Jan 24 11:32:56 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: minor compute layout fixes, still more to do + +Tue Jan 23 17:15:33 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: better compute results, layout needs fixing + +Tue Jan 23 11:24:40 EST 2007 Nick Castellano + * src/dblib/dblib.c: fix off-by-one bug in dbbylist() + +Mon Jan 22 15:54:02 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: fix :r with unreadable file + +Mon Jan 22 15:50:31 EST 2007 Nick Castellano + * src/dblib/dblib.c: print line separator after compute results + +Mon Jan 22 00:56:12 EST 2007 JK Lowden + * src/odbc/connectparams.c src/odbc/error.c + * src/odbc/odbc.c + - added log entry for API functions + * src/odbc/unittests/common.c always use '/' separator + +Sat Jan 20 15:24:03 EST 2007 JK Lowden + * include/dblib.h include/sybdb.h src/dblib/dblib.c + - moved DBOPTION to dblib.h and removed unused members. + +Sat Jan 20 01:29:36 EST 2007 JK Lowden + * doc/defncopy.txt doc/fisql.txt cleanup formatting + * src/apps/bsqldb.c src/dblib/dblib.c fix compute row headers + +Sat Jan 20 01:30:22 EST 2007 Nick Castellano + * ChangeLog src/apps/fisql/edit.c src/apps/fisql/edit.h + * src/apps/fisql/fisql.c src/apps/fisql/handlers.c + * src/apps/fisql/handlers.h src/apps/fisql/interrupt.c + * src/apps/fisql/interrupt.h src/apps/fisql/terminal.c + * src/apps/fisql/terminal.h: + - Fix my name and the program name + +Sat Jan 20 01:20:39 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: + - Be slightly less stupid about compute rows. + +Sat Jan 20 00:54:57 EST 2007 Nick Castellano + * src/dblib/dblib.c: + - do not return bogus nul character in dbgetchar() + +Sat Jan 20 00:35:45 EST 2007 Nick Castellano + * src/dblib/dblib.c: + - dbspr*() functions get nul termination not line termination + +Fri Jan 19 22:39:00 EST 2007 Nick Castellano + * doc/fisql.txt: restore compute rows BUGS entry. + +Fri Jan 19 14:05:13 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: + - Provide xmalloc() and xrealloc() instead of relying on + libreadline for these. + +Fri Jan 19 13:47:42 EST 2007 Nick Castellano + * src/apps/fisql/Makefile.am + * src/apps/fisql/fisql.c + * src/apps/fisql/xgetpass.c(removed) + * src/apps/fisql/xgetpass.h(removed): + - use readpassphrase() in fisql application. + +Fri Jan 19 13:31:31 EST 2007 Nick Castellano + * src/apps/fisql/edit.c src/apps/fisql/fisql.c + * src/apps/fisql/handlers.c src/apps/fisql/handlers.h + * src/apps/fisql/interrupt.c src/apps/fisql/interrupt.h + * src/apps/fisql/terminal.c src/apps/fisql/terminal.h + * src/apps/fisql/xgetpass.c: + - Indent fisql to standard FreeTDS coding style + +Fri Jan 19 13:19:04 EST 2007 Nick Castellano + * src/apps/fisql/fisql.c: remove obsolete code + +Fri Jan 19 13:12:56 EST 2007 Nick Castellano + * doc/fisql.txt: fisql now works, update doc + +Fri Jan 19 13:01:53 EST 2007 Nick Castellano + * .cvsignore doc/.cvsignore: clean up + +Fri Jan 19 12:45:27 EST 2007 Nick Castellano + * src/dblib/dblib.c: fix dbspr1row(), fisql now works + +Fri Jan 19 11:17:13 EST 2007 JK Lowden + * doc/fisql.txt + * src/apps/fisql/edit.c src/apps/fisql/edit.h + * src/apps/fisql/handlers.c src/apps/fisql/handlers.h + * src/apps/fisql/interrupt.c src/apps/fisql/interrupt.h + * src/apps/fisql/terminal.c src/apps/fisql/terminal.h + * src/apps/fisql/xgetpass.c src/apps/fisql/xgetpass.h + * src/apps/fisql/fisql.c + - Added notice of copyright and GPL license + +Thu Jan 18 23:55:17 EST 2007 JK Lowden + * doc/Makefile.am doc/fisql.txt added man page for fisql + * src/apps/fisql/fisql.c fixed discarding const warnings + * doc/api_status.txt include/sybdb.h src/dblib/dblib.c + - added dbgettime() + +Thu Jan 18 17:57:52 EST 2007 Nick Castellano + * AUTHORS: credit myself as a contributor + +Thu Jan 18 17:50:18 EST 2007 Nick Castellano + * src/dblib/dblib.c: + - fix dbprrow() to print character data correctly + - fix dbprrow() to not loop endlessly on aggregate rows + +Thu Jan 18 08:57:10 CET 2007 Frediano Ziglio + * src/tds/unittests/utf8_2.c: fix error handler + +Wed Jan 17 09:48:45 CET 2007 Frediano Ziglio + * src/apps/fisql/fisql.c: use mkstemp instead of mktemp + * src/tds/util.c: cleanup + +Tue Jan 16 16:30:42 EDT 2007 Nick Castellano + * configure.ac + * src/apps/Makefile.am + * src/apps/fisql: contribute free DB-Libary isql application + +Tue Jan 16 09:57:35 CET 2007 Frediano Ziglio + * src/tds/util.c: fix messages + +Tue Jan 16 09:48:43 CET 2007 Frediano Ziglio + * misc/test-other.sh: fix problem with Perl 5.8.8 + * src/dblib/dblib.c: fix possible thread problem + +Tue Jan 16 00:28:28 EST 2007 JK Lowden + * include/dblib.h src/dblib/bcp.c + * src/dblib/dblib.c src/dblib/unittests/rpc.c + - support variadic form of dbperror + +Mon Jan 15 14:40:35 EST 2007 JK Lowden + * src/dblib/unittests/common.c + * src/dblib/unittests/rpc.c + * src/dblib/unittests/t0004.c + * src/dblib/unittests/t0005.c + * src/dblib/unittests/t0007.c + * src/dblib/unittests/t0019.c + * src/dblib/unittests/t0020.c + - fail if an unanticipated message/error is received + +Sun Jan 14 23:16:17 EST 2007 JK Lowden + * src/tds/config.c src/tds/login.c + - began work on autodetecting the server's TDSVER + - works with libtds, not db-lib + +Sun Jan 14 20:38:25 EST 2007 JK Lowden + * include/dblib.h include/tds.h + * src/dblib/dblib.c src/dblib/dbutil.c + * src/dblib/unittests/t0001.c src/dblib/unittests/t0012.c + * src/dblib/unittests/timeout.c + * src/tds/net.c TODO + - timeout unit test also works with dbsetinterrupt + +Sat Jan 13 17:09:05 EST 2007 JK Lowden + * src/dblib/unittests/timeout.c added + * src/dblib/dblib.c + * src/dblib/unittests/Makefile.am src/dblib/unittests/t0001.c + * src/tds/login.c src/tds/query.c src/tds/util.c + - new timeout unit test works. + +Fri Jan 12 14:28:32 CET 2007 Frediano Ziglio + * src/odbc/odbc.c: update code to new libTDS timeout code + * src/tds/net.c: handle send/recv errors + * src/tds/util.c: fix msgno if error not found in table + +Thu Jan 11 10:49:52 EST 2007 JK Lowden + * src/apps/osql + - fixed incorrect report when drivername is not a file + +Tue Jan 09 22:44:08 CET 2007 Frediano Ziglio + * src/apps/tsql.c: fix option problem + +Tue Jan 9 00:16:46 EST 2007 JK Lowden + * src/tds/net.c simpler tds_select, thanks Frediano + +Sun Jan 7 10:45:23 EST 2007 JK Lowden + * src/ctlib/ctutil.c works with tdserror() + +Sun Jan 7 00:41:19 EST 2007 JK Lowden + * include/tds.h + * src/dblib/dblib.c src/dblib/dbutil.c + * src/tds/net.c src/tds/query.c + * src/tds/token.c src/tds/util.c + - implement new timeout strategy using tds_select() and + - calling the client library's error handler (via tdserror). + - db-lib no worse than before, others not yet tested. + +Fri Jan 05 14:08:53 CET 2007 Frediano Ziglio + * include/tds.h src/tds/token.c: new token + * src/tds/util.c: optimize + +Fri Jan 5 02:08:54 EST 2007 JK Lowden + * include/tds.h src/tds/net.c src/tds/util.c + - begin new timeout strategy, not done. + +Thu Jan 4 18:47:46 EST 2007 JK Lowden + * doc/bsqldb.txt src/apps/bsqldb.c nicer headers + * doc/osql.txt src/apps/osql allow ini location override + +Tue Jan 2 15:42:09 EST 2007 JK Lowden + * include/dblib.h include/tds.h + * src/apps/tsql.c + * src/dblib/dblib.c src/dblib/dbutil.c + * src/tds/iconv.c src/tds/login.c src/tds/net.c + * src/tds/token.c src/tds/util.c + - replace tds_client_msg with tdserror() + +Mon Jan 01 12:56:50 CET 2007 Frediano Ziglio + * src/dblib/dblib.c src/tds/query.c: + - remove some warning compiling with SUN compiler + - Happy New Year + +Fri Dec 29 20:43:55 CET 2006 Frediano Ziglio + * src/tds/mem.c: remove warning and optimize + +Fri Dec 29 20:42:41 CET 2006 Frediano Ziglio + * src/apps/tsql.c: remove warnings + +Fri Dec 29 20:05:00 CET 2006 Frediano Ziglio + * include/tdsodbc.h: cleanup + +Fri Dec 29 20:03:30 CET 2006 Frediano Ziglio + * src/ctlib/unittests/rpc_ct_param.c: + * src/ctlib/unittests/rpc_ct_setparam.c src/odbc/odbc.c: + - remove warnings + +Fri Dec 29 17:18:42 CET 2006 Frediano Ziglio + * configure.ac src/tds/log.c: + - use localtime_r if available + +Fri Dec 29 10:06:56 CET 2006 Frediano Ziglio + * src/tds/log.c: + - avoid locking if no logging + +Tue Dec 26 15:57:38 CET 2006 Frediano Ziglio + * include/tds.h src/ctlib/unittests/array_bind.c: + * src/ctlib/unittests/ct_diagall.c: + * src/ctlib/unittests/get_send_data.c: + * src/ctlib/unittests/lang_ct_param.c: + * src/dblib/bcp.c src/dblib/dblib.c: + * src/dblib/dbutil.c src/dblib/rpc.c: + * src/dblib/xact.c src/dblib/unittests/common.h: + * src/dblib/unittests/t0016.c src/odbc/connectparams.c: + * src/odbc/descriptor.c src/odbc/error.c: + * src/odbc/odbc.c src/odbc/odbc_checks.c: + * src/odbc/prepare_query.c src/odbc/unittests/common.h: + * src/odbc/unittests/describecol.c src/pool/config.c: + * src/pool/main.c src/pool/member.c src/pool/stream.c: + * src/pool/user.c src/pool/util.c: + * src/replacements/readpassphrase.c: + * src/replacements/strtok_r.c src/replacements/vasprintf.c: + * src/server/login.c src/server/unittest.c: + * src/tds/config.c src/tds/convert.c src/tds/data.c: + * src/tds/getmac.c src/tds/iconv.c src/tds/locale.c: + * src/tds/login.c src/tds/net.c src/tds/numeric.c: + * src/tds/tds_checks.c src/tds/tdsstring.c src/tds/threadsafe.c: + * src/tds/write.c src/tds/unittests/common.h win32/winlogin.c: + * win32/winsetup.c: + - include stdarg.h always before stdio.h to fix portability + issues defining va_list + +Tue Dec 26 13:54:25 CET 2006 Frediano Ziglio + * src/tds/Makefile.am src/tds/util.c src/tds/log.c (added): + - separate log stuff + +Sun Dec 24 12:40:19 CET 2006 Frediano Ziglio + * src/odbc/descriptor.c: cleanup + +Fri Dec 22 09:34:37 CET 2006 Frediano Ziglio + * src/tds/convert.c: fix typo error + +Mon Dec 21 14:07:55 CET 2006 Frediano Ziglio + * src/tds/iconv.c: use cp1252 instead of iso8859-1 for mssql + +Wed Dec 20 22:47:36 EST 2006 JK Lowden + * src/tds/iconv.c src/tds/token.c log server charset changes + * src/tds/unittests/convert.c permit varbinary + +Mon Dec 18 10:50:34 CET 2006 Frediano Ziglio + * src/tds/Makefile.am: distribute enum_cap.h + +Fri Dec 15 14:41:14 EST 2006 JK Lowden + * src/tds/tds_willconvert.pl allow varbinary + +Thu Dec 14 22:18:16 EST 2006 JK Lowden + * src/tds/mem.c src/tds/unittests/t0001.c + - Added tds_capability_set and enumerated capabilities + * src/tds/enum_cap.h added + +Tue Dec 12 08:45:12 CET 2006 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c src/odbc/odbc_util.c: + - improve describecol test + +Sun Dec 10 16:04:02 EST 2006 JK Lowden + * doc/htdoc/faq.html minor fixes + * src/apps/tsql.c send *sybase* charset name in login record + * src/tds/net.c src/tds/read.c a little less logging + +Thu Dec 7 17:06:50 CET 2006 Frediano Ziglio + * src/tds/token.c: make get_send_data works + +Tue Dec 5 11:42:04 CET 2006 Frediano Ziglio + * src/odbc/unittests/funccall.c: add a test + +Fri Dec 1 16:45:59 EST 2006 JK Lowden + * include/sybdb.h src/dblib/bcp.c src/apps/freebcp.c + - Changed freetbcp batch-copied information messages to + - match the output of Sybase's bcp utility. + +Wed Nov 29 15:46:38 EST 2006 JK Lowden + * src/apps/tsql.c fixed broken "go" option handling. + +Tue Nov 28 11:52:27 EST 2006 JK Lowden + * src/apps/tsql.c fix -o option code + * src/tds/net.c reorganize tds_open_socket() + +Mon Nov 27 18:31:18 EST 2006 JK Lowden + * src/tds/net.c more detailed log of connect(2) + +Sun Nov 26 15:26:31 EST 2006 JK Lowden + * src/apps/tsql.c added connection timer feedback + * src/tds/login.c src/tds/net.c slightly better logging + +Thu Nov 23 09:43:00 CET 2006 Frediano Ziglio + * src/odbc/unittests/genparams.c: + - fix possible problem with very remote servers + +Thu Oct 26 15:09:48 EDT 2006 JK Lowden + * src/dblib/dbutil.c log error message from server + * src/tds/net.c log TDS version + +Thu Oct 26 14:26:27 EDT 2006 JK Lowden + * src/dblib/unittests/common.c src/dblib/unittests/common.h + * src/dblib/unittests/t0001.c + - corrected command-line option handling + +Sat Oct 21 16:42:08 EDT 2006 JK Lowden + * src/dblib/dblib.c src/dblib/unittests/t0022.c: + - dbresults succeeds if metadata or only return status is + - present, cf. ML yesterday. + +Sat Oct 21 14:22:44 CET 2006 Frediano Ziglio + * autogen.sh: fix some portability issues + +Wed Oct 18 21:38:57 CET 2006 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/tables.c: + - fix problem with mssql2005 and SQLTables + +Mon Oct 16 09:48:31 CET 2006 Frediano Ziglio + * src/tds/net.c: reduce system calls required + +Thu Oct 12 11:19:02 CET 2006 Frediano Ziglio + * src/tds/token.c: + - fix wrong assert + - return correctly RETURNSTATUS under Sybase + +Wed Oct 11 16:37:04 CET 2006 Frediano Ziglio + * src/tds/token.c: fix wrong assert using numerics + +Tue Oct 10 15:52:22 EDT 2006 JK Lowden + * doc/osql.txt clarified + +Fri Oct 6 17:08:43 EDT 2006 JK Lowden + * src/apps/freebcp.c src/apps/freebcp.h doc/freebcp.txt + - applied -0 patch from ML + - by Constantin Vasilyev + +Wed Oct 4 19:46:29 EDT 2006 JK Lowden + * src/apps/freebcp.c + - applied -P from stdin patch + - from ML Constantin Vasilyev + +Wed Oct 4 17:36:43 EDT 2006 JK Lowden + * src/apps/osql GNU sed does not support -E + +Wed Oct 4 14:48:20 EDT 2006 JK Lowden + * doc/Makefile.am doc/osql.txt added osql man page + +Wed Oct 4 14:12:25 EDT 2006 JK Lowden + * src/apps/Makefile.am add osql as installable script + +Tue Oct 3 15:40:12 EDT 2006 JK Lowden + * src/dblib/bcp.c test fwrite(3) correctly + +Tue Sep 26 16:57:42 EDT 2006 JK Lowden + * src/dblib/bcp.c src/dblib/dblib.c + * src/tds/convert.c src/tds/net.c src/tds/token.c + - added more user-level error checking, checking against + - known list of db-lib error messages + * src/apps/osql added + +Wed Sep 13 13:55:24 CET 2006 Frediano Ziglio + * samples/Makefile.am samples/unixodbc.freetds.driver.template.in: + - add Setup entry to unixODBC template + - unixODBC templates are not executables + +Wed Sep 13 13:52:40 CET 2006 Frediano Ziglio + * src/tds/mem.c: enable wide table + +Wed Sep 13 11:47:27 CET 2006 Frediano Ziglio + * src/tds/token.c: + - fix really broken tds5_process_result + +Fri Sep 08 11:58:24 CET 2006 Frediano Ziglio + * configure.ac src/tds/threadsafe.c: + - fix threadsafe problem on NetBSD + +Fri Sep 08 11:17:55 CET 2006 Frediano Ziglio + * include/tds.h src/tds/token.c: make splint a bit more happy + * src/odbc/odbc.c: small 64bit improvements + +Thu Sep 07 23:10:29 CET 2006 Frediano Ziglio + * src/odbc/sql2tds.c: fix paramset (Levente Tamási) + +Fri Sep 1 10:34:20 CET 2006 Frediano Ziglio + * include/tds.h include/tdsstring.h src/ctlib/ct.c: + * src/odbc/connectparams.c src/odbc/odbc.c src/server/login.c: + * src/tds/config.c src/tds/tdsstring.c: + - add dstr_size to DSTR + - add tds_dstr_alloc, tds_dstr_setlen, tds_dstr_buf + +Wed Aug 30 13:58:56 CET 2006 Frediano Ziglio + * include/tds.h src/tds/challenge.c src/tds/login.c: + - make tds_answer_challenge return flags + - tds_dstr fix + * src/dblib/dblib.c: small fix + * src/odbc/odbc.c: constification + * src/tds/query.c: + - some static functions rename + - do not convert string in tds7_build_param_def_from_query + * src/tds/threadsafe.c: cleanup + +Mon Aug 28 09:36:32 CET 2006 Frediano Ziglio + * include/cspublic.h: + - applied Norbert Sendetzky patch for ctlib compatibility + +Fri Aug 25 11:03:40 CET 2006 Frediano Ziglio + * src/dblib/unittests/Makefile.am src/dblib/unittests/t0017.c: + * src/dblib/unittests/t0017.in.be(added): + - fix big endian problem with t0017 test + +Fri Aug 25 09:17:37 CET 2006 Frediano Ziglio + * src/apps/tsql.c: remove 1024 char limit on tsql_readline + +Thu Aug 24 21:18:48 CET 2006 Frediano Ziglio + * src/apps/tsql.c: applied Christos Zoulas patch for no-tty + +Thu Aug 24 16:29:17 CET 2006 Frediano Ziglio + * include/sybdb.h src/dblib/dblib.c: + - do not change compatibility + * src/tds/config.c: small optimization + +Thu Aug 24 11:37:15 CET 2006 Frediano Ziglio + * m4/sprintf_i64_format.m4: fix 64bit problem for LP64 + +Thu Aug 24 11:17:26 CET 2006 Frediano Ziglio + * include/tds_sysdep_private.h src/apps/tsql.c src/ctlib/Makefile.am: + * src/dblib/Makefile.am src/tds/net.c win32/initnet.c: + * win32/winsetup.c win32/dev-cpp/FreeTDS.dev: + * win32/dev-cpp/Makefile.win win32/msvc6/FreeTDS.dsp: + - initialize socket library on win32 + +Thu Aug 24 08:32:07 CET 2006 Frediano Ziglio + * src/apps/tsql.c: + - do not print return status if quiet (patch from Christos Zoulas) + +Wed Aug 23 21:43:50 CET 2006 Frediano Ziglio + * doc/tsql.txt: applied Christos Zoulas updates + * doc/txt2man: updated + +Wed Aug 23 17:16:10 CET 2006 Frediano Ziglio + * src/tds/net.c: + - clean error before reading SO_ERROR, some system need this + * src/tds/util.c src/ctlib/ct.c: cross compile fixes + +Wed Aug 23 16:25:25 CET 2006 Frediano Ziglio + * m4/ac_tds_func_which_getpwuid_r.m4 m4/sprintf_i64_format.m4: + * configure.ac src/ctlib/cs.c src/apps/tsql.c: + * src/replacements/asprintf.c src/tds/query.c: + - fixes some cross compile issues with hp-ux + +Mon Aug 21 11:08:37 CET 2006 Frediano Ziglio + * src/dblib/dblib.c: remove small buffer overflow + +Thu Aug 17 11:13:40 CET 2006 Frediano Ziglio + * configure.ac include/tds.h src/dblib/unittests/Makefile.am: + * src/tds/net.c src/tds/query.c src/tds/token.c src/tds/util.c: + * m4/acx_pthread.m4(added): + - timeout more precise and use monotonic clock if available + - check pthread support more deeply + +Wed Aug 16 13:04:48 CET 2006 Frediano Ziglio + * src/tds/net.c: cleanup, fix possible problem under Linux + * src/tds/read.c: avoid invalid in_pos value on tds_peek + +Mon Aug 14 19:12:58 CET 2006 Frediano Ziglio + * src/ctlib/blk.c src/dblib/bcp.c src/dblib/dblib.c: + * src/dblib/unittests/common.c: + - fix warnings compiling with SUN cc + * src/dblib/unittests/thread.c: make error more verbose + +Sun Aug 13 15:02:40 CET 2006 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/data.c: + * src/odbc/unittests/transaction.c: + - fix minor issues with 64-bit machines + +Thu Aug 10 10:10:30 CET 2006 Frediano Ziglio + * src/ctlib/ct.c: fix possible buffer overflow + * src/replacements/gettimeofday.c: add comment + * src/tds/threadsafe.c: better and simple win implementation + * vms/descrip_mms.template win32/config.h: + * win32/dev-cpp/FreeTDS.dev win32/msvc6/libTDS.dsp: + - update build file + +Tue Aug 08 19:14:32 CET 2006 Frediano Ziglio + * doc/htdoc/index.html: update link + * src/tds/query.c: add comment + +Tue Aug 08 16:42:39 CET 2006 Frediano Ziglio + * src/tds/query.c src/tds/util.c: + - fix timeout problem setting correctly query_start_time + +Tue Aug 08 14:43:50 CET 2006 Frediano Ziglio + * src/odbc/unittests/Makefile.am: + * src/odbc/unittests/timeout2.c(added): + - added a test for timeout problem (cf "Query Time Out" on ML) + +Mon Aug 07 21:37:39 CET 2006 Frediano Ziglio + * include/tdsstring.h src/odbc/odbc_util.c: + * src/replacements/iconv.c src/tds/challenge.c: + * src/tds/config.c src/tds/convert.c: + * src/tds/iconv.c src/tds/mem.c src/tds/net.c: + * src/tds/query.c src/tds/read.c src/tds/tdsstring.c: + * src/tds/token.c src/tds/write.c: + - updated doxygen comments + +Sun Aug 06 17:54:11 CET 2006 Frediano Ziglio + * freetds.spec.in: fix rpm build on suse + +Thu Aug 03 20:30:07 CET 2006 Frediano Ziglio + * NEWS include/tds.h src/ctlib/ct.c src/odbc/odbc.c: + * src/tds/mem.c src/tds/query.c src/tds/tds_checks.c: + * src/tds/token.c src/tds/util.c: + - use reference counting for TDSCURSOR to avoid memory errors + +Thu Aug 03 10:32:37 CET 2006 Frediano Ziglio + * src/tds/unittests/iconv_fread.c(added): + * src/tds/iconv.c src/tds/unittests/.cvsignore: + * src/tds/unittests/Makefile.am: + - fix tds_iconv_fread and add a test for it + +Mon Jul 31 13:27:53 EDT 2006 JK Lowden + * src/dblib/bcp.c + - proper error message for using bcp with TDS version 4.2 + +Mon Jul 31 13:23:44 EDT 2006 JK Lowden + * include/sybdb.h src/dblib/dblib.c + - proper error message for using bcp with TDS version 4.2 + +Thu Jul 27 15:22:27 EDT 2006 JK Lowden + * samples/odbc_rpc.pl use fetchrow_array + * src/tds/unittests/Makefile.am include parent directory + +Tue Jul 25 10:16:45 CET 2006 Frediano Ziglio + * configure.ac m4/ac_nullzero.m4: add test for portability + +Tue Jul 25 10:10:22 CET 2006 Frediano Ziglio + * src/odbc/unittests/paramcore.c: updated + +Mon Jul 24 11:39:13 CET 2006 Frediano Ziglio + * src/odbc/unittests/prepclose.c: + - test with SQLExecDirect + +Mon Jul 17 15:18:48 CET 2006 Frediano Ziglio + * src/dblib/unittests/build_dsw.pl(removed): + * win32/build_dsw.pl(added) src/dblib/unittests/Makefile.am: + * src/odbc/unittests/Makefile.am: + - add a Makefile target to build projects for msvc6 + +Thu Jul 13 10:20:45 CET 2006 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c src/odbc/unittests/moreandcount.c: + - remove next_row_count, now useless... rpc.c works the same + +Wed Jul 12 13:23:43 EDT 2006 JK Lowden + * src/odbc/odbc.c src/tds/token.c: + - use TDS_NO_COUNT instead of bad rows_affected for next_row_count. + - src/odbc/unittests/rpc.c now works + +Wed Jul 12 16:15:14 CET 2006 Frediano Ziglio + * misc/test-other.sh: add file log + * src/odbc/unittests/rpc.c: fix uninitialized error + +Tue Jul 11 17:52:43 EDT 2006 JK Lowden + * src/odbc/odbc.c src/odbc/unittests/rpc.c: + - Better logging + +Tue Jul 11 17:28:34 CET 2006 Frediano Ziglio + * src/dblib/unittests/done_handling.c: improve + +Tue Jul 11 17:27:26 CET 2006 Frediano Ziglio + * src/odbc/unittests/paramcore.c: + - fix compatibility with sybase + +Tue Jul 11 11:56:53 CET 2006 Frediano Ziglio + * misc/online.pl: generate more friendly names + +Mon Jul 10 17:07:00 EDT 2006 JK Lowden + * src/tds/token.c src/dblib/dblib.c src/dblib/unittests/rpc.c + - dbresults does not return on DONEPROC + +Sun Jul 09 12:52:45 CET 2006 Frediano Ziglio + * doc/Makefile.am: fix compatibility problem + * src/odbc/unittests/rpc.c: fix warning + +Fri Jul 7 19:08:44 EDT 2006 JK Lowden + * include/sybdb.h src/dblib/dblib.c src/tds/token.c: + - Better logging + +Wed Jul 05 14:45:08 CET 2006 Frediano Ziglio + * src/dblib/unittests/Makefile.am src/dblib/unittests/bcp.c: + * src/dblib/unittests/common.c src/dblib/unittests/common.h: + * src/dblib/unittests/dbmorecmds.c: + * src/dblib/unittests/done_handling.c: + * src/dblib/unittests/rpc.c src/dblib/unittests/t0001.c: + * src/dblib/unittests/t0002.c src/dblib/unittests/t0003.c: + * src/dblib/unittests/t0004.c src/dblib/unittests/t0005.c: + * src/dblib/unittests/t0006.c src/dblib/unittests/t0007.c: + * src/dblib/unittests/t0008.c src/dblib/unittests/t0009.c: + * src/dblib/unittests/t0011.c src/dblib/unittests/t0012.c: + * src/dblib/unittests/t0013.c src/dblib/unittests/t0014.c: + * src/dblib/unittests/t0015.c src/dblib/unittests/t0016.c: + * src/dblib/unittests/t0017.c src/dblib/unittests/t0018.c: + * src/dblib/unittests/t0019.c src/dblib/unittests/t0020.c: + * src/dblib/unittests/t0021.c src/dblib/unittests/t0022.c: + * src/dblib/unittests/t0023.c src/dblib/unittests/text_buffer.c: + * src/dblib/unittests/thread.c: + * src/dblib/unittests/build_dsw.pl(added): + - put include stuff in common.h + - fix compile with ms dblib + - simplify testing under windows creating project files + +Wed Jul 5 18:29:21 EDT 2006 JK Lowden + * src/dblib/dblib.c src/dblib/rpc.c: + - removed nonprintable characters from TDSDUMP log + +Wed Jul 5 15:43:24 EDT 2006 JK Lowden + * src/dblib/unittests/rpc.c src/odbc/unittests/rpc.c: + - more thorough tests, currently fail + +Tue Jul 04 17:13:08 CET 2006 Frediano Ziglio + * src/odbc/unittests/Makefile.am: + * src/odbc/unittests/paramcore.c(added): + * src/odbc/unittests/.cvsignore src/odbc/sql2tds.c: + - test for core using SQLBindParameter, small fix + +Mon Jul 03 13:09:40 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: + - assure there is always an error when SQL_ERROR is returned + - fix warning + +Fri Jun 30 10:31:49 EDT 2006 JK Lowden + * src/odbc/sql2tds.c assert good pointer in case user passed NULL + * src/odbc/unittests/Makefile.am src/odbc/unittests/rpc.c + - added new unit test, similar to that used in dblib. + +Thu Jun 29 17:05:35 CET 2006 Frediano Ziglio + * NEWS src/tds/challenge.c: + - fix small buffer overflow + - reuse buffer + +Thu Jun 29 14:07:42 CET 2006 Frediano Ziglio + * include/tds.h src/tds/Makefile.am src/tds/challenge.c: + * src/tds/login.c src/tds/token.c: + - add NTLM2 Session Response support + +Tue Jun 27 15:47:46 CET 2006 Frediano Ziglio + * src/dblib/unittests/done_handling.c: + - improve + - update style + - fix typo + +Mon Jun 26 16:10:02 CET 2006 Frediano Ziglio + * phptests/rpc2.php(added): + - test from Ellert van Koperen (cf "SP parameters" and + http://kb.vankoperen.nl/freetds-problems.html) + +Sun Jun 25 10:12:48 CET 2006 Frediano Ziglio + * src/odbc/unittests/warning.c: + - tested + - fix portability problem with former Sybase db + - test returned warning + +Sun Jun 25 09:50:00 CET 2006 Frediano Ziglio + * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: + * src/odbc/unittests/warning.c(added): + - added warning test from John K. Hohm (cf + "Warning return as copy of last result row" on ML) + * src/odbc/unittests/describecol.c: compile fix + +Wed Jun 21 17:03:55 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: + * src/odbc/unittests/describecol.in(added): + - rewrote describecol test + +Wed Jun 21 09:26:02 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: improve column_length + * src/odbc/odbc_util.c: fix for odbc_sql_to_displaysize + * src/tds/iconv.c: invalid iconv_t is only -1, not NULL + +Tue Jun 20 17:52:19 EDT 2006 Nick Castellano + * src/odbc/unittests/array_out.c: + - rename variable to avoid libc symbol conflict + +Tue Jun 20 14:38:03 CET 2006 Frediano Ziglio + * src/tds/convert.c: use macro in sprintf + +Tue Jun 20 14:34:03 CET 2006 Frediano Ziglio + * src/tds/mem.c: small macro to allocate columns + +Tue Jun 20 14:33:09 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: improved a lot + +Tue Jun 20 11:15:16 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: catch error better + +Mon Jun 19 10:38:36 CET 2006 Frediano Ziglio + * freetds.spec.in misc/test-other.sh src/apps/Makefile.am: + * src/ctlib/Makefile.am src/dblib/Makefile.am src/odbc/Makefile.am: + * src/server/Makefile.am src/tds/Makefile.am: + * src/tds/unittests/Makefile.am: + - do not make libTDS shared library any more + +Mon Jun 19 09:57:23 CET 2006 Frediano Ziglio + * src/ctlib/ct.c src/odbc/sql2tds.c src/odbc/unittests/data.c: + * src/server/unittest.c: + - remove warning compiling with gcc4 + +Thu Jun 15 14:15:24 CET 2006 Frediano Ziglio + * configure.ac src/ctlib/unittests/cancel.c: + * src/dblib/unittests/common.c src/odbc/Makefile.am: + * src/replacements/readpassphrase.c: + - finished cross mingw32 + +Wed Jun 14 17:34:56 CET 2006 Frediano Ziglio + * src/odbc/convert_tds2sql.c: fix for date format + +Wed Jun 14 17:29:13 CET 2006 Frediano Ziglio + * configure.ac: add function + * src/apps/Makefile.am src/dblib/unittests/Makefile.am: + * src/dblib/unittests/bcp.c src/odbc/unittests/Makefile.am: + * src/replacements/Makefile.am src/replacements/gettimeofday.c: + * src/tds/unittests/Makefile.am: + - more fixes for cross mingw32 + +Wed Jun 14 13:26:42 CET 2006 Frediano Ziglio + * include/tds_sysdep_private.h src/apps/Makefile.am: + - fix for cross mingw32 + * src/odbc/unittests/describecol.c: report more clearly problems + +Tue Jun 13 20:17:16 CET 2006 Frediano Ziglio + * src/odbc/unittests/common.h src/server/unittest.c: + - small fixes for cross mingw + +Tue Jun 13 14:38:34 CET 2006 Frediano Ziglio + * src/odbc/unittests/prepclose.c(added) configure.ac: + * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: + - add test to test error closing connection on SQLPrepare + +Mon Jun 12 22:02:57 CET 2006 Frediano Ziglio + * m4/sprintf_i64_format.m4: fix for cross mingw32 + +Mon Jun 12 21:52:24 CET 2006 Frediano Ziglio + * src/odbc/sql2tds.c: fix for possible uninitialized variable + +Mon Jun 12 21:48:15 CET 2006 Frediano Ziglio + * src/apps/datacopy.c src/apps/freebcp.c src/apps/freebcp.h: + * src/pool/main.c src/pool/pool.h: + - fix some issues cross compiling for mingw32 + +Mon Jun 12 16:55:59 CET 2006 Frediano Ziglio + * src/odbc/unittests/data.c: add test for date to char + +Fri Jun 9 14:33:31 EDT 2006 Nick Castellano + * src/apps/tsql.c: inhibit readline tab completion in tsql + +Fri Jun 09 11:50:55 EDT 2006 Nick Castellano + * locales.conf: use same date format as Sybase in default and en_US + +Thu Jun 08 10:18:50 CET 2006 Frediano Ziglio + * src/tds/unittests/t0007.c: + - improved to detect possible date problems + +Wed Jun 07 14:37:56 EDT 2006 Nick Castellano + * src/tds/convert.c: correctly convert dates in January + +Tue Jun 06 12:02:10 CET 2006 Frediano Ziglio + * configure.ac src/tds/config.c: + - fix tsql -C for sybase compatibility + +Tue Jun 06 11:32:24 CET 2006 Frediano Ziglio + * src/tds/mem.c: use calloc instead of malloc/memset + +Mon Jun 05 13:42:24 CET 2006 Frediano Ziglio + * src/ctlib/ct.c src/tds/token.c: + - style and cleanup + +Mon May 29 13:38:05 CET 2006 Frediano Ziglio + * m4/sprintf_i64_format.m4: fix quoting + +Mon May 29 12:58:38 CET 2006 Frediano Ziglio + * NEWS include/tds.h src/tds/token.c: + - make tds_alloc_get_string static + +Mon May 15 17:11:54 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: + - applied fixes from Charlene Herring (cf. "Problems when + using odbc : SQLPutData, SQLExecDirect,Decimals" 2006/05/14 + +Sun May 14 14:34:04 CET 2006 Frediano Ziglio + * src/odbc/descriptor.c: fix memory error + +Sat May 13 10:49:40 CET 2006 Frediano Ziglio + * src/odbc/unittests/copydesc.c: improve + +Mon May 08 11:38:30 CET 2006 Frediano Ziglio + * src/odbc/descriptor.c src/odbc/unittests/Makefile.am: + * src/odbc/unittests/copydesc.c(added): add test for SQLCopyDesc + +Fri Apr 21 17:10:00 CET 2006 Frediano Ziglio + * src/odbc/sql2tds.c: use new tds_convert types + +Fri Apr 21 09:45:56 CET 2006 Frediano Ziglio + * doc/htdoc/faq.html: fix html compatibility + +Thu Apr 20 12:10:28 CET 2006 Frediano Ziglio + * src/ctlib/unittests/ct_dynamic.c: remove leak in test + +Tue Apr 17 19:47:57 CET 2006 Frediano Ziglio + * src/ctlib/ct.c: fix double free + +Mon Apr 17 10:51:09 CET 2006 Frediano Ziglio + * src/odbc/convert_tds2sql.c src/odbc/prepare_query.c: + - use new conversion style in ODBC + +Sun Apr 16 10:11:32 CET 2006 Frediano Ziglio + * include/tds.h src/tds/locale.c src/tds/mem.c: + - TDSLOCALE changes to keep ABI + +Sat Apr 15 10:18:29 CET 2006 Frediano Ziglio + * include/tdsconvert.h * src/tds/convert.c: + - add new type of conversion for copy optimizations + +Sat Apr 15 10:02:20 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: fix for older Sybase versions + * src/tds/config.c: optimize option read + +Sat Apr 15 09:03:34 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: remove warning + +Fri Apr 14 15:22:02 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: + - improved + +Fri Apr 14 13:55:09 CET 2006 Frediano Ziglio + * src/odbc/unittests/describecol.c: + - add test for precision returned by SQLDescribeCol + +Wed Apr 12 21:41:51 CET 2006 Frediano Ziglio + * locales.conf: fix charset typo + * doc/userguide.sgml: fix attributes for locales.conf + +Wed Apr 12 15:53:18 CET 2006 Frediano Ziglio + * include/tds.h include/tds_sysdep_private.h: + * include/tds_sysdep_public.h.in include/tdsconvert.h: + * include/tdsver.h.in: + - avoid ident strings in all objects + * m4/sprintf_i64_format.m4: add Ld format + +Tue Apr 11 16:33:41 CET 2006 Frediano Ziglio + * include/tds_sysdep_public.h.in include/tdsver.h.in: + - small constification + +Tue Apr 11 13:51:43 CET 2006 Frediano Ziglio + * src/odbc/unittests/connect.c: do not fail if not FreeTDS + * src/odbc/unittests/raiserror.c: more verbose + +Mon Apr 10 18:14:17 EDT 2006 JK Lowden + * include/tds.h src/apps/tsql.c src/tds/config.c + - report sysconfdir with tsql -C + +Mon Apr 10 11:59:53 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: cleanup + +Fri Apr 07 09:38:45 CET 2006 Frediano Ziglio + * misc/test-other.sh: update to php 5.1 + * phptests/nextres.php: a bit more verbose + +Thu Apr 06 11:37:45 CET 2006 Frediano Ziglio + * misc/coverage.sh: less verbose + * src/dblib/bcp.c: small change + +Wed Apr 05 08:42:54 CET 2006 Frediano Ziglio + * misc/full-test.sh: cleanup + * misc/test-auto.sh: allow configuration + * misc/test-other.sh: make output suitable for online.pl + * src/apps/tsql.c: + - improve documentation + - fix problem for multiple options + * src/odbc/odbc.c src/tds/token.c: avoid void message to application + +Wed Apr 05 07:09:32 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: remove some warnings + +Wed Mar 29 18:25:54 CET 2006 Frediano Ziglio + * m4/ac_caolan_func_which_gethostbyname_r.m4: + * m4/ac_have_inaddr_none.m4 m4/ac_have_malloc_options.m4: + * m4/ac_raf_func_which_getservbyname_r.m4: + * m4/ac_tds_func_which_gethostbyaddr_r.m4: + * m4/ac_tds_func_which_getpwuid_r.m4: + * m4/ac_tds_func_which_localtime_r.m4: + * m4/ax_cflags_gcc_option.m4 m4/lib-link.m4: + * m4/sprintf_i64_format.m4 m4/type_socklen_t.m4: + - quote as necessary + +Mon Mar 27 19:01:05 EST 2006 JK Lowden + * configure.ac + * m4/ac_caolan_func_which_gethostbyname_r.m4 + * m4/ac_have_inaddr_none.m4 + * m4/ac_have_malloc_options.m4 + * m4/ac_raf_func_which_getservbyname_r.m4 + * m4/ac_tds_func_which_gethostbyaddr_r.m4 + * m4/ac_tds_func_which_getpwuid_r.m4 + * m4/ac_tds_func_which_localtime_r.m4 + * m4/ax_cflags_gcc_option.m4 + * m4/sprintf_i64_format.m4 + * m4/type_socklen_t.m4 + * src/ctlib/unittests/Makefile.am + * src/dblib/unittests/Makefile.am + * src/odbc/unittests/Makefile.am + * src/tds/unittests/Makefile.am + - removed/updated obsolete autoconf macros + * m4/am_iconv.m4 removed + * m4/README.iconv + * m4/iconv.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 + - added from GNU libiconv + +Mon Mar 27 09:48:56 EST 2006 JK Lowden + * doc/htdoc/index.html corrected nightly test link + +Mon Mar 27 10:17:42 CET 2006 Frediano Ziglio + * src/dblib/rpc.c: allow again null for fixed types + +Mon Mar 27 02:20:16 EST 2006 JK Lowden + * configure.ac m4/am_iconv.m4 m4/check_openssl.m4 + * src/apps/Makefile.am src/ctlib/Makefile.am src/dblib/Makefile.am + * src/odbc/Makefile.am src/pool/Makefile.am src/replacements/Makefile.am + * src/server/Makefile.am src/tds/Makefile.am + - modernized autotool contructs + * configure.in removed + +Sun Mar 26 19:01:43 CET 2006 Frediano Ziglio + * src/odbc/prepare_query.c: + - fixed constant parameters after mssql 2005 patch + +Fri Mar 24 16:47:26 EST 2006 JK Lowden + * configure.in removed, is now configure.ac + * acinclude.m4 removed, added m4 directory + * Makefile.am include m4 directory + * m4/ac_caolan_func_which_gethostbyname_r.m4 m4/ac_have_inaddr_none.m4 + * m4/ac_have_malloc_options.m4 m4/ac_raf_func_which_getservbyname_r.m4 + * m4/ac_tds_func_which_gethostbyaddr_r.m4 + * m4/ac_tds_func_which_getpwuid_r.m4 + * m4/ac_tds_func_which_localtime_r.m4 m4/am_iconv.m4 + * m4/check_openssl.m4 m4/sprintf_i64_format.m4 m4/type_socklen_t.m4 + - Split acinclude.m4 into one macro defintion per file. + * m4/ax_cflags_gcc_option.m4 + - Check for gcc features e.g. the declaration-after-statement warning. + +Fri Mar 24 13:03:36 EST 2006 JK Lowden + * doc/htdoc/docs.html doc/htdoc/index.html updated + +Fri Mar 24 12:36:02 EST 2006 JK Lowden + * doc/htdoc/software.html fixed broken links added link to RC + +Fri Mar 24 16:27:27 CET 2006 Frediano Ziglio + * misc/full-test.sh misc/test-auto.sh misc/full-test-ol.sh(removed): + - use an "online" version for test + +Thu Mar 23 15:53:45 CET 2006 Frediano Ziglio + * src/odbc/sql2tds.c src/odbc/unittests/earlybind.c: + * src/odbc/unittests/norowset.c src/odbc/unittests/t0004.c: + * src/odbc/unittests/tables.c src/tds/data.c src/tds/tds_checks.c: + - fixes for mssql 2005 + +Thu Mar 23 13:48:23 CET 2006 Frediano Ziglio + * src/tds/query.c: partially fix problem with mssql2k5 + +Thu Mar 23 11:44:32 CET 2006 Frediano Ziglio + * misc/full-test-ol.sh misc/online.pl misc/test-auto.sh: + - changed online.pl with James hints + - enable Valgrind tests using online check + +Tue Mar 21 15:24:04 CET 2006 Frediano Ziglio + * src/odbc/unittests/cursor2.c(aded) src/odbc/unittests/Makefile.am: + - added test to check errors using cursor on no row statement + +Tue Mar 21 13:22:07 CET 2006 Frediano Ziglio + * src/odbc/native.c: + - applied patch from Richard Krehbiel (cf "ODBC datetime literal issue") + +Tue Mar 21 08:49:44 CET 2006 Frediano Ziglio + * configure.in src/dblib/dblib.c: + - fix declaration after statements + +Mon Mar 20 15:28:25 CET 2006 Frediano Ziglio + * src/dblib/bcp.c: fix error in bcp_colfmt + +Mon Mar 20 15:00:45 CET 2006 Frediano Ziglio + * src/dblib/bcp.c src/dblib/dblib.c src/dblib/rpc.c: + - remove some double checks + - return correct values from CHECK_PARAMETER + - fix some possible core if dbproc == NULL + +Mon Mar 20 09:42:55 CET 2006 Frediano Ziglio + * misc/full-test.sh: added timeout + +Sun Mar 19 18:34:47 CET 2006 Frediano Ziglio + * misc/test-auto.sh: fix typo in header + * src/dblib/dblib.c: remove double checks + +Sun Mar 19 18:33:14 CET 2006 Frediano Ziglio + * src/odbc/unittests/genparams.c src/odbc/unittests/transaction.c: + - remove warnings on 64bit int + +Sun Mar 19 09:27:09 EST 2006 JK Lowden + * src/dblib/bcp.c src/dblib/dblib.c more logging repairs + +Sat Mar 18 12:34:02 EST 2006 JK Lowden + * include/dblib.h src/dblib/bcp.c + - validate parameters. Unable to run unittest due to down server. + +Sat Mar 18 01:27:32 EST 2006 JK Lowden + * include/dblib.h src/dblib/dblib.c src/dblib/rpc.c + - test parameters for all public functions (except bcp) + +Fri Mar 17 01:35:17 EST 2006 JK Lowden + * src/dblib/dblib.c src/dblib/rpc.c + - added a TDSDUMP log entry for every public function + +Thu Mar 16 09:59:25 EST 2006 JK Lowden + * TODO add rpc error messages + * src/apps/bsqldb.c exit if severity > 10 + +Wed Mar 15 00:41:11 EST 2006 JK Lowden + * doc/freebcp.txt The freebcp manpage was seriously out of date. + * src/apps/freebcp.c give better error message. + +Thu Mar 9 14:33:37 CET 2006 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c: + - add cursor_type to connection attributes (required for DBD::ODBC) + - removed small TODO on error report + +Mon Mar 6 12:55:10 CET 2006 Frediano Ziglio + * include/tds.h src/ctlib/ct.c src/odbc/connectparams.c: + * src/pool/util.c src/server/login.c src/server/unittest.c: + * src/tds/config.c src/tds/login.c src/tds/mem.c: + - renamed host_name field to client_host_name + - optimize way strings are allocated + +Fri Feb 24 15:04:35 EST 2006 JK Lowden + * src/tds/config.c src/tds/login.c: + - nicer TDSDUMPCONFIG output, including a recap + +Sun Feb 19 14:56:15 CET 2006 Frediano Ziglio + * src/odbc/odbc.c: fix wrong declaration + +Thu Feb 16 08:30:00 CET 2006 Frediano Ziglio + * src/odbc/unittests/scroll.c src/odbc/unittests/raiserror.c: + * src/odbc/unittests/cursor1.c: + - remove warning compiling with gcc4 + * misc/test-other.sh: fix problem with DBD:ODBC test + +Mon Feb 13 17:11:30 CET 2006 Frediano Ziglio + * src/odbc/unittests/genparams.c: add BIGINT type to test + +Wed Feb 8 10:48:36 CET 2006 Frediano Ziglio + * include/tdsodbc.h src/odbc/error.c src/odbc/odbc.c: + * vms/odbc_driver_axp.opt win32/FreeTDS.def: + - start cursor stuff for odbc + - added SQLSetScrollOptions + * src/odbc/unittests/scroll.c: support more fetch types + +Tue Feb 7 15:42:56 CET 2006 Frediano Ziglio + * include/tds.h src/tds/query.c src/ctlib/ct.c NEWS: + - improve cursor support + +Tue Feb 7 14:22:50 CET 2006 Frediano Ziglio + * src/odbc/unittests/scroll.c(added): + * src/odbc/unittests/.cvsignore: + * src/odbc/unittests/Makefile.am: + * src/odbc/unittests/cursor1.c: + - add scroll test for cursor + - build msvc project for odbc unittests + * src/dblib/unittests/Makefile.am: add done_handling test + +Mon Feb 6 16:50:05 CET 2006 Frediano Ziglio + * include/sybdb.h src/apps/freebcp.c src/dblib/bcp.c: + - implemented BCPKEEPIDENTITY for bcp_control + - make freebcp do not depend on dblib internals + +Mon Feb 6 16:44:27 CET 2006 Frediano Ziglio + * src/odbc/unittests/.cvsignore src/odbc/unittests/cursor1.c: + - update cursor1 test + +Thu Feb 2 15:33:21 CET 2006 Frediano Ziglio + * NEWS: updated + * src/odbc/odbc.c vms/odbc_driver_axp.opt win32/FreeTDS.def: + - compile SQLSetPos function + * src/odbc/unittests/Makefile.am src/odbc/unittests/cursor1.c(added): + - added a test for cursors (do not work...) + +Tue Jan 31 14:27:51 CET 2006 Frediano Ziglio + * src/apps/freebcp.c src/dblib/bcp.c: + - fix broken charcater conversion + - use calloc instead of malloc/memset + - support 64bit file on win32 + +Tue Jan 31 09:59:28 CET 2006 Frediano Ziglio + * src/dblib/dblib.c: do more argument check + +Mon Jan 30 16:29:20 CET 2006 Frediano Ziglio + * src/ctlib/unittests/blk_out.c src/ctlib/unittests/ct_cursor.c: + * src/ctlib/unittests/ct_cursors.c src/ctlib/unittests/ct_dynamic.c: + * src/dblib/unittests/t0005.c src/dblib/unittests/t0014.c: + * src/dblib/unittests/t0022.c src/dblib/unittests/thread.c: + - reduce false errors + +Sat Jan 28 15:49:55 CET 2006 Frediano Ziglio + * src/dblib/bcp.c: + - update row allocation using new row_free + - fix native format + - correctly check and handle EOF + - change _bcp_build_bcp_record to direct send row (renamed to + _bcp_send_bcp_record) + - write error file only if needed + * src/dblib/unittests/t0016.c: improved + * src/dblib/unittests/t0016.in: + - make input same of output + * src/dblib/unittests/t0017.c: get all data + * src/tds/mem.c: reset pointer just freed + +Sat Jan 28 09:39:10 CET 2006 Frediano Ziglio + * src/dblib/unittests/t0017.c: reformat output + +Fri Jan 27 14:34:09 EST 2006 JK Lowden + * src/dblib/bcp.c recognize EOF errors from _bcp_read_hostfile + +Fri Jan 27 10:43:54 EST 2006 JK Lowden + * src/dblib/unittests/t0017.c better feedback + +Thu Jan 26 13:58:51 CET 2006 Frediano Ziglio + * src/apps/freebcp.c src/apps/freebcp.h: + - support for NUL in terminators + +Wed Jan 25 15:33:20 CET 2006 Frediano Ziglio + * src/dblib/bcp.c: fix return test for fseeko + +Wed Jan 25 15:01:51 CET 2006 Frediano Ziglio + * acinclude.m4 configure.in src/tds/numeric.c: + - use 64bit sprintf format if available + * misc/test-other.sh: redirect odbc to compiled driver + +Tue Jan 24 16:01:41 CET 2006 Frediano Ziglio + * NEWS include/tds.h src/apps/tsql.c src/ctlib/blk.c: + * src/ctlib/ct.c src/dblib/bcp.c src/dblib/buffering.h: + * src/dblib/dblib.c src/dblib/rpc.c src/odbc/odbc.c: + * src/odbc/odbc_util.c src/odbc/prepare_query.c: + * src/odbc/sql2tds.c src/pool/stream.c src/server/server.c: + * src/tds/mem.c src/tds/query.c src/tds/tds_checks.c: + * src/tds/token.c src/tds/unittests/dataread.c: + * src/tds/unittests/dynamic1.c src/tds/unittests/t0002.c: + * src/tds/unittests/t0004.c src/tds/unittests/t0005.c: + * src/tds/unittests/t0006.c src/tds/unittests/utf8_1.c: + * src/tds/unittests/utf8_2.c: + - use direct pointer column_data instead of old column_offset + +Mon Jan 23 17:30:38 EST 2006 JK Lowden + * src/apps/bsqldb.c bind to printable width, not column size + +Mon Jan 23 14:04:44 CET 2006 Frediano Ziglio + * configure.in: start developing 0.65 version +$Id: ChangeLog-0.82,v 1.1 2008/01/10 01:01:38 jklowden Exp $ commit b10c0ecf799e3db6bf8e2617fd29aba4e5000e57 Author: jklowden Date: Thu Jan 10 01:02:20 2008 +0000 formatting diff --git a/ChangeLog b/ChangeLog index ad8d878..1bfbe78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release - - ChangeLog-0.82 added because of release + * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2455 2008/01/10 01:01:31 jklowden Exp $ +$Id: ChangeLog,v 1.2456 2008/01/10 01:02:20 jklowden Exp $ commit b9bbaa400d6a758e9dd6896035f971fc41dacf7b Author: freddy77 Date: Thu Jan 10 08:47:37 2008 +0000 fix SQLNumResultCols() is wrong (+1) problem diff --git a/ChangeLog b/ChangeLog index 1bfbe78..d1d80dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ +Thu Jan 10 09:46:41 CET 2008 Frediano Ziglio + * TODO src/odbc/odbc.c src/odbc/unittests/.cvsignore: + * src/odbc/unittests/Makefile.am: + - small fix for hidden fields (ignore them entirely) + Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2456 2008/01/10 01:02:20 jklowden Exp $ +$Id: ChangeLog,v 1.2457 2008/01/10 08:47:37 freddy77 Exp $ diff --git a/TODO b/TODO index 6b770b4..49074e8 100644 --- a/TODO +++ b/TODO @@ -8,7 +8,7 @@ anyone else can post a patch to Source Forge. In this way we can communicate with each other about the project's priorities and needs. -To Do List $Id: TODO,v 1.165 2007/12/26 20:56:00 freddy77 Exp $ +To Do List $Id: TODO,v 1.166 2008/01/10 08:47:37 freddy77 Exp $ ------------ Bug? ML 2007-05-30 "dbsqlexec() never returns" @@ -131,6 +131,14 @@ For future versions (in priority order within library): . report error just before returning SQL_ERROR from inner function? . 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: all binding types (input and output) . test: descriptors work - ODBC 2 type returned (datetime) diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index 7180d23..a19f734 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.464 2008/01/06 10:48:43 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.465 2008/01/10 08:47:37 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -2652,7 +2652,7 @@ odbc_ird_check(TDS_STMT * stmt) return; /* check columns number */ - assert(ird->header.sql_desc_count == cols || ird->header.sql_desc_count == 0); + assert(ird->header.sql_desc_count <= cols || ird->header.sql_desc_count == 0); /* check all columns */ @@ -2717,6 +2717,10 @@ odbc_populate_ird(TDS_STMT * stmt) 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) { odbc_errs_add(&stmt->errs, "HY001", NULL); return SQL_ERROR; diff --git a/src/odbc/unittests/.cvsignore b/src/odbc/unittests/.cvsignore index d6eea5a..1316adb 100644 --- a/src/odbc/unittests/.cvsignore +++ b/src/odbc/unittests/.cvsignore @@ -62,3 +62,4 @@ cursor3 cursor4 cursor5 attributes +hidden diff --git a/src/odbc/unittests/Makefile.am b/src/odbc/unittests/Makefile.am index e68b0a4..14726b2 100644 --- a/src/odbc/unittests/Makefile.am +++ b/src/odbc/unittests/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.68 2007/12/19 14:36:05 freddy77 Exp $ +# $Id: Makefile.am,v 1.69 2008/01/10 08:47:38 freddy77 Exp $ TESTS = \ t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT)\ t0004$(EXEEXT) connect$(EXEEXT) print$(EXEEXT)\ @@ -20,7 +20,7 @@ TESTS = \ paramcore$(EXEEXT) timeout2$(EXEEXT) timeout3$(EXEEXT) \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ - attributes$(EXEEXT) + attributes$(EXEEXT) hidden$(EXEEXT) check_PROGRAMS = $(TESTS) @@ -77,6 +77,7 @@ cursor3_SOURCES = cursor3.c common.c common.h cursor4_SOURCES = cursor4.c common.c common.h cursor5_SOURCES = cursor5.c common.c common.h attributes_SOURCES = attributes.c common.c common.h +hidden_SOURCES = hidden.c common.c common.h AM_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) -DFREETDS_SRCDIR=\"$(srcdir)\" if MINGW32 commit 49951943657f47fb003342a116ec3e77a833bed4 Author: freddy77 Date: Thu Jan 10 08:54:46 2008 +0000 fix SQLNumResultCols() is wrong (+1) problem diff --git a/src/odbc/unittests/hidden.c b/src/odbc/unittests/hidden.c new file mode 100755 index 0000000..d9b6b25 --- /dev/null +++ b/src/odbc/unittests/hidden.c @@ -0,0 +1,96 @@ +/* Testing result column numbers having hidden columns */ +/* Test from Sebastien Flaesch */ + +#include "common.h" + +static char software_version[] = "$Id: hidden.c,v 1.2 2008/01/10 08:54:46 freddy77 Exp $"; +static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; + +#define CHECK_RCODE(t,h,m) \ + if ( rcode != SQL_NO_DATA \ + && rcode != SQL_SUCCESS \ + && rcode != SQL_SUCCESS_WITH_INFO \ + && rcode != SQL_NEED_DATA ) { \ + fprintf(stderr,"Error %d at: %s\n",rcode,m); \ + getErrorInfo(t,h); \ + exit(1); \ + } + +static void +getErrorInfo(SQLSMALLINT sqlhdltype, SQLHANDLE sqlhandle) +{ + SQLRETURN rcode = 0; + SQLCHAR sqlstate[SQL_SQLSTATE_SIZE + 1]; + SQLINTEGER naterror = 0; + SQLCHAR msgtext[SQL_MAX_MESSAGE_LENGTH + 1]; + SQLSMALLINT msgtextl = 0; + + rcode = SQLGetDiagRec((SQLSMALLINT) sqlhdltype, + (SQLHANDLE) sqlhandle, + (SQLSMALLINT) 1, + (SQLCHAR *) sqlstate, + (SQLINTEGER *) & naterror, + (SQLCHAR *) msgtext, (SQLSMALLINT) sizeof(msgtext), (SQLSMALLINT *) & msgtextl); + fprintf(stderr, "Diagnostic info:\n"); + fprintf(stderr, " SQL State: %s\n", (char *) sqlstate); + fprintf(stderr, " SQL code : %d\n", (int) naterror); + fprintf(stderr, " Message : %s\n", (char *) msgtext); +} + +int +main(int argc, char **argv) +{ + SQLRETURN rcode; + SQLHSTMT m_hstmt1; + SQLSMALLINT cnt = 0; + int failed = 0; + + use_odbc_version3 = 1; + Connect(); + + Command(Statement, "CREATE TABLE #t1 ( k INT, c CHAR(10), vc VARCHAR(10) )"); + Command(Statement, "CREATE TABLE #tmp1 (i NUMERIC(10,0) IDENTITY PRIMARY KEY, b VARCHAR(20) NULL, c INT NOT NULL)"); + + /* test hidden column with FOR BROWSE */ + ResetStatement(); + + m_hstmt1 = Statement; + + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "SELECT c, b FROM #tmp1", SQL_NTS); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect"); + + rcode = SQLNumResultCols(m_hstmt1, &cnt); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLNumResultCols 1"); + + if (cnt != 2) { + fprintf(stderr, "Wrong number of columns in result set: %d\n", (int) cnt); + failed = 1; + } + ResetStatement(); + + /* test hidden column with cursors*/ + CheckCursor(); + + rcode = SQLSetStmtAttr(m_hstmt1, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); + rcode = SQLSetStmtAttr(m_hstmt1, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); + + rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM #t1", SQL_NTS); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLPrepare 1"); + + rcode = SQLExecute(m_hstmt1); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecute 1"); + + rcode = SQLNumResultCols(m_hstmt1, &cnt); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLNumResultCols 1"); + + if (cnt != 3) { + fprintf(stderr, "Wrong number of columns in result set: %d\n", (int) cnt); + failed = 1; + } + + Disconnect(); + + return failed ? 1: 0; +} commit ea3ce27c24032abbdd44c8453cc23d291b466583 Author: freddy77 Date: Thu Jan 10 13:11:07 2008 +0000 fix SQLGetData problem diff --git a/ChangeLog b/ChangeLog index d1d80dd..bb41c3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jan 10 14:10:28 CET 2008 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/.cvsignore: + * src/odbc/unittests/Makefile.am src/odbc/unittests/blob1.c(added): + - fix problem with SQLGetData and blobs + Thu Jan 10 09:46:41 CET 2008 Frediano Ziglio * TODO src/odbc/odbc.c src/odbc/unittests/.cvsignore: * src/odbc/unittests/Makefile.am: @@ -7,4 +12,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2457 2008/01/10 08:47:37 freddy77 Exp $ +$Id: ChangeLog,v 1.2458 2008/01/10 13:11:07 freddy77 Exp $ diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index a19f734..a638dc7 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.465 2008/01/10 08:47:37 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.466 2008/01/10 13:11:07 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -4583,12 +4583,12 @@ SQLGetData(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgb if (*pcbValue < 0) ODBC_RETURN(stmt, SQL_ERROR); - if (is_variable_type(colinfo->column_type)) { + if (is_variable_type(colinfo->column_type) && (fCType == SQL_C_CHAR || fCType == SQL_C_BINARY)) { /* calc how many bytes was readed */ int readed = cbValueMax; /* FIXME test on destination char ??? */ - if (stmt->dbc->env->attr.output_nts != SQL_FALSE && is_char_type(nSybType) && readed > 0) + if (stmt->dbc->env->attr.output_nts != SQL_FALSE && fCType == SQL_C_CHAR && readed > 0) --readed; if (readed > *pcbValue) readed = *pcbValue; diff --git a/src/odbc/unittests/.cvsignore b/src/odbc/unittests/.cvsignore index 1316adb..d7c663e 100644 --- a/src/odbc/unittests/.cvsignore +++ b/src/odbc/unittests/.cvsignore @@ -63,3 +63,4 @@ cursor4 cursor5 attributes hidden +blob1 diff --git a/src/odbc/unittests/blob1.c b/src/odbc/unittests/blob1.c new file mode 100755 index 0000000..838a507 --- /dev/null +++ b/src/odbc/unittests/blob1.c @@ -0,0 +1,224 @@ +/* Testing large objects */ +/* Test from Sebastien Flaesch */ + +#include "common.h" + +static char software_version[] = "$Id: blob1.c,v 1.1 2008/01/10 13:11:08 freddy77 Exp $"; +static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; + +#define CHECK_RCODE(t,h,m) \ + if ( rcode != SQL_SUCCESS && rcode != SQL_SUCCESS_WITH_INFO && rcode != SQL_NO_DATA && rcode != SQL_NEED_DATA ) { \ + fprintf(stderr,"Error %d at: %s\n",rcode,m); \ + getErrorInfo(t,h); \ + exit(1); \ + } + +#define NBYTES 10000 + +static int failed = 0; + +static void +getErrorInfo(SQLSMALLINT sqlhdltype, SQLHANDLE sqlhandle) +{ + SQLRETURN rcode = 0; + SQLCHAR sqlstate[SQL_SQLSTATE_SIZE + 1]; + SQLINTEGER naterror = 0; + SQLCHAR msgtext[SQL_MAX_MESSAGE_LENGTH + 1]; + SQLSMALLINT msgtextl = 0; + + rcode = SQLGetDiagRec((SQLSMALLINT) sqlhdltype, + (SQLHANDLE) sqlhandle, + (SQLSMALLINT) 1, + (SQLCHAR *) sqlstate, + (SQLINTEGER *) & naterror, + (SQLCHAR *) msgtext, (SQLSMALLINT) sizeof(msgtext), (SQLSMALLINT *) & msgtextl); + fprintf(stderr, "Diagnostic info:\n"); + fprintf(stderr, " SQL State: %s\n", (char *) sqlstate); + fprintf(stderr, " SQL code : %d\n", (int) naterror); + fprintf(stderr, " Message : %s\n", (char *) msgtext); +} + +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 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 +readBlob(SQLHSTMT * stmth, SQLUSMALLINT pos) +{ + SQLRETURN rcode; + char buf[4096]; + SQLLEN len, total = 0; + int i = 0; + int check; + + printf(">> readBlob field %d\n", pos); + while (1) { + i++; + rcode = SQLGetData(stmth, pos, SQL_C_BINARY, (SQLPOINTER) buf, (SQLINTEGER) sizeof(buf), &len); + if (!SQL_SUCCEEDED(rcode) || len <= 0) + break; + if (len > (SQLLEN) sizeof(buf)) + len = (SQLLEN) sizeof(buf); + printf(">> step %d: %d bytes readed\n", i, (int) len); + if (pos == 1) + check = check_chars(buf, len, 123 + total, 1); + else + check = check_chars(buf, len, 987 + total, 25); + if (!check) { + fprintf(stderr, "Wrong buffer content\n"); + failed = 1; + } + total += len; + } + printf(">> total bytes read = %d \n", (int) total); + if (total != 10000) + failed = 1; + return rcode; +} + +int +main(int argc, char **argv) +{ + SQLRETURN rcode; + SQLHSTMT m_hstmt = NULL; + int i; + + int key; + SQLINTEGER vind0; + char buf1[NBYTES]; + SQLINTEGER vind1; + char buf2[NBYTES]; + SQLINTEGER vind2; + int cnt = 2; + + use_odbc_version3 = 1; + Connect(); + + Command(Statement, "IF OBJECT_ID('tt') IS NOT NULL DROP TABLE tt"); + Command(Statement, "CREATE TABLE tt ( k INT, t TEXT, b IMAGE, v INT )"); + + /* Insert rows ... */ + + for (i = 0; i < cnt; i++) { + + m_hstmt = NULL; + rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt); + CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle StmtH"); + + rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "insert into tt values ( ?, ?, ?, ? )", SQL_NTS); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPrepare"); + + SQLBindParameter(m_hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &key, 0, &vind0); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindParameter 1"); + + SQLBindParameter(m_hstmt, 2, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARCHAR, 0x10000000, 0, buf1, 0, &vind1); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindParameter 2"); + + SQLBindParameter(m_hstmt, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, 0x10000000, 0, buf2, 0, &vind2); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindParameter 3"); + + SQLBindParameter(m_hstmt, 4, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &key, 0, &vind0); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindParameter 4"); + + key = i; + vind0 = 0; + + fill_chars(buf1, NBYTES, 123, 1); + vind1 = SQL_LEN_DATA_AT_EXEC(NBYTES); + + fill_chars(buf2, NBYTES, 987, 25); + vind2 = SQL_LEN_DATA_AT_EXEC(NBYTES); + + printf(">> insert... %d\n", i); + rcode = SQLExecute(m_hstmt); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLExecute StmtH"); + while (rcode == SQL_NEED_DATA) { + char *p; + + rcode = SQLParamData(m_hstmt, (SQLPOINTER) & p); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLParamData StmtH"); + printf(">> SQLParamData: ptr = %p rcode = %d\n", (void *) p, rcode); + if (rcode == SQL_NEED_DATA) { + SQLRETURN rcode = SQLPutData(m_hstmt, p, NBYTES); + + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPutData StmtH"); + printf(">> param %p: total bytes written = %d\n", (void *) p, NBYTES); + } + } + + rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLFreeHandle StmtH"); + + } + + /* No fetch rows ... */ + + for (i = 0; i < cnt; i++) { + + m_hstmt = NULL; + rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt); + CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle StmtH"); + + rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); + rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); + + rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "SELECT t, b, v FROM tt WHERE k = ?", SQL_NTS); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPrepare"); + + SQLBindParameter(m_hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &i, 0, &vind0); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindParameter 1"); + + SQLBindCol(m_hstmt, 1, SQL_C_BINARY, NULL, 0, &vind1); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindCol 2"); + SQLBindCol(m_hstmt, 2, SQL_C_BINARY, NULL, 0, &vind2); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindCol 3"); + SQLBindCol(m_hstmt, 3, SQL_C_LONG, &key, 0, &vind0); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLBindCol 1"); + + vind0 = 0; + vind1 = SQL_DATA_AT_EXEC; + vind2 = SQL_DATA_AT_EXEC; + + rcode = SQLExecute(m_hstmt); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLExecute StmtH"); + + rcode = SQLFetchScroll(m_hstmt, SQL_FETCH_NEXT, 0); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLFetchScroll StmtH"); + printf(">> fetch... %d rcode = %d\n", i, rcode); + + rcode = readBlob(m_hstmt, 1); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "readBlob 1"); + rcode = readBlob(m_hstmt, 2); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "readBlob 2"); + + rcode = SQLCloseCursor(m_hstmt); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLCloseCursor StmtH"); + + rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLFreeHandle StmtH"); + } + + Disconnect(); + + return failed ? 1 : 0; +} + commit 53181ec91693d58dfee70e7c1ce4bc66b05de712 Author: freddy77 Date: Thu Jan 10 13:21:12 2008 +0000 fix SQLGetData problem diff --git a/src/odbc/unittests/Makefile.am b/src/odbc/unittests/Makefile.am index 14726b2..830c6c5 100644 --- a/src/odbc/unittests/Makefile.am +++ b/src/odbc/unittests/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.69 2008/01/10 08:47:38 freddy77 Exp $ +# $Id: Makefile.am,v 1.70 2008/01/10 13:21:12 freddy77 Exp $ TESTS = \ t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT)\ t0004$(EXEEXT) connect$(EXEEXT) print$(EXEEXT)\ @@ -20,7 +20,7 @@ TESTS = \ paramcore$(EXEEXT) timeout2$(EXEEXT) timeout3$(EXEEXT) \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ - attributes$(EXEEXT) hidden$(EXEEXT) + attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) check_PROGRAMS = $(TESTS) @@ -78,6 +78,7 @@ cursor4_SOURCES = cursor4.c common.c common.h cursor5_SOURCES = cursor5.c common.c common.h attributes_SOURCES = attributes.c common.c common.h hidden_SOURCES = hidden.c common.c common.h +blob1_SOURCES = blob1.c common.c common.h AM_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) -DFREETDS_SRCDIR=\"$(srcdir)\" if MINGW32 commit e88fe96932f46fb3b1db41e1c967373ec153a831 Author: freddy77 Date: Thu Jan 10 15:26:51 2008 +0000 updates for new version diff --git a/ChangeLog b/ChangeLog index bb41c3d..1a6b943 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Thu Jan 10 16:25:19 CET 2008 Frediano Ziglio + * doc/README.releasing misc/freetds_autobuild: updates + Thu Jan 10 14:10:28 CET 2008 Frediano Ziglio * src/odbc/odbc.c src/odbc/unittests/.cvsignore: * src/odbc/unittests/Makefile.am src/odbc/unittests/blob1.c(added): @@ -12,4 +15,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2458 2008/01/10 13:11:07 freddy77 Exp $ +$Id: ChangeLog,v 1.2459 2008/01/10 15:26:51 freddy77 Exp $ diff --git a/doc/README.releasing b/doc/README.releasing index cae6dc0..a4c60df 100644 --- a/doc/README.releasing +++ b/doc/README.releasing @@ -2,11 +2,12 @@ It's pretty simple, basically: 0) Form a branch in cvs: - $ cvs tag -b BRANCH0_xx - - Use the form BRANCH0_xx, where xx is the release number. This affects only + $ cvs tag branch-0_xx + $ cvs tag -b Branch-0_xx + + Use the form Branch-0_xx, where xx is the release number. This affects only the repository, not the working directory. - + 1) Change the version number in configure.ac and UG. 2) Update web pages regarding purpose and status of rc. 3) Put out a release candidates until everyone's happy. @@ -50,4 +51,4 @@ less important per step ;-) convention for naming - .tar.gz for tar and gzip, rather than .tgz. -- -$Id: README.releasing,v 1.10 2008/01/08 13:29:40 freddy77 Exp $ +$Id: README.releasing,v 1.11 2008/01/10 15:26:51 freddy77 Exp $ diff --git a/misc/freetds_autobuild b/misc/freetds_autobuild index 7217a27..a78d6f4 100755 --- a/misc/freetds_autobuild +++ b/misc/freetds_autobuild @@ -9,7 +9,7 @@ export PATH="/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:$HOME GROUPDIR=/home/groups/f/fr/freetds/htdocs # directory to compile -FTDSDIR=freetds65 +FTDSDIR=freetds82 # output directory on server OUTDIR=out # additional flags for Autogen (current version) commit 637220d3666abf47363cb5217e96796bbc6ba3ab Author: freddy77 Date: Thu Jan 10 15:29:03 2008 +0000 use temporary tables diff --git a/ChangeLog b/ChangeLog index 1a6b943..238d403 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jan 10 16:28:44 CET 2008 Frediano Ziglio + * src/odbc/unittests/blob1.c src/odbc/unittests/cursor3.c: + * src/odbc/unittests/cursor4.c src/odbc/unittests/cursor5.c: + - use temporary tables + Thu Jan 10 16:25:19 CET 2008 Frediano Ziglio * doc/README.releasing misc/freetds_autobuild: updates @@ -15,4 +20,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2459 2008/01/10 15:26:51 freddy77 Exp $ +$Id: ChangeLog,v 1.2460 2008/01/10 15:29:03 freddy77 Exp $ diff --git a/src/odbc/unittests/blob1.c b/src/odbc/unittests/blob1.c index 838a507..9e4be47 100755 --- a/src/odbc/unittests/blob1.c +++ b/src/odbc/unittests/blob1.c @@ -3,7 +3,7 @@ #include "common.h" -static char software_version[] = "$Id: blob1.c,v 1.1 2008/01/10 13:11:08 freddy77 Exp $"; +static char software_version[] = "$Id: blob1.c,v 1.2 2008/01/10 15:29:03 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -111,8 +111,7 @@ main(int argc, char **argv) use_odbc_version3 = 1; Connect(); - Command(Statement, "IF OBJECT_ID('tt') IS NOT NULL DROP TABLE tt"); - Command(Statement, "CREATE TABLE tt ( k INT, t TEXT, b IMAGE, v INT )"); + Command(Statement, "CREATE TABLE #tt ( k INT, t TEXT, b IMAGE, v INT )"); /* Insert rows ... */ @@ -122,7 +121,7 @@ main(int argc, char **argv) rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt); CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle StmtH"); - rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "insert into tt values ( ?, ?, ?, ? )", SQL_NTS); + rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "INSERT INTO #tt VALUES ( ?, ?, ?, ? )", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPrepare"); SQLBindParameter(m_hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &key, 0, &vind0); @@ -181,7 +180,7 @@ main(int argc, char **argv) rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); - rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "SELECT t, b, v FROM tt WHERE k = ?", SQL_NTS); + rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "SELECT t, b, v FROM #tt WHERE k = ?", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPrepare"); SQLBindParameter(m_hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &i, 0, &vind0); diff --git a/src/odbc/unittests/cursor3.c b/src/odbc/unittests/cursor3.c index 791783a..d44fe3c 100644 --- a/src/odbc/unittests/cursor3.c +++ b/src/odbc/unittests/cursor3.c @@ -1,7 +1,7 @@ /* Tests 2 active statements */ #include "common.h" -static char software_version[] = "$Id: cursor3.c,v 1.3 2007/12/21 10:39:10 freddy77 Exp $"; +static char software_version[] = "$Id: cursor3.c,v 1.4 2008/01/10 15:29:03 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static SQLHDBC m_hdbc; @@ -69,12 +69,11 @@ main(int argc, char **argv) m_hdbc = Connection; - exec_direct(0, "DROP TABLE t1"); - exec_direct(1, "CREATE TABLE t1 ( k INT, c VARCHAR(20))"); - exec_direct(1, "INSERT INTO t1 VALUES (1, 'aaa')"); - exec_direct(1, "INSERT INTO t1 VALUES (2, 'bbbbb')"); - exec_direct(1, "INSERT INTO t1 VALUES (3, 'ccccccccc')"); - exec_direct(1, "INSERT INTO t1 VALUES (4, 'dd')"); + exec_direct(1, "CREATE TABLE #t1 ( k INT, c VARCHAR(20))"); + exec_direct(1, "INSERT INTO #t1 VALUES (1, 'aaa')"); + exec_direct(1, "INSERT INTO #t1 VALUES (2, 'bbbbb')"); + exec_direct(1, "INSERT INTO #t1 VALUES (3, 'ccccccccc')"); + exec_direct(1, "INSERT INTO #t1 VALUES (4, 'dd')"); m_hstmt1 = NULL; rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt1); @@ -114,10 +113,10 @@ main(int argc, char **argv) rcode = SQLSetCursorName(m_hstmt2, (SQLCHAR *) "c2", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SetCursorName c2"); - rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM t1", SQL_NTS); + rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM #t1", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "Prepare 1"); - rcode = SQLPrepare(m_hstmt2, (SQLCHAR *) "SELECT * FROM t1", SQL_NTS); + rcode = SQLPrepare(m_hstmt2, (SQLCHAR *) "SELECT * FROM #t1", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "Prepare 2"); rcode = SQLExecute(m_hstmt1); @@ -152,8 +151,6 @@ main(int argc, char **argv) rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt2); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SQLFreeHandle 2"); - exec_direct(1, "DROP TABLE t1"); - Disconnect(); return 0; diff --git a/src/odbc/unittests/cursor4.c b/src/odbc/unittests/cursor4.c index b352644..ef67014 100755 --- a/src/odbc/unittests/cursor4.c +++ b/src/odbc/unittests/cursor4.c @@ -5,7 +5,7 @@ #include "common.h" -static char software_version[] = "$Id: cursor4.c,v 1.3 2007/12/21 10:39:10 freddy77 Exp $"; +static char software_version[] = "$Id: cursor4.c,v 1.4 2008/01/10 15:29:03 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static SQLHDBC m_hdbc; @@ -72,9 +72,8 @@ main(int argc, char **argv) m_hdbc = Connection; - exec_direct(0, "DROP TABLE t1"); - exec_direct(1, "CREATE TABLE t1 ( k INT, c VARCHAR(20))"); - exec_direct(1, "INSERT INTO t1 VALUES (1, 'aaa')"); + exec_direct(1, "CREATE TABLE #t1 ( k INT, c VARCHAR(20))"); + exec_direct(1, "INSERT INTO #t1 VALUES (1, 'aaa')"); m_hstmt1 = NULL; rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt1); @@ -86,7 +85,7 @@ main(int argc, char **argv) rcode = SQLSetCursorName(m_hstmt1, (SQLCHAR *) "c112", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SetCursorName c112"); - rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM t1 FOR UPDATE", SQL_NTS); + rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM #t1 FOR UPDATE", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "Prepare 2"); exec_direct(1, "BEGIN TRANSACTION"); @@ -97,14 +96,14 @@ main(int argc, char **argv) rcode = SQLFetch(m_hstmt1); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLFetch 1"); - exec_direct(1, "UPDATE t1 SET c = 'xxx' WHERE CURRENT OF c112"); + exec_direct(1, "UPDATE #t1 SET c = 'xxx' WHERE CURRENT OF c112"); rcode = SQLCloseCursor(m_hstmt1); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLCloseCursor 2"); exec_direct(1, "COMMIT TRANSACTION"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "SELECT c FROM t1 WHERE k = 1", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "SELECT c FROM #t1 WHERE k = 1", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 2"); rcode = SQLFetch(m_hstmt1); @@ -118,8 +117,6 @@ main(int argc, char **argv) rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt1); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLFreeHandle 1"); - exec_direct(1, "DROP TABLE t1"); - Disconnect(); return 0; diff --git a/src/odbc/unittests/cursor5.c b/src/odbc/unittests/cursor5.c index c7be7e4..53f380b 100755 --- a/src/odbc/unittests/cursor5.c +++ b/src/odbc/unittests/cursor5.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: cursor5.c,v 1.2 2007/12/21 10:39:10 freddy77 Exp $"; +static char software_version[] = "$Id: cursor5.c,v 1.3 2008/01/10 15:29:03 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -76,15 +76,14 @@ main(int argc, char **argv) rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt2); CHECK_RCODE(SQL_HANDLE_DBC, m_hdbc, "SQLAllocHandle StmtH 2"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "drop table mytab1", SQL_NTS); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "create table mytab1 (k int, c char(30))", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "create table #mytab1 (k int, c char(30))", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.1"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into mytab1 values (1,'aaa')", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into #mytab1 values (1,'aaa')", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.2"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into mytab1 values (2,'bbb')", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into #mytab1 values (2,'bbb')", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.3"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into mytab1 values (3,'ccc')", SQL_NTS); + rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "insert into #mytab1 values (3,'ccc')", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.4"); /* @@ -95,7 +94,7 @@ main(int argc, char **argv) rcode = SQLSetStmtAttr(m_hstmt2, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, SQL_IS_UINTEGER); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SQLSetStmtAttr 1"); - rcode = SQLPrepare(m_hstmt2, (SQLCHAR *) "select k, c from mytab1 order by k", SQL_NTS); + rcode = SQLPrepare(m_hstmt2, (SQLCHAR *) "select k, c from #mytab1 order by k", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SQLPrepare 3"); rcode = SQLBindCol(m_hstmt2, 1, SQL_C_LONG, &v_int_3, 0, &v_ind_3_1); @@ -126,9 +125,6 @@ main(int argc, char **argv) rcode = SQLCloseCursor(m_hstmt2); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SQLCloseCursor StmtH 2"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "drop table mytab1", SQL_NTS); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.3"); - rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt1); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLFreeHandle StmtH 1"); commit 7f82734a2bd3cb45de9711bc31a48a2ae3b7113d Author: freddy77 Date: Thu Jan 10 16:05:59 2008 +0000 add a test for SQLCancel which seems broken diff --git a/ChangeLog b/ChangeLog index 238d403..30115b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jan 10 17:04:15 CET 2008 Frediano Ziglio + * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: + * src/odbc/unittests/cancel.c(added): + - add test for SQLCancel + Thu Jan 10 16:28:44 CET 2008 Frediano Ziglio * src/odbc/unittests/blob1.c src/odbc/unittests/cursor3.c: * src/odbc/unittests/cursor4.c src/odbc/unittests/cursor5.c: @@ -20,4 +25,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2460 2008/01/10 15:29:03 freddy77 Exp $ +$Id: ChangeLog,v 1.2461 2008/01/10 16:05:59 freddy77 Exp $ diff --git a/src/odbc/unittests/.cvsignore b/src/odbc/unittests/.cvsignore index d7c663e..ae23946 100644 --- a/src/odbc/unittests/.cvsignore +++ b/src/odbc/unittests/.cvsignore @@ -64,3 +64,4 @@ cursor5 attributes hidden blob1 +cancel diff --git a/src/odbc/unittests/Makefile.am b/src/odbc/unittests/Makefile.am index 830c6c5..7fca97b 100644 --- a/src/odbc/unittests/Makefile.am +++ b/src/odbc/unittests/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.70 2008/01/10 13:21:12 freddy77 Exp $ +# $Id: Makefile.am,v 1.71 2008/01/10 16:05:59 freddy77 Exp $ TESTS = \ t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT)\ t0004$(EXEEXT) connect$(EXEEXT) print$(EXEEXT)\ @@ -20,7 +20,8 @@ TESTS = \ paramcore$(EXEEXT) timeout2$(EXEEXT) timeout3$(EXEEXT) \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ - attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) + attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) \ + cancel$(EXEEXT) check_PROGRAMS = $(TESTS) @@ -79,6 +80,7 @@ cursor5_SOURCES = cursor5.c common.c common.h attributes_SOURCES = attributes.c common.c common.h hidden_SOURCES = hidden.c common.c common.h blob1_SOURCES = blob1.c common.c common.h +cancel_SOURCES = cancel.c common.c common.h AM_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) -DFREETDS_SRCDIR=\"$(srcdir)\" if MINGW32 diff --git a/src/odbc/unittests/cancel.c b/src/odbc/unittests/cancel.c new file mode 100644 index 0000000..b01630f --- /dev/null +++ b/src/odbc/unittests/cancel.c @@ -0,0 +1,96 @@ +/* Testing SQLCancel() */ + +#include "common.h" +#include + +#ifdef HAVE_ALARM + +#define CHECK_RCODE(t,h,m) \ + if ( rcode != SQL_NO_DATA \ + && rcode != SQL_SUCCESS \ + && rcode != SQL_SUCCESS_WITH_INFO \ + && rcode != SQL_NEED_DATA ) { \ + fprintf(stderr,"Error %d at: %s\n",rcode,m); \ + getErrorInfo(t,h); \ + exit(1); \ + } + +static SQLCHAR sqlstate[SQL_SQLSTATE_SIZE + 1]; + +static void +getErrorInfo(SQLSMALLINT sqlhdltype, SQLHANDLE sqlhandle) +{ + SQLRETURN rcode = 0; + SQLINTEGER naterror = 0; + SQLCHAR msgtext[SQL_MAX_MESSAGE_LENGTH + 1]; + SQLSMALLINT msgtextl = 0; + + rcode = SQLGetDiagRec((SQLSMALLINT) sqlhdltype, + (SQLHANDLE) sqlhandle, + (SQLSMALLINT) 1, + (SQLCHAR *) sqlstate, + (SQLINTEGER *) & naterror, + (SQLCHAR *) msgtext, (SQLSMALLINT) sizeof(msgtext), (SQLSMALLINT *) & msgtextl); + fprintf(stderr, "Diagnostic info:\n"); + fprintf(stderr, " SQL State: %s\n", (char *) sqlstate); + fprintf(stderr, " SQL code : %d\n", (int) naterror); + fprintf(stderr, " Message : %s\n", (char *) msgtext); +} + +static void +exit_forced(int s) +{ + exit(1); +} + +static void +sigalrm_handler(int s) +{ + SQLRETURN rcode; + + printf(">>>> SQLCancel() ...\n"); + rcode = SQLCancel(Statement); + printf(">>>> ... SQLCancel done rcode = %d\n", rcode); + CHECK_RCODE(SQL_HANDLE_STMT, Statement, "SQLCancel failed"); + + alarm(4); + signal(SIGALRM, exit_forced); +} + +int +main(int argc, char **argv) +{ + SQLRETURN rcode; + + use_odbc_version3 = 1; + Connect(); + + printf(">> Select tab1...\n"); + alarm(4); + signal(SIGALRM, sigalrm_handler); + rcode = SQLExecDirect(Statement, (SQLCHAR *) "WAITFOR DELAY '000:05:00'", SQL_NTS); + if (rcode != SQL_ERROR) { + fprintf(stderr, "SQLExecDirect should return error\n"); + return 1; + } + getErrorInfo(SQL_HANDLE_STMT, Statement); + if (strcmp(sqlstate, "HY008") != 0) { + fprintf(stderr, "Unexpected sql state returned\n"); + return 1; + } + printf(">> ... done rcode = %d\n", rcode); + signal(SIGINT, NULL); + + Disconnect(); + return 0; +} + +#else +int +main(void) +{ + printf("Not possible for this platform.\n"); + return 0; +} +#endif + commit 4457549eba093983d80f1cfdcfa44e35310c2ce0 Author: freddy77 Date: Thu Jan 10 21:19:47 2008 +0000 memory fixes diff --git a/ChangeLog b/ChangeLog index 30115b3..1fa8966 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jan 10 22:19:26 CET 2008 Frediano Ziglio + * src/odbc/unittests/cancel.c src/odbc/unittests/hidden.c: + - memory fixes + Thu Jan 10 17:04:15 CET 2008 Frediano Ziglio * src/odbc/unittests/.cvsignore src/odbc/unittests/Makefile.am: * src/odbc/unittests/cancel.c(added): @@ -25,4 +29,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2461 2008/01/10 16:05:59 freddy77 Exp $ +$Id: ChangeLog,v 1.2462 2008/01/10 21:19:47 freddy77 Exp $ diff --git a/src/odbc/unittests/cancel.c b/src/odbc/unittests/cancel.c index b01630f..6aa5e3f 100644 --- a/src/odbc/unittests/cancel.c +++ b/src/odbc/unittests/cancel.c @@ -25,6 +25,7 @@ getErrorInfo(SQLSMALLINT sqlhdltype, SQLHANDLE sqlhandle) SQLCHAR msgtext[SQL_MAX_MESSAGE_LENGTH + 1]; SQLSMALLINT msgtextl = 0; + msgtext[0] = 0; rcode = SQLGetDiagRec((SQLSMALLINT) sqlhdltype, (SQLHANDLE) sqlhandle, (SQLSMALLINT) 1, @@ -76,6 +77,7 @@ main(int argc, char **argv) getErrorInfo(SQL_HANDLE_STMT, Statement); if (strcmp(sqlstate, "HY008") != 0) { fprintf(stderr, "Unexpected sql state returned\n"); + Disconnect(); return 1; } printf(">> ... done rcode = %d\n", rcode); diff --git a/src/odbc/unittests/hidden.c b/src/odbc/unittests/hidden.c index d9b6b25..71124a6 100755 --- a/src/odbc/unittests/hidden.c +++ b/src/odbc/unittests/hidden.c @@ -3,7 +3,7 @@ #include "common.h" -static char software_version[] = "$Id: hidden.c,v 1.2 2008/01/10 08:54:46 freddy77 Exp $"; +static char software_version[] = "$Id: hidden.c,v 1.3 2008/01/10 21:19:47 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -70,6 +70,7 @@ main(int argc, char **argv) /* test hidden column with cursors*/ CheckCursor(); + m_hstmt1 = Statement; rcode = SQLSetStmtAttr(m_hstmt1, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); commit e28c151956bedc82ff4a97b8a90e083a026dcb1e Author: jklowden Date: Thu Jan 10 22:57:33 2008 +0000 moved some preprocessor logic to the header file diff --git a/ChangeLog b/ChangeLog index 1fa8966..f508d56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jan 10 17:55:41 EST 2008 JK Lowden + * include/tds_sysdep_private.h src/tds/net.c + - moved some preprocessor logic to the header file + * INSTALL.CVS NEWS TODO doc/userguide.sgml + - updated documentation + Thu Jan 10 22:19:26 CET 2008 Frediano Ziglio * src/odbc/unittests/cancel.c src/odbc/unittests/hidden.c: - memory fixes @@ -29,4 +35,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2462 2008/01/10 21:19:47 freddy77 Exp $ +$Id: ChangeLog,v 1.2463 2008/01/10 22:57:33 jklowden Exp $ diff --git a/include/tds_sysdep_private.h b/include/tds_sysdep_private.h index 9b6fcb0..8adfb9b 100644 --- a/include/tds_sysdep_private.h +++ b/include/tds_sysdep_private.h @@ -20,7 +20,7 @@ #ifndef _tds_sysdep_private_h_ #define _tds_sysdep_private_h_ -/* $Id: tds_sysdep_private.h,v 1.23 2007/01/29 11:02:43 freddy77 Exp $ */ +/* $Id: tds_sysdep_private.h,v 1.24 2008/01/10 22:57:33 jklowden Exp $ */ #undef TDS_RCSID #if defined(__GNUC__) && __GNUC__ >= 3 @@ -34,6 +34,12 @@ #define TDS_ADDITIONAL_SPACE 0 +#ifdef MSG_NOSIGNAL +# define TDS_NOSIGNAL MSG_NOSIGNAL +#else +# define TDS_NOSIGNAL 0L +#endif + #ifdef __cplusplus extern "C" { @@ -47,10 +53,11 @@ extern "C" #endif /* __INCvxWorksh */ #if defined(DOS32X) -#define READSOCKET(a,b,c) recv((a), (b), (c), 0L) -#define WRITESOCKET(a,b,c) send((a), (b), (c), 0L) +#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 @@ -62,10 +69,11 @@ typedef int pid_t; #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) #include -#define READSOCKET(a,b,c) recv((a), (b), (c), 0L) -#define WRITESOCKET(a,b,c) send((a), (b), (c), 0L) +#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), (c)) +#define SOCKLEN_T int int _tds_socket_init(void); #define INITSOCKET() _tds_socket_init() void _tds_socket_done(void); @@ -120,21 +128,33 @@ typedef DWORD pid_t; #endif /* !DONESOCKET */ #ifndef READSOCKET -#define READSOCKET(a,b,c) read((a), (b), (c)) +# 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 -#define WRITESOCKET(a,b,c) write((a), (b), (c)) +# 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(a) close((a)) +#define CLOSESOCKET(s) close((s)) #endif /* !CLOSESOCKET */ #ifndef IOCTLSOCKET -#define IOCTLSOCKET(a,b,c) ioctl((a), (b), (c)) +#define IOCTLSOCKET(s,b,l) ioctl((s), (b), (l)) #endif /* !IOCTLSOCKET */ +#ifndef SOCKLEN_T +# define SOCKLEN_T socklen_t +#endif + #ifndef TDS_SDIR_SEPARATOR #define TDS_SDIR_SEPARATOR "/" #endif /* !TDS_SDIR_SEPARATOR */ diff --git a/src/tds/net.c b/src/tds/net.c index c551127..741f9b4 100644 --- a/src/tds/net.c +++ b/src/tds/net.c @@ -99,7 +99,7 @@ #include #endif -TDS_RCSID(var, "$Id: net.c,v 1.71 2007/12/12 06:27:38 freddy77 Exp $"); +TDS_RCSID(var, "$Id: net.c,v 1.72 2008/01/10 22:57:33 jklowden Exp $"); static int tds_select(TDSSOCKET * tds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, int timeout_seconds); @@ -165,18 +165,12 @@ int tds_open_socket(TDSSOCKET * tds, const char *ip_addr, unsigned int port, int timeout) { struct sockaddr_in sin; -#if !defined(DOS32X) ioctl_nonblocking_t ioctl_nonblocking; - int retval; -#endif - int len; + SOCKLEN_T optlen; + + int retval, len; int tds_error = TDSECONN; char ip[20]; -#if defined(DOS32X) || defined(WIN32) - int optlen; -#else - socklen_t optlen; -#endif memset(&sin, 0, sizeof(sin)); @@ -270,8 +264,7 @@ tds_open_socket(TDSSOCKET * tds, const char *ip_addr, unsigned int port, int tim goto not_available; } } - -#endif +#endif /* not DOS32X */ /* check socket error */ optlen = sizeof(len); @@ -436,11 +429,9 @@ tds_goodread(TDSSOCKET * tds, unsigned char *buf, int buflen, unsigned char unfi if ((len = tds_select(tds, &rfds, NULL, NULL, tds->query_timeout)) > 0) { len = 0; if (FD_ISSET(tds->s, &rfds)) { -#ifndef MSG_NOSIGNAL + len = READSOCKET(tds->s, buf + got, buflen); -#else - len = recv(tds->s, buf + got, buflen, MSG_NOSIGNAL); -#endif + if (len < 0 && sock_errno == EAGAIN) continue; /* detect connection close */ @@ -656,10 +647,8 @@ tds_goodwrite(TDSSOCKET * tds, const unsigned char *p, int len, unsigned char la /* In case the kernel does not support MSG_MORE, try again without it */ if (nput < 0 && errno == EINVAL && !last) nput = send(tds->s, p, remaining, MSG_NOSIGNAL); -#elif !defined(MSG_NOSIGNAL) - nput = WRITESOCKET(tds->s, p, remaining); #else - nput = send(tds->s, p, remaining, MSG_NOSIGNAL); + nput = WRITESOCKET(tds->s, p, remaining); #endif if (nput < 0 && sock_errno == EAGAIN) continue; commit 998e0c0a7e8a6305acb7a20748dba6fe9c212081 Author: jklowden Date: Thu Jan 10 22:57:39 2008 +0000 updated documentation diff --git a/INSTALL.CVS b/INSTALL.CVS index d42c3aa..53d62d6 100644 --- a/INSTALL.CVS +++ b/INSTALL.CVS @@ -16,9 +16,9 @@ connecting to the CVS server. Then follow these steps: Autotool versions that work: $ (autoconf --version; automake --version; libtool --version) |grep GNU - autoconf (GNU Autoconf) 2.59 - automake (GNU automake) 1.9.5 - ltmain.sh (GNU libtool) 1.5.14 (1.1220.2.195 2005/02/12 12:12:33) + autoconf (GNU Autoconf) 2.60 + automake (GNU automake) 1.9.6 + ltmain.sh (GNU libtool) 1.5.18 (1.1220.2.245 2005/05/16 08:55:27) The above are used to generate the distributions. You may get away with older versions, as far back as 2.53 for autoconf. @@ -44,10 +44,10 @@ connecting to the CVS server. Then follow these steps: +++ -You are not required to rely on Source Forge's anonymous CVS server, which at +You are not required to rely on SourceForge's anonymous CVS server, which at the present time (July 2004) runs up to 1 hour behind the development server. You can fetch the CVS tarball (the basis for a CVS server, not a snapshot) from -Source Forge at: +SourceForge at: http://cvs.sourceforge.net/cvstarballs/freetds-cvsroot.tar.bz2 @@ -62,4 +62,4 @@ the CVS tree via rsync: $ rsync -av rsync://freetds.cvs.sourceforge.net/cvsroot/freetds/* . -- -$Id: INSTALL.CVS,v 1.7 2007/04/05 14:17:05 freddy77 Exp $ +$Id: INSTALL.CVS,v 1.8 2008/01/10 22:57:39 jklowden Exp $ diff --git a/NEWS b/NEWS index 851fbce..bc2fdf3 100644 --- a/NEWS +++ b/NEWS @@ -1,33 +1,63 @@ -$Id: NEWS,v 1.43 2008/01/08 13:29:40 freddy77 Exp $ -* 0.82 -- support NUL characters inside terminators in freebcp -- cursors under ODBC (mssql) +$Id: NEWS,v 1.44 2008/01/10 22:57:39 jklowden Exp $ + +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 -- lot of update to TDS protocol documentation +- 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 -- add row termination and column termination option to tsql -- improve locale stuff on ctlib - added cs_loc_alloc, cs_loc_drop, cs_locale implementations -- improve MingW compile (even cross one) -- implement dbsetnull on dblib -- improve dblib error reporting and check +- improved MingW compile (even cross one) - more verbose log for dblib and odbc -- fix rpc parameter on dblib, now php works correctly - many test added 1 test for libTDS 1 test for ctlib 3 tests for dblib 13 tests for odbc -- fix database setting on odbc -- fix timeout stuff -- return always an error if odbc return SQL_ERROR -- fix SQLGetData result -- add freetds.conf option for encryption -- add protocol version discovery -- read table and real column name from wire -- experimental Kerberos support using gssapi libTDS API changes - tds_add_row_column_size removed @@ -38,7 +68,7 @@ libTDS API changes - 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 -- make tds_alloc_get_string static +- made tds_alloc_get_string static - removed tds_free_cursor - added TDSCURSOR->ref_count - added tds_cursor_deallocated and tds_release_cursor to handle @@ -48,8 +78,8 @@ libTDS API changes to trace pointer owner between libTDS and upper libraries - added TDS_COMPILETIME_SETTINGS->sysconfdir - changed DSTR_STRUCT structure to include dstr_size -- change DSTR type -- error handler cannot return TDS_INT_EXIT (no more defined) +- 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 @@ -83,7 +113,6 @@ libTDS API changes - 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 diff --git a/TODO b/TODO index 49074e8..55b0fbf 100644 --- a/TODO +++ b/TODO @@ -4,11 +4,11 @@ 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 Source Forge. +anyone else can post a patch to SourceForge. In this way we can communicate with each other about the project's priorities and needs. -To Do List $Id: TODO,v 1.166 2008/01/10 08:47:37 freddy77 Exp $ +To Do List $Id: TODO,v 1.167 2008/01/10 22:57:39 jklowden Exp $ ------------ Bug? ML 2007-05-30 "dbsqlexec() never returns" @@ -30,20 +30,13 @@ Broken: Work in progress: -Postponed to 0.65 version . log and call error handler on problems with tds_iconv_init(). . iconv - support string conversions for Sybase - - add test for locale_charset() to configure.in. Use it if available - instead of nl_langinfo, because it implies we're using GNU iconv . add doc/htdoc/Makefile with "publish" target to commit cvs and update freetds.org . drop txt2man from cvs, skip building man pages without it. . be able to disable iconv for BCP (see Sybase documentation) -. userguide - - update table of working configurations - server (vendor, version, platform) - client (freetds version, platform) - - protocol - charsets - date For future versions (in priority order within library): All: @@ -59,7 +52,6 @@ For future versions (in priority order within library): . Add missing constants needed for python and verify working . Add missing constants needed for Gnome-DB and verify working . conversion from ucs2 to utf8, provide for 2+ bytes/character -. tdsping program for testing purposes . Finish off the TDS dissector for ethereal . more solid. handle out of memory conditions (started, we must test all allocation and all function that return allocated data and be able to @@ -81,8 +73,8 @@ For future versions (in priority order within library): (too complicate, see ctlib bulk, cf "bulk copy and row buffer") . improve cursor support on dblib and ctlib . support for VARIANT type (requested one time, 2003-8-1) -. support for NT named pipe (requested many time ago for mssql6.5 server, only - for completeness). If anybody knows a library to handle named pipes +. support for NT named pipe (requested long ago for mssql6.5 server, only + for completeness). If the reader knows a library to handle named pipes compatible with LGPL please tell us. . read on partial packet, do not wait entire one . detect if realloc/free accepts NULL pointers (in configure.in) diff --git a/doc/userguide.sgml b/doc/userguide.sgml index d26bb2e..e8d4c79 100644 --- a/doc/userguide.sgml +++ b/doc/userguide.sgml @@ -5,8 +5,8 @@ ]> - $Date: 2008/01/08 13:29:40 $ - $Revision: 1.110 $ + $Date: 2008/01/10 22:57:39 $ + $Revision: 1.111 $ <productname>FreeTDS</productname> User Guide A Guide to Installing, Configuring, and Running FreeTDS @@ -26,6 +26,7 @@ 2005 2006 2007 + 2008 Brian Bruns and James K. Lowden @@ -55,9 +56,9 @@ This guide is here for you, and we hope that you will be here for it, that other The version you're reading is: -$Revision: 1.110 $ -$Date: 2008/01/08 13:29:40 $ -CVS control number $Id: userguide.sgml,v 1.110 2008/01/08 13:29:40 freddy77 Exp $. +$Revision: 1.111 $ +$Date: 2008/01/10 22:57:39 $ +CVS control number $Id: userguide.sgml,v 1.111 2008/01/10 22:57:39 jklowden Exp $. can be found on the FreeTDS @@ -201,7 +202,7 @@ project on SourceForge. It is a fork of the Status -The db-lib and ct-lib 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. That is not to say that these drivers are complete; they're not. But they faithfully implement an important subset of their APIs, enough to be useful. This 0.64 version boasts support for server-side cursors in ct-lib. +The db-lib and ct-lib 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. That is not to say that these drivers are complete; they're not. But they faithfully implement a useful — and widely used — subset of their APIs. In addition to the core db-lib API, FreeTDS includes a full implementation of db-lib's bcp functions, as well as freebcp, a replacement for Sybase's bcp utility. @@ -567,7 +568,7 @@ url="http://www.madgoat.com">www.madgoat.com). OS X® - As of this writing ($Date: 2008/01/08 13:29:40 $), the regular distribution compiles on OS X. Releases prior to 0.63 either did not compile or required patching. + As of this writing ($Date: 2008/01/10 22:57:39 $), the regular distribution compiles on OS X. Releases prior to 0.63 either did not compile or required patching. Alternative build procedure @@ -941,8 +942,7 @@ As of 0.62 FreeTDS uses iconv to convert all character data, so there's no need instance instance name none - Name of Microsoft SQL Server instance to connect to. The port will be detected automatically. - This requires an extra round-trip with server and may thus slightly delay making the connection. + Name of Microsoft SQL Server instance to connect to. The port will be detected automatically. debug flags @@ -1512,7 +1512,7 @@ The following table defines all possible ODBC connection attributes for the Server A server name or (ip) address none - Hostname of a server. Used in an ODBC-only configuration. As of version 0.64 you can specify a Microsoft SQL Server instance in the form of server\instance. + Hostname of a server. Used in an ODBC-only configuration. To specify a Microsoft SQL Server instance, use the form server\instance. Port commit 296c62697062c312476ce658ef7e22913008a877 Author: freddy77 Date: Fri Jan 11 08:30:09 2008 +0000 merged notes diff --git a/ChangeLog b/ChangeLog index f508d56..d8678f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Fri Jan 11 9:29:44 CET 2008 Frediano Ziglio + * README: merged + Thu Jan 10 17:55:41 EST 2008 JK Lowden * include/tds_sysdep_private.h src/tds/net.c - moved some preprocessor logic to the header file @@ -35,4 +38,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2463 2008/01/10 22:57:33 jklowden Exp $ +$Id: ChangeLog,v 1.2464 2008/01/11 08:30:09 freddy77 Exp $ diff --git a/README b/README index 33da879..d7509e6 100644 --- a/README +++ b/README @@ -1,12 +1,11 @@ -$Id: README,v 1.11 2007/04/05 14:17:05 freddy77 Exp $ -README for FreeTDS 0.64 -Saturday 1 July 2006 +README for FreeTDS 0.82 +Thusday 10 January 2008 -* to build FreeTDS read the file INSTALL, -* see also the FreeTDS Users Guide, +* to build FreeTDS read the file INSTALL or + the FreeTDS Users Guide (doc/userguide.tgz) and http://www.freetds.org/userguide/ -FreeTDS is a free (open source) implementation of Sybase's db-lib, +FreeTDS is a free implementation of Sybase's db-lib, ct-lib, and ODBC libraries. FreeTDS builds and runs on every flavor of unix-like systems we've heard of, as well as Win32 (with or without Cygwin), VMS, and Mac OS X. Failure to build on your system is probably @@ -27,60 +26,8 @@ TODO The roadmap, such as it is Also, doc/api_status.txt shows which functions are implemented. -************************************ -** Warning regarding Sybase 12.5! ** -************************************ - -Do Not Use TDS version 4.2 to connect to Sybase 12.5. Please! - -While we don't like to put the bad news first, neither do we want you to -hurt your server. We know that our implementation of TDS 4.2 gives -Sybase 12.5 a bad case of heartburn. In short: it crashes the server. - -We don't know what it is about our version of TDS 4.2 that Sybase 12.5 -doesn't like, and we'd like to figure it out eventually. But in the -meanwhile, until we can find the problem and fix it, please don't use -that combination. Unless you want to help us test it, that is. - -FreeTDS 0.63 works fine with Sybase 12.5 if you use TDS version 5.0. - -If you are using Sybase 12.5 and anything above is not clear to you, -please see the User Guide. If it is still not clear after that, please -write to the FreeTDS mailing list. We'd rather answer your questions -while your server is still running. - -Thank you. We return now to your regularly scheduled README, already in -progress. - -New in this version -=================== - -ct-lib ------- - -Ct-lib now sports bcp and cursors. The largest missing feature is now -placeholder support compatible with Perl's DBD::Sybase. - -ODBC ----- - -ODBC continues to be improved. It is now compatible with OpenOffice.org, for -example, and even works with Oracle's OTL libary. It has better 64-bit -support. - -Applications ------------- - -This version includes two new applications, bsqldb and defncopy. See their man -pages for details. - -etc. ----- - -Naturally, there have been other improvements as well. This version compiles -and runs better than its predecessors. - - +For details on what's new in this version, see NEWS. For unbearable +detail, see ChangeLog-0.82. Documentation ============= @@ -139,3 +86,6 @@ 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. + +$Id: README,v 1.12 2008/01/11 08:30:10 freddy77 Exp $ + commit 239ad2280de52827b19c5d05e923165bcc8e6ddb Author: freddy77 Date: Fri Jan 11 09:44:26 2008 +0000 make test work with Sybase, add test for poll diff --git a/ChangeLog b/ChangeLog index d8678f2..3f540fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Jan 11 10:42:58 CET 2008 Frediano Ziglio + * src/odbc/unittests/blob1.c: make it work with Sybase + * configure.ac: test for poll function + Fri Jan 11 9:29:44 CET 2008 Frediano Ziglio * README: merged @@ -38,4 +42,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2464 2008/01/11 08:30:09 freddy77 Exp $ +$Id: ChangeLog,v 1.2465 2008/01/11 09:44:26 freddy77 Exp $ diff --git a/configure.ac b/configure.ac index 96ec6c5..6d0bff4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.30 2008/01/09 06:51:45 freddy77 Exp $ +dnl $Id: configure.ac,v 1.31 2008/01/11 09:44:26 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -15,7 +15,7 @@ dnl ------------------------------------------------------------ AC_INIT(FreeTDS, 0.83.dev.esyscmd(echo -n $(date +"%Y%m%d"))) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.30 $) +AC_REVISION($Revision: 1.31 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -200,7 +200,8 @@ AC_CHECK_MEMBERS([struct tm.__tm_zone],,,[#include #include <$ac_cv_struct_tm> ]) AC_CHECK_HEADERS([unistd.h errno.h wchar.h sys/time.h sys/types.h \ -sys/param.h sys/stat.h sys/wait.h limits.h locale.h odbcss.h readpassphrase.h signal.h libgen.h]) +sys/param.h sys/stat.h sys/wait.h limits.h locale.h odbcss.h readpassphrase.h \ +signal.h libgen.h poll.h]) if test $tds_mingw = no; then AC_CHECK_HEADERS([sys/socket.h arpa/inet.h netdb.h netinet/in.h \ netinet/tcp.h paths.h sys/ioctl.h langinfo.h]) @@ -367,7 +368,7 @@ gethrtime localtime_r]) OLD_LIBS="$LIBS" LIBS="$LIBS $NETWORK_LIBS" AC_CHECK_FUNCS([inet_ntoa_r getipnodebyaddr getipnodebyname \ -getaddrinfo getnameinfo inet_ntop gethostname]) +getaddrinfo getnameinfo inet_ntop gethostname poll]) LIBS="$OLD_LIBS" AC_REPLACE_FUNCS([asprintf vasprintf atoll strtok_r readpassphrase \ strlcpy strlcat basename]) diff --git a/src/odbc/unittests/blob1.c b/src/odbc/unittests/blob1.c index 9e4be47..6b7b99c 100755 --- a/src/odbc/unittests/blob1.c +++ b/src/odbc/unittests/blob1.c @@ -3,7 +3,7 @@ #include "common.h" -static char software_version[] = "$Id: blob1.c,v 1.2 2008/01/10 15:29:03 freddy77 Exp $"; +static char software_version[] = "$Id: blob1.c,v 1.3 2008/01/11 09:44:26 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -167,7 +167,7 @@ main(int argc, char **argv) } - /* No fetch rows ... */ + /* Now fetch rows ... */ for (i = 0; i < cnt; i++) { @@ -175,10 +175,12 @@ main(int argc, char **argv) rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt); CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle StmtH"); - rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); - rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); + if (db_is_microsoft()) { + rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); + rcode = SQLSetStmtAttr(m_hstmt, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); + } rcode = SQLPrepare(m_hstmt, (SQLCHAR *) "SELECT t, b, v FROM #tt WHERE k = ?", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLPrepare"); commit 1c7684ceba4779e1eb04c13197bcd9ece2a3cb47 Author: freddy77 Date: Fri Jan 11 12:43:39 2008 +0000 fix compile for MacOSX diff --git a/ChangeLog b/ChangeLog index 3f540fa..120eda3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Jan 11 13:42:06 CET 2008 Frediano Ziglio + * configure.ac src/apps/tsql.c: + - fix compile problem for MacOSX + Fri Jan 11 10:42:58 CET 2008 Frediano Ziglio * src/odbc/unittests/blob1.c: make it work with Sybase * configure.ac: test for poll function @@ -42,4 +46,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2465 2008/01/11 09:44:26 freddy77 Exp $ +$Id: ChangeLog,v 1.2466 2008/01/11 12:43:39 freddy77 Exp $ diff --git a/configure.ac b/configure.ac index 6d0bff4..4a0f729 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.31 2008/01/11 09:44:26 freddy77 Exp $ +dnl $Id: configure.ac,v 1.32 2008/01/11 12:43:39 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -15,7 +15,7 @@ dnl ------------------------------------------------------------ AC_INIT(FreeTDS, 0.83.dev.esyscmd(echo -n $(date +"%Y%m%d"))) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.31 $) +AC_REVISION($Revision: 1.32 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -178,7 +178,24 @@ if test $tds_mingw = no; then 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" LIBS="$OLDLIBS" AC_SUBST(READLINE_LIBS) diff --git a/src/apps/tsql.c b/src/apps/tsql.c index 6a04027..17268ef 100644 --- a/src/apps/tsql.c +++ b/src/apps/tsql.c @@ -85,7 +85,7 @@ #include "tdsconvert.h" #include "replacements.h" -TDS_RCSID(var, "$Id: tsql.c,v 1.112 2007/12/23 21:12:02 jklowden Exp $"); +TDS_RCSID(var, "$Id: tsql.c,v 1.113 2008/01/11 12:43:39 freddy77 Exp $"); enum { @@ -683,7 +683,7 @@ main(int argc, char **argv) mybuf[0] = '\0'; buflen = 0; -#ifdef HAVE_READLINE +#if defined(HAVE_READLINE) && HAVE_RL_INHIBIT_COMPLETION rl_inhibit_completion = 1; #endif commit 3ee05c86c5e0af66287ccd0d67dfc3aa5de0755d Author: freddy77 Date: Sat Jan 12 00:14:11 2008 +0000 fix for heavy load on server diff --git a/ChangeLog b/ChangeLog index 120eda3..bd33ef6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Jan 12 1:13:30 CET 2008 Frediano Ziglio + * src/odbc/unittests/blob1.c: small fix for 64bit + * src/tds/net.c: fix for heavy loads + Fri Jan 11 13:42:06 CET 2008 Frediano Ziglio * configure.ac src/apps/tsql.c: - fix compile problem for MacOSX @@ -46,4 +50,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2466 2008/01/11 12:43:39 freddy77 Exp $ +$Id: ChangeLog,v 1.2467 2008/01/12 00:14:11 freddy77 Exp $ diff --git a/src/odbc/unittests/blob1.c b/src/odbc/unittests/blob1.c index 6b7b99c..379930d 100755 --- a/src/odbc/unittests/blob1.c +++ b/src/odbc/unittests/blob1.c @@ -3,7 +3,7 @@ #include "common.h" -static char software_version[] = "$Id: blob1.c,v 1.3 2008/01/11 09:44:26 freddy77 Exp $"; +static char software_version[] = "$Id: blob1.c,v 1.4 2008/01/12 00:14:11 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -101,11 +101,11 @@ main(int argc, char **argv) int i; int key; - SQLINTEGER vind0; + SQLLEN vind0; char buf1[NBYTES]; - SQLINTEGER vind1; + SQLLEN vind1; char buf2[NBYTES]; - SQLINTEGER vind2; + SQLLEN vind2; int cnt = 2; use_odbc_version3 = 1; diff --git a/src/tds/net.c b/src/tds/net.c index 741f9b4..196af9b 100644 --- a/src/tds/net.c +++ b/src/tds/net.c @@ -82,6 +82,10 @@ #include #endif /* HAVE_SELECT_H */ +#if HAVE_POLL_H +#include +#endif /* HAVE_POLL_H */ + #include "tds.h" #include "tdsstring.h" #include "replacements.h" @@ -99,9 +103,23 @@ #include #endif -TDS_RCSID(var, "$Id: net.c,v 1.72 2008/01/10 22:57:33 jklowden Exp $"); +TDS_RCSID(var, "$Id: net.c,v 1.73 2008/01/12 00:14:11 freddy77 Exp $"); + +#undef USE_POLL +#if defined(HAVE_POLL_H) && defined(HAVE_POLL) +# define USE_POLL 1 +# define TDSSELREAD POLLIN +# define TDSSELWRITE POLLOUT +/* error is always returned */ +# define TDSSELERR 0 +#else +# define USE_POLL 0 +# define TDSSELREAD 1 +# define TDSSELWRITE 2 +# define TDSSELERR 4 +#endif -static int tds_select(TDSSOCKET * tds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, int timeout_seconds); +static int tds_select(TDSSOCKET * tds, unsigned tds_sel, int timeout_seconds); /** @@ -237,8 +255,6 @@ tds_open_socket(TDSSOCKET * tds, const char *ip_addr, unsigned int port, int tim if (retval == 0) { tdsdump_log(TDS_DBG_INFO2, "connection established\n"); } else { - fd_set fds; - tdsdump_log(TDS_DBG_ERROR, "tds_open_socket: connect(2) returned \"%s\"\n", strerror(sock_errno)); #if DEBUGGING_CONNECTING_PROBLEM if (sock_errno != ECONNREFUSED && sock_errno != ENETUNREACH && sock_errno != EINPROGRESS) { @@ -258,8 +274,7 @@ tds_open_socket(TDSSOCKET * tds, const char *ip_addr, unsigned int port, int tim if (sock_errno != TDSSOCK_EINPROGRESS) goto not_available; - FD_ZERO(&fds); - if (tds_select(tds, NULL, &fds, &fds, timeout) <= 0) { + if (tds_select(tds, TDSSELWRITE|TDSSELERR, timeout) <= 0) { tds_error = TDSESOCK; goto not_available; } @@ -313,13 +328,39 @@ tds_close_socket(TDSSOCKET * tds) * This function does not call tdserror or close the socket because it can't know the context in which it's being called. */ static int -tds_select(TDSSOCKET * tds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, int timeout_seconds) +tds_select(TDSSOCKET * tds, unsigned tds_sel, int timeout_seconds) { int rc, seconds; unsigned int poll_seconds; +#if !USE_POLL + fd_set fds[3]; + fd_set *readfds = NULL, *writefds = NULL, *exceptfds = NULL; +#endif assert(tds != NULL); assert(timeout_seconds >= 0); + +#if !USE_POLL +#if !defined(WIN32) && defined(FD_SETSIZE) + if (tds->s >= FD_SETSIZE) { + sock_errno = EINVAL; + return -1; + } +#endif + if ((tds_sel & TDSSELREAD) != 0) { + FD_ZERO(&fds[0]); + readfds = &fds[0]; + } + if ((tds_sel & TDSSELWRITE) != 0) { + FD_ZERO(&fds[1]); + writefds = &fds[1]; + } + if ((tds_sel & TDSSELERR) != 0) { + FD_ZERO(&fds[2]); + exceptfds = &fds[2]; + } +#endif + /* * The select loop. * If an interrupt handler is installed, we iterate once per second, @@ -337,8 +378,17 @@ tds_select(TDSSOCKET * tds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds */ poll_seconds = (tds->tds_ctx && tds->tds_ctx->int_handler)? 1 : timeout_seconds; for (seconds = timeout_seconds; timeout_seconds == 0 || seconds > 0; seconds -= poll_seconds) { +#if USE_POLL + struct pollfd fd; + int timeout = poll_seconds ? poll_seconds * 1000 : -1; + + fd.fd = tds->s; + fd.events = tds_sel; + fd.revents = 0; + rc = poll(&fd, 1, timeout); +#else struct timeval tv, *ptv = poll_seconds? &tv : NULL; - + tv.tv_sec = poll_seconds; tv.tv_usec = 0; @@ -350,6 +400,7 @@ tds_select(TDSSOCKET * tds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds FD_SET(tds->s, exceptfds); rc = select(tds->s + 1, readfds, writefds, exceptfds, ptv); +#endif if (rc > 0 ) { return rc; @@ -414,7 +465,6 @@ static int tds_goodread(TDSSOCKET * tds, unsigned char *buf, int buflen, unsigned char unfinished) { int rc, got = 0; - fd_set rfds; if (buf == NULL || buflen < 1 || tds == NULL) return 0; @@ -425,21 +475,17 @@ tds_goodread(TDSSOCKET * tds, unsigned char *buf, int buflen, unsigned char unfi if (IS_TDSDEAD(tds)) return -1; - FD_ZERO(&rfds); - if ((len = tds_select(tds, &rfds, NULL, NULL, tds->query_timeout)) > 0) { - len = 0; - if (FD_ISSET(tds->s, &rfds)) { - - len = READSOCKET(tds->s, buf + got, buflen); - - if (len < 0 && sock_errno == EAGAIN) - continue; - /* detect connection close */ - if (len <= 0) { - tdserror(tds->tds_ctx, tds, len == 0 ? TDSESEOF : TDSEREAD, sock_errno); - tds_close_socket(tds); - return -1; - } + if ((len = tds_select(tds, TDSSELREAD, tds->query_timeout)) > 0) { + + len = READSOCKET(tds->s, buf + got, buflen); + + if (len < 0 && sock_errno == EAGAIN) + continue; + /* detect connection close */ + if (len <= 0) { + tdserror(tds->tds_ctx, tds, len == 0 ? TDSESEOF : TDSEREAD, sock_errno); + tds_close_socket(tds); + return -1; } } else if (len < 0) { if (sock_errno == EAGAIN) /* shouldn't happen, but OK */ @@ -631,34 +677,29 @@ tds_goodwrite(TDSSOCKET * tds, const unsigned char *p, int len, unsigned char la { int remaining = len; int nput, rc, err=0; - fd_set fds; /* Fix of SIGSEGV when FD_SET() called with negative fd (Sergey A. Cherukhin, 23/09/2005) */ if (TDS_IS_SOCKET_INVALID(tds->s)) return -1; while (remaining > 0) { - FD_ZERO(&fds); - if ((rc = tds_select(tds, NULL, &fds, NULL, tds->query_timeout)) > 0) { - nput = 0; - if (FD_ISSET(tds->s, &fds)) { + if ((rc = tds_select(tds, TDSSELWRITE, tds->query_timeout)) > 0) { #ifdef USE_MSGMORE - nput = send(tds->s, p, remaining, last ? MSG_NOSIGNAL : MSG_NOSIGNAL|MSG_MORE); - /* In case the kernel does not support MSG_MORE, try again without it */ - if (nput < 0 && errno == EINVAL && !last) - nput = send(tds->s, p, remaining, MSG_NOSIGNAL); + nput = send(tds->s, p, remaining, last ? MSG_NOSIGNAL : MSG_NOSIGNAL|MSG_MORE); + /* In case the kernel does not support MSG_MORE, try again without it */ + if (nput < 0 && errno == EINVAL && !last) + nput = send(tds->s, p, remaining, MSG_NOSIGNAL); #else - nput = WRITESOCKET(tds->s, p, remaining); + nput = WRITESOCKET(tds->s, p, remaining); #endif - if (nput < 0 && sock_errno == EAGAIN) - continue; - /* detect connection close */ - if (nput <= 0) { - tdserror(tds->tds_ctx, tds, nput == 0 ? TDSESEOF : TDSEWRIT, sock_errno); - tds_close_socket(tds); - return -1; - } - } + if (nput < 0 && sock_errno == EAGAIN) + continue; + /* detect connection close */ + if (nput <= 0) { + tdserror(tds->tds_ctx, tds, nput == 0 ? TDSESEOF : TDSEWRIT, sock_errno); + tds_close_socket(tds); + return -1; + } } else if (rc < 0) { if (sock_errno == EAGAIN) /* shouldn't happen, but OK, retry */ continue; @@ -770,8 +811,12 @@ tds7_get_instance_port(const char *ip_addr, const char *instance) int num_try; struct sockaddr_in sin; ioctl_nonblocking_t ioctl_nonblocking; +#if USE_POLL + struct pollfd fd; +#else struct timeval selecttimeout; fd_set fds; +#endif int retval; TDS_SYS_SOCKET s; char msg[1024]; @@ -795,6 +840,15 @@ tds7_get_instance_port(const char *ip_addr, const char *instance) return 0; } +#if !USE_POLL +#if !defined(WIN32) && defined(FD_SETSIZE) + if (s >= FD_SETSIZE) { + sock_errno = EINVAL; + return 0; + } +#endif +#endif + /* * on cluster environment is possible that reply packet came from * different IP so do not filter by ip with connect @@ -817,12 +871,20 @@ tds7_get_instance_port(const char *ip_addr, const char *instance) tds_strlcpy(msg + 1, instance, sizeof(msg) - 1); sendto(s, msg, strlen(msg) + 1, 0, (struct sockaddr *) &sin, sizeof(sin)); +#if USE_POLL + fd.fd = s; + fd.events = POLLIN; + fd.revents = 0; + + retval = poll(&fd, 1, 1000); +#else FD_ZERO(&fds); FD_SET(s, &fds); selecttimeout.tv_sec = 1; selecttimeout.tv_usec = 0; retval = select(s + 1, &fds, NULL, NULL, &selecttimeout); +#endif /* on interrupt ignore */ if (retval < 0 && sock_errno == TDSSOCK_EINTR) commit ff4edf2fa2b3b326b0930093675d0269b90081bb Author: freddy77 Date: Sun Jan 13 20:01:43 2008 +0000 detect cancellation error on ODBC diff --git a/ChangeLog b/ChangeLog index bd33ef6..021efb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jan 13 20:59:55 CET 2008 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/cancel.c src/tds/token.c: + - detect cancellation and add proper error + - remove errors from cancel test + Sat Jan 12 1:13:30 CET 2008 Frediano Ziglio * src/odbc/unittests/blob1.c: small fix for 64bit * src/tds/net.c: fix for heavy loads @@ -50,4 +55,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2467 2008/01/12 00:14:11 freddy77 Exp $ +$Id: ChangeLog,v 1.2468 2008/01/13 20:01:43 freddy77 Exp $ diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index a638dc7..df2cc9a 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.466 2008/01/10 13:11:07 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.467 2008/01/13 20:01:44 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -3260,6 +3260,7 @@ odbc_process_tokens(TDS_STMT * stmt, unsigned flag) case TDS_NO_MORE_RESULTS: return TDS_CMD_DONE; case TDS_CANCELLED: + odbc_errs_add(&stmt->errs, "HY008", NULL); case TDS_FAIL: return TDS_CMD_FAIL; } @@ -4187,6 +4188,8 @@ SQLPrepare(SQLHSTMT hstmt, SQLCHAR FAR * szSqlStr, SQLINTEGER cbSqlStr) continue; case TDS_NO_MORE_RESULTS: break; + case TDS_CANCELLED: + odbc_errs_add(&stmt->errs, "HY008", NULL); default: stmt->errs.lastrc = SQL_ERROR; break; @@ -5683,6 +5686,9 @@ SQLGetTypeInfo(SQLHSTMT hstmt, SQLSMALLINT fSqlType) if (n >= varchar_pos && varchar_pos > 0) goto redo; break; + case TDS_CANCELLED: + odbc_errs_add(&stmt->errs, "HY008", NULL); + break; } if (!tds->current_results) break; diff --git a/src/odbc/unittests/cancel.c b/src/odbc/unittests/cancel.c index 6aa5e3f..a43db5b 100644 --- a/src/odbc/unittests/cancel.c +++ b/src/odbc/unittests/cancel.c @@ -1,8 +1,15 @@ /* Testing SQLCancel() */ #include "common.h" + +/* TODO port to windows, use thread */ + #include +#if HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ + #ifdef HAVE_ALARM #define CHECK_RCODE(t,h,m) \ @@ -15,7 +22,7 @@ exit(1); \ } -static SQLCHAR sqlstate[SQL_SQLSTATE_SIZE + 1]; +static char sqlstate[SQL_SQLSTATE_SIZE + 1]; static void getErrorInfo(SQLSMALLINT sqlhdltype, SQLHANDLE sqlhandle) @@ -32,8 +39,9 @@ getErrorInfo(SQLSMALLINT sqlhdltype, SQLHANDLE sqlhandle) (SQLCHAR *) sqlstate, (SQLINTEGER *) & naterror, (SQLCHAR *) msgtext, (SQLSMALLINT) sizeof(msgtext), (SQLSMALLINT *) & msgtextl); + sqlstate[sizeof(sqlstate)-1] = 0; fprintf(stderr, "Diagnostic info:\n"); - fprintf(stderr, " SQL State: %s\n", (char *) sqlstate); + fprintf(stderr, " SQL State: %s\n", sqlstate); fprintf(stderr, " SQL code : %d\n", (int) naterror); fprintf(stderr, " Message : %s\n", (char *) msgtext); } @@ -66,10 +74,11 @@ main(int argc, char **argv) use_odbc_version3 = 1; Connect(); - printf(">> Select tab1...\n"); + printf(">> Wait 5 minutes...\n"); alarm(4); signal(SIGALRM, sigalrm_handler); rcode = SQLExecDirect(Statement, (SQLCHAR *) "WAITFOR DELAY '000:05:00'", SQL_NTS); + alarm(0); if (rcode != SQL_ERROR) { fprintf(stderr, "SQLExecDirect should return error\n"); return 1; @@ -81,7 +90,10 @@ main(int argc, char **argv) return 1; } printf(">> ... done rcode = %d\n", rcode); - signal(SIGINT, NULL); + + ResetStatement(); + + Command(Statement, "SELECT name FROM sysobjects WHERE 0=1"); Disconnect(); return 0; diff --git a/src/tds/token.c b/src/tds/token.c index 0c80a00..e6d5a6d 100644 --- a/src/tds/token.c +++ b/src/tds/token.c @@ -42,7 +42,7 @@ #include #endif -TDS_RCSID(var, "$Id: token.c,v 1.343 2007/12/28 23:00:18 jklowden Exp $"); +TDS_RCSID(var, "$Id: token.c,v 1.344 2008/01/13 20:01:45 freddy77 Exp $"); static int tds_process_msg(TDSSOCKET * tds, int marker); static int tds_process_compute_result(TDSSOCKET * tds); @@ -2238,7 +2238,7 @@ tds_process_end(TDSSOCKET * tds, int marker, int *flags_parm) if (IS_TDSDEAD(tds)) return TDS_FAIL; - return TDS_SUCCEED; + return was_cancelled ? TDS_CANCELLED : TDS_SUCCEED; } /** commit f9912e0d61c0c0f225d8d910c4b506135cc408db Author: freddy77 Date: Mon Jan 14 19:21:06 2008 +0000 finish patch for HY008 diff --git a/ChangeLog b/ChangeLog index 021efb9..f318306 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Jan 14 20:20:31 CET 2008 Frediano Ziglio + * include/tdsodbc.h src/odbc/odbc.c: + - handle SQLCancel in signal handlers + Sun Jan 13 20:59:55 CET 2008 Frediano Ziglio * src/odbc/odbc.c src/odbc/unittests/cancel.c src/tds/token.c: - detect cancellation and add proper error @@ -55,4 +59,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2468 2008/01/13 20:01:43 freddy77 Exp $ +$Id: ChangeLog,v 1.2469 2008/01/14 19:21:06 freddy77 Exp $ diff --git a/include/tdsodbc.h b/include/tdsodbc.h index 59fdfc1..a58d547 100644 --- a/include/tdsodbc.h +++ b/include/tdsodbc.h @@ -66,7 +66,7 @@ extern "C" #endif #endif -/* $Id: tdsodbc.h,v 1.103 2007/11/26 18:12:30 freddy77 Exp $ */ +/* $Id: tdsodbc.h,v 1.104 2008/01/14 19:21:06 freddy77 Exp $ */ #if defined(__GNUC__) && __GNUC__ >= 4 #pragma GCC visibility push(hidden) @@ -370,6 +370,7 @@ struct _hstmt int special_row; /* do NOT free cursor, free from socket or attach to connection */ TDSCURSOR *cursor; + unsigned char cancel_sent; }; typedef struct _henv TDS_ENV; diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index df2cc9a..74f8057 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.467 2008/01/13 20:01:44 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.468 2008/01/14 19:21:06 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -562,6 +562,7 @@ odbc_lock_statement(TDS_STMT* stmt) tds->query_timeout = (stmt->attr.query_timeout != DEFAULT_QUERY_TIMEOUT) ? stmt->attr.query_timeout : stmt->dbc->default_query_timeout; stmt->dbc->current_statement = stmt; + stmt->cancel_sent = 0; return 1; } @@ -1582,6 +1583,7 @@ SQLCancel(SQLHSTMT hstmt) /* FIXME test current statement */ + stmt->cancel_sent = 1; if (tds_send_cancel(tds) == TDS_FAIL) { ODBC_SAFE_ERROR(stmt); ODBC_RETURN(stmt, SQL_ERROR); @@ -1592,7 +1594,9 @@ SQLCancel(SQLHSTMT hstmt) ODBC_RETURN(stmt, SQL_ERROR); } - stmt->dbc->current_statement = NULL; + /* only if we processed cancel reset statement */ + if (stmt->dbc->current_statement && stmt->dbc->current_statement == stmt && tds->state == TDS_IDLE) + stmt->dbc->current_statement = NULL; ODBC_RETURN_(stmt); } @@ -2025,6 +2029,12 @@ odbc_errmsg_handler(const TDSCONTEXT * ctx, TDSSOCKET * tds, TDSMESSAGE * msg) tdsdump_log(TDS_DBG_INFO1, "in timeout\n"); if (tds && (dbc = (TDS_DBC *) tds->parent) && dbc->current_statement) { TDS_STMT *stmt = dbc->current_statement; + /* cancel sent, handling interrupt */ + if (tds->in_cancel && stmt ->cancel_sent) { + stmt ->cancel_sent = 0; + tdsdump_log(TDS_DBG_INFO1, "returning from timeout\n"); + return TDS_INT_TIMEOUT; + } if (!tds->in_cancel) odbc_errs_add(&stmt->errs, "HYT00", "Timeout expired"); stmt->errs.lastrc = SQL_ERROR; commit f5d35b8af351e12aca845f27441c970a27cc45a7 Author: freddy77 Date: Thu Jan 17 06:56:50 2008 +0000 do not dump received header diff --git a/ChangeLog b/ChangeLog index f318306..06276f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Thu Jan 17 7:56:02 CET 2008 Frediano Ziglio + * src/tds/net.c: do not dump received header + Mon Jan 14 20:20:31 CET 2008 Frediano Ziglio * include/tdsodbc.h src/odbc/odbc.c: - handle SQLCancel in signal handlers @@ -59,4 +62,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2469 2008/01/14 19:21:06 freddy77 Exp $ +$Id: ChangeLog,v 1.2470 2008/01/17 06:56:50 freddy77 Exp $ diff --git a/src/tds/net.c b/src/tds/net.c index 196af9b..867c8f5 100644 --- a/src/tds/net.c +++ b/src/tds/net.c @@ -103,7 +103,7 @@ #include #endif -TDS_RCSID(var, "$Id: net.c,v 1.73 2008/01/12 00:14:11 freddy77 Exp $"); +TDS_RCSID(var, "$Id: net.c,v 1.74 2008/01/17 06:56:50 freddy77 Exp $"); #undef USE_POLL #if defined(HAVE_POLL_H) && defined(HAVE_POLL) @@ -581,7 +581,6 @@ tds_read_packet(TDSSOCKET * tds) } return -1; } - tdsdump_dump_buf(TDS_DBG_NETWORK, "Received header", header, sizeof(header)); #if 0 /* @@ -606,7 +605,7 @@ tds_read_packet(TDSSOCKET * tds) #endif /* Convert our packet length from network to host byte order */ - len = ((((unsigned int) header[2]) << 8) | header[3]) - 8; + len = (((unsigned int) header[2]) << 8) | header[3]; /* * If this packet size is the largest we have gotten allocate space for it @@ -630,9 +629,10 @@ tds_read_packet(TDSSOCKET * tds) /* Clean out the in_buf so we don't use old stuff by mistake */ memset(tds->in_buf, 0, tds->in_buf_max); + memcpy(tds->in_buf, header, 8); /* Now get exactly how many bytes the server told us to get */ - have = 0; + have = 8; while (have < len) { int nbytes = goodread(tds, tds->in_buf + have, len - have); if (nbytes < 1) { @@ -659,7 +659,7 @@ tds_read_packet(TDSSOCKET * tds) /* Set the length and pos (not sure what pos is used for now */ tds->in_len = have; - tds->in_pos = 0; + tds->in_pos = 8; tdsdump_dump_buf(TDS_DBG_NETWORK, "Received packet", tds->in_buf, tds->in_len); return (tds->in_len); commit 510c7865cd8f8a44029d975beaf30a92f4d8a2c0 Author: freddy77 Date: Thu Jan 17 06:59:28 2008 +0000 add param for version diff --git a/misc/freetds_autobuild b/misc/freetds_autobuild index a78d6f4..4ba053d 100755 --- a/misc/freetds_autobuild +++ b/misc/freetds_autobuild @@ -9,7 +9,7 @@ export PATH="/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:$HOME GROUPDIR=/home/groups/f/fr/freetds/htdocs # directory to compile -FTDSDIR=freetds82 +FTDSDIR=freetds83 # output directory on server OUTDIR=out # additional flags for Autogen (current version) @@ -66,15 +66,26 @@ read_pwd_fields() rm ~/freetds.log /tmp/sql.log +ignore= for param do - case $param in + shift + case "$param" in + $ignore) + ignore= + ;; --previous) OUTDIR=out0 FTDSDIR=freetds64 FLAGS_ADD="$FLAGS_ADD_OLD" WORKDIR=ftds_comp_old ;; + --version) + ignore=$1 + OUTDIR=out$1 + FTDSDIR=freetds$1 + WORKDIR=ftds_comp$1 + ;; *) echo 'Option not supported!' 1>&2 exit 1 commit 953a096fb706599772e0828dc9c22cf5a9c7a8e0 Author: jklowden Date: Thu Jan 17 22:45:50 2008 +0000 announce 0.82RC1 diff --git a/ChangeLog b/ChangeLog index 06276f3..9c3fb34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Thu Jan 17 17:44:43 EST 2008 JK Lowden + * doc/htdoc/news.html announce 0.82RC1 + Thu Jan 17 7:56:02 CET 2008 Frediano Ziglio * src/tds/net.c: do not dump received header @@ -62,4 +65,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2470 2008/01/17 06:56:50 freddy77 Exp $ +$Id: ChangeLog,v 1.2471 2008/01/17 22:45:50 jklowden Exp $ diff --git a/doc/htdoc/news.html b/doc/htdoc/news.html index ed0a8a9..c4f8434 100644 --- a/doc/htdoc/news.html +++ b/doc/htdoc/news.html @@ -1,7 +1,7 @@ - + FreeTDS.org @@ -24,11 +24,31 @@ News  | 
- +

News and Press

+ + + + + + + commit a8b3aa76401d5ba7c1f858cedb015a7619666d8f Author: jklowden Date: Thu Jan 17 22:55:33 2008 +0000 no comment diff --git a/doc/htdoc/news.html b/doc/htdoc/news.html index c4f8434..0e26056 100644 --- a/doc/htdoc/news.html +++ b/doc/htdoc/news.html @@ -1,7 +1,7 @@ - + FreeTDS.org @@ -25,7 +25,7 @@ News  | 

News and Press commit 33c555f4d9ccb9203c80176e2548ba2cb33a4059 Author: jklowden Date: Thu Jan 17 22:57:27 2008 +0000 fixed link diff --git a/doc/htdoc/news.html b/doc/htdoc/news.html index 0e26056..5dbbcee 100644 --- a/doc/htdoc/news.html +++ b/doc/htdoc/news.html @@ -1,7 +1,7 @@ - + FreeTDS.org @@ -38,7 +38,7 @@ News  | 

FreeTDS enters release process for Version 0.82
+
+Version 0.82RC1 is now available from + +ftp.ibiblio.org. This important release will incorporate many new features, involving some +23,710 lines of code. Detailed information can be found in the NEWS file included in the +the distribution. +

Version 0.82 will be the successor to 0.64, released in July 2006. The jump in version +number represents the progress toward version 1.0. +
+
+

FreeTDS announces Version 0.63

Version 0.82RC1 is now available from - + ftp.ibiblio.org. This important release will incorporate many new features, involving some 23,710 lines of code. Detailed information can be found in the NEWS file included in the the distribution. commit 3a6980a9d331be4a918460a4075b616754943ba5 Author: freddy77 Date: Fri Jan 18 13:37:11 2008 +0000 merge Sebastien Flaesch patch improving ODBC parameters diff --git a/ChangeLog b/ChangeLog index 9c3fb34..05d433d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Jan 18 14:33:09 CET 2008 Frediano Ziglio + * include/tds.h src/odbc/connectparams.c src/tds/config.c: + - merge Sebastien Flaesch patch for ODBC parameters + - add ClientCharset, DumpFile, DumpFileAppend, DebugFlags, Encryption + - rewrote ODBCINSTGetProperties + Thu Jan 17 17:44:43 EST 2008 JK Lowden * doc/htdoc/news.html announce 0.82RC1 @@ -65,4 +71,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2471 2008/01/17 22:45:50 jklowden Exp $ +$Id: ChangeLog,v 1.2472 2008/01/18 13:37:11 freddy77 Exp $ diff --git a/include/tds.h b/include/tds.h index 4a63ca1..1a5eafa 100644 --- a/include/tds.h +++ b/include/tds.h @@ -20,7 +20,7 @@ #ifndef _tds_h_ #define _tds_h_ -/* $Id: tds.h,v 1.284 2007/12/27 13:45:22 freddy77 Exp $ */ +/* $Id: tds.h,v 1.285 2008/01/18 13:37:12 freddy77 Exp $ */ #include #include @@ -1387,6 +1387,7 @@ const TDS_COMPILETIME_SETTINGS *tds_get_compiletime_settings(void); typedef void (*TDSCONFPARSE) (const char *option, const char *value, void *param); int tds_read_conf_section(FILE * in, const char *section, TDSCONFPARSE tds_conf_parse, void *parse_param); int tds_read_conf_file(TDSCONNECTION * connection, const char *server); +void tds_parse_conf_section(const char *option, const char *value, void *param); TDSCONNECTION *tds_read_config_info(TDSSOCKET * tds, TDSLOGIN * login, TDSLOCALE * locale); void tds_fix_connection(TDSCONNECTION * connection); void tds_config_verstr(const char *tdsver, TDSCONNECTION * connection); diff --git a/src/odbc/connectparams.c b/src/odbc/connectparams.c index 7221a67..657062c 100644 --- a/src/odbc/connectparams.c +++ b/src/odbc/connectparams.c @@ -37,7 +37,22 @@ #include #endif -TDS_RCSID(var, "$Id: connectparams.c,v 1.72 2007/07/01 10:10:52 freddy77 Exp $"); +TDS_RCSID(var, "$Id: connectparams.c,v 1.73 2008/01/18 13:37:12 freddy77 Exp $"); + +static const char odbc_param_Servername[] = "Servername"; +static const char odbc_param_Address[] = "Address"; +static const char odbc_param_Server[] = "Server"; +static const char odbc_param_Port[] = "Port"; +static const char odbc_param_TDS_Version[] = "TDS_Version"; +static const char odbc_param_Language[] = "Language"; +static const char odbc_param_Database[] = "Database"; +static const char odbc_param_TextSize[] = "TextSize"; +static const char odbc_param_PacketSize[] = "PacketSize"; +static const char odbc_param_ClientCharset[] = "ClientCharset"; +static const char odbc_param_DumpFile[] = "DumpFile"; +static const char odbc_param_DumpFileAppend[] = "DumpFileAppend"; +static const char odbc_param_DebugFlags[] = "DebugFlags"; +static const char odbc_param_Encryption[] = "Encryption"; #if !HAVE_SQLGETPRIVATEPROFILESTRING @@ -114,6 +129,13 @@ parse_server(char *server, TDSCONNECTION * connection) 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 @@ -128,8 +150,7 @@ odbc_get_dsn_info(const char *DSN, TDSCONNECTION * connection) int address_specified = 0; /* use old servername */ - tmp[0] = '\0'; - if (SQLGetPrivateProfileString(DSN, "Servername", "", tmp, FILENAME_MAX, "odbc.ini") > 0) { + if (myGetPrivateProfileString(DSN, odbc_param_Servername, tmp) > 0) { freetds_conf_less = 0; tds_dstr_copy(&connection->server_name, tmp); tds_read_conf_file(connection, tmp); @@ -137,16 +158,13 @@ odbc_get_dsn_info(const char *DSN, TDSCONNECTION * connection) /* search for server (compatible with ms one) */ if (freetds_conf_less) { - tmp[0] = '\0'; - if (SQLGetPrivateProfileString(DSN, "Address", "", tmp, FILENAME_MAX, "odbc.ini") > 0) { + if (myGetPrivateProfileString(DSN, odbc_param_Address, tmp) > 0) { address_specified = 1; /* TODO parse like MS */ tds_lookup_host(tmp, tmp); tds_dstr_copy(&connection->ip_addr, tmp); } - - tmp[0] = '\0'; - if (SQLGetPrivateProfileString(DSN, "Server", "", tmp, FILENAME_MAX, "odbc.ini") > 0) { + if (myGetPrivateProfileString(DSN, odbc_param_Server, tmp) > 0) { tds_dstr_copy(&connection->server_name, tmp); if (!address_specified) { if (!parse_server(tmp, connection)) @@ -155,35 +173,39 @@ odbc_get_dsn_info(const char *DSN, TDSCONNECTION * connection) } } - tmp[0] = '\0'; - if (SQLGetPrivateProfileString(DSN, "Port", "", tmp, FILENAME_MAX, "odbc.ini") > 0) { - connection->port = atoi(tmp); - } + if (myGetPrivateProfileString(DSN, odbc_param_Port, tmp) > 0) + tds_parse_conf_section(TDS_STR_PORT, tmp, connection); - tmp[0] = '\0'; - if (SQLGetPrivateProfileString(DSN, "TDS_Version", "", tmp, FILENAME_MAX, "odbc.ini") > 0) { - tds_config_verstr(tmp, connection); - } + if (myGetPrivateProfileString(DSN, odbc_param_TDS_Version, tmp) > 0) + tds_parse_conf_section(TDS_STR_VERSION, tmp, connection); - tmp[0] = '\0'; - if (SQLGetPrivateProfileString(DSN, "Language", "", tmp, FILENAME_MAX, "odbc.ini") > 0) { - tds_dstr_copy(&connection->language, tmp); - } + if (myGetPrivateProfileString(DSN, odbc_param_Language, tmp) > 0) + tds_parse_conf_section(TDS_STR_LANGUAGE, tmp, connection); - tmp[0] = '\0'; if (tds_dstr_isempty(&connection->database) - && SQLGetPrivateProfileString(DSN, "Database", "", tmp, FILENAME_MAX, "odbc.ini") > 0) + && myGetPrivateProfileString(DSN, odbc_param_Database, tmp) > 0) tds_dstr_copy(&connection->database, tmp); - tmp[0] = '\0'; - if (SQLGetPrivateProfileString(DSN, "TextSize", "", tmp, FILENAME_MAX, "odbc.ini") > 0) { - connection->text_size = atoi(tmp); - } + if (myGetPrivateProfileString(DSN, odbc_param_TextSize, tmp) > 0) + tds_parse_conf_section(TDS_STR_TEXTSZ, tmp, connection); - tmp[0] = '\0'; - if (SQLGetPrivateProfileString(DSN, "PacketSize", "", tmp, FILENAME_MAX, "odbc.ini") > 0) { - connection->block_size = atoi(tmp); - } + if (myGetPrivateProfileString(DSN, odbc_param_PacketSize, tmp) > 0) + tds_parse_conf_section(TDS_STR_BLKSZ, tmp, connection); + + if (myGetPrivateProfileString(DSN, odbc_param_ClientCharset, tmp) > 0) + tds_parse_conf_section(TDS_STR_CLCHARSET, tmp, connection); + + if (myGetPrivateProfileString(DSN, odbc_param_DumpFile, tmp) > 0) + tds_parse_conf_section(TDS_STR_DUMPFILE, tmp, connection); + + if (myGetPrivateProfileString(DSN, odbc_param_DumpFileAppend, tmp) > 0) + tds_parse_conf_section(TDS_STR_APPENDMODE, tmp, connection); + + if (myGetPrivateProfileString(DSN, odbc_param_DebugFlags, tmp) > 0) + tds_parse_conf_section(TDS_STR_DEBUGFLAGS, tmp, connection); + + if (myGetPrivateProfileString(DSN, odbc_param_Encryption, tmp) > 0) + tds_parse_conf_section(TDS_STR_ENCRYPTION, tmp, connection); return 1; } @@ -279,16 +301,26 @@ odbc_parse_connect_string(const char *connect_string, const char *connect_string } else if (strcasecmp(option, "WSID") == 0) { dest_s = &connection->client_host_name; } else if (strcasecmp(option, "LANGUAGE") == 0) { - dest_s = &connection->language; - } else if (strcasecmp(option, "Port") == 0) { - connection->port = atoi(tds_dstr_cstr(&value)); - } else if (strcasecmp(option, "TDS_Version") == 0) { - tds_config_verstr(tds_dstr_cstr(&value), connection); - } else if (strcasecmp(option, "TextSize") == 0) { - connection->text_size = atoi(tds_dstr_cstr(&value)); - } else if (strcasecmp(option, "PacketSize") == 0) { - connection->block_size = atoi(tds_dstr_cstr(&value)); - /* TODO "Address" field */ + tds_parse_conf_section(TDS_STR_LANGUAGE, tds_dstr_cstr(&value), connection); + } else if (strcasecmp(option, odbc_param_Port) == 0) { + tds_parse_conf_section(TDS_STR_PORT, tds_dstr_cstr(&value), connection); + } else if (strcasecmp(option, odbc_param_TDS_Version) == 0) { + tds_parse_conf_section(TDS_STR_VERSION, tds_dstr_cstr(&value), connection); + } else if (strcasecmp(option, odbc_param_TextSize) == 0) { + tds_parse_conf_section(TDS_STR_TEXTSZ, tds_dstr_cstr(&value), connection); + } else if (strcasecmp(option, odbc_param_PacketSize) == 0) { + tds_parse_conf_section(TDS_STR_BLKSZ, tds_dstr_cstr(&value), connection); + } else if (strcasecmp(option, odbc_param_ClientCharset) == 0) { + tds_parse_conf_section(TDS_STR_CLCHARSET, tds_dstr_cstr(&value), connection); + } else if (strcasecmp(option, odbc_param_DumpFile) == 0) { + tds_parse_conf_section(TDS_STR_DUMPFILE, tds_dstr_cstr(&value), connection); + } else if (strcasecmp(option, odbc_param_DumpFileAppend) == 0) { + tds_parse_conf_section(TDS_STR_APPENDMODE, tds_dstr_cstr(&value), connection); + } else if (strcasecmp(option, odbc_param_DebugFlags) == 0) { + tds_parse_conf_section(TDS_STR_DEBUGFLAGS, tds_dstr_cstr(&value), connection); + } else if (strcasecmp(option, odbc_param_Encryption) == 0) { + tds_parse_conf_section(TDS_STR_ENCRYPTION, tds_dstr_cstr(&value), connection); + /* TODO odbc_param_Address field */ } /* copy to destination */ @@ -487,6 +519,19 @@ static const char *const aLanguage[] = { 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", @@ -496,129 +541,132 @@ static const char *aAuth[] = { }; */ -int -ODBCINSTGetProperties(HODBCINSTPROPERTY hLastProperty) +static HODBCINSTPROPERTY +addProperty(HODBCINSTPROPERTY hLastProperty) { hLastProperty->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); hLastProperty = hLastProperty->pNext; memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT; - tds_strlcpy(hLastProperty->szName, "Servername", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("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->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT; - tds_strlcpy(hLastProperty->szName, "Server", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("Name of server to connect to.\n" - "This should be the name of real server.\n" - "This property cannot be used with Servername property."); + return hLastProperty; +} - hLastProperty->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); +static HODBCINSTPROPERTY +definePropertyString(HODBCINSTPROPERTY hLastProperty, const char *name, const char *value, const char *comment) +{ + hLastProperty = addProperty(hLastProperty); hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT; - tds_strlcpy(hLastProperty->szName, "Address", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("The hostname or ip address of the server."); + tds_strlcpy(hLastProperty->szName, name, INI_MAX_PROPERTY_NAME); + tds_strlcpy(hLastProperty->szValue, value, INI_MAX_PROPERTY_VALUE); + hLastProperty->pszHelp = (char *) strdup(comment); + return hLastProperty; +} - hLastProperty->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT; - tds_strlcpy(hLastProperty->szName, "Port", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "1433", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("TCP/IP Port to connect to."); +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)); + tds_strlcpy(hLastProperty->szName, name, INI_MAX_PROPERTY_NAME); + tds_strlcpy(hLastProperty->szValue, value, INI_MAX_PROPERTY_VALUE); + hLastProperty->pszHelp = (char *) strdup(comment); + return hLastProperty; +} - hLastProperty->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT; - tds_strlcpy(hLastProperty->szName, "Database", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("Default database."); +static HODBCINSTPROPERTY +definePropertyHidden(HODBCINSTPROPERTY hLastProperty, const char *name, const char *value, const char *comment) +{ + hLastProperty = addProperty(hLastProperty); + hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_HIDDEN; + tds_strlcpy(hLastProperty->szName, name, INI_MAX_PROPERTY_NAME); + tds_strlcpy(hLastProperty->szValue, value, INI_MAX_PROPERTY_VALUE); + hLastProperty->pszHelp = (char *) strdup(comment); + return hLastProperty; +} - hLastProperty->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); +static HODBCINSTPROPERTY +definePropertyList(HODBCINSTPROPERTY hLastProperty, const char *name, const char *value, void *list, int size, const char *comment) +{ + hLastProperty = addProperty(hLastProperty); hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_LISTBOX; - hLastProperty->aPromptData = malloc(sizeof(aTDSver)); - memcpy(hLastProperty->aPromptData, aTDSver, sizeof(aTDSver)); - tds_strlcpy(hLastProperty->szName, "TDS_Version", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "4.2", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("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 or MSSQL 2000\n" " 8.0 MSSQL 2000"); + hLastProperty->aPromptData = malloc(size); + memcpy(hLastProperty->aPromptData, list, size); + tds_strlcpy(hLastProperty->szName, name, INI_MAX_PROPERTY_NAME); + tds_strlcpy(hLastProperty->szValue, value, INI_MAX_PROPERTY_VALUE); + hLastProperty->pszHelp = (char *) strdup(comment); + return hLastProperty; +} - hLastProperty->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_COMBOBOX; - hLastProperty->aPromptData = malloc(sizeof(aLanguage)); - memcpy(hLastProperty->aPromptData, aLanguage, sizeof(aLanguage)); - tds_strlcpy(hLastProperty->szName, "Language", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "us_english", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("The default language setting."); +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->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_HIDDEN; - tds_strlcpy(hLastProperty->szName, "TextSize", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("Text datatype limit."); + 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 or MSSQL 2000\n" + " 8.0 MSSQL 2000"); + + 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->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT; - tds_strlcpy(hLastProperty->szName, "UID", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("User ID (Beware of security issues)."); + hLastProperty = definePropertyString(hLastProperty, odbc_param_UID, "", + "User ID (Beware of security issues)."); - hLastProperty->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT; - tds_strlcpy(hLastProperty->szName, "PWD", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("Password (Beware of security issues)."); + hLastProperty = definePropertyString(hLastProperty, odbc_param_PWD, "", + "Password (Beware of security issues)."); */ /* - hLastProperty->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_LISTBOX; - hLastProperty->aPromptData = malloc(sizeof(aAuth)); - memcpy(hLastProperty->aPromptData, aAuth, sizeof(aAuth)); - tds_strlcpy(hLastProperty->szName, "Authentication", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "Server", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("The server authentication mechanism."); + 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->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT; - tds_strlcpy(hLastProperty->szName, "Domain", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("The default domain to use when using Domain Authentication."); + hLastProperty = definePropertyString(hLastProperty, odbc_param_PacketSize, "", + "Size of network packets."); - hLastProperty->pNext = (HODBCINSTPROPERTY) malloc(sizeof(ODBCINSTPROPERTY)); - hLastProperty = hLastProperty->pNext; - memset(hLastProperty, 0, sizeof(ODBCINSTPROPERTY)); - hLastProperty->nPromptType = ODBCINST_PROMPTTYPE_TEXTEDIT; - tds_strlcpy(hLastProperty->szName, "PacketSize", INI_MAX_PROPERTY_NAME); - tds_strlcpy(hLastProperty->szValue, "", INI_MAX_PROPERTY_VALUE); - hLastProperty->pszHelp = (char *) strdup("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."); return 1; } diff --git a/src/tds/config.c b/src/tds/config.c index f88b268..9be062a 100644 --- a/src/tds/config.c +++ b/src/tds/config.c @@ -76,7 +76,7 @@ #include #endif -TDS_RCSID(var, "$Id: config.c,v 1.132 2007/12/23 21:12:02 jklowden Exp $"); +TDS_RCSID(var, "$Id: config.c,v 1.133 2008/01/18 13:37:12 freddy77 Exp $"); static void tds_config_login(TDSCONNECTION * connection, TDSLOGIN * login); static void tds_config_env_tdsdump(TDSCONNECTION * connection); @@ -84,7 +84,6 @@ static void tds_config_env_tdsver(TDSCONNECTION * connection); static void tds_config_env_tdsport(TDSCONNECTION * connection); static void tds_config_env_tdshost(TDSCONNECTION * connection); static int tds_read_conf_sections(FILE * in, const char *server, TDSCONNECTION * connection); -static void tds_parse_conf_section(const char *option, const char *value, void *param); static void tds_read_interfaces(const char *server, TDSCONNECTION * connection); static int tds_config_boolean(const char *value); static int parse_server_name_for_port(TDSCONNECTION * connection, TDSLOGIN * login); @@ -349,13 +348,27 @@ tds_read_conf_sections(FILE * in, const char *server, TDSCONNECTION * connection return tds_read_conf_section(in, server, tds_parse_conf_section, connection); } +static const struct { + char value[7]; + unsigned char to_return; +} boolean_values[] = { + { "yes", 1 }, + { "no", 0 }, + { "on", 1 }, + { "off", 0 }, + { "true", 1 }, + { "false", 0 } +}; + static int tds_config_boolean(const char *value) { - if (!strcmp(value, "yes") || !strcmp(value, "on") || !strcmp(value, "true") || !strcmp(value, "1")) - return 1; - if (!strcmp(value, "no") || !strcmp(value, "off") || !strcmp(value, "false") || !strcmp(value, "0")) - return 0; + 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; + } tdsdump_log(TDS_DBG_INFO1, "UNRECOGNIZED boolean value: '%s'. Treating as 'no'.\n", value); return 0; } @@ -471,7 +484,8 @@ tds_read_conf_section(FILE * in, const char *section, TDSCONFPARSE tds_conf_pars #undef option } -static void +/* Also used to scan ODBC.INI entries */ +void tds_parse_conf_section(const char *option, const char *value, void *param) { TDSCONNECTION *connection = (TDSCONNECTION *) param; commit fbd7bff7112f0353f1bab471cd166369e18ab6a3 Author: freddy77 Date: Sun Jan 20 14:23:58 2008 +0000 port to win64 diff --git a/ChangeLog b/ChangeLog index 05d433d..468a3bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Sun Jan 20 15:23:16 CET 2008 Frediano Ziglio + * configure.ac include/tds_sysdep_private.h: + * include/tds_sysdep_public.h.in src/apps/Makefile.am: + * src/ctlib/unittests/cancel.c src/dblib/unittests/timeout.c: + * src/odbc/unittests/describecol.c src/replacements/iconv.c: + * src/tds/query.c win32/tds_sysdep_public.h win32/winlogin.c: + * win32/winsetup.c: + - port to win64 + Fri Jan 18 14:33:09 CET 2008 Frediano Ziglio * include/tds.h src/odbc/connectparams.c src/tds/config.c: - merge Sebastien Flaesch patch for ODBC parameters @@ -71,4 +80,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2472 2008/01/18 13:37:11 freddy77 Exp $ +$Id: ChangeLog,v 1.2473 2008/01/20 14:23:58 freddy77 Exp $ diff --git a/configure.ac b/configure.ac index 4a0f729..77740fc 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.32 2008/01/11 12:43:39 freddy77 Exp $ +dnl $Id: configure.ac,v 1.33 2008/01/20 14:23:58 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -15,7 +15,7 @@ dnl ------------------------------------------------------------ AC_INIT(FreeTDS, 0.83.dev.esyscmd(echo -n $(date +"%Y%m%d"))) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.32 $) +AC_REVISION($Revision: 1.33 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -142,7 +142,9 @@ tds_mingw=no case $host in *-*-mingw*) tds_mingw=yes - if test -r /usr/lib/w32api/libwsock32.a; then + if test "$host_cpu" = "x86_64"; then + LIBS="-lws2_32" + elif test -r /usr/lib/w32api/libwsock32.a; then LIBS="-L/usr/lib/w32api -lwsock32" else LIBS="-lwsock32" @@ -381,7 +383,7 @@ TDS_NULL_IS_ZERO AC_CHECK_FUNCS([vsnprintf _vsnprintf gettimeofday \ nl_langinfo locale_charset setenv putenv \ getuid getpwuid getpwuid_r fstat alarm fork \ -gethrtime localtime_r]) +gethrtime localtime_r setitimer]) OLD_LIBS="$LIBS" LIBS="$LIBS $NETWORK_LIBS" AC_CHECK_FUNCS([inet_ntoa_r getipnodebyaddr getipnodebyname \ @@ -474,6 +476,7 @@ if test "$with_odbc_nodm"; then # Can't use ODBCLIB/LDFLAGS variables since they are used in building # other directories. ODBCNODMLIB="-L.. -ltdsodbc" + ODBCNODMLIBAPP="-L../odbc -ltdsodbc" odbc=true fi @@ -594,6 +597,7 @@ AC_SUBST(ODBC_INC) AC_SUBST(ODBCLIB) AC_SUBST(ODBCINSTLIB) AC_SUBST(ODBCNODMLIB) +AC_SUBST(ODBCNODMLIBAPP) AC_ARG_WITH(gnutls, AS_HELP_STRING([--with-gnutls], [build with TLS support])) diff --git a/include/tds_sysdep_private.h b/include/tds_sysdep_private.h index 8adfb9b..bce25a0 100644 --- a/include/tds_sysdep_private.h +++ b/include/tds_sysdep_private.h @@ -20,7 +20,7 @@ #ifndef _tds_sysdep_private_h_ #define _tds_sysdep_private_h_ -/* $Id: tds_sysdep_private.h,v 1.24 2008/01/10 22:57:33 jklowden Exp $ */ +/* $Id: tds_sysdep_private.h,v 1.25 2008/01/20 14:23:59 freddy77 Exp $ */ #undef TDS_RCSID #if defined(__GNUC__) && __GNUC__ >= 3 @@ -95,6 +95,10 @@ typedef DWORD pid_t; #define WIN32 1 #endif +#if defined(_WIN64) && !defined(WIN64) +#define WIN64 1 +#endif + #define TDS_SDIR_SEPARATOR "\\" /* use macros to use new style names */ diff --git a/include/tds_sysdep_public.h.in b/include/tds_sysdep_public.h.in index 4ab78fb..96a782c 100644 --- a/include/tds_sysdep_public.h.in +++ b/include/tds_sysdep_public.h.in @@ -20,7 +20,7 @@ #ifndef _tds_sysdep_public_h_ #define _tds_sysdep_public_h_ -/* $Id: tds_sysdep_public.h.in,v 1.11 2006/04/12 13:54:10 freddy77 Exp $ */ +/* $Id: tds_sysdep_public.h.in,v 1.12 2008/01/20 14:23:59 freddy77 Exp $ */ #ifdef __cplusplus extern "C" @@ -37,7 +37,11 @@ extern "C" #define tds_sysdep_int64_type __int64 /* 64-bit int */ #define tds_sysdep_real32_type float /* 32-bit real */ #define tds_sysdep_real64_type double /* 64-bit real */ -#define tds_sysdep_intptr_type int /* 32-bit int */ +#if !defined(WIN64) && !defined(_WIN64) +#define tds_sysdep_intptr_type int /* 32-bit int */ +#else +#define tds_sysdep_intptr_type __int64 /* 64-bit int */ +#endif #endif /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) */ #ifndef tds_sysdep_int16_type diff --git a/src/apps/Makefile.am b/src/apps/Makefile.am index cfa03ac..6b03ce8 100644 --- a/src/apps/Makefile.am +++ b/src/apps/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.25 2008/01/01 23:09:46 freddy77 Exp $ +# $Id: Makefile.am,v 1.26 2008/01/20 14:23:59 freddy77 Exp $ AM_CPPFLAGS = -I$(top_srcdir)/include @@ -28,9 +28,8 @@ bsqldb_LDADD = ../dblib/libsybdb.la \ $(NETWORK_LIBS) if ODBC -bsqlodbc_LDADD = ../odbc/libtdsodbc.la \ - ../replacements/libreplacements.la \ - $(ODBCLIB) $(NETWORK_LIBS) +bsqlodbc_LDADD = ../replacements/libreplacements.la \ + $(ODBCLIB) $(ODBCNODMLIBAPP) $(NETWORK_LIBS) bsqlodbc_CPPFLAGS = $(ODBC_INC) $(AM_CPPFLAGS) endif diff --git a/src/ctlib/unittests/cancel.c b/src/ctlib/unittests/cancel.c index 09f3a1a..74e4da9 100644 --- a/src/ctlib/unittests/cancel.c +++ b/src/ctlib/unittests/cancel.c @@ -10,10 +10,10 @@ #include #include "common.h" -static char software_version[] = "$Id: cancel.c,v 1.11 2006/06/15 12:17:47 freddy77 Exp $"; +static char software_version[] = "$Id: cancel.c,v 1.12 2008/01/20 14:23:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; -#ifdef HAVE_ALARM +#if defined(HAVE_ALARM) && defined(HAVE_SETITIMER) /* protos */ int do_fetch(CS_COMMAND * cmd, int *cnt); diff --git a/src/dblib/unittests/timeout.c b/src/dblib/unittests/timeout.c index 736f968..7de6013 100644 --- a/src/dblib/unittests/timeout.c +++ b/src/dblib/unittests/timeout.c @@ -7,7 +7,7 @@ #include "common.h" #include -static char software_version[] = "$Id: timeout.c,v 1.3 2007/12/04 02:06:38 jklowden Exp $"; +static char software_version[] = "$Id: timeout.c,v 1.4 2008/01/20 14:23:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int ntimeouts = 0, ncancels = 0; @@ -29,7 +29,7 @@ timeout_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char return INT_CANCEL; if (dberr == SYBETIME) { - fprintf(stderr, "%d timeouts received in %ld seconds, ", ++ntimeouts, time(NULL) - start_time); + 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"); @@ -73,14 +73,14 @@ timeout_err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char int chkintr(DBPROCESS * dbproc) { - printf("in chkintr, %ld seconds elapsed\n", time(NULL) - start_time); + printf("in chkintr, %ld seconds elapsed\n", (long int) (time(NULL) - start_time)); return FALSE; } int hndlintr(DBPROCESS * dbproc) { - printf("in hndlintr, %ld seconds elapsed\n", time(NULL) - start_time); + printf("in hndlintr, %ld seconds elapsed\n", (long int) (time(NULL) - start_time)); return INT_CONTINUE; } diff --git a/src/odbc/unittests/describecol.c b/src/odbc/unittests/describecol.c index cd1de67..3739957 100644 --- a/src/odbc/unittests/describecol.c +++ b/src/odbc/unittests/describecol.c @@ -6,7 +6,7 @@ * test what say SQLDescribeCol about precision using some type */ -static char software_version[] = "$Id: describecol.c,v 1.13 2007/12/31 10:06:50 freddy77 Exp $"; +static char software_version[] = "$Id: describecol.c,v 1.14 2008/01/20 14:23:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static int g_result = 0; @@ -78,6 +78,9 @@ static struct lookup_int sql_types[] = { 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), @@ -140,7 +143,7 @@ typedef int (*get_attr_t) (ATTR_PARAMS); static int get_attr_ird(ATTR_PARAMS) { - SQLINTEGER i; + SQLLEN i; SQLRETURN ret; if (attr->type == type_CHARP) diff --git a/src/replacements/iconv.c b/src/replacements/iconv.c index c709275..80fe192 100644 --- a/src/replacements/iconv.c +++ b/src/replacements/iconv.c @@ -53,7 +53,7 @@ #include #endif -TDS_RCSID(var, "$Id: iconv.c,v 1.15 2006/08/07 19:37:59 freddy77 Exp $"); +TDS_RCSID(var, "$Id: iconv.c,v 1.16 2008/01/20 14:23:59 freddy77 Exp $"); /** * \addtogroup conv @@ -116,7 +116,7 @@ tds_sys_iconv_open (const char* tocode, const char* fromcode) case UTF8_ASCII: case UCS2LE_UTF8: case UTF8_UCS2LE: - return (iconv_t)fromto; + return (iconv_t) (TDS_INTPTR) fromto; break; default: break; @@ -144,7 +144,7 @@ tds_sys_iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * out int local_errno; #undef CD -#define CD ((int)cd) +#define CD ((int) (TDS_INTPTR) cd) /* iconv defines valid semantics for NULL inputs, but we don't support them. */ if (!inbuf || !*inbuf || !inbytesleft || !outbuf || !*outbuf || !outbytesleft) diff --git a/src/tds/query.c b/src/tds/query.c index 8ef57f7..61c266d 100644 --- a/src/tds/query.c +++ b/src/tds/query.c @@ -46,7 +46,7 @@ #include -TDS_RCSID(var, "$Id: query.c,v 1.217 2008/01/05 11:24:40 freddy77 Exp $"); +TDS_RCSID(var, "$Id: query.c,v 1.218 2008/01/20 14:23:59 freddy77 Exp $"); static void tds_put_params(TDSSOCKET * tds, TDSPARAMINFO * info, int flags); static void tds7_put_query_params(TDSSOCKET * tds, const char *query, int query_len); @@ -1729,7 +1729,7 @@ tds_get_dynid(TDSSOCKET * tds, char **id) inc_num = (inc_num + 1) & 0xffff; /* some version of Sybase require length <= 10, so we code id */ - n = (unsigned long) tds; + n = (unsigned long) (TDS_INTPTR) tds; if (!(p = (char *) malloc(16))) return TDS_FAIL; *id = p; diff --git a/win32/tds_sysdep_public.h b/win32/tds_sysdep_public.h index 048c409..d86e324 100644 --- a/win32/tds_sysdep_public.h +++ b/win32/tds_sysdep_public.h @@ -20,7 +20,7 @@ #ifndef _tds_sysdep_public_h_ #define _tds_sysdep_public_h_ -static char rcsid_tds_sysdep_public_h[] = "$Id: tds_sysdep_public.h,v 1.5 2004/02/03 19:28:12 jklowden Exp $"; +static char rcsid_tds_sysdep_public_h[] = "$Id: tds_sysdep_public.h,v 1.6 2008/01/20 14:23:59 freddy77 Exp $"; static void *no_unused_tds_sysdep_public_h_warn[] = { rcsid_tds_sysdep_public_h, no_unused_tds_sysdep_public_h_warn }; #ifdef __cplusplus @@ -34,12 +34,23 @@ extern "C" #define tds_sysdep_int64_type __int64 /* 64-bit int */ #define tds_sysdep_real32_type float /* 32-bit real */ #define tds_sysdep_real64_type double /* 64-bit real */ +#if !defined(WIN64) && !defined(_WIN64) #define tds_sysdep_intptr_type int /* 32-bit int */ +#else +#define tds_sysdep_intptr_type __int64 /* 64-bit int */ +#endif typedef SOCKET TDS_SYS_SOCKET; #ifndef TDS_IS_SOCKET_INVALID #define TDS_IS_SOCKET_INVALID(s) ((s) == INVALID_SOCKET) #endif +#if !defined(MSDBLIB) && !defined(SYBDBLIB) +#define SYBDBLIB 1 +#endif +#if defined(MSDBLIB) && defined(SYBDBLIB) +#error MSDBLIB and SYBDBLIB cannot both be defined +#endif + #ifdef __cplusplus } #endif diff --git a/win32/winlogin.c b/win32/winlogin.c index 4a2c2aa..9e5969d 100644 --- a/win32/winlogin.c +++ b/win32/winlogin.c @@ -88,6 +88,14 @@ get_desktop_file(const char *file) 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 @@ -107,7 +115,7 @@ LoginDlgProc(HWND hDlg, UINT message, WPARAM wParam, /* */ case WM_INITDIALOG: /* lParam points to the TDSCONNECTION */ connection = (TDSCONNECTION *) lParam; - SetWindowLong(hDlg, GWL_USERDATA, lParam); + SetWindowUserData(hDlg, lParam); /* copy info from TDSCONNECTION to the dialog */ SendDlgItemMessage(hDlg, IDC_LOGINSERVER, WM_SETTEXT, 0, (LPARAM) tds_dstr_cstr(&connection->server_name)); @@ -122,7 +130,7 @@ LoginDlgProc(HWND hDlg, UINT message, WPARAM wParam, /* */ case WM_COMMAND: /* Dialog's user data points to TDSCONNECTION */ - connection = (TDSCONNECTION *) GetWindowLong(hDlg, GWL_USERDATA); + connection = (TDSCONNECTION *) GetWindowUserData(hDlg); /* The wParam indicates which button was pressed */ if (LOWORD(wParam) == IDCANCEL) { diff --git a/win32/winsetup.c b/win32/winsetup.c index 20585f0..e33dc76 100644 --- a/win32/winsetup.c +++ b/win32/winsetup.c @@ -192,6 +192,13 @@ validate(DSNINFO * di) 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 @@ -216,7 +223,7 @@ DSNDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: /* lParam points to the DSNINFO */ di = (DSNINFO *) lParam; - SetWindowLong(hDlg, GWL_USERDATA, lParam); + SetWindowUserData(hDlg, lParam); /* Stuff legal protocol names into IDC_PROTOCOL */ for (i = 0; protocols[i]; i++) { @@ -236,7 +243,7 @@ DSNDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_COMMAND: /* Dialog's user data points to DSNINFO */ - di = (DSNINFO *) GetWindowLong(hDlg, GWL_USERDATA); + di = (DSNINFO *) GetWindowUserData(hDlg); /* The wParam indicates which button was pressed */ if (LOWORD(wParam) == IDCANCEL) { commit efed20c5ed4afafa6f782e90904bf213871b9370 Author: freddy77 Date: Sun Jan 20 16:36:51 2008 +0000 remove warning diff --git a/ChangeLog b/ChangeLog index 468a3bf..f8be023 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Sun Jan 20 17:36:34 CET 2008 Frediano Ziglio + * src/odbc/connectparams.c: remove warning + Sun Jan 20 15:23:16 CET 2008 Frediano Ziglio * configure.ac include/tds_sysdep_private.h: * include/tds_sysdep_public.h.in src/apps/Makefile.am: @@ -80,4 +83,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2473 2008/01/20 14:23:58 freddy77 Exp $ +$Id: ChangeLog,v 1.2474 2008/01/20 16:36:51 freddy77 Exp $ diff --git a/src/odbc/connectparams.c b/src/odbc/connectparams.c index 657062c..d16e218 100644 --- a/src/odbc/connectparams.c +++ b/src/odbc/connectparams.c @@ -37,7 +37,7 @@ #include #endif -TDS_RCSID(var, "$Id: connectparams.c,v 1.73 2008/01/18 13:37:12 freddy77 Exp $"); +TDS_RCSID(var, "$Id: connectparams.c,v 1.74 2008/01/20 16:36:51 freddy77 Exp $"); static const char odbc_param_Servername[] = "Servername"; static const char odbc_param_Address[] = "Address"; @@ -586,7 +586,7 @@ definePropertyHidden(HODBCINSTPROPERTY hLastProperty, const char *name, const ch } static HODBCINSTPROPERTY -definePropertyList(HODBCINSTPROPERTY hLastProperty, const char *name, const char *value, void *list, int size, const char *comment) +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; commit 4f125fbe4a6beb3be0d617634f1de2698cd60be6 Author: freddy77 Date: Sun Jan 20 20:47:45 2008 +0000 test for 64bit diff --git a/src/odbc/unittests/test64.c b/src/odbc/unittests/test64.c new file mode 100644 index 0000000..2f81731 --- /dev/null +++ b/src/odbc/unittests/test64.c @@ -0,0 +1,257 @@ +/* test win64 consistency */ +#include "common.h" + +static char software_version[] = "$Id: test64.c,v 1.1 2008/01/20 20:47:45 freddy77 Exp $"; +static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; + +#define CHK(func,params) \ + if (func params != SQL_SUCCESS) \ + ODBC_REPORT_ERROR(#func) + +/* +set ipd processed_ptr with +SQLParamOptions/SQLSetDescField/SQL_ATTR_PARAMS_PROCESSED_PTR +check always same value IPD->processed_ptr attr +*/ + +static void +check_ipd_params(void) +{ + void *ptr, *ptr2; + SQLHDESC desc; + SQLINTEGER ind; + + CHK(SQLGetStmtAttr,(Statement, SQL_ATTR_PARAMS_PROCESSED_PTR, &ptr, sizeof(ptr), NULL)); + + /* get IPD */ + CHK(SQLGetStmtAttr, (Statement, SQL_ATTR_IMP_PARAM_DESC, &desc, sizeof(desc), &ind)); + + CHK(SQLGetDescField, (desc, 1, SQL_DESC_ROWS_PROCESSED_PTR, &ptr2, sizeof(ptr2), &ind)); + + if (ptr != ptr2) { + fprintf(stderr, "IPD inconsistency ptr %p ptr2 %p\n", ptr, ptr2); + exit(1); + } +} + +static void +set_ipd_params1(SQLULEN *ptr) +{ + CHK(SQLSetStmtAttr,(Statement, SQL_ATTR_PARAMS_PROCESSED_PTR, ptr, 0)); +} + +static void +set_ipd_params2(SQLULEN *ptr) +{ + SQLHDESC desc; + SQLINTEGER ind; + + /* get IPD */ + CHK(SQLGetStmtAttr, (Statement, SQL_ATTR_IMP_PARAM_DESC, &desc, sizeof(desc), &ind)); + + CHK(SQLSetDescField, (desc, 1, SQL_DESC_ROWS_PROCESSED_PTR, ptr, 0)); +} + +static void +set_ipd_params3(SQLULEN *ptr) +{ + CHK(SQLParamOptions, (Statement, 2, ptr)); +} + +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; + + for (n = 0; n < ARRAY_SIZE; ++n) { + ids[n] = n; + id_lens[n] = 0; + } + + /* test setting just some test pointers */ + set_ipd_params1(int2ptr(0x01020304)); + check_ipd_params(); + set_ipd_params2(int2ptr(0xabcdef12)); + check_ipd_params(); + set_ipd_params3(int2ptr(0x87654321)); + check_ipd_params(); + + /* now see results */ + for (p = param_set; *p != NULL; ++p) { + ResetStatement(); + len = 0xdeadbeef; + len <<= 16; + len <<= 16; + len |= 12345678; + + (*p)(&len); + check_ipd_params(); + + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_PARAMSET_SIZE, (void *) int2ptr(ARRAY_SIZE), 0)); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER, 5, 0, ids, 0, id_lens)); + + Command(Statement, "INSERT INTO #tmp1(i) VALUES(?)"); + SQLMoreResults(Statement); + for (n = 0; n < ARRAY_SIZE; ++n) + SQLMoreResults(Statement); + l = len; + len >>= 16; + h = 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; + + CHK(SQLGetStmtAttr,(Statement, SQL_ATTR_ROWS_FETCHED_PTR, &ptr, sizeof(ptr), NULL)); + + /* get IRD */ + CHK(SQLGetStmtAttr, (Statement, SQL_ATTR_IMP_ROW_DESC, &desc, sizeof(desc), &ind)); + + CHK(SQLGetDescField, (desc, 1, SQL_DESC_ROWS_PROCESSED_PTR, &ptr2, sizeof(ptr2), &ind)); + + if (ptr != ptr2) { + fprintf(stderr, "IRD inconsistency ptr %p ptr2 %p\n", ptr, ptr2); + exit(1); + } +} + +static void +set_ird_params1(SQLULEN *ptr) +{ + CHK(SQLSetStmtAttr,(Statement, SQL_ATTR_ROWS_FETCHED_PTR, ptr, 0)); +} + +static void +set_ird_params2(SQLULEN *ptr) +{ + SQLHDESC desc; + SQLINTEGER ind; + + /* get IRD */ + CHK(SQLGetStmtAttr, (Statement, SQL_ATTR_IMP_ROW_DESC, &desc, sizeof(desc), &ind)); + + CHK(SQLSetDescField, (desc, 1, SQL_DESC_ROWS_PROCESSED_PTR, ptr, 0)); +} + +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; + + for (n = 0; n < ARRAY_SIZE; ++n) { + ids[n] = n; + id_lens[n] = 0; + } + + /* test setting just some test pointers */ + set_ird_params1(int2ptr(0x01020304)); + check_ird_params(); + set_ird_params2(int2ptr(0xabcdef12)); + check_ird_params(); + + /* now see results */ + for (p = row_set; ; ++p) { + ResetStatement(); + len = 0xdeadbeef; + len <<= 16; + len <<= 16; + len |= 12345678; + if (*p) + (*p)(&len); + check_ird_params(); + +// CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_PARAMSET_SIZE, (void *) int2ptr(ARRAY_SIZE), 0)); +// CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER, 5, 0, ids, 0, id_lens)); + + CHK(SQLBindCol, (Statement, 1, SQL_C_ULONG, ids, 0, id_lens)); + if (*p) { + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_ROW_ARRAY_SIZE, (void *) int2ptr(ARRAY_SIZE), 0)); + + Command(Statement, "SELECT DISTINCT i FROM #tmp1"); + SQLFetch(Statement); + } else { + CHK(SQLSetStmtAttr, (Statement, SQL_ROWSET_SIZE, (void *) int2ptr(ARRAY_SIZE), 0)); + Command(Statement, "SELECT DISTINCT i FROM #tmp1"); + CHK(SQLExtendedFetch, (Statement, SQL_FETCH_NEXT, 0, &len, NULL)); + } + SQLMoreResults(Statement); + + l = len; + len >>= 16; + h = len >> 16; + if (h != 0 || l != 2) { + fprintf(stderr, "Wrong number returned in rows high %lu(0x%lx) low %lu(0x%lx)\n", h, h, l, l); + exit(1); + } + + if (!*p) + break; + } + + free(ids); + free(id_lens); +} + +int +main() +{ + use_odbc_version3 = 1; + Connect(); + + Command(Statement, "create table #tmp1 (i int)"); + + test_params(); + test_rows(); + + Disconnect(); + return 0; +} + commit 9d07f193e704910aefc7dbd96d6bc0614864d0e3 Author: freddy77 Date: Sun Jan 20 21:48:00 2008 +0000 fix ms odbc problem with SQLGetDescField diff --git a/src/odbc/unittests/test64.c b/src/odbc/unittests/test64.c index 2f81731..dc88ed8 100644 --- a/src/odbc/unittests/test64.c +++ b/src/odbc/unittests/test64.c @@ -1,7 +1,7 @@ /* test win64 consistency */ #include "common.h" -static char software_version[] = "$Id: test64.c,v 1.1 2008/01/20 20:47:45 freddy77 Exp $"; +static char software_version[] = "$Id: test64.c,v 1.2 2008/01/20 21:48:00 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHK(func,params) \ @@ -22,11 +22,11 @@ check_ipd_params(void) SQLINTEGER ind; CHK(SQLGetStmtAttr,(Statement, SQL_ATTR_PARAMS_PROCESSED_PTR, &ptr, sizeof(ptr), NULL)); - + /* get IPD */ CHK(SQLGetStmtAttr, (Statement, SQL_ATTR_IMP_PARAM_DESC, &desc, sizeof(desc), &ind)); - CHK(SQLGetDescField, (desc, 1, SQL_DESC_ROWS_PROCESSED_PTR, &ptr2, sizeof(ptr2), &ind)); + CHK(SQLGetDescField, (desc, 0, SQL_DESC_ROWS_PROCESSED_PTR, &ptr2, sizeof(ptr2), &ind)); if (ptr != ptr2) { fprintf(stderr, "IPD inconsistency ptr %p ptr2 %p\n", ptr, ptr2); @@ -138,11 +138,11 @@ check_ird_params(void) SQLINTEGER ind; CHK(SQLGetStmtAttr,(Statement, SQL_ATTR_ROWS_FETCHED_PTR, &ptr, sizeof(ptr), NULL)); - + /* get IRD */ CHK(SQLGetStmtAttr, (Statement, SQL_ATTR_IMP_ROW_DESC, &desc, sizeof(desc), &ind)); - CHK(SQLGetDescField, (desc, 1, SQL_DESC_ROWS_PROCESSED_PTR, &ptr2, sizeof(ptr2), &ind)); + CHK(SQLGetDescField, (desc, 0, SQL_DESC_ROWS_PROCESSED_PTR, &ptr2, sizeof(ptr2), &ind)); if (ptr != ptr2) { fprintf(stderr, "IRD inconsistency ptr %p ptr2 %p\n", ptr, ptr2); commit 39e3951a5a51fa75a5b79b1f06fcdeb62bc859a2 Author: freddy77 Date: Mon Jan 21 15:34:32 2008 +0000 merge fix for date/time from Dann Corbit diff --git a/ChangeLog b/ChangeLog index f8be023..1b49d15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Jan 21 16:33:58 CET 2008 Frediano Ziglio + * src/odbc/odbc_util.c: + - merge fix for date/time from Dann Corbit + Sun Jan 20 17:36:34 CET 2008 Frediano Ziglio * src/odbc/connectparams.c: remove warning @@ -83,4 +87,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2474 2008/01/20 16:36:51 freddy77 Exp $ +$Id: ChangeLog,v 1.2475 2008/01/21 15:34:32 freddy77 Exp $ diff --git a/src/odbc/odbc_util.c b/src/odbc/odbc_util.c index fb38d5b..06a4d07 100644 --- a/src/odbc/odbc_util.c +++ b/src/odbc/odbc_util.c @@ -38,7 +38,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc_util.c,v 1.94 2007/06/19 13:31:34 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc_util.c,v 1.95 2008/01/21 15:34:32 freddy77 Exp $"); /** * \ingroup odbc_api @@ -562,10 +562,12 @@ odbc_sql_to_displaysize(int sqltype, TDSCOLUMN *col) size = col->column_prec + 2; break; case SQL_DATE: + case SQL_TYPE_DATE: /* FIXME check always yyyy-mm-dd ?? */ size = 19; break; case SQL_TIME: + case SQL_TYPE_TIME: /* FIXME check always hh:mm:ss[.fff] */ size = 19; break; commit c0a4f6c10da784231e110c95d1d16454d30e09ca Author: freddy77 Date: Thu Jan 24 21:02:14 2008 +0000 add test on type diff --git a/ChangeLog b/ChangeLog index 1b49d15..e88e56c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jan 24 22:01:41 CET 2008 Frediano Ziglio + * src/odbc/unittests/describecol.in: + - some additional tests + Mon Jan 21 16:33:58 CET 2008 Frediano Ziglio * src/odbc/odbc_util.c: - merge fix for date/time from Dann Corbit @@ -87,4 +91,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2475 2008/01/21 15:34:32 freddy77 Exp $ +$Id: ChangeLog,v 1.2476 2008/01/24 21:02:14 freddy77 Exp $ diff --git a/src/odbc/unittests/describecol.in b/src/odbc/unittests/describecol.in index 4f1d874..aa6a63a 100644 --- a/src/odbc/unittests/describecol.in +++ b/src/odbc/unittests/describecol.in @@ -119,6 +119,7 @@ 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 @@ -129,6 +130,7 @@ 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 @@ -349,6 +351,7 @@ 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 @@ -359,6 +362,7 @@ 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 commit ede2f0bed2728757f3bef5f664adfaf921fe88b9 Author: freddy77 Date: Thu Jan 24 21:14:55 2008 +0000 va_list cleanups diff --git a/ChangeLog b/ChangeLog index e88e56c..fd76f3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jan 24 22:14:31 CET 2008 Frediano Ziglio + * src/dblib/dblib.c src/tds/vstrbuild.c: + - va_list cleanups + Thu Jan 24 22:01:41 CET 2008 Frediano Ziglio * src/odbc/unittests/describecol.in: - some additional tests @@ -91,4 +95,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2476 2008/01/24 21:02:14 freddy77 Exp $ +$Id: ChangeLog,v 1.2477 2008/01/24 21:14:55 freddy77 Exp $ diff --git a/src/dblib/dblib.c b/src/dblib/dblib.c index 59b3a49..b6950aa 100644 --- a/src/dblib/dblib.c +++ b/src/dblib/dblib.c @@ -76,7 +76,7 @@ #include #endif -TDS_RCSID(var, "$Id: dblib.c,v 1.320 2008/01/01 23:09:46 freddy77 Exp $"); +TDS_RCSID(var, "$Id: dblib.c,v 1.321 2008/01/24 21:14:55 freddy77 Exp $"); static RETCODE _dbresults(DBPROCESS * dbproc); static int _db_get_server_type(int bindtype); @@ -7775,7 +7775,6 @@ dbperror (DBPROCESS *dbproc, DBINT msgno, long errnum, ...) DBLIB_ERROR_MESSAGE constructed_message = { 0, EXCONSISTENCY, NULL }; const DBLIB_ERROR_MESSAGE *msg = &default_message; - va_list ap; int i, rc = INT_CANCEL; char *os_msgtext = strerror(errnum), *rc_name; @@ -7811,17 +7810,16 @@ dbperror (DBPROCESS *dbproc, DBINT msgno, long errnum, ...) msg = &dblib_error_messages[i]; assert(*(pformats - 1) == '\0'); if(*pformats != '\0') { + va_list ap; int result_len, len = 2 * strlen(ptext); char * buffer = calloc(1, len); - long save_errnum = errnum; - errnum = (long) pformats; + 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); - errnum = save_errnum; if (TDS_FAIL == rc) { free(buffer); break; diff --git a/src/tds/vstrbuild.c b/src/tds/vstrbuild.c index ff521d3..af7a519 100644 --- a/src/tds/vstrbuild.c +++ b/src/tds/vstrbuild.c @@ -35,7 +35,7 @@ #include "tds.h" #include "replacements.h" -TDS_RCSID(var, "$Id: vstrbuild.c,v 1.14 2007/10/16 15:12:23 freddy77 Exp $"); +TDS_RCSID(var, "$Id: vstrbuild.c,v 1.15 2008/01/24 21:14:55 freddy77 Exp $"); struct string_linked_list { @@ -206,6 +206,5 @@ tds_vstrbuild(char *buffer, int buflen, int *resultlen, char *text, int textlen, } free(params); - va_end(ap); return rc; } commit e95d57532bc55c15fe948cda91224ed2a854bbd1 Author: freddy77 Date: Fri Jan 25 17:35:52 2008 +0000 fix problems with some linker diff --git a/src/apps/Makefile.am b/src/apps/Makefile.am index 6b03ce8..9e5c4d1 100644 --- a/src/apps/Makefile.am +++ b/src/apps/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.26 2008/01/20 14:23:59 freddy77 Exp $ +# $Id: Makefile.am,v 1.27 2008/01/25 17:35:52 freddy77 Exp $ AM_CPPFLAGS = -I$(top_srcdir)/include @@ -28,8 +28,8 @@ bsqldb_LDADD = ../dblib/libsybdb.la \ $(NETWORK_LIBS) if ODBC -bsqlodbc_LDADD = ../replacements/libreplacements.la \ - $(ODBCLIB) $(ODBCNODMLIBAPP) $(NETWORK_LIBS) +bsqlodbc_LDADD = $(ODBCLIB) $(ODBCNODMLIBAPP) \ + ../replacements/libreplacements.la $(NETWORK_LIBS) bsqlodbc_CPPFLAGS = $(ODBC_INC) $(AM_CPPFLAGS) endif commit 78b44066acdd787d1b81bcdab135403efc5ade6f Author: freddy77 Date: Sat Jan 26 21:47:26 2008 +0000 remove warning diff --git a/src/odbc/unittests/test64.c b/src/odbc/unittests/test64.c index dc88ed8..f29e745 100644 --- a/src/odbc/unittests/test64.c +++ b/src/odbc/unittests/test64.c @@ -1,7 +1,7 @@ /* test win64 consistency */ #include "common.h" -static char software_version[] = "$Id: test64.c,v 1.2 2008/01/20 21:48:00 freddy77 Exp $"; +static char software_version[] = "$Id: test64.c,v 1.3 2008/01/26 21:47:26 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHK(func,params) \ @@ -241,7 +241,7 @@ test_rows(void) } int -main() +main(void) { use_odbc_version3 = 1; Connect(); commit 7671d563ca2b7a2ce589d8b5fd1b7c2837e38fd6 Author: freddy77 Date: Sun Jan 27 10:25:03 2008 +0000 *** empty log message *** diff --git a/src/odbc/unittests/.cvsignore b/src/odbc/unittests/.cvsignore index ae23946..2aea2d3 100644 --- a/src/odbc/unittests/.cvsignore +++ b/src/odbc/unittests/.cvsignore @@ -65,3 +65,4 @@ attributes hidden blob1 cancel +test64 commit 1de1a0984a75a2a6f7e532ebe3e0f584ffc06c28 Author: freddy77 Date: Sun Jan 27 10:25:39 2008 +0000 add generated diff --git a/.cvsignore b/.cvsignore index c4ca19c..d6098e5 100644 --- a/.cvsignore +++ b/.cvsignore @@ -18,3 +18,4 @@ freetds.spec PWD doxyfile test-dist.log +compile commit 12190adda9d9522577554554ad07080ba3e9a474 Author: freddy77 Date: Sun Jan 27 17:36:17 2008 +0000 implemented SQL_ATTR_CONNECTION_DEAD diff --git a/ChangeLog b/ChangeLog index fd76f3b..1f7e2b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Jan 27 18:35:55 CET 2008 Frediano Ziglio + * src/odbc/odbc.c: + - implemented SQL_ATTR_CONNECTION_DEAD + Thu Jan 24 22:14:31 CET 2008 Frediano Ziglio * src/dblib/dblib.c src/tds/vstrbuild.c: - va_list cleanups @@ -95,4 +99,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2477 2008/01/24 21:14:55 freddy77 Exp $ +$Id: ChangeLog,v 1.2478 2008/01/27 17:36:17 freddy77 Exp $ diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index 74f8057..937a8d7 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.468 2008/01/14 19:21:06 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.469 2008/01/27 17:36:17 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -2030,8 +2030,8 @@ odbc_errmsg_handler(const TDSCONTEXT * ctx, TDSSOCKET * tds, TDSMESSAGE * msg) if (tds && (dbc = (TDS_DBC *) tds->parent) && dbc->current_statement) { TDS_STMT *stmt = dbc->current_statement; /* cancel sent, handling interrupt */ - if (tds->in_cancel && stmt ->cancel_sent) { - stmt ->cancel_sent = 0; + if (tds->in_cancel && stmt->cancel_sent) { + stmt->cancel_sent = 0; tdsdump_log(TDS_DBG_INFO1, "returning from timeout\n"); return TDS_INT_TIMEOUT; } @@ -4443,6 +4443,11 @@ _SQLGetConnectAttr(SQLHDBC hdbc, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTE *((SQLUINTEGER *) Value) = dbc->attr.autocommit; ODBC_RETURN_(dbc); break; +#if defined(SQL_ATTR_CONNECTION_DEAD) && defined(SQL_CD_TRUE) + *((SQLUINTEGER *) Value) = IS_TDSDEAD(dbc->tds_socket) ? SQL_CD_TRUE : SQL_CD_FALSE; + ODBC_RETURN_(dbc); + break; +#endif case SQL_ATTR_CONNECTION_TIMEOUT: *((SQLUINTEGER *) Value) = dbc->attr.connection_timeout; ODBC_RETURN_(dbc); commit d9c30d6e29dc23b76eb3341471e6f1f3d87bdab8 Author: freddy77 Date: Mon Jan 28 13:36:07 2008 +0000 base test diff --git a/src/odbc/unittests/base.c b/src/odbc/unittests/base.c new file mode 100644 index 0000000..f4b365f --- /dev/null +++ b/src/odbc/unittests/base.c @@ -0,0 +1,19 @@ +#include "common.h" + +/* TODO place comment here */ + +static char software_version[] = "$Id: base.c,v 1.1 2008/01/28 13:36:07 freddy77 Exp $"; +static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; + +int +main(int argc, char *argv[]) +{ + /* TODO remove if not neeeded */ + use_odbc_version3 = 1; + Connect(); + + /* TODO write your test */ + + Disconnect(); + return 0; +} commit de0657f9227f964ce8db4b66bee483dc871df0ff Author: freddy77 Date: Tue Jan 29 09:35:24 2008 +0000 handle errors from convert_tds2sql diff --git a/ChangeLog b/ChangeLog index 1f7e2b8..09c3d0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jan 29 10:34:41 CET 2008 Frediano Ziglio + * src/odbc/convert_tds2sql.c src/odbc/odbc.c src/odbc/odbc_util.c: + * src/odbc/unittests/getdata.c: + - handle errors from convert_tds2sql + Sun Jan 27 18:35:55 CET 2008 Frediano Ziglio * src/odbc/odbc.c: - implemented SQL_ATTR_CONNECTION_DEAD @@ -99,4 +104,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2478 2008/01/27 17:36:17 freddy77 Exp $ +$Id: ChangeLog,v 1.2479 2008/01/29 09:35:24 freddy77 Exp $ diff --git a/src/odbc/convert_tds2sql.c b/src/odbc/convert_tds2sql.c index 04e0b8a..f29df5b 100644 --- a/src/odbc/convert_tds2sql.c +++ b/src/odbc/convert_tds2sql.c @@ -39,7 +39,7 @@ #include #endif -TDS_RCSID(var, "$Id: convert_tds2sql.c,v 1.49 2007/05/25 09:10:10 freddy77 Exp $"); +TDS_RCSID(var, "$Id: convert_tds2sql.c,v 1.50 2008/01/29 09:35:24 freddy77 Exp $"); TDS_INT convert_tds2sql(TDSCONTEXT * context, int srctype, TDS_CHAR * src, TDS_UINT srclen, int desttype, TDS_CHAR * dest, SQLULEN destlen, @@ -56,7 +56,7 @@ convert_tds2sql(TDSCONTEXT * context, int srctype, TDS_CHAR * src, TDS_UINT srcl TIMESTAMP_STRUCT *tssp; SQL_NUMERIC_STRUCT *num; - int ret = TDS_FAIL; + int ret = TDS_CONVERT_FAIL; int i, cplen; tdsdump_log(TDS_DBG_FUNC, "convert_tds2sql: src is %d dest = %d\n", srctype, desttype); @@ -89,7 +89,7 @@ convert_tds2sql(TDSCONTEXT * context, int srctype, TDS_CHAR * src, TDS_UINT srcl } else { /* if destlen == 0 we return only length */ if (destlen != 0) - ret = TDS_FAIL; + ret = TDS_CONVERT_FAIL; } return ret; } @@ -143,7 +143,7 @@ convert_tds2sql(TDSCONTEXT * context, int srctype, TDS_CHAR * src, TDS_UINT srcl } else { /* if destlen == 0 we return only length */ if (destlen != 0) - ret = TDS_FAIL; + ret = TDS_CONVERT_FAIL; } break; diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index 937a8d7..b7b8235 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.469 2008/01/27 17:36:17 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.470 2008/01/29 09:35:25 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -3340,6 +3340,28 @@ odbc_process_tokens(TDS_STMT * stmt, unsigned flag) } } +static void +odbc_convert_err_set(struct _sql_errors *errs, TDS_INT err) +{ + 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; + } +} + /* * - handle correctly SQLGetData (for forward cursors accept only row_size == 1 * for other types application must use SQLSetPos) @@ -3574,6 +3596,7 @@ _SQLFetch(TDS_STMT * stmt, SQLSMALLINT FetchOrientation, SQLLEN FetchOffset) len = convert_tds2sql(context, tds_get_conversion_type(colinfo->column_type, colinfo->column_size), src, srclen, c_type, data_ptr, drec_ard->sql_desc_octet_length, drec_ard); if (len < 0) { + odbc_convert_err_set(&stmt->errs, len); row_status = SQL_ROW_ERROR; break; } @@ -4596,10 +4619,19 @@ SQLGetData(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgb nSybType = tds_get_conversion_type(colinfo->column_type, colinfo->column_size); 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_RETURN(stmt, SQL_ERROR); + } + fCType = stmt->ard->records[icol - 1].sql_desc_concise_type; + } assert(fCType); *pcbValue = convert_tds2sql(context, nSybType, src, srclen, fCType, (TDS_CHAR *) rgbValue, cbValueMax, NULL); - if (*pcbValue < 0) + if (*pcbValue < 0) { + odbc_convert_err_set(&stmt->errs, *pcbValue); ODBC_RETURN(stmt, SQL_ERROR); + } if (is_variable_type(colinfo->column_type) && (fCType == SQL_C_CHAR || fCType == SQL_C_BINARY)) { /* calc how many bytes was readed */ diff --git a/src/odbc/odbc_util.c b/src/odbc/odbc_util.c index 06a4d07..b5e5e7c 100644 --- a/src/odbc/odbc_util.c +++ b/src/odbc/odbc_util.c @@ -38,7 +38,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc_util.c,v 1.95 2008/01/21 15:34:32 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc_util.c,v 1.96 2008/01/29 09:35:25 freddy77 Exp $"); /** * \ingroup odbc_api @@ -140,7 +140,7 @@ odbc_set_return_status(struct _hstmt *stmt, unsigned int n_row) len = convert_tds2sql(context, SYBINT4, (TDS_CHAR *) & tds->ret_status, sizeof(TDS_INT), drec->sql_desc_concise_type, (void *) data_ptr, drec->sql_desc_octet_length, NULL); - if (TDS_FAIL == len) + if (len < 0) return /* SQL_ERROR */ ; if (drec->sql_desc_indicator_ptr) LEN(drec->sql_desc_indicator_ptr) = 0; diff --git a/src/odbc/unittests/getdata.c b/src/odbc/unittests/getdata.c index eead6e0..1752423 100644 --- a/src/odbc/unittests/getdata.c +++ b/src/odbc/unittests/getdata.c @@ -1,15 +1,54 @@ #include "common.h" -static char software_version[] = "$Id: getdata.c,v 1.4 2007/08/07 09:20:32 freddy77 Exp $"; +static char software_version[] = "$Id: getdata.c,v 1.5 2008/01/29 09:35:25 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; +static char odbc_err[256]; +static char odbc_sqlstate[6]; + +static void +ReadError(void) +{ + memset(odbc_err, 0, sizeof(odbc_err)); + memset(odbc_sqlstate, 0, sizeof(odbc_sqlstate)); + if (!SQL_SUCCEEDED(SQLGetDiagRec(SQL_HANDLE_STMT, Statement, 1, (SQLCHAR *) odbc_sqlstate, NULL, (SQLCHAR *) odbc_err, sizeof(odbc_err), NULL))) { + printf("SQLGetDiagRec should not fail\n"); + exit(1); + } + printf("Message: '%s' %s\n", odbc_sqlstate, odbc_err); +} + +static void +test_err(const char *data, int c_type, const char *state) +{ + char sql[128]; + SQLRETURN rc; + SQLLEN ind; + const unsigned int buf_size = 128; + char *buf = (char *) malloc(buf_size); + + sprintf(sql, "SELECT '%s'", data); + Command(Statement, sql); + SQLFetch(Statement); + rc = SQLGetData(Statement, 1, c_type, buf, buf_size, &ind); + free(buf); + if (rc != SQL_ERROR) + ODBC_REPORT_ERROR("SQLGetData error expected"); + ReadError(); + if (strcmp(odbc_sqlstate, state) != 0) { + fprintf(stderr, "Unexpected sql state returned\n"); + Disconnect(); + exit(1); + } + ResetStatement(); +} + int main(int argc, char *argv[]) { char buf[16]; SQLINTEGER int_buf; SQLLEN len; - int ms_db = 0; Connect(); @@ -90,14 +129,24 @@ main(int argc, char *argv[]) ResetStatement(); - ms_db = db_is_microsoft(); - Disconnect(); - if (ms_db) { - use_odbc_version3 = 1; - Connect(); + use_odbc_version3 = 1; + Connect(); + /* test error from SQLGetData */ + /* wrong constant */ + 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, int */ + test_err("prova 123", SQL_C_TIMESTAMP, "22018"); + /* overflow */ + test_err("1234567890123456789", SQL_C_LONG, "22003"); + + if (db_is_microsoft()) { Command(Statement, "SELECT CONVERT(TEXT,'')"); if (SQLFetch(Statement) != SQL_SUCCESS) @@ -114,10 +163,10 @@ main(int argc, char *argv[]) if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 1, NULL) != SQL_NO_DATA) ODBC_REPORT_ERROR("invalid return from SQLGetData"); - - Disconnect(); } + Disconnect(); + printf("Done.\n"); return 0; } commit 6b2f6d934757cb502817665692b1005b84331037 Author: freddy77 Date: Tue Jan 29 14:30:48 2008 +0000 reuse code diff --git a/ChangeLog b/ChangeLog index 09c3d0d..800bfc2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +Tue Jan 29 15:28:32 CET 2008 Frediano Ziglio + * src/odbc/unittests/array_out.c src/odbc/unittests/common.c: + * src/odbc/unittests/common.h src/odbc/unittests/compute.c: + * src/odbc/unittests/connect2.c src/odbc/unittests/const_params.c: + * src/odbc/unittests/copydesc.c src/odbc/unittests/cursor1.c: + * src/odbc/unittests/cursor2.c src/odbc/unittests/cursor3.c: + * src/odbc/unittests/cursor4.c src/odbc/unittests/cursor5.c: + * src/odbc/unittests/data.c src/odbc/unittests/date.c: + * src/odbc/unittests/error.c src/odbc/unittests/funccall.c: + * src/odbc/unittests/genparams.c src/odbc/unittests/getdata.c: + * src/odbc/unittests/hidden.c src/odbc/unittests/lang_error.c: + * src/odbc/unittests/moreandcount.c src/odbc/unittests/norowset.c: + * src/odbc/unittests/params.c src/odbc/unittests/prepare_results.c: + * src/odbc/unittests/print.c src/odbc/unittests/putdata.c: + * src/odbc/unittests/raiserror.c src/odbc/unittests/rebindpar.c: + * src/odbc/unittests/scroll.c src/odbc/unittests/t0001.c: + * src/odbc/unittests/t0002.c src/odbc/unittests/t0003.c: + * src/odbc/unittests/t0004.c src/odbc/unittests/tables.c: + * src/odbc/unittests/test64.c src/odbc/unittests/timeout.c: + * src/odbc/unittests/timeout2.c src/odbc/unittests/timeout4.c: + * src/odbc/unittests/transaction.c src/odbc/unittests/typeinfo.c: + * src/odbc/unittests/warning.c: + - reuse reuse reuse! + Tue Jan 29 10:34:41 CET 2008 Frediano Ziglio * src/odbc/convert_tds2sql.c src/odbc/odbc.c src/odbc/odbc_util.c: * src/odbc/unittests/getdata.c: @@ -104,4 +128,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2479 2008/01/29 09:35:24 freddy77 Exp $ +$Id: ChangeLog,v 1.2480 2008/01/29 14:30:48 freddy77 Exp $ diff --git a/src/odbc/unittests/array_out.c b/src/odbc/unittests/array_out.c index f99918d..1bbb852 100644 --- a/src/odbc/unittests/array_out.c +++ b/src/odbc/unittests/array_out.c @@ -3,7 +3,7 @@ /* Test using array binding */ -static char software_version[] = "$Id: array_out.c,v 1.11 2007/11/26 20:03:17 freddy77 Exp $"; +static char software_version[] = "$Id: array_out.c,v 1.12 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static const char *test_query = NULL; @@ -74,9 +74,7 @@ query_test(SQLRETURN expected, const char *expected_status) SQLBindCol(Statement, 1, SQL_C_ULONG, &IDS(0), 0, &ID_LENS(0)); SQLBindCol(Statement, 2, SQL_C_CHAR, DESCS(0), desc_len, &DESC_LENS(0)); - ret = SQLExecDirect(Statement, (SQLCHAR *) test_query, SQL_NTS); - if (ret != SQL_SUCCESS) - ODBC_REPORT_ERROR("Invalid result"); + CHK(SQLExecDirect, (Statement, (SQLCHAR *) test_query, SQL_NTS)); ret = SQLFetch(Statement); if (ret != expected) diff --git a/src/odbc/unittests/common.c b/src/odbc/unittests/common.c index 0fde53d..78f58fe 100644 --- a/src/odbc/unittests/common.c +++ b/src/odbc/unittests/common.c @@ -12,7 +12,7 @@ #define TDS_SDIR_SEPARATOR "\\" #endif -static char software_version[] = "$Id: common.c,v 1.42 2007/12/27 10:22:18 freddy77 Exp $"; +static char software_version[] = "$Id: common.c,v 1.43 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; HENV Environment; @@ -251,9 +251,8 @@ Command(HSTMT stmt, const char *command) printf("%s\n", command); result = SQLExecDirect(stmt, (SQLCHAR *) command, SQL_NTS); if (result != SQL_SUCCESS && result != SQL_NO_DATA) { - printf("Unable to execute statement\n"); + fprintf(stderr, "Unable to execute statement\n"); CheckReturn(); - exit(1); } } diff --git a/src/odbc/unittests/common.h b/src/odbc/unittests/common.h index 175b164..b74e162 100644 --- a/src/odbc/unittests/common.h +++ b/src/odbc/unittests/common.h @@ -21,7 +21,7 @@ #include #include -static char rcsid_common_h[] = "$Id: common.h,v 1.21 2007/12/21 10:39:10 freddy77 Exp $"; +static char rcsid_common_h[] = "$Id: common.h,v 1.22 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_common_h_warn[] = { rcsid_common_h, no_unused_common_h_warn }; #ifndef HAVE_SQLLEN @@ -56,6 +56,12 @@ void ResetStatement(void); void CheckCursor(void); #define ODBC_REPORT_ERROR(msg) ReportError(msg, __LINE__, __FILE__) + +#define CHK(func,params) \ + do { if (func params != SQL_SUCCESS) \ + ODBC_REPORT_ERROR(#func); \ + } while(0) + int Connect(void); int Disconnect(void); void Command(HSTMT stmt, const char *command); diff --git a/src/odbc/unittests/compute.c b/src/odbc/unittests/compute.c index dfa0f58..11c0548 100644 --- a/src/odbc/unittests/compute.c +++ b/src/odbc/unittests/compute.c @@ -9,7 +9,7 @@ * and declared in odbcss.h */ -static char software_version[] = "$Id: compute.c,v 1.9 2007/07/03 15:13:55 freddy77 Exp $"; +static char software_version[] = "$Id: compute.c,v 1.10 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static char col1[256], col2[256]; @@ -23,12 +23,9 @@ TestName(SQLSMALLINT index, const char *expected_name) char name[128]; char buf[256]; SQLSMALLINT len, type; - SQLRETURN rc; #define NAME_TEST \ do { \ - if (rc != SQL_SUCCESS) \ - ODBC_REPORT_ERROR("SQLDescribeCol failed"); \ if (strcmp(name, expected_name) != 0) \ { \ sprintf(buf, "line %d: wrong name in column %d expected '%s' got '%s'", \ @@ -38,14 +35,14 @@ TestName(SQLSMALLINT index, const char *expected_name) } while(0) /* retrieve with SQLDescribeCol */ - rc = SQLDescribeCol(Statement, index, (SQLCHAR *) name, sizeof(name), &len, &type, NULL, NULL, NULL); + CHK(SQLDescribeCol, (Statement, index, (SQLCHAR *) name, sizeof(name), &len, &type, NULL, NULL, NULL)); NAME_TEST; /* retrieve with SQLColAttribute */ - rc = SQLColAttribute(Statement, index, SQL_DESC_NAME, name, sizeof(name), &len, NULL); + CHK(SQLColAttribute, (Statement, index, SQL_DESC_NAME, name, sizeof(name), &len, NULL)); if (db_is_microsoft()) NAME_TEST; - rc = SQLColAttribute(Statement, index, SQL_DESC_LABEL, name, sizeof(name), &len, NULL); + CHK(SQLColAttribute, (Statement, index, SQL_DESC_LABEL, name, sizeof(name), &len, NULL)); NAME_TEST; } @@ -56,8 +53,7 @@ CheckFetch(const char *c1name, const char *c1, const char *c2) TestName(1, c1name); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("error fetching"); + CHK(SQLFetch, (Statement)); 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, @@ -107,8 +103,7 @@ main(int argc, char *argv[]) CheckFetch("c", "pluto", "3"); if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Still data ??"); - if (SQLMoreResults(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("No more data ??"); + CHK(SQLMoreResults, (Statement)); /* why I need to rebind ?? ms bug of feature ?? */ SQLBindCol(Statement, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); @@ -131,8 +126,7 @@ main(int argc, char *argv[]) CheckFetch("mao", "pippo", "34"); if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Still data ??"); - if (SQLMoreResults(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("No more data ??"); + CHK(SQLMoreResults, (Statement)); SQLBindCol(Statement, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(Statement, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); @@ -140,8 +134,7 @@ main(int argc, char *argv[]) CheckFetch("sum", "46", "##"); if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Still data ??"); - if (SQLMoreResults(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("No more data ??"); + CHK(SQLMoreResults, (Statement)); SQLBindCol(Statement, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(Statement, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); @@ -150,8 +143,7 @@ main(int argc, char *argv[]) CheckFetch("mao", "pluto", "3"); if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Still data ??"); - if (SQLMoreResults(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Still data ??"); + CHK(SQLMoreResults, (Statement)); SQLBindCol(Statement, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(Statement, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); @@ -159,8 +151,7 @@ main(int argc, char *argv[]) CheckFetch("sum", "6", "%"); if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Still data ??"); - if (SQLMoreResults(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Still data ??"); + CHK(SQLMoreResults, (Statement)); SQLBindCol(Statement, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(Statement, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); @@ -182,21 +173,17 @@ main(int argc, char *argv[]) CheckFetch("c", "pippo", "34"); if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Still data ??"); - if (SQLMoreResults(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("No more data ??"); + CHK(SQLMoreResults, (Statement)); /* here just skip results, before a row */ - if (SQLMoreResults(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Still data ??"); - + CHK(SQLMoreResults, (Statement)); SQLBindCol(Statement, 1, SQL_C_CHAR, col1, sizeof(col1), &ind1); SQLBindCol(Statement, 2, SQL_C_CHAR, col2, sizeof(col2), &ind2); CheckFetch("c", "pluto", "2"); if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Still data ??"); - if (SQLMoreResults(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("No more data ??"); + CHK(SQLMoreResults, (Statement)); /* here just skip results, before done */ if (SQLMoreResults(Statement) != SQL_NO_DATA) diff --git a/src/odbc/unittests/connect2.c b/src/odbc/unittests/connect2.c index c7f01a9..0f00546 100644 --- a/src/odbc/unittests/connect2.c +++ b/src/odbc/unittests/connect2.c @@ -5,7 +5,7 @@ * either SQLConnect and SQLDriverConnect */ -static char software_version[] = "$Id: connect2.c,v 1.4 2007/04/12 07:49:30 freddy77 Exp $"; +static char software_version[] = "$Id: connect2.c,v 1.5 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static int failed = 0; @@ -35,7 +35,6 @@ normal_connect(void) if (!SQL_SUCCEEDED(res)) { fprintf(stderr, "Unable to open data source (ret=%d)\n", res); CheckReturn(); - exit(1); } } @@ -50,7 +49,6 @@ driver_connect(const char *conn_str) if (!SQL_SUCCEEDED(res)) { fprintf(stderr, "Unable to open data source (ret=%d)\n", res); CheckReturn(); - exit(1); } } @@ -66,7 +64,6 @@ check_dbname(const char *dbname) if (!SQL_SUCCEEDED(res)) { fprintf(stderr, "Unable to get database name to %s\n", dbname); CheckReturn(); - exit(1); } if (strcmp(out, dbname) != 0) { @@ -84,7 +81,6 @@ set_dbname(const char *dbname) if (!SQL_SUCCEEDED(res)) { fprintf(stderr, "Unable to set database name to %s\n", dbname); CheckReturn(); - exit(1); } } diff --git a/src/odbc/unittests/const_params.c b/src/odbc/unittests/const_params.c index a9fabfe..a1482e1 100644 --- a/src/odbc/unittests/const_params.c +++ b/src/odbc/unittests/const_params.c @@ -2,7 +2,7 @@ /* Test for {?=call store(?,123,'foo')} syntax and run */ -static char software_version[] = "$Id: const_params.c,v 1.13 2007/11/26 06:25:11 freddy77 Exp $"; +static char software_version[] = "$Id: const_params.c,v 1.14 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int @@ -26,22 +26,17 @@ main(int argc, char *argv[]) " return 24680\n" "end"); - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind input parameter"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind)); - if (SQLBindParameter(Statement, 2, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &out1, 0, &ind2) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter"); + CHK(SQLBindParameter, (Statement, 2, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &out1, 0, &ind2)); /* TODO use {ts ...} for date */ - if (SQLPrepare(Statement, (SQLCHAR *) "{call const_param(?, 13579, '2004-10-15 12:09:08', 'foo', ?)}", SQL_NTS) != - SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to prepare statement"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "{call const_param(?, 13579, '2004-10-15 12:09:08', 'foo', ?)}", SQL_NTS)); input = 13579; ind = sizeof(input); out1 = output = 0xdeadbeef; - if (SQLExecute(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to execute statement"); + CHK(SQLExecute, (Statement)); if (out1 != 7654321) { fprintf(stderr, "Invalid output %d (0x%x)\n", (int) out1, (int) out1); @@ -51,25 +46,17 @@ main(int argc, char *argv[]) /* just to reset some possible buffers */ Command(Statement, "DECLARE @i INT"); - if (SQLBindParameter(Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter"); - - if (SQLBindParameter(Statement, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind2) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind input parameter"); - - if (SQLBindParameter(Statement, 3, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &out1, 0, &ind3) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind)); + CHK(SQLBindParameter, (Statement, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind2)); + CHK(SQLBindParameter, (Statement, 3, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &out1, 0, &ind3)); /* TODO use {ts ...} for date */ - if (SQLPrepare(Statement, (SQLCHAR *) "{?=call const_param(?, , '2004-10-15 12:09:08', 'foo', ?)}", SQL_NTS) != - SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to prepare statement"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "{?=call const_param(?, , '2004-10-15 12:09:08', 'foo', ?)}", SQL_NTS)); input = 13579; ind2 = sizeof(input); out1 = output = 0xdeadbeef; - if (SQLExecute(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to execute statement"); + CHK(SQLExecute, (Statement)); if (out1 != 7654321) { fprintf(stderr, "Invalid output %d (0x%x)\n", (int) out1, (int) out1); @@ -81,8 +68,7 @@ main(int argc, char *argv[]) exit(1); } - if (CommandWithResult(Statement, "drop proc const_param") != SQL_SUCCESS) - printf("Unable to execute statement\n"); + Command(Statement, "IF OBJECT_ID('const_param') IS NOT NULL DROP PROC const_param"); Command(Statement, "create proc const_param @in1 float, @in2 varbinary(100) as\n" "begin\n" @@ -91,24 +77,19 @@ main(int argc, char *argv[]) " return 54321\n" "end"); - if (SQLBindParameter(Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind)); - if (SQLPrepare(Statement, (SQLCHAR *) "{?=call const_param(12.5, 0x0102030405060708)}", SQL_NTS) != - SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to prepare statement"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "{?=call const_param(12.5, 0x0102030405060708)}", SQL_NTS)); output = 0xdeadbeef; - if (SQLExecute(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to execute statement"); + CHK(SQLExecute, (Statement)); if (output != 54321) { fprintf(stderr, "Invalid result %d (0x%x) expected 54321\n", (int) output, (int) output); return 1; } - if (CommandWithResult(Statement, "drop proc const_param") != SQL_SUCCESS) - printf("Unable to execute statement\n"); + Command(Statement, "drop proc const_param"); Command(Statement, "create proc const_param @in varchar(20) as\n" "begin\n" @@ -119,7 +100,7 @@ main(int argc, char *argv[]) /* catch problem reported by Peter Deacon */ output = 0xdeadbeef; Command(Statement, "{CALL const_param('value')}"); - SQLBindCol(Statement, 1, SQL_C_SLONG, &output, 0, &ind); + CHK(SQLBindCol, (Statement, 1, SQL_C_SLONG, &output, 0, &ind)); SQLFetch(Statement); if (output != 8421) { @@ -129,8 +110,7 @@ main(int argc, char *argv[]) ResetStatement(); - if (CommandWithResult(Statement, "drop proc const_param") != SQL_SUCCESS) - printf("Unable to execute statement\n"); + Command(Statement, "drop proc const_param"); Disconnect(); diff --git a/src/odbc/unittests/copydesc.c b/src/odbc/unittests/copydesc.c index a92d2d9..75380bc 100644 --- a/src/odbc/unittests/copydesc.c +++ b/src/odbc/unittests/copydesc.c @@ -2,7 +2,7 @@ /* Test SQLCopyDesc and SQLAllocHandle(SQL_HANDLE_DESC) */ -static char software_version[] = "$Id: copydesc.c,v 1.3 2007/04/12 07:49:30 freddy77 Exp $"; +static char software_version[] = "$Id: copydesc.c,v 1.4 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int @@ -15,24 +15,20 @@ main(int argc, char *argv[]) Connect(); - if (SQLGetStmtAttr(Statement, SQL_ATTR_APP_ROW_DESC, &ard, 0, NULL) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLGetStmtAttr"); + CHK(SQLGetStmtAttr, (Statement, SQL_ATTR_APP_ROW_DESC, &ard, 0, NULL)); - SQLBindCol(Statement, 1, SQL_C_SLONG, &id, sizeof(SQLINTEGER), &ind1); - SQLBindCol(Statement, 2, SQL_C_CHAR, name, sizeof(name), &ind2); + CHK(SQLBindCol, (Statement, 1, SQL_C_SLONG, &id, sizeof(SQLINTEGER), &ind1)); + CHK(SQLBindCol, (Statement, 2, SQL_C_CHAR, name, sizeof(name), &ind2)); - if (SQLAllocHandle(SQL_HANDLE_DESC, Connection, &ard2) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLAllocHandle"); + CHK(SQLAllocHandle, (SQL_HANDLE_DESC, Connection, &ard2)); /* * this is an additional test to test additional allocation * As of 0.64 for a bug in SQLAllocDesc we only allow to allocate one */ - if (SQLAllocHandle(SQL_HANDLE_DESC, Connection, &ard3) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLAllocHandle"); + CHK(SQLAllocHandle, (SQL_HANDLE_DESC, Connection, &ard3)); - if (SQLCopyDesc(ard, ard2) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLCopyDesc"); + CHK(SQLCopyDesc, (ard, ard2)); Disconnect(); diff --git a/src/odbc/unittests/cursor1.c b/src/odbc/unittests/cursor1.c index d10e777..28e4609 100644 --- a/src/odbc/unittests/cursor1.c +++ b/src/odbc/unittests/cursor1.c @@ -2,14 +2,9 @@ /* Test cursors */ -static char software_version[] = "$Id: cursor1.c,v 1.12 2007/11/26 06:25:11 freddy77 Exp $"; +static char software_version[] = "$Id: cursor1.c,v 1.13 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; -#define CHK(func,params) \ - do { if (func params != SQL_SUCCESS) \ - ODBC_REPORT_ERROR(#func); \ - } while(0) - #define CHK_INFO(func,params) \ do { if (!SQL_SUCCEEDED(func params)) \ ODBC_REPORT_ERROR(#func); \ @@ -145,11 +140,7 @@ Test0(int use_sql, const char *create_sql, const char *insert_sql, const char *s exit(1); } - retcode = SQLGetDiagRec(SQL_HANDLE_STMT, Statement, 1, sqlstate, NULL, msg, sizeof(msg), NULL); - if (retcode != SQL_SUCCESS) { - fprintf(stderr, "Error not expected at line %d\n", __LINE__); - exit(1); - } + CHK(SQLGetDiagRec, (SQL_HANDLE_STMT, Statement, 1, sqlstate, NULL, msg, sizeof(msg), NULL)); if (strstr((char *) msg, "Invalid column name 'c'") == NULL) { fprintf(stderr, "Expected message not found at line %d\n", __LINE__); exit(1); diff --git a/src/odbc/unittests/cursor2.c b/src/odbc/unittests/cursor2.c index d5fd48d..ac1d1db 100644 --- a/src/odbc/unittests/cursor2.c +++ b/src/odbc/unittests/cursor2.c @@ -2,13 +2,9 @@ /* Test cursor do not give error for statement that do not return rows */ -static char software_version[] = "$Id: cursor2.c,v 1.3 2007/04/20 13:27:14 freddy77 Exp $"; +static char software_version[] = "$Id: cursor2.c,v 1.4 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; -#define CHK(func,params) \ - if (func params != SQL_SUCCESS) \ - ODBC_REPORT_ERROR(#func) - int main(int argc, char *argv[]) { diff --git a/src/odbc/unittests/cursor3.c b/src/odbc/unittests/cursor3.c index d44fe3c..6ef62c8 100644 --- a/src/odbc/unittests/cursor3.c +++ b/src/odbc/unittests/cursor3.c @@ -1,11 +1,9 @@ /* Tests 2 active statements */ #include "common.h" -static char software_version[] = "$Id: cursor3.c,v 1.4 2008/01/10 15:29:03 freddy77 Exp $"; +static char software_version[] = "$Id: cursor3.c,v 1.5 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; -static SQLHDBC m_hdbc; - #define CHECK_RCODE(t,h,m) \ if ( rcode != SQL_NO_DATA \ && rcode != SQL_SUCCESS \ @@ -43,7 +41,7 @@ exec_direct(int check, const char *stmt) SQLRETURN rcode; SQLHSTMT stmth = 0; - rcode = SQLAllocHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hdbc, (SQLHANDLE *) & stmth); + rcode = SQLAllocHandle(SQL_HANDLE_STMT, (SQLHANDLE) Connection, (SQLHANDLE *) & stmth); CHECK_RCODE(SQL_HANDLE_STMT, stmth, "SQLAllocHandle"); rcode = SQLExecDirect(stmth, (SQLCHAR *) stmt, SQL_NTS); if (check) { @@ -67,8 +65,6 @@ main(int argc, char **argv) CheckCursor(); - m_hdbc = Connection; - exec_direct(1, "CREATE TABLE #t1 ( k INT, c VARCHAR(20))"); exec_direct(1, "INSERT INTO #t1 VALUES (1, 'aaa')"); exec_direct(1, "INSERT INTO #t1 VALUES (2, 'bbbbb')"); @@ -76,12 +72,12 @@ main(int argc, char **argv) exec_direct(1, "INSERT INTO #t1 VALUES (4, 'dd')"); m_hstmt1 = NULL; - rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt1); - CHECK_RCODE(SQL_HANDLE_DBC, m_hdbc, "SQLAllocHandle 1"); + rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt1); + CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle 1"); m_hstmt2 = NULL; - rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt2); - CHECK_RCODE(SQL_HANDLE_DBC, m_hdbc, "SQLAllocHandle 2"); + rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt2); + CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle 2"); /* rcode = SQLSetStmtAttr(m_hstmt1, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); diff --git a/src/odbc/unittests/cursor4.c b/src/odbc/unittests/cursor4.c index ef67014..363ebfd 100755 --- a/src/odbc/unittests/cursor4.c +++ b/src/odbc/unittests/cursor4.c @@ -5,11 +5,9 @@ #include "common.h" -static char software_version[] = "$Id: cursor4.c,v 1.4 2008/01/10 15:29:03 freddy77 Exp $"; +static char software_version[] = "$Id: cursor4.c,v 1.5 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; -static SQLHDBC m_hdbc; - #define CHECK_RCODE(t,h,m) \ if ( rcode != SQL_NO_DATA \ && rcode != SQL_SUCCESS \ @@ -47,7 +45,7 @@ exec_direct(int check, const char *stmt) SQLRETURN rcode; SQLHSTMT stmth = 0; - rcode = SQLAllocHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hdbc, (SQLHANDLE *) & stmth); + rcode = SQLAllocHandle(SQL_HANDLE_STMT, (SQLHANDLE) Connection, (SQLHANDLE *) & stmth); CHECK_RCODE(SQL_HANDLE_STMT, stmth, "SQLAllocHandle"); rcode = SQLExecDirect(stmth, (SQLCHAR *) stmt, SQL_NTS); if (check) { @@ -70,14 +68,12 @@ main(int argc, char **argv) CheckCursor(); - m_hdbc = Connection; - exec_direct(1, "CREATE TABLE #t1 ( k INT, c VARCHAR(20))"); exec_direct(1, "INSERT INTO #t1 VALUES (1, 'aaa')"); m_hstmt1 = NULL; - rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt1); - CHECK_RCODE(SQL_HANDLE_DBC, m_hdbc, "SQLAllocHandle 1"); + rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt1); + CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle 1"); rcode = SQLSetStmtAttr(m_hstmt1, SQL_ATTR_CONCURRENCY, (SQLPOINTER) SQL_CONCUR_LOCK, SQL_IS_UINTEGER); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "Set attribute SQL_ATTR_CONCURRENCY"); diff --git a/src/odbc/unittests/cursor5.c b/src/odbc/unittests/cursor5.c index 53f380b..d8c4540 100755 --- a/src/odbc/unittests/cursor5.c +++ b/src/odbc/unittests/cursor5.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: cursor5.c,v 1.3 2008/01/10 15:29:03 freddy77 Exp $"; +static char software_version[] = "$Id: cursor5.c,v 1.4 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -56,25 +56,23 @@ int main(int argc, char **argv) { SQLRETURN rcode; - SQLHDBC m_hdbc; SQLHSTMT m_hstmt1; SQLHSTMT m_hstmt2; use_odbc_version3 = 1; Connect(); CheckCursor(); - m_hdbc = Connection; - rcode = SQLSetConnectAttr(m_hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_ON, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_ENV, m_hdbc, "SQLSetConnectAttr(autocommit)"); + rcode = SQLSetConnectAttr(Connection, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER) SQL_AUTOCOMMIT_ON, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_ENV, Connection, "SQLSetConnectAttr(autocommit)"); m_hstmt1 = NULL; - rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt1); - CHECK_RCODE(SQL_HANDLE_DBC, m_hdbc, "SQLAllocHandle StmtH 1"); + rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt1); + CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle StmtH 1"); m_hstmt2 = NULL; - rcode = SQLAllocHandle(SQL_HANDLE_STMT, m_hdbc, &m_hstmt2); - CHECK_RCODE(SQL_HANDLE_DBC, m_hdbc, "SQLAllocHandle StmtH 2"); + rcode = SQLAllocHandle(SQL_HANDLE_STMT, Connection, &m_hstmt2); + CHECK_RCODE(SQL_HANDLE_DBC, Connection, "SQLAllocHandle StmtH 2"); rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "create table #mytab1 (k int, c char(30))", SQL_NTS); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect 1.1"); diff --git a/src/odbc/unittests/data.c b/src/odbc/unittests/data.c index 7b60d86..640510e 100644 --- a/src/odbc/unittests/data.c +++ b/src/odbc/unittests/data.c @@ -3,7 +3,7 @@ /* Test various bind type */ -static char software_version[] = "$Id: data.c,v 1.13 2007/06/21 07:21:21 freddy77 Exp $"; +static char software_version[] = "$Id: data.c,v 1.14 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static int result = 0; @@ -24,10 +24,7 @@ Test(const char *type, const char *value_to_convert, SQLSMALLINT out_c_type, con sprintf(sbuf, "SELECT CONVERT(%s, '%s') AS data", type, value_to_convert); Command(Statement, sbuf); SQLBindCol(Statement, 1, out_c_type, out_buf, sizeof(out_buf), &out_len); - if (SQLFetch(Statement) != SQL_SUCCESS) { - fprintf(stderr, "Expected row\n"); - exit(1); - } + CHK(SQLFetch, (Statement)); if (SQLFetch(Statement) != SQL_NO_DATA) { fprintf(stderr, "Row not expected\n"); exit(1); diff --git a/src/odbc/unittests/date.c b/src/odbc/unittests/date.c index 320e8b1..a37360f 100644 --- a/src/odbc/unittests/date.c +++ b/src/odbc/unittests/date.c @@ -1,7 +1,7 @@ #include "common.h" -static char software_version[] = "$Id: date.c,v 1.9 2004/10/28 13:16:18 freddy77 Exp $"; +static char software_version[] = "$Id: date.c,v 1.10 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void @@ -18,35 +18,25 @@ DoTest(int n) TIMESTAMP_STRUCT ts; - if (CommandWithResult(Statement, "select convert(datetime, '2002-12-27 18:43:21')") != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to execute statement"); + Command(Statement, "select convert(datetime, '2002-12-27 18:43:21')"); res = SQLFetch(Statement); if (res != SQL_SUCCESS && res != SQL_SUCCESS_WITH_INFO) ODBC_REPORT_ERROR("Unable to fetch row"); - if (SQLDescribeCol(Statement, 1, output, sizeof(output), NULL, &colType, &colSize, &colScale, &colNullable) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Error getting data"); + CHK(SQLDescribeCol, (Statement, 1, output, sizeof(output), NULL, &colType, &colSize, &colScale, &colNullable)); if (n == 0) { memset(&ts, 0, sizeof(ts)); - if (SQLGetData(Statement, 1, SQL_C_TIMESTAMP, &ts, sizeof(ts), &dataSize) != SQL_SUCCESS) { - printf("Unable to get data col %d\n", 1); - CheckReturn(); - exit(1); - } + CHK(SQLGetData, (Statement, 1, SQL_C_TIMESTAMP, &ts, sizeof(ts), &dataSize)); sprintf((char *) output, "%04d-%02d-%02d %02d:%02d:%02d.000", ts.year, ts.month, ts.day, ts.hour, ts.minute, ts.second); } else { - if (SQLGetData(Statement, 1, SQL_C_CHAR, output, sizeof(output), &dataSize) != SQL_SUCCESS) { - printf("Unable to get data col %d\n", 1); - CheckReturn(); - exit(1); - } + CHK(SQLGetData, (Statement, 1, SQL_C_CHAR, output, sizeof(output), &dataSize)); } printf("Date returned: %s\n", output); if (strcmp((char *) output, "2002-12-27 18:43:21.000") != 0) { - printf("Invalid returned date\n"); + fprintf(stderr, "Invalid returned date\n"); exit(1); } diff --git a/src/odbc/unittests/error.c b/src/odbc/unittests/error.c index 125d002..d8cffb2 100644 --- a/src/odbc/unittests/error.c +++ b/src/odbc/unittests/error.c @@ -2,7 +2,7 @@ /* some tests on error reporting */ -static char software_version[] = "$Id: error.c,v 1.3 2004/05/22 17:25:27 freddy77 Exp $"; +static char software_version[] = "$Id: error.c,v 1.4 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static SQLCHAR output[256]; @@ -45,17 +45,15 @@ main(int argc, char *argv[]) /* TODO when multiple row fetch available test for error on some columns */ - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLFetch failed when it shouldn't"); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLFetch failed when it shouldn't"); + CHK(SQLFetch, (Statement)); + CHK(SQLFetch, (Statement)); if (SQLFetch(Statement) != SQL_ERROR) ODBC_REPORT_ERROR("SQLFetch succeed when it shouldn't"); } ReadError(); if (!strstr((char *) output, "zero")) { - printf("Message invalid\n"); + fprintf(stderr, "Message invalid\n"); return 1; } @@ -64,8 +62,7 @@ main(int argc, char *argv[]) SQLFetch(Statement); SQLMoreResults(Statement); - if (SQLAllocStmt(Connection, &stmt) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to allocate statement"); + CHK(SQLAllocStmt, (Connection, &stmt)); Command(Statement, "SELECT * FROM sysobjects"); diff --git a/src/odbc/unittests/funccall.c b/src/odbc/unittests/funccall.c index 0773818..bf80de9 100644 --- a/src/odbc/unittests/funccall.c +++ b/src/odbc/unittests/funccall.c @@ -2,7 +2,7 @@ /* Test for {?=call store(?)} syntax and run */ -static char software_version[] = "$Id: funccall.c,v 1.14 2007/04/12 13:36:14 freddy77 Exp $"; +static char software_version[] = "$Id: funccall.c,v 1.15 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int @@ -15,29 +15,20 @@ main(int argc, char *argv[]) Connect(); - if (CommandWithResult(Statement, "drop proc simpleresult") != SQL_SUCCESS) - printf("Unable to execute statement\n"); + Command(Statement, "IF OBJECT_ID('simpleresult') IS NOT NULL DROP PROC simpleresult"); Command(Statement, "create proc simpleresult @i int as begin return @i end"); - if (SQLBindParameter(Statement, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind2) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind input parameter"); + CHK(SQLBindParameter, (Statement, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind2)); - if (SQLBindParameter(Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind)); - if (SQLPrepare(Statement, (SQLCHAR *) "{ \n?\t\r= call simpleresult(?)}", SQL_NTS) != SQL_SUCCESS) { - printf("Unable to prepare statement\n"); - exit(1); - } + CHK(SQLPrepare, (Statement, (SQLCHAR *) "{ \n?\t\r= call simpleresult(?)}", SQL_NTS)); input = 123; ind2 = sizeof(input); output = 0xdeadbeef; - if (SQLExecute(Statement) != SQL_SUCCESS) { - printf("Unable to execute statement\n"); - exit(1); - } + CHK(SQLExecute, (Statement)); if (output != 123) { printf("Invalid result\n"); @@ -57,26 +48,22 @@ main(int argc, char *argv[]) input = 567; ind2 = sizeof(input); output = 0xdeadbeef; - if (SQLExecDirect(Statement, (SQLCHAR *) "{?=call simpleresult(?)}", SQL_NTS) != SQL_SUCCESS) { - printf("Unable to execure direct statement\n"); - exit(1); - } + CHK(SQLExecDirect, (Statement, (SQLCHAR *) "{?=call simpleresult(?)}", SQL_NTS)); if (output != 567) { - printf("Invalid result\n"); + fprintf(stderr, "Invalid result\n"); exit(1); } /* should return "Invalid cursor state" */ if (SQLFetch(Statement) != SQL_ERROR) { - printf("Data not expected\n"); + fprintf(stderr, "Data not expected\n"); exit(1); } Command(Statement, "drop proc simpleresult"); - if (CommandWithResult(Statement, "drop proc simpleresult2") != SQL_SUCCESS) - printf("Unable to execute statement\n"); + Command(Statement, "IF OBJECT_ID('simpleresult2') IS NOT NULL DROP PROC simpleresult2"); /* force cursor close */ SQLCloseCursor(Statement); @@ -85,31 +72,12 @@ main(int argc, char *argv[]) Command(Statement, "create proc simpleresult2 @i int, @x int output, @y varchar(20) output as begin select @x = 6789 select @y = 'test foo' return @i end"); - if (SQLBindParameter(Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind) != SQL_SUCCESS) { - printf("Unable to bind output parameter\n"); - exit(1); - } + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind)); + CHK(SQLBindParameter, (Statement, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind2)); + CHK(SQLBindParameter, (Statement, 3, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &out1, 0, &ind3)); + CHK(SQLBindParameter, (Statement, 4, SQL_PARAM_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, 20, 0, out2, sizeof(out2), &ind4)); - if (SQLBindParameter(Statement, 2, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &input, 0, &ind2) != SQL_SUCCESS) { - printf("Unable to bind input parameter\n"); - exit(1); - } - - if (SQLBindParameter(Statement, 3, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &out1, 0, &ind3) != SQL_SUCCESS) { - printf("Unable to bind output parameter\n"); - exit(1); - } - - if (SQLBindParameter(Statement, 4, SQL_PARAM_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, 20, 0, out2, sizeof(out2), &ind4) != - SQL_SUCCESS) { - printf("Unable to bind output parameter\n"); - exit(1); - } - - if (SQLPrepare(Statement, (SQLCHAR *) "{ \n?\t\r= call simpleresult2(?,?,?)}", SQL_NTS) != SQL_SUCCESS) { - printf("Unable to prepare statement\n"); - exit(1); - } + CHK(SQLPrepare, (Statement, (SQLCHAR *) "{ \n?\t\r= call simpleresult2(?,?,?)}", SQL_NTS)); input = 987; ind2 = sizeof(input); @@ -117,10 +85,7 @@ main(int argc, char *argv[]) output = 0xdeadbeef; ind3 = SQL_DATA_AT_EXEC; ind4 = SQL_DEFAULT_PARAM; - if (SQLExecute(Statement) != SQL_SUCCESS) { - printf("Unable to execute statement\n"); - exit(1); - } + CHK(SQLExecute, (Statement)); 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, @@ -131,7 +96,7 @@ main(int argc, char *argv[]) /* should return "Invalid cursor state" */ if (SQLFetch(Statement) != SQL_ERROR) { - printf("Data not expected\n"); + fprintf(stderr, "Data not expected\n"); exit(1); } @@ -142,42 +107,33 @@ main(int argc, char *argv[]) * Cfr ML 2006-11-21 "specifying a 0 for the StrLen_or_IndPtr in the * SQLBindParameter call is not working on AIX" */ - if (CommandWithResult(Statement, "drop proc rpc_read") != SQL_SUCCESS) - printf("Unable to execute statement\n"); + Command(Statement, "IF OBJECT_ID('rpc_read') IS NOT NULL DROP PROC rpc_read"); - SQLCloseCursor(Statement); + ResetStatement(); Command(Statement, "create proc rpc_read @i int, @x timestamp as begin select 1 return 1234 end"); SQLCloseCursor(Statement); - SQLFreeStmt(Statement, SQL_CLOSE); - SQLFreeStmt(Statement, SQL_UNBIND); - if (SQLPrepare(Statement, (SQLCHAR *) "{ ? = CALL rpc_read ( ?, ? ) }" , SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to prepare statement\n"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "{ ? = CALL rpc_read ( ?, ? ) }" , SQL_NTS)); ind = 0; - if (SQLBindParameter(Statement, 1, SQL_PARAM_OUTPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &output, 0, &ind) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter\n"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_OUTPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &output, 0, &ind)); ind2 = 0; - if (SQLBindParameter(Statement, 2, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &input, 0, &ind2) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind input parameter\n"); + CHK(SQLBindParameter, (Statement, 2, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, 0, 0, &input, 0, &ind2)); ind3 = 8; - if (SQLBindParameter(Statement, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_VARBINARY, 8, 0, out2, 8, &ind3) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter\n"); + CHK(SQLBindParameter, (Statement, 3, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_VARBINARY, 8, 0, out2, 8, &ind3)); - if (SQLExecute(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to execute statement\n"); + CHK(SQLExecute, (Statement)); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Data not expected\n"); + CHK(SQLFetch, (Statement)); if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Data not expected\n"); ResetStatement(); - CommandWithResult(Statement, "drop proc rpc_read"); + Command(Statement, "drop proc rpc_read"); /* * Test from Joao Amaral @@ -190,19 +146,16 @@ main(int argc, char *argv[]) ResetStatement(); - CommandWithResult(Statement, "drop proc sp_test"); + Command(Statement, "IF OBJECT_ID('sp_test') IS NOT NULL DROP PROC sp_test"); Command(Statement, "create proc sp_test @res int output as set @res = 456"); ResetStatement(); - if (SQLPrepare(Statement, (SQLCHAR *) "{ call sp_test(?)}", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to prepare statement\n"); - if (SQLBindParameter(Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter\n"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "{ call sp_test(?)}", SQL_NTS)); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &output, 0, &ind)); output = 0xdeadbeef; - if (SQLExecute(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to execute statement\n"); + CHK(SQLExecute, (Statement)); if (output != 456) { fprintf(stderr, "Invalid result %d(%x)\n", (int) output, (int) output); diff --git a/src/odbc/unittests/genparams.c b/src/odbc/unittests/genparams.c index 6b783c9..9eb1b4f 100644 --- a/src/odbc/unittests/genparams.c +++ b/src/odbc/unittests/genparams.c @@ -4,7 +4,7 @@ /* Test various type from odbc and to odbc */ -static char software_version[] = "$Id: genparams.c,v 1.23 2008/01/08 09:33:32 freddy77 Exp $"; +static char software_version[] = "$Id: genparams.c,v 1.24 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #ifdef TDS_NO_DM @@ -37,34 +37,28 @@ Test(const char *type, const char *value_to_convert, SQLSMALLINT out_c_type, SQL if (use_cursors) { ResetStatement(); - if (SQLSetStmtAttr(Statement, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, 0) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLSetStmtAttr error"); - if (SQLSetStmtAttr(Statement, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, 0) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLSetStmtAttr error"); + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, 0)); + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, 0)); } /* bind parameter */ if (exec_direct) { - if (SQLBindParameter(Statement, 1, SQL_PARAM_OUTPUT, out_c_type, out_sql_type, precision, 0, out_buf, - sizeof(out_buf), &out_len) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_OUTPUT, out_c_type, out_sql_type, precision, 0, out_buf, + sizeof(out_buf), &out_len)); /* call store procedure */ - if (SQLExecDirect(Statement, (SQLCHAR *) "{call spTestProc(?)}", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to execute store statement"); + CHK(SQLExecDirect, (Statement, (SQLCHAR *) "{call spTestProc(?)}", SQL_NTS)); } else { - if (prepare_before && SQLPrepare(Statement, (SQLCHAR *) "{call spTestProc(?)}", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLPrepare() failure!"); + if (prepare_before) + CHK(SQLPrepare, (Statement, (SQLCHAR *) "{call spTestProc(?)}", SQL_NTS)); - if (SQLBindParameter(Statement, 1, SQL_PARAM_OUTPUT, out_c_type, out_sql_type, precision, 0, out_buf, - sizeof(out_buf), &out_len) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_OUTPUT, out_c_type, out_sql_type, precision, 0, out_buf, + sizeof(out_buf), &out_len)); - if (!prepare_before && SQLPrepare(Statement, (SQLCHAR *) "{call spTestProc(?)}", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLPrepare() failure!"); + if (!prepare_before) + CHK(SQLPrepare, (Statement, (SQLCHAR *) "{call spTestProc(?)}", SQL_NTS)); - if (SQLExecute(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLExecute() failure!"); + CHK(SQLExecute, (Statement)); } /* test results */ @@ -152,16 +146,14 @@ TestInput(SQLSMALLINT out_c_type, const char *type, SQLSMALLINT out_sql_type, co } else { SQLRETURN rc; - if (prepare_before && SQLPrepare(Statement, (SQLCHAR *) sbuf, SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLPrepare() failure!"); + if (prepare_before) + CHK(SQLPrepare, (Statement, (SQLCHAR *) sbuf, SQL_NTS)); out_len = 1; - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, out_c_type, out_sql_type, 20, 0, out_buf, sizeof(out_buf), &out_len) != - SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind input parameter"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, out_c_type, out_sql_type, 20, 0, out_buf, sizeof(out_buf), &out_len)); - if (!prepare_before && SQLPrepare(Statement, (SQLCHAR *) sbuf, SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLPrepare() failure!"); + if (!prepare_before) + CHK(SQLPrepare, (Statement, (SQLCHAR *) sbuf, SQL_NTS)); rc = SQLExecute(Statement); if (rc != SQL_SUCCESS && rc != SQL_NO_DATA) @@ -173,8 +165,7 @@ TestInput(SQLSMALLINT out_c_type, const char *type, SQLSMALLINT out_sql_type, co sprintf(sbuf, "SELECT * FROM #tmp_insert WHERE col = CONVERT(%s, '%s')", param_type, expected); Command(Statement, sbuf); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Expected row"); + CHK(SQLFetch, (Statement)); if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Row not expected"); if (SQLMoreResults(Statement) != SQL_NO_DATA) diff --git a/src/odbc/unittests/getdata.c b/src/odbc/unittests/getdata.c index 1752423..8520ca1 100644 --- a/src/odbc/unittests/getdata.c +++ b/src/odbc/unittests/getdata.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: getdata.c,v 1.5 2008/01/29 09:35:25 freddy77 Exp $"; +static char software_version[] = "$Id: getdata.c,v 1.6 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static char odbc_err[256]; @@ -55,11 +55,7 @@ main(int argc, char *argv[]) /* TODO test with VARCHAR too */ Command(Statement, "SELECT CONVERT(TEXT,'Prova')"); - if (SQLFetch(Statement) != SQL_SUCCESS) { - printf("Unable to fetch row\n"); - CheckReturn(); - exit(1); - } + CHK(SQLFetch, (Statement)); /* these 2 tests test an old severe BUG in FreeTDS */ if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 0, NULL) != SQL_SUCCESS_WITH_INFO) @@ -75,8 +71,7 @@ main(int argc, char *argv[]) exit(1); } - if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 16, NULL) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to get data"); + CHK(SQLGetData, (Statement, 1, SQL_C_CHAR, buf, 16, NULL)); if (strcmp(buf, "ova") != 0) { printf("Wrong data result 2 res = '%s'\n", buf); exit(1); @@ -87,8 +82,7 @@ main(int argc, char *argv[]) /* test with varchar, not blob but variable */ Command(Statement, "SELECT CONVERT(VARCHAR(100), 'Other test')"); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to fetch row"); + CHK(SQLFetch, (Statement)); if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 7, NULL) != SQL_SUCCESS_WITH_INFO) ODBC_REPORT_ERROR("Unable to get data"); @@ -97,8 +91,7 @@ main(int argc, char *argv[]) exit(1); } - if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 16, NULL) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to get data"); + CHK(SQLGetData, (Statement, 1, SQL_C_CHAR, buf, 16, NULL)); if (strcmp(buf, "test") != 0) { printf("Wrong data result 2 res = '%s'\n", buf); exit(1); @@ -109,12 +102,10 @@ main(int argc, char *argv[]) /* test with fixed length */ Command(Statement, "SELECT CONVERT(INT, 12345)"); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to fetch row"); + CHK(SQLFetch, (Statement)); int_buf = 0xdeadbeef; - if (SQLGetData(Statement, 1, SQL_C_SLONG, &int_buf, 0, NULL) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to get data"); + CHK(SQLGetData, (Statement, 1, SQL_C_SLONG, &int_buf, 0, NULL)); if (int_buf != 12345) { printf("Wrong data result\n"); exit(1); @@ -149,12 +140,10 @@ main(int argc, char *argv[]) if (db_is_microsoft()) { Command(Statement, "SELECT CONVERT(TEXT,'')"); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to fetch row"); + CHK(SQLFetch, (Statement)); len = 1234; - if (SQLGetData(Statement, 1, SQL_C_CHAR, buf, 1, &len) != SQL_SUCCESS) - ODBC_REPORT_ERROR("invalid return from SQLGetData"); + CHK(SQLGetData, (Statement, 1, SQL_C_CHAR, buf, 1, &len)); if (len != 0) { fprintf(stderr, "Wrong len returned, returned %ld\n", (long) len); diff --git a/src/odbc/unittests/hidden.c b/src/odbc/unittests/hidden.c index 71124a6..b02881e 100755 --- a/src/odbc/unittests/hidden.c +++ b/src/odbc/unittests/hidden.c @@ -3,7 +3,7 @@ #include "common.h" -static char software_version[] = "$Id: hidden.c,v 1.3 2008/01/10 21:19:47 freddy77 Exp $"; +static char software_version[] = "$Id: hidden.c,v 1.4 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -41,7 +41,6 @@ int main(int argc, char **argv) { SQLRETURN rcode; - SQLHSTMT m_hstmt1; SQLSMALLINT cnt = 0; int failed = 0; @@ -54,13 +53,10 @@ main(int argc, char **argv) /* test hidden column with FOR BROWSE */ ResetStatement(); - m_hstmt1 = Statement; + Command(Statement, "SELECT c, b FROM #tmp1"); - rcode = SQLExecDirect(m_hstmt1, (SQLCHAR *) "SELECT c, b FROM #tmp1", SQL_NTS); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecDirect"); - - rcode = SQLNumResultCols(m_hstmt1, &cnt); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLNumResultCols 1"); + rcode = SQLNumResultCols(Statement, &cnt); + CHECK_RCODE(SQL_HANDLE_STMT, Statement, "SQLNumResultCols 1"); if (cnt != 2) { fprintf(stderr, "Wrong number of columns in result set: %d\n", (int) cnt); @@ -70,21 +66,20 @@ main(int argc, char **argv) /* test hidden column with cursors*/ CheckCursor(); - m_hstmt1 = Statement; - rcode = SQLSetStmtAttr(m_hstmt1, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); - rcode = SQLSetStmtAttr(m_hstmt1, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); + rcode = SQLSetStmtAttr(Statement, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_NONSCROLLABLE, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_STMT, Statement, "SQLSetStmtAttr SQL_ATTR_CURSOR_SCROLLABLE"); + rcode = SQLSetStmtAttr(Statement, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER) SQL_SENSITIVE, SQL_IS_UINTEGER); + CHECK_RCODE(SQL_HANDLE_STMT, Statement, "SQLSetStmtAttr SQL_ATTR_CURSOR_SENSITIVITY"); - rcode = SQLPrepare(m_hstmt1, (SQLCHAR *) "SELECT * FROM #t1", SQL_NTS); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLPrepare 1"); + rcode = SQLPrepare(Statement, (SQLCHAR *) "SELECT * FROM #t1", SQL_NTS); + CHECK_RCODE(SQL_HANDLE_STMT, Statement, "SQLPrepare 1"); - rcode = SQLExecute(m_hstmt1); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLExecute 1"); + rcode = SQLExecute(Statement); + CHECK_RCODE(SQL_HANDLE_STMT, Statement, "SQLExecute 1"); - rcode = SQLNumResultCols(m_hstmt1, &cnt); - CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLNumResultCols 1"); + rcode = SQLNumResultCols(Statement, &cnt); + CHECK_RCODE(SQL_HANDLE_STMT, Statement, "SQLNumResultCols 1"); if (cnt != 3) { fprintf(stderr, "Wrong number of columns in result set: %d\n", (int) cnt); diff --git a/src/odbc/unittests/lang_error.c b/src/odbc/unittests/lang_error.c index 7634934..90192b4 100644 --- a/src/odbc/unittests/lang_error.c +++ b/src/odbc/unittests/lang_error.c @@ -2,7 +2,7 @@ /* Test if SQLExecDirect return error if a error in row is returned */ -static char software_version[] = "$Id: lang_error.c,v 1.2 2003/11/08 18:00:33 freddy77 Exp $"; +static char software_version[] = "$Id: lang_error.c,v 1.3 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int @@ -12,7 +12,7 @@ main(int argc, char *argv[]) /* issue print statement and test message returned */ if (CommandWithResult(Statement, "SELECT DATEADD(dd,-100000,getdate())") != SQL_ERROR) { - printf("SQLExecDirect should return SQL_ERROR\n"); + fprintf(stderr, "SQLExecDirect should return SQL_ERROR\n"); return 1; } diff --git a/src/odbc/unittests/moreandcount.c b/src/odbc/unittests/moreandcount.c index 4c922dc..95ae329 100644 --- a/src/odbc/unittests/moreandcount.c +++ b/src/odbc/unittests/moreandcount.c @@ -2,7 +2,7 @@ /* Test for SQLMoreResults and SQLRowCount on batch */ -static char software_version[] = "$Id: moreandcount.c,v 1.14 2006/07/13 08:21:56 freddy77 Exp $"; +static char software_version[] = "$Id: moreandcount.c,v 1.15 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void @@ -45,21 +45,12 @@ DoTest(int prepare) "UPDATE #tmp1 SET i=i+1 WHERE i >= 2"; if (prepare) { - if (SQLPrepare(Statement, (SQLCHAR *) query, SQL_NTS) != SQL_SUCCESS) { - printf("Unable to prepare statement\n"); - exit(1); - } - if (SQLExecute(Statement) != SQL_SUCCESS) { - printf("Unable to execute statement\n"); - exit(1); - } + CHK(SQLPrepare, (Statement, (SQLCHAR *) query, SQL_NTS)); + CHK(SQLExecute, (Statement)); } else { /* execute a batch command select insert insert select and check rows */ - if (SQLExecDirect(Statement, (SQLCHAR *) query, SQL_NTS) != SQL_SUCCESS) { - printf("Unable to execute direct statement\n"); - exit(1); - } + CHK(SQLExecDirect, (Statement, (SQLCHAR *) query, SQL_NTS)); } if (!prepare) { printf("Result %d\n", ++n); diff --git a/src/odbc/unittests/norowset.c b/src/odbc/unittests/norowset.c index 6a6afb3..b18245c 100644 --- a/src/odbc/unittests/norowset.c +++ b/src/odbc/unittests/norowset.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: norowset.c,v 1.5 2006/03/23 14:53:44 freddy77 Exp $"; +static char software_version[] = "$Id: norowset.c,v 1.6 2008/01/29 14:30:48 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 */ @@ -22,18 +22,9 @@ main(int argc, char *argv[]) /* note, mssql 2005 seems to not return row for tempdb, use always master */ Command(Statement, "select name from master..sysobjects where name = 'sysobjects'"); - res = SQLFetch(Statement); - if (res != SQL_SUCCESS) { - printf("Unable to fetch row\n"); - CheckReturn(); - exit(1); - } + CHK(SQLFetch, (Statement)); - if (SQLGetData(Statement, 1, SQL_C_CHAR, output, sizeof(output), &dataSize) != SQL_SUCCESS) { - printf("Unable to get data col %d\n", 1); - CheckReturn(); - exit(1); - } + CHK(SQLGetData, (Statement, 1, SQL_C_CHAR, output, sizeof(output), &dataSize)); if (strcmp(output, "sysobjects") != 0) { printf("Unexpected result\n"); @@ -42,13 +33,12 @@ main(int argc, char *argv[]) res = SQLFetch(Statement); if (res != SQL_NO_DATA) { - printf("Row not expected\n"); + fprintf(stderr, "Row not expected\n"); CheckReturn(); - exit(1); } if (SQLMoreResults(Statement) != SQL_NO_DATA) { - printf("Not expected another recordset\n"); + fprintf(stderr, "Not expected another recordset\n"); exit(1); } diff --git a/src/odbc/unittests/params.c b/src/odbc/unittests/params.c index cbf01ee..191066c 100644 --- a/src/odbc/unittests/params.c +++ b/src/odbc/unittests/params.c @@ -3,7 +3,7 @@ /* Test for store procedure and params */ /* Test from Tom Rogers */ -static char software_version[] = "$Id: params.c,v 1.7 2005/03/29 15:19:36 freddy77 Exp $"; +static char software_version[] = "$Id: params.c,v 1.8 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; /* SP definition */ @@ -39,51 +39,22 @@ Test(int bind_before) /* create proc */ Command(Statement, sp_define); - if (!bind_before) { - if (SQLPrepare(Statement, (SQLCHAR *) SP_TEXT, strlen(SP_TEXT)) != SQL_SUCCESS) { - fprintf(stderr, "Unable to prepare statement\n"); - return 1; - } - } - - if (SQLBindParameter(Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &ReturnCode, 0, &cbReturnCode) != - SQL_SUCCESS) { - fprintf(stderr, "Unable to bind input parameter\n"); - return 1; - } - - if (SQLBindParameter(Statement, 2, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &InParam, 0, &cbInParam) != - SQL_SUCCESS) { - fprintf(stderr, "Unable to bind input parameter\n"); - return 1; - } + if (!bind_before) + CHK(SQLPrepare, (Statement, (SQLCHAR *) SP_TEXT, strlen(SP_TEXT))); - if (SQLBindParameter(Statement, 3, SQL_PARAM_OUTPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &OutParam, 0, &cbOutParam) != - SQL_SUCCESS) { - fprintf(stderr, "Unable to bind input parameter\n"); - return 1; - } + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_OUTPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &ReturnCode, 0, &cbReturnCode)); + CHK(SQLBindParameter, (Statement, 2, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &InParam, 0, &cbInParam)); + CHK(SQLBindParameter, (Statement, 3, SQL_PARAM_OUTPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &OutParam, 0, &cbOutParam)); OutString[0] = '\0'; strcpy(OutString, "Test"); /* Comment this line and we get an error! Why? */ - if (SQLBindParameter - (Statement, 4, SQL_PARAM_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, OUTSTRING_LEN, 0, OutString, OUTSTRING_LEN, - &cbOutString) != SQL_SUCCESS) { - fprintf(stderr, "Unable to bind input parameter\n"); - return 1; - } + CHK(SQLBindParameter, (Statement, 4, SQL_PARAM_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, OUTSTRING_LEN, 0, OutString, + OUTSTRING_LEN, &cbOutString)); - if (bind_before) { - if (SQLPrepare(Statement, (SQLCHAR *) SP_TEXT, strlen(SP_TEXT)) != SQL_SUCCESS) { - fprintf(stderr, "Unable to prepare statement\n"); - return 1; - } - } + if (bind_before) + CHK(SQLPrepare, (Statement, (SQLCHAR *) SP_TEXT, strlen(SP_TEXT))); - if (SQLExecute(Statement) != SQL_SUCCESS) { - fprintf(stderr, "Unable to execute statement\n"); - return 1; - } + CHK(SQLExecute, (Statement)); Command(Statement, "drop proc spTestProc"); diff --git a/src/odbc/unittests/prepare_results.c b/src/odbc/unittests/prepare_results.c index 651ce0a..8ebdb4e 100644 --- a/src/odbc/unittests/prepare_results.c +++ b/src/odbc/unittests/prepare_results.c @@ -2,7 +2,7 @@ /* Test for data format returned from SQLPrepare */ -static char software_version[] = "$Id: prepare_results.c,v 1.8 2007/06/19 12:07:59 freddy77 Exp $"; +static char software_version[] = "$Id: prepare_results.c,v 1.9 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int @@ -22,11 +22,9 @@ main(int argc, char *argv[]) SQLMoreResults(Statement); /* test query returns column information for update */ - if (SQLPrepare(Statement, (SQLCHAR *) "update #odbctestdata set i = 20", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLPrepare return failure"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "update #odbctestdata set i = 20", SQL_NTS)); - if (SQLNumResultCols(Statement, &count) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLNumResultCols return failure"); + CHK(SQLNumResultCols, (Statement, &count)); if (count != 0) { fprintf(stderr, "Wrong number of columns returned. Got %d expected 0\n", (int) count); @@ -34,35 +32,30 @@ main(int argc, char *argv[]) } /* test query returns column information */ - if (SQLPrepare(Statement, (SQLCHAR *) "select * from #odbctestdata select * from #odbctestdata", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLPrepare return failure"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "select * from #odbctestdata select * from #odbctestdata", SQL_NTS)); - if (SQLNumResultCols(Statement, &count) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLNumResultCols return failure"); + CHK(SQLNumResultCols, (Statement, &count)); if (count != 3) { fprintf(stderr, "Wrong number of columns returned. Got %d expected 3\n", (int) count); exit(1); } - if (SQLDescribeCol(Statement, 1, (SQLCHAR *) name, sizeof(name), &namelen, &type, &size, &digits, &nullable) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLDescribeCol failure for column 1"); + CHK(SQLDescribeCol, (Statement, 1, (SQLCHAR *) name, sizeof(name), &namelen, &type, &size, &digits, &nullable)); if (type != SQL_INTEGER || strcmp(name, "i") != 0) { fprintf(stderr, "wrong column 1 informations (type %d name '%s' size %d)\n", (int) type, name, (int) size); exit(1); } - if (SQLDescribeCol(Statement, 2, (SQLCHAR *) name, sizeof(name), &namelen, &type, &size, &digits, &nullable) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLDescribeCol failure for column 2"); + CHK(SQLDescribeCol, (Statement, 2, (SQLCHAR *) name, sizeof(name), &namelen, &type, &size, &digits, &nullable)); if (type != SQL_CHAR || strcmp(name, "c") != 0 || (size != 20 && (db_is_microsoft() || size != 40))) { fprintf(stderr, "wrong column 2 informations (type %d name '%s' size %d)\n", (int) type, name, (int) size); exit(1); } - if (SQLDescribeCol(Statement, 3, (SQLCHAR *) name, sizeof(name), &namelen, &type, &size, &digits, &nullable) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLDescribeCol failure for column 3"); + CHK(SQLDescribeCol, (Statement, 3, (SQLCHAR *) name, sizeof(name), &namelen, &type, &size, &digits, &nullable)); if (type != SQL_NUMERIC || strcmp(name, "n") != 0 || size != 34 || digits != 12) { fprintf(stderr, "wrong column 3 informations (type %d name '%s' size %d)\n", (int) type, name, (int) size); diff --git a/src/odbc/unittests/print.c b/src/odbc/unittests/print.c index 4033d5b..45f33dd 100644 --- a/src/odbc/unittests/print.c +++ b/src/odbc/unittests/print.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: print.c,v 1.18 2005/12/04 11:16:30 freddy77 Exp $"; +static char software_version[] = "$Id: print.c,v 1.19 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static SQLCHAR output[256]; @@ -53,16 +53,13 @@ test(int odbc3) rc = SQLFetch(Statement); if (rc != SQL_ERROR) ODBC_REPORT_ERROR("Still data?"); - rc = SQLMoreResults(Statement); - if (rc != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLMoreResults failed"); + CHK(SQLMoreResults, (Statement)); } CHECK_COLS(1); CHECK_ROWS(-1); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLFetch no succeeded"); + CHK(SQLFetch, (Statement)); CHECK_COLS(1); CHECK_ROWS(-1); if (SQLFetch(Statement) != SQL_NO_DATA) diff --git a/src/odbc/unittests/putdata.c b/src/odbc/unittests/putdata.c index b199b9d..a9d3878 100644 --- a/src/odbc/unittests/putdata.c +++ b/src/odbc/unittests/putdata.c @@ -2,7 +2,7 @@ /* Test for SQLPutData */ -static char software_version[] = "$Id: putdata.c,v 1.9 2004/10/28 13:16:18 freddy77 Exp $"; +static char software_version[] = "$Id: putdata.c,v 1.10 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static const char test_text[] = @@ -25,9 +25,7 @@ main(int argc, char *argv[]) /* create table to hold data */ Command(Statement, "CREATE TABLE #putdata (c TEXT NULL, b IMAGE NULL)"); - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, 0, 0, (SQLPOINTER) 123, 0, &ind) != - SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, 0, 0, (SQLPOINTER) 123, 0, &ind)); /* length required */ ind = SQL_LEN_DATA_AT_EXEC(len); @@ -35,8 +33,7 @@ main(int argc, char *argv[]) * test for char */ - if (SQLPrepare(Statement, (SQLCHAR *) "INSERT INTO #putdata(c) VALUES(?)", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to prepare statement"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "INSERT INTO #putdata(c) VALUES(?)", SQL_NTS)); if (SQLExecute(Statement) != SQL_NEED_DATA) ODBC_REPORT_ERROR("Wrong result executing statement"); @@ -57,8 +54,7 @@ main(int argc, char *argv[]) p += n; n *= 2; } - if (SQLParamData(Statement, &ptr) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Wrong result from SQLParamData"); + CHK(SQLParamData, (Statement, &ptr)); if (SQLParamData(Statement, &ptr) != SQL_ERROR) ODBC_REPORT_ERROR("Wrong result from SQLParamData"); @@ -74,13 +70,10 @@ main(int argc, char *argv[]) * test for binary */ - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, 0, 0, (SQLPOINTER) 4567, 0, &ind) != - SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind output parameter"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_LONGVARBINARY, 0, 0, (SQLPOINTER) 4567, 0, &ind)); ind = SQL_LEN_DATA_AT_EXEC(254); - if (SQLPrepare(Statement, (SQLCHAR *) "UPDATE #putdata SET b = ?", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to prepare statement"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "UPDATE #putdata SET b = ?", SQL_NTS)); if (SQLExecute(Statement) != SQL_NEED_DATA) ODBC_REPORT_ERROR("Wrong result executing statement"); @@ -96,13 +89,11 @@ main(int argc, char *argv[]) if (l < n) n = l; - if (SQLPutData(Statement, (char *) p, n) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Wrong result from SQLPutData"); + CHK(SQLPutData, (Statement, (char *) p, n)); pb += n; n *= 2; } - if (SQLParamData(Statement, &ptr) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Wrong result from SQLParamData"); + CHK(SQLParamData, (Statement, &ptr)); if (SQLParamData(Statement, &ptr) != SQL_ERROR) ODBC_REPORT_ERROR("Wrong result from SQLParamData"); @@ -112,14 +103,11 @@ main(int argc, char *argv[]) /* test len == 0 case from ML */ - if (SQLFreeStmt(Statement, SQL_RESET_PARAMS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLFreeStmt error"); + CHK(SQLFreeStmt, (Statement, SQL_RESET_PARAMS)); - if (SQLPrepare(Statement, (SQLCHAR *) "INSERT INTO #putdata(c) VALUES(?)", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to prepare statement"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "INSERT INTO #putdata(c) VALUES(?)", SQL_NTS)); - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, 0, 0, (PTR) 2, 0, &ind) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLBindParameter error"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, 0, 0, (PTR) 2, 0, &ind)); ind = SQL_LEN_DATA_AT_EXEC(0); diff --git a/src/odbc/unittests/raiserror.c b/src/odbc/unittests/raiserror.c index 94bb486..76fd66f 100644 --- a/src/odbc/unittests/raiserror.c +++ b/src/odbc/unittests/raiserror.c @@ -4,7 +4,7 @@ /* TODO add support for Sybase */ -static char software_version[] = "$Id: raiserror.c,v 1.19 2007/11/26 06:25:11 freddy77 Exp $"; +static char software_version[] = "$Id: raiserror.c,v 1.20 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define SP_TEXT "{?=call #tmp1(?,?,?)}" @@ -153,14 +153,10 @@ Test(int level) SQLBindParameter(Statement, 4, SQL_PARAM_OUTPUT, SQL_C_CHAR, SQL_VARCHAR, OUTSTRING_LEN, 0, OutString, OUTSTRING_LEN, &cbOutString); - result = SQLExecute(Statement); - - if (result != SQL_SUCCESS) - ODBC_REPORT_ERROR("query should success"); + CHK(SQLExecute, (Statement)); CheckData(""); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLFetch returned failure"); + CHK(SQLFetch, (Statement)); CheckData("Here is the first row"); result = SQLFetch(Statement); @@ -221,8 +217,7 @@ Test(int level) CheckReturnCode(result, INVALID_RETURN); CheckData(""); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLFetch returned failure"); + CHK(SQLFetch, (Statement)); CheckData("Here is the last row"); if (SQLFetch(Statement) != SQL_NO_DATA) diff --git a/src/odbc/unittests/rebindpar.c b/src/odbc/unittests/rebindpar.c index d8f0c21..d814b1c 100644 --- a/src/odbc/unittests/rebindpar.c +++ b/src/odbc/unittests/rebindpar.c @@ -2,7 +2,7 @@ /* Test for executing SQLExecute and rebinding parameters */ -static char software_version[] = "$Id: rebindpar.c,v 1.6 2004/12/01 13:11:35 freddy77 Exp $"; +static char software_version[] = "$Id: rebindpar.c,v 1.7 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void @@ -13,16 +13,15 @@ TestInsert(HSTMT stmt, char *buf) char sql[200]; /* insert some data and test success */ - if (SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, l, 0, buf, l, &ind) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind"); + CHK(SQLBindParameter, (stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, l, 0, buf, l, &ind)); ind = l; - if (SQLExecute(stmt) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to execute"); + CHK(SQLExecute, (stmt)); sprintf(sql, "SELECT 1 FROM #tmp1 WHERE c = '%s'", buf); Command(Statement, sql); - if (SQLFetch(Statement) != SQL_SUCCESS || SQLFetch(Statement) != SQL_NO_DATA || SQLMoreResults(Statement) != SQL_NO_DATA) { + CHK(SQLFetch, (Statement)); + if (SQLFetch(Statement) != SQL_NO_DATA || SQLMoreResults(Statement) != SQL_NO_DATA) { fprintf(stderr, "One row expected!\n"); exit(1); } @@ -43,15 +42,12 @@ Test(int prebind) Command(Statement, "DELETE FROM #tmp1"); - if (SQLAllocStmt(Connection, &stmt) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to allocate statement"); + CHK(SQLAllocStmt, (Connection, &stmt)); if (prebind) - if (SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 1, 0, buf, 1, &ind) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind"); + CHK(SQLBindParameter, (stmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 1, 0, buf, 1, &ind)); - if (SQLPrepare(stmt, (SQLCHAR *) "INSERT INTO #tmp1(c) VALUES(?)", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to prepare statement"); + CHK(SQLPrepare, (stmt, (SQLCHAR *) "INSERT INTO #tmp1(c) VALUES(?)", SQL_NTS)); /* try to insert al empty string, should not fail */ /* NOTE this is currently the only test for insert a empty string using rpc */ @@ -61,8 +57,7 @@ Test(int prebind) TestInsert(stmt, "bb"); TestInsert(stmt, buf); - if (SQLFreeStmt(stmt, SQL_DROP) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to free statement"); + CHK(SQLFreeStmt, (stmt, SQL_DROP)); } int diff --git a/src/odbc/unittests/scroll.c b/src/odbc/unittests/scroll.c index 9ba8e5f..f3ff03f 100644 --- a/src/odbc/unittests/scroll.c +++ b/src/odbc/unittests/scroll.c @@ -2,13 +2,9 @@ /* Test cursors */ -static char software_version[] = "$Id: scroll.c,v 1.6 2007/11/26 06:25:11 freddy77 Exp $"; +static char software_version[] = "$Id: scroll.c,v 1.7 2008/01/29 14:30:48 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; -#define CHK(func,params) \ - if (func params != SQL_SUCCESS) \ - ODBC_REPORT_ERROR(#func) - int main(int argc, char *argv[]) { diff --git a/src/odbc/unittests/t0001.c b/src/odbc/unittests/t0001.c index 399e30c..6ca6c8d 100644 --- a/src/odbc/unittests/t0001.c +++ b/src/odbc/unittests/t0001.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: t0001.c,v 1.14 2004/10/28 13:16:18 freddy77 Exp $"; +static char software_version[] = "$Id: t0001.c,v 1.15 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int @@ -24,40 +24,23 @@ main(int argc, char *argv[]) "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)"; - if (CommandWithResult(Statement, command) != SQL_SUCCESS) { - printf("Unable to execute statement\n"); - CheckReturn(); - exit(1); - } + CHK(CommandWithResult, (Statement, command)); command = "insert #odbctestdata values (" "'ABCDEFGHIJKLMNOP'," "123456," "1234.56," "123456.78," "'Sep 11 2001 10:00AM'," "'just to check returned length...')"; - if (CommandWithResult(Statement, command) != SQL_SUCCESS) { - printf("Unable to execute statement\n"); - CheckReturn(); - exit(1); - } + CHK(CommandWithResult, (Statement, command)); - if (CommandWithResult(Statement, "select * from #odbctestdata") != SQL_SUCCESS) { - printf("Unable to execute statement\n"); - CheckReturn(); - exit(1); - } + CHK(CommandWithResult, (Statement, "select * from #odbctestdata")); res = SQLFetch(Statement); if (res != SQL_SUCCESS && res != SQL_SUCCESS_WITH_INFO) { - printf("Unable to fetch row\n"); + fprintf(stderr, "Unable to fetch row\n"); CheckReturn(); - exit(1); } for (i = 1; i <= 6; i++) { - if (SQLGetData(Statement, i, SQL_C_CHAR, output, sizeof(output), &cnamesize) != SQL_SUCCESS) { - printf("Unable to get data col %d\n", i); - CheckReturn(); - exit(1); - } + CHK(SQLGetData, (Statement, i, SQL_C_CHAR, output, sizeof(output), &cnamesize)); printf("output data >%s< len_or_ind = %d\n", output, (int) cnamesize); if (cnamesize != strlen((char *) output)) @@ -66,23 +49,17 @@ main(int argc, char *argv[]) res = SQLFetch(Statement); if (res != SQL_NO_DATA) { - printf("Unable to fetch row\n"); + fprintf(stderr, "Unable to fetch row\n"); CheckReturn(); - exit(1); } res = SQLCloseCursor(Statement); if (!SQL_SUCCEEDED(res)) { - printf("Unable to close cursr\n"); + fprintf(stderr, "Unable to close cursor\n"); CheckReturn(); - exit(1); } - if (CommandWithResult(Statement, "drop table #odbctestdata") != SQL_SUCCESS) { - printf("Unable to drop table #odbctestdata \n"); - CheckReturn(); - exit(1); - } + Command(Statement, "drop table #odbctestdata"); Disconnect(); diff --git a/src/odbc/unittests/t0002.c b/src/odbc/unittests/t0002.c index 5da1784..8fa2830 100644 --- a/src/odbc/unittests/t0002.c +++ b/src/odbc/unittests/t0002.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: t0002.c,v 1.12 2005/06/29 07:21:24 freddy77 Exp $"; +static char software_version[] = "$Id: t0002.c,v 1.13 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int @@ -24,53 +24,42 @@ main(int argc, char *argv[]) * result should not disappear (required for DBD::ODBC) */ - if (SQLAllocStmt(Connection, &stmt) != SQL_SUCCESS) { - printf("Unable to allocate statement\n"); - CheckReturn(); - exit(1); - } + CHK(SQLAllocStmt, (Connection, &stmt)); Command(stmt, "select * from #odbctestdata where 0=1"); if (SQLFetch(stmt) != SQL_NO_DATA) { - printf("Data not expected\n"); + fprintf(stderr, "Data not expected\n"); exit(1); } res = SQLCloseCursor(stmt); if (!SQL_SUCCEEDED(res)) { - printf("Unable to close cursr\n"); + fprintf(stderr, "Unable to close cursor\n"); CheckReturn(); - exit(1); } Command(Statement, "select * from #odbctestdata"); /* drop first statement .. data should not disappear */ - if (SQLFreeStmt(stmt, SQL_DROP) != SQL_SUCCESS) { - printf("Error dropping??\n"); - exit(1); - } + CHK(SQLFreeStmt, (stmt, SQL_DROP)); res = SQLFetch(Statement); if (res != SQL_SUCCESS && res != SQL_SUCCESS_WITH_INFO) { - printf("Unable to fetch row. Drop of previous statement discard results... bad!\n"); + fprintf(stderr, "Unable to fetch row. Drop of previous statement discard results... bad!\n"); CheckReturn(); - exit(1); } res = SQLFetch(Statement); if (res != SQL_NO_DATA) { - printf("Unable to fetch row\n"); + fprintf(stderr, "Unable to fetch row\n"); CheckReturn(); - exit(1); } res = SQLCloseCursor(Statement); if (!SQL_SUCCEEDED(res)) { - printf("Unable to close cursr\n"); + fprintf(stderr, "Unable to close cursr\n"); CheckReturn(); - exit(1); } Command(Statement, "drop table #odbctestdata"); diff --git a/src/odbc/unittests/t0003.c b/src/odbc/unittests/t0003.c index c36947e..d9e6640 100644 --- a/src/odbc/unittests/t0003.c +++ b/src/odbc/unittests/t0003.c @@ -2,7 +2,7 @@ /* Test for SQLMoreResults */ -static char software_version[] = "$Id: t0003.c,v 1.16 2005/03/29 15:19:36 freddy77 Exp $"; +static char software_version[] = "$Id: t0003.c,v 1.17 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void @@ -14,17 +14,14 @@ DoTest(int prepared) if (!prepared) { Command(Statement, "select * from #odbctestdata select * from #odbctestdata"); } else { - if (SQLPrepare(Statement, (SQLCHAR *)"select * from #odbctestdata select * from #odbctestdata", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLPrepare return failure"); - if (SQLExecute(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLExecure return failure"); + CHK(SQLPrepare, (Statement, (SQLCHAR *)"select * from #odbctestdata select * from #odbctestdata", SQL_NTS)); + CHK(SQLExecute, (Statement)); } if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Data not expected"); - if (SQLMoreResults(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Expected another recordset"); + CHK(SQLMoreResults, (Statement)); printf("Getting next recordset\n"); if (SQLFetch(Statement) != SQL_NO_DATA) @@ -38,18 +35,14 @@ DoTest(int prepared) if (!prepared) { Command(Statement, "select * from #odbctestdata select * from #odbctestdata"); } else { - if (SQLPrepare(Statement, (SQLCHAR *)"select * from #odbctestdata select * from #odbctestdata", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLPrepare return failure"); - if (SQLExecute(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLExecure return failure"); + CHK(SQLPrepare, (Statement, (SQLCHAR *)"select * from #odbctestdata select * from #odbctestdata", SQL_NTS)); + CHK(SQLExecute, (Statement)); } - if (SQLMoreResults(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Expected another recordset"); + CHK(SQLMoreResults, (Statement)); printf("Getting next recordset\n"); - if (SQLFetch(Statement) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Expecting a row"); + CHK(SQLFetch, (Statement)); if (SQLFetch(Statement) != SQL_NO_DATA) ODBC_REPORT_ERROR("Data not expected"); diff --git a/src/odbc/unittests/t0004.c b/src/odbc/unittests/t0004.c index 60cbddb..839fa60 100644 --- a/src/odbc/unittests/t0004.c +++ b/src/odbc/unittests/t0004.c @@ -2,7 +2,7 @@ /* Test for SQLMoreResults */ -static char software_version[] = "$Id: t0004.c,v 1.15 2006/03/23 14:53:44 freddy77 Exp $"; +static char software_version[] = "$Id: t0004.c,v 1.16 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void @@ -15,28 +15,19 @@ Test(int use_indicator) strcpy(buf, "I don't exist"); ind = strlen(buf); - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 20, 0, buf, 128, pind) != SQL_SUCCESS) { - printf("Unable to bind parameter\n"); - exit(1); - } + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 20, 0, buf, 128, pind)); - if (SQLPrepare(Statement, (SQLCHAR *) "SELECT id, name FROM master..sysobjects WHERE name = ?", SQL_NTS) != SQL_SUCCESS) { - printf("Unable to prepare statement\n"); - exit(1); - } + CHK(SQLPrepare, (Statement, (SQLCHAR *) "SELECT id, name FROM master..sysobjects WHERE name = ?", SQL_NTS)); - if (SQLExecute(Statement) != SQL_SUCCESS) { - printf("Unable to execute statement\n"); - exit(1); - } + CHK(SQLExecute, (Statement)); if (SQLFetch(Statement) != SQL_NO_DATA) { - printf("Data not expected\n"); + fprintf(stderr, "Data not expected\n"); exit(1); } if (SQLMoreResults(Statement) != SQL_NO_DATA) { - printf("Not expected another recordset\n"); + fprintf(stderr, "Not expected another recordset\n"); exit(1); } @@ -44,23 +35,17 @@ Test(int use_indicator) strcpy(buf, "sysobjects"); ind = strlen(buf); - if (SQLExecute(Statement) != SQL_SUCCESS) { - printf("Unable to execute statement\n"); - exit(1); - } + CHK(SQLExecute, (Statement)); - if (SQLFetch(Statement) != SQL_SUCCESS) { - printf("Data expected\n"); - exit(1); - } + CHK(SQLFetch, (Statement)); if (SQLFetch(Statement) != SQL_NO_DATA) { - printf("Data not expected\n"); + fprintf(stderr, "Data not expected\n"); exit(1); } if (SQLMoreResults(Statement) != SQL_NO_DATA) { - printf("Not expected another recordset\n"); + fprintf(stderr, "Not expected another recordset\n"); exit(1); } } diff --git a/src/odbc/unittests/tables.c b/src/odbc/unittests/tables.c index 011a377..671ef79 100644 --- a/src/odbc/unittests/tables.c +++ b/src/odbc/unittests/tables.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: tables.c,v 1.13 2007/07/03 15:13:55 freddy77 Exp $"; +static char software_version[] = "$Id: tables.c,v 1.14 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #ifdef WIN32 @@ -15,11 +15,7 @@ static void ReadCol(int i) { strcpy(output, "NULL"); - if (SQLGetData(Statement, i, SQL_C_CHAR, output, sizeof(output), &cnamesize) != SQL_SUCCESS) { - printf("Unable to get data col %d\n", i); - CheckReturn(); - exit(1); - } + CHK(SQLGetData, (Statement, i, SQL_C_CHAR, output, sizeof(output), &cnamesize)); } static void @@ -28,12 +24,9 @@ TestName(int index, const char *expected_name) char name[128]; char buf[256]; SQLSMALLINT len, type; - SQLRETURN rc; #define NAME_TEST \ do { \ - if (rc != SQL_SUCCESS) \ - ODBC_REPORT_ERROR("SQLDescribeCol failed"); \ if (strcmp(name, expected_name) != 0) \ { \ sprintf(buf, "wrong name in column %d expected '%s' got '%s'", index, expected_name, name); \ @@ -42,14 +35,14 @@ TestName(int index, const char *expected_name) } while(0) /* retrieve with SQLDescribeCol */ - rc = SQLDescribeCol(Statement, index, (SQLCHAR *) name, sizeof(name), &len, &type, NULL, NULL, NULL); + CHK(SQLDescribeCol, (Statement, index, (SQLCHAR *) name, sizeof(name), &len, &type, NULL, NULL, NULL)); NAME_TEST; /* retrieve with SQLColAttribute */ - rc = SQLColAttribute(Statement, index, SQL_DESC_NAME, name, sizeof(name), &len, NULL); + CHK(SQLColAttribute, (Statement, index, SQL_DESC_NAME, name, sizeof(name), &len, NULL)); if (db_is_microsoft()) NAME_TEST; - rc = SQLColAttribute(Statement, index, SQL_DESC_LABEL, name, sizeof(name), &len, NULL); + CHK(SQLColAttribute, (Statement, index, SQL_DESC_LABEL, name, sizeof(name), &len, NULL)); NAME_TEST; } diff --git a/src/odbc/unittests/test64.c b/src/odbc/unittests/test64.c index f29e745..8d0dd75 100644 --- a/src/odbc/unittests/test64.c +++ b/src/odbc/unittests/test64.c @@ -1,13 +1,9 @@ /* test win64 consistency */ #include "common.h" -static char software_version[] = "$Id: test64.c,v 1.3 2008/01/26 21:47:26 freddy77 Exp $"; +static char software_version[] = "$Id: test64.c,v 1.4 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; -#define CHK(func,params) \ - if (func params != SQL_SUCCESS) \ - ODBC_REPORT_ERROR(#func) - /* set ipd processed_ptr with SQLParamOptions/SQLSetDescField/SQL_ATTR_PARAMS_PROCESSED_PTR diff --git a/src/odbc/unittests/timeout.c b/src/odbc/unittests/timeout.c index a1b7385..f8a7ddf 100644 --- a/src/odbc/unittests/timeout.c +++ b/src/odbc/unittests/timeout.c @@ -3,27 +3,19 @@ /* Test timeout of query */ -static char software_version[] = "$Id: timeout.c,v 1.7 2007/11/26 18:12:31 freddy77 Exp $"; +static char software_version[] = "$Id: timeout.c,v 1.8 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void AutoCommit(int onoff) { - SQLRETURN ret; - - ret = SQLSetConnectAttr(Connection, SQL_ATTR_AUTOCOMMIT, int2ptr(onoff), 0); - if (ret != SQL_SUCCESS) - ODBC_REPORT_ERROR("Enabling AutoCommit"); + CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_AUTOCOMMIT, int2ptr(onoff), 0)); } static void EndTransaction(SQLSMALLINT type) { - SQLRETURN ret; - - ret = SQLEndTran(SQL_HANDLE_DBC, Connection, type); - if (ret != SQL_SUCCESS) - ODBC_REPORT_ERROR("Can't commit transaction"); + CHK(SQLEndTran, (SQL_HANDLE_DBC, Connection, type)); } int @@ -58,17 +50,12 @@ main(int argc, char *argv[]) Connect(); AutoCommit(SQL_AUTOCOMMIT_OFF); - ret = SQLSetStmtAttr(Statement, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0); - if (ret != SQL_SUCCESS) - ODBC_REPORT_ERROR("Error setting timeout"); + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0)); i = 1; - ret = SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &i, 0, NULL); - if (ret != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLBindParameter failure"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &i, 0, NULL)); - if (SQLPrepare(Statement, (SQLCHAR *) "update test_timeout set t = 'bad' where n = ?", SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLPrepare failure"); + CHK(SQLPrepare, (Statement, (SQLCHAR *) "update test_timeout set t = 'bad' where n = ?", SQL_NTS)); ret = SQLExecute(Statement); if (ret != SQL_ERROR) ODBC_REPORT_ERROR("SQLExecute success ??"); diff --git a/src/odbc/unittests/timeout2.c b/src/odbc/unittests/timeout2.c index 3cded35..1c61565 100644 --- a/src/odbc/unittests/timeout2.c +++ b/src/odbc/unittests/timeout2.c @@ -14,17 +14,13 @@ * Test from Ou Liu, cf "Query Time Out", 2006-08-08 */ -static char software_version[] = "$Id: timeout2.c,v 1.4 2007/06/27 14:52:25 freddy77 Exp $"; +static char software_version[] = "$Id: timeout2.c,v 1.5 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #if defined(__MINGW32__) || defined(WIN32) #define sleep(s) Sleep((s)*1000) #endif -#define CHK(func,params) \ - if (func params != SQL_SUCCESS) \ - ODBC_REPORT_ERROR(#func) - int main(int argc, char *argv[]) { diff --git a/src/odbc/unittests/timeout4.c b/src/odbc/unittests/timeout4.c index 3738dc8..be9c6f9 100644 --- a/src/odbc/unittests/timeout4.c +++ b/src/odbc/unittests/timeout4.c @@ -39,7 +39,7 @@ * prepare or execute a query. This should fail and return an error message. */ -static char software_version[] = "$Id: timeout4.c,v 1.1 2007/04/20 09:15:06 freddy77 Exp $"; +static char software_version[] = "$Id: timeout4.c,v 1.2 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #if HAVE_FSTAT && defined(S_IFSOCK) @@ -91,9 +91,7 @@ Test(int direct) return 1; } - ret = SQLSetStmtAttr(Statement, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 10, SQL_IS_UINTEGER); - if (ret != SQL_SUCCESS) - ODBC_REPORT_ERROR("Error setting timeout"); + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 10, SQL_IS_UINTEGER)); alarm(30); start_time = time(NULL); diff --git a/src/odbc/unittests/transaction.c b/src/odbc/unittests/transaction.c index a166f63..e7b507a 100644 --- a/src/odbc/unittests/transaction.c +++ b/src/odbc/unittests/transaction.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: transaction.c,v 1.12 2006/08/13 13:03:19 freddy77 Exp $"; +static char software_version[] = "$Id: transaction.c,v 1.13 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static int @@ -27,96 +27,48 @@ Test(int discard_test) /* create stored proc */ CommandWithResult(Statement, "DROP PROCEDURE testinsert"); - result = CommandWithResult(Statement, createProcedure); - if (result != SQL_SUCCESS) { - ODBC_REPORT_ERROR("Can't create proc testinsert"); - retcode = 1; - goto cleanup; - } + Command(Statement, createProcedure); /* create stored proc that generates an error */ CommandWithResult(Statement, "DROP PROCEDURE testerror"); - result = CommandWithResult(Statement, createErrorProcedure); - if (result != SQL_SUCCESS) { - ODBC_REPORT_ERROR("Can't create proc testerror"); - retcode = 1; - goto cleanup; - } + Command(Statement, createErrorProcedure); /* Start transaction */ - result = SQLSetConnectAttr(Connection, SQL_ATTR_AUTOCOMMIT, (void *) SQL_AUTOCOMMIT_OFF, 0); - if (result != SQL_SUCCESS) { - ODBC_REPORT_ERROR("Can't start transaction"); - retcode = 1; - goto cleanup; - } + CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_AUTOCOMMIT, (void *) SQL_AUTOCOMMIT_OFF, 0)); /* Insert a value */ Command(Statement, "EXEC testinsert 1"); /* we should be able to read row count */ - if (SQLRowCount(Statement, &rows) != SQL_SUCCESS) { - ODBC_REPORT_ERROR("Can't get row counts"); - retcode = 1; - goto cleanup; - } + CHK(SQLRowCount, (Statement, &rows)); /* Commit transaction */ - result = SQLEndTran(SQL_HANDLE_DBC, Connection, SQL_COMMIT); - if (result != SQL_SUCCESS) { - ODBC_REPORT_ERROR("Can't commit transaction"); - retcode = 1; - goto cleanup; - } + CHK(SQLEndTran, (SQL_HANDLE_DBC, Connection, SQL_COMMIT)); SQLCloseCursor(Statement); /* Start transaction */ - result = SQLSetConnectAttr(Connection, SQL_ATTR_AUTOCOMMIT, (void *) SQL_AUTOCOMMIT_OFF, 0); - if (result != SQL_SUCCESS) { - ODBC_REPORT_ERROR("Can't start transaction"); - retcode = 1; - goto cleanup; - } + CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_AUTOCOMMIT, (void *) SQL_AUTOCOMMIT_OFF, 0)); /* Insert another value */ Command(Statement, "EXEC testinsert 2"); /* Roll back transaction */ - result = SQLEndTran(SQL_HANDLE_DBC, Connection, SQL_ROLLBACK); - if (result != SQL_SUCCESS) { - ODBC_REPORT_ERROR("Can't roll back transaction"); - retcode = 1; - goto cleanup; - } + CHK(SQLEndTran, (SQL_HANDLE_DBC, Connection, SQL_ROLLBACK)); /* TODO test row inserted */ - result = SQLSetConnectAttr(Connection, SQL_ATTR_AUTOCOMMIT, (void *) SQL_AUTOCOMMIT_ON, 0); - if (result != SQL_SUCCESS) { - ODBC_REPORT_ERROR("Can't stop transaction"); - retcode = 1; - goto cleanup; - } + CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_AUTOCOMMIT, (void *) SQL_AUTOCOMMIT_ON, 0)); /* generate an error */ - result = CommandWithResult(Statement, "EXEC testerror"); - if (result != SQL_SUCCESS) { - ODBC_REPORT_ERROR("error: SQLExecDirect: testerror"); - retcode = 1; - goto cleanup; - } - if (SQLBindCol(Statement, 1, SQL_C_SLONG, &out_buf, sizeof(out_buf), &out_len) != SQL_SUCCESS) { - ODBC_REPORT_ERROR("error: SQLBindCol: testerror"); - retcode = 1; - goto cleanup; - } + Command(Statement, "EXEC testerror"); + CHK(SQLBindCol, (Statement, 1, SQL_C_SLONG, &out_buf, sizeof(out_buf), &out_len)); while ((result = SQLFetch(Statement)) == SQL_SUCCESS) { printf("\t%ld\n", (long int) out_buf); if (out_buf != 1) { - printf("error: expected to select 1 got %ld\n", (long int) out_buf); + fprintf(stderr, "error: expected to select 1 got %ld\n", (long int) out_buf); retcode = 1; goto cleanup; } @@ -131,7 +83,7 @@ Test(int discard_test) printf("SQLMoreResults returned %d\n", result); if (result != SQL_ERROR) { - printf("SQLMoreResults should return error\n"); + fprintf(stderr, "SQLMoreResults should return error\n"); retcode = 1; goto cleanup; } @@ -147,7 +99,7 @@ Test(int discard_test) result = SQLMoreResults(Statement); printf("SQLMoreResults returned %d\n", result); if (result != SQL_NO_DATA) { - printf("SQLMoreResults should return error"); + fprintf(stderr, "SQLMoreResults should return error"); retcode = 1; goto cleanup; } @@ -163,26 +115,19 @@ Test(int discard_test) int main(int argc, char *argv[]) { - int result; int retcode = 0; Connect(); /* create table */ CommandWithResult(Statement, "DROP TABLE TestTransaction"); - result = CommandWithResult(Statement, "CREATE TABLE TestTransaction ( value INT )"); - if (result != SQL_SUCCESS) { - ODBC_REPORT_ERROR("Can't create table TestTransaction"); - retcode = 1; - goto cleanup; - } + Command(Statement, "CREATE TABLE TestTransaction ( value INT )"); if (!retcode) retcode = Test(1); if (!retcode) retcode = Test(0); - cleanup: /* drop table */ CommandWithResult(Statement, "DROP TABLE TestTransaction"); diff --git a/src/odbc/unittests/typeinfo.c b/src/odbc/unittests/typeinfo.c index cae15e5..c9539c9 100644 --- a/src/odbc/unittests/typeinfo.c +++ b/src/odbc/unittests/typeinfo.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: typeinfo.c,v 1.8 2007/07/03 15:13:55 freddy77 Exp $"; +static char software_version[] = "$Id: typeinfo.c,v 1.9 2008/01/29 14:30:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void @@ -9,12 +9,9 @@ TestName(int index, const char *expected_name) char name[128]; char buf[256]; SQLSMALLINT len, type; - SQLRETURN rc; #define NAME_TEST \ do { \ - if (rc != SQL_SUCCESS) \ - ODBC_REPORT_ERROR("SQLDescribeCol failed"); \ if (strcmp(name, expected_name) != 0) \ { \ sprintf(buf, "wrong name in column %d expected '%s' got '%s'", index, expected_name, name); \ @@ -23,14 +20,14 @@ TestName(int index, const char *expected_name) } while(0) /* retrieve with SQLDescribeCol */ - rc = SQLDescribeCol(Statement, index, (SQLCHAR *) name, sizeof(name), &len, &type, NULL, NULL, NULL); + CHK(SQLDescribeCol, (Statement, index, (SQLCHAR *) name, sizeof(name), &len, &type, NULL, NULL, NULL)); NAME_TEST; /* retrieve with SQLColAttribute */ - rc = SQLColAttribute(Statement, index, SQL_DESC_NAME, name, sizeof(name), &len, NULL); + CHK(SQLColAttribute, (Statement, index, SQL_DESC_NAME, name, sizeof(name), &len, NULL)); if (db_is_microsoft()) NAME_TEST; - rc = SQLColAttribute(Statement, index, SQL_DESC_LABEL, name, sizeof(name), &len, NULL); + CHK(SQLColAttribute, (Statement, index, SQL_DESC_LABEL, name, sizeof(name), &len, NULL)); NAME_TEST; } diff --git a/src/odbc/unittests/warning.c b/src/odbc/unittests/warning.c index 05f3353..741a250 100644 --- a/src/odbc/unittests/warning.c +++ b/src/odbc/unittests/warning.c @@ -14,7 +14,7 @@ * inside recordset * Sybase do not return warning but test works the same */ -static char software_version[] = "$Id: warning.c,v 1.5 2007/05/17 13:11:56 freddy77 Exp $"; +static char software_version[] = "$Id: warning.c,v 1.6 2008/01/29 14:30:49 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"; @@ -30,15 +30,9 @@ Test(const char *query) { int res; - if (SQLPrepare(Statement, (SQLCHAR *) query, SQL_NTS) != SQL_SUCCESS) { - fprintf(stderr, "Unable to prepare statement\n"); - exit(1); - } + CHK(SQLPrepare, (Statement, (SQLCHAR *) query, SQL_NTS)); - if (SQLExecute(Statement) != SQL_SUCCESS) { - fprintf(stderr, "Unable to execute statement\n"); - exit(1); - } + CHK(SQLExecute, (Statement)); res = SQLFetch(Statement); if (res != SQL_SUCCESS && res != SQL_SUCCESS_WITH_INFO) { commit d49abfe40b4b73fc27676fcd5ef742493cdda99a Author: freddy77 Date: Thu Jan 31 09:13:05 2008 +0000 reuse code diff --git a/ChangeLog b/ChangeLog index 800bfc2..0e5bc0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jan 21 10:12:42 CET 2008 Frediano Ziglio + * src/odbc/unittests/convert_error.c src/odbc/unittests/genparams.c: + - more reuse + Tue Jan 29 15:28:32 CET 2008 Frediano Ziglio * src/odbc/unittests/array_out.c src/odbc/unittests/common.c: * src/odbc/unittests/common.h src/odbc/unittests/compute.c: @@ -128,4 +132,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2480 2008/01/29 14:30:48 freddy77 Exp $ +$Id: ChangeLog,v 1.2481 2008/01/31 09:13:05 freddy77 Exp $ diff --git a/src/odbc/unittests/convert_error.c b/src/odbc/unittests/convert_error.c index 29c8c93..68a70ef 100644 --- a/src/odbc/unittests/convert_error.c +++ b/src/odbc/unittests/convert_error.c @@ -4,33 +4,11 @@ */ #include "common.h" -static char software_version[] = "$Id: convert_error.c,v 1.7 2005/08/03 06:24:50 freddy77 Exp $"; +static char software_version[] = "$Id: convert_error.c,v 1.8 2008/01/31 09:13:08 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static int test_num = 0; -static int -success(int ident, SQLRETURN r) -{ - if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) - return 1; - printf("failed: num:%d ident:%d sqlreturn:%d\n", test_num, ident, (int) r); - - if (Statement) { - SQLCHAR buf[4096]; - SQLCHAR state[6]; - SQLINTEGER nativeerrorcode; - SQLSMALLINT tmp; - - memset(state, 0, sizeof(state)); - memset(buf, 0, sizeof(buf)); - SQLGetDiagRec(SQL_HANDLE_STMT, Statement, 1, state, &nativeerrorcode, buf, 4096, &tmp); - printf("%s\n", buf); - } - Disconnect(); - exit(1); -} - static void Test(const char *bind1, SQLSMALLINT type1, const char *bind2, SQLSMALLINT type2) { @@ -44,14 +22,13 @@ Test(const char *bind1, SQLSMALLINT type1, const char *bind2, SQLSMALLINT type2) ++test_num; sprintf(sql, "insert into #test_output values (%s, %s)", bind1, bind2); - success(2, SQLPrepare(Statement, (SQLCHAR *) sql, strlen(sql))); + CHK(SQLPrepare, (Statement, (SQLCHAR *) sql, strlen(sql))); if (bind1[0] == '?') - success(3, SQLBindParameter(Statement, id++, SQL_PARAM_INPUT, SQL_C_LONG, type1, 3, 0, &test_num, 0, &ind)); + CHK(SQLBindParameter, (Statement, id++, SQL_PARAM_INPUT, SQL_C_LONG, type1, 3, 0, &test_num, 0, &ind)); if (bind2[0] == '?') - success(4, - SQLBindParameter(Statement, id++, SQL_PARAM_INPUT, SQL_C_CHAR, type2, strlen(val) + 1, 0, (SQLCHAR *) val, + CHK(SQLBindParameter, (Statement, id++, SQL_PARAM_INPUT, SQL_C_CHAR, type2, strlen(val) + 1, 0, (SQLCHAR *) val, 0, &ind)); - success(5, SQLExecute(Statement)); + CHK(SQLExecute, (Statement)); } int diff --git a/src/odbc/unittests/genparams.c b/src/odbc/unittests/genparams.c index 9eb1b4f..96f153b 100644 --- a/src/odbc/unittests/genparams.c +++ b/src/odbc/unittests/genparams.c @@ -4,7 +4,7 @@ /* Test various type from odbc and to odbc */ -static char software_version[] = "$Id: genparams.c,v 1.24 2008/01/29 14:30:48 freddy77 Exp $"; +static char software_version[] = "$Id: genparams.c,v 1.25 2008/01/31 09:13:08 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #ifdef TDS_NO_DM @@ -124,10 +124,8 @@ TestInput(SQLSMALLINT out_c_type, const char *type, SQLSMALLINT out_sql_type, co if (use_cursors) { ResetStatement(); - if (SQLSetStmtAttr(Statement, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, 0) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLSetStmtAttr error"); - if (SQLSetStmtAttr(Statement, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, 0) != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLSetStmtAttr error"); + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER) SQL_SCROLLABLE, 0)); + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_CURSOR_TYPE, (SQLPOINTER) SQL_CURSOR_DYNAMIC, 0)); } /* insert data using prepared statements */ @@ -136,9 +134,7 @@ TestInput(SQLSMALLINT out_c_type, const char *type, SQLSMALLINT out_sql_type, co SQLRETURN rc; out_len = 1; - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, out_c_type, out_sql_type, 20, 0, out_buf, sizeof(out_buf), &out_len) != - SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to bind input parameter"); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, out_c_type, out_sql_type, 20, 0, out_buf, sizeof(out_buf), &out_len)); rc = SQLExecDirect(Statement, (SQLCHAR *) sbuf, SQL_NTS); if (rc != SQL_SUCCESS && rc != SQL_NO_DATA) commit d55aa0695496bec96daf4d7fb01a91431e0462b5 Author: freddy77 Date: Mon Feb 4 07:51:10 2008 +0000 fix silly memory leak diff --git a/ChangeLog b/ChangeLog index 0e5bc0f..8256c3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Mon Feb 04 08:49:58 CET 2008 Frediano Ziglio + * src/tds/convert.c: fix silly memory leak + Thu Jan 21 10:12:42 CET 2008 Frediano Ziglio * src/odbc/unittests/convert_error.c src/odbc/unittests/genparams.c: - more reuse @@ -132,4 +135,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2481 2008/01/31 09:13:05 freddy77 Exp $ +$Id: ChangeLog,v 1.2482 2008/02/04 07:51:10 freddy77 Exp $ diff --git a/src/tds/convert.c b/src/tds/convert.c index fa8dbd1..67ea545 100644 --- a/src/tds/convert.c +++ b/src/tds/convert.c @@ -64,7 +64,7 @@ #include #endif -TDS_RCSID(var, "$Id: convert.c,v 1.179 2007/12/31 10:06:50 freddy77 Exp $"); +TDS_RCSID(var, "$Id: convert.c,v 1.180 2008/02/04 07:51:11 freddy77 Exp $"); typedef unsigned short utf16_t; @@ -1958,6 +1958,7 @@ string_to_datetime(const char *instr, int desttype, CONV_RESULT * cr) 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; } commit 18dedd394149a835f6f90602af7c56cdc9482a10 Author: freddy77 Date: Tue Feb 5 09:46:33 2008 +0000 deal with SQLWCHAR type diff --git a/src/odbc/sqlwchar.c b/src/odbc/sqlwchar.c new file mode 100644 index 0000000..61eb5a7 --- /dev/null +++ b/src/odbc/sqlwchar.c @@ -0,0 +1,40 @@ +/* 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. + */ + +#if HAVE_CONFIG_H +#include +#endif /* HAVE_CONFIG_H */ + +#include +#include + +#include "tdsodbc.h" + +TDS_RCSID(var, "$Id: sqlwchar.c,v 1.1 2008/02/05 09:46:33 freddy77 Exp $"); + +#if SIZEOF_SQLWCHAR != SIZEOF_WCHAR_T +size_t sqlwcslen(const SQLWCHAR * s) +{ + size_t res = 0; + while (*s) + ++s, ++res; + return res; +} +#endif + commit 1f108b0482cd647bb38ad17a0bed1b301682b06a Author: freddy77 Date: Tue Feb 5 10:03:57 2008 +0000 test NCHAR and SQL_C_DEFAULT diff --git a/src/odbc/unittests/wchar.c b/src/odbc/unittests/wchar.c new file mode 100644 index 0000000..92bb084 --- /dev/null +++ b/src/odbc/unittests/wchar.c @@ -0,0 +1,38 @@ +#include "common.h" + +/* test SQL_C_DEFAULT with NCHAR type */ + +static char software_version[] = "$Id: wchar.c,v 1.1 2008/02/05 10:03:57 freddy77 Exp $"; +static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; + +int +main(int argc, char *argv[]) +{ + char buf[102]; + SQLLEN ind; + int failed = 0; + + /* TODO remove if not neeeded */ + use_odbc_version3 = 1; + Connect(); + + SQLBindCol(Statement, 1, SQL_C_DEFAULT, buf, 100, &ind); + Command(Statement, "SELECT CONVERT(NCHAR(10), 'Pippo 123')"); + + /* get data */ + memset(buf, 0, sizeof(buf)); + SQLFetch(Statement); + + SQLMoreResults(Statement); + SQLMoreResults(Statement); + + Disconnect(); + + if (strcmp(buf, "Pippo 123 ") != 0) { + fprintf(stderr, "Wrong results '%s'\n", buf); + failed = 1; + } + + return failed ? 1 : 0; +} + commit 332bf81cc62288f01164db84b316a01f7e8bce8f Author: freddy77 Date: Tue Feb 5 15:01:28 2008 +0000 conversion test improve diff --git a/ChangeLog b/ChangeLog index 8256c3a..f167c34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Feb 05 15:59:04 CET 2008 Frediano Ziglio + * src/tds/unittests/t0007.c: + - improve SYBINT8 conversions testing + Mon Feb 04 08:49:58 CET 2008 Frediano Ziglio * src/tds/convert.c: fix silly memory leak @@ -135,4 +139,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2482 2008/02/04 07:51:10 freddy77 Exp $ +$Id: ChangeLog,v 1.2483 2008/02/05 15:01:28 freddy77 Exp $ diff --git a/src/tds/unittests/t0007.c b/src/tds/unittests/t0007.c index d867fbe..1c20101 100644 --- a/src/tds/unittests/t0007.c +++ b/src/tds/unittests/t0007.c @@ -20,7 +20,7 @@ #include "common.h" #include -static char software_version[] = "$Id: t0007.c,v 1.14 2006/06/08 08:19:05 freddy77 Exp $"; +static char software_version[] = "$Id: t0007.c,v 1.15 2008/02/05 15:01:29 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static TDSCONTEXT ctx; @@ -39,6 +39,7 @@ test0(const char *src, int len, int dsttype, const char *result) if (res < 0) strcpy(buf, "error"); else { + buf[0] = 0; switch (dsttype) { case SYBINT1: sprintf(buf, "%d", cr.ti); @@ -49,6 +50,9 @@ test0(const char *src, int len, int dsttype, const char *result) case SYBINT4: sprintf(buf, "%d", cr.i); break; + case SYBINT8: + sprintf(buf, "0x%08x%08x", (unsigned int) ((cr.bi >> 32) & 0xfffffffflu), (unsigned int) (cr.bi & 0xfffffffflu)); + break; case SYBUNIQUE: sprintf(buf, "%08X-%04X-%04X-%02X%02X%02X%02X" "%02X%02X%02X%02X", @@ -92,9 +96,42 @@ main(int argc, char **argv) test("123", SYBINT1, "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("+", 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(" - 1234 a", SYBINT8, "error"); + test("", SYBINT8, "0x0000000000000000"); + test(" ", SYBINT8, "0x0000000000000000"); + test(" 123", SYBINT8, "0x000000000000007b"); + test(" 123 ", SYBINT8, "0x000000000000007b"); + test(" + 123 ", SYBINT8, "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 */ printf("overflow checks...\n"); + test("9223372036854775807", SYBINT8, "0x7fffffffffffffff"); + test("9223372036854775808", SYBINT8, "error"); + test("-9223372036854775808", SYBINT8, "0x8000000000000000"); + test("-9223372036854775809", SYBINT8, "error"); test("2147483647", SYBINT4, "2147483647"); test("2147483648", SYBINT4, "error"); test("-2147483648", SYBINT4, "-2147483648"); @@ -121,6 +158,7 @@ main(int argc, char **argv) /* test not terminated string */ test0("1234", 2, SYBINT4, "12"); + test0("123456", 4, SYBINT8, "0x00000000000004d2"); /* some test for unique */ printf("unique type...\n"); commit 21dd3e0ae79e8b08d30c0553d19c359127307cc1 Author: freddy77 Date: Wed Feb 6 08:28:10 2008 +0000 use printf instead of fprintf(stdout...) diff --git a/ChangeLog b/ChangeLog index f167c34..d6e621a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 06 09:27:10 CET 2008 Frediano Ziglio + * src/odbc/unittests/rpc.c src/odbc/unittests/cursor5.c: + * src/odbc/unittests/cursor4.c src/odbc/unittests/cursor3.c: + - use printf instead of fprintf(stdout...) + Tue Feb 05 15:59:04 CET 2008 Frediano Ziglio * src/tds/unittests/t0007.c: - improve SYBINT8 conversions testing @@ -139,4 +144,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2483 2008/02/05 15:01:28 freddy77 Exp $ +$Id: ChangeLog,v 1.2484 2008/02/06 08:28:10 freddy77 Exp $ diff --git a/src/odbc/unittests/cursor3.c b/src/odbc/unittests/cursor3.c index 6ef62c8..5a6849f 100644 --- a/src/odbc/unittests/cursor3.c +++ b/src/odbc/unittests/cursor3.c @@ -1,7 +1,7 @@ /* Tests 2 active statements */ #include "common.h" -static char software_version[] = "$Id: cursor3.c,v 1.5 2008/01/29 14:30:48 freddy77 Exp $"; +static char software_version[] = "$Id: cursor3.c,v 1.6 2008/02/06 08:28:10 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -126,14 +126,14 @@ main(int argc, char **argv) rcode = SQLGetData(m_hstmt1, 2, SQL_C_CHAR, (SQLPOINTER) buff, sizeof(buff), &ind); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLGetData 1"); - fprintf(stdout, ">> Fetch from 1: [%s]\n", buff); + printf(">> Fetch from 1: [%s]\n", buff); rcode = SQLFetch(m_hstmt2); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SQLFetch 2"); rcode = SQLGetData(m_hstmt2, 2, SQL_C_CHAR, (SQLPOINTER) buff, sizeof(buff), &ind); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt2, "SQLGetData 2"); - fprintf(stdout, ">> Fetch from 2: [%s]\n", buff); + printf(">> Fetch from 2: [%s]\n", buff); rcode = SQLCloseCursor(m_hstmt1); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLCloseCursor 1"); diff --git a/src/odbc/unittests/cursor4.c b/src/odbc/unittests/cursor4.c index 363ebfd..c1ac6cd 100755 --- a/src/odbc/unittests/cursor4.c +++ b/src/odbc/unittests/cursor4.c @@ -5,7 +5,7 @@ #include "common.h" -static char software_version[] = "$Id: cursor4.c,v 1.5 2008/01/29 14:30:48 freddy77 Exp $"; +static char software_version[] = "$Id: cursor4.c,v 1.6 2008/02/06 08:28:10 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -108,7 +108,7 @@ main(int argc, char **argv) rcode = SQLGetData(m_hstmt1, 1, SQL_C_CHAR, buff, sizeof(buff), &ind); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLGetData"); - fprintf(stdout, ">> New value after update = [%s] (should be [xxx]) \n", buff); + printf(">> New value after update = [%s] (should be [xxx]) \n", buff); rcode = SQLFreeHandle(SQL_HANDLE_STMT, (SQLHANDLE) m_hstmt1); CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt1, "SQLFreeHandle 1"); diff --git a/src/odbc/unittests/cursor5.c b/src/odbc/unittests/cursor5.c index d8c4540..9b300f5 100755 --- a/src/odbc/unittests/cursor5.c +++ b/src/odbc/unittests/cursor5.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: cursor5.c,v 1.4 2008/01/29 14:30:48 freddy77 Exp $"; +static char software_version[] = "$Id: cursor5.c,v 1.5 2008/02/06 08:28:10 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define CHECK_RCODE(t,h,m) \ @@ -47,9 +47,9 @@ doFetch(SQLHSTMT m_hstmt, int dir, int pos) CHECK_RCODE(SQL_HANDLE_STMT, m_hstmt, "SQLFetchScroll"); if (rcode != SQL_NO_DATA) - fprintf(stdout, ">> 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"); + 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 - fprintf(stdout, ">> fetch %2d %10d : no data found\n", dir, pos); + printf(">> fetch %2d %10d : no data found\n", dir, pos); } int diff --git a/src/odbc/unittests/rpc.c b/src/odbc/unittests/rpc.c index 5543dd4..23d8436 100644 --- a/src/odbc/unittests/rpc.c +++ b/src/odbc/unittests/rpc.c @@ -6,7 +6,7 @@ #include "common.h" #include -static char software_version[] = "$Id: rpc.c,v 1.8 2007/11/26 06:25:11 freddy77 Exp $"; +static char software_version[] = "$Id: rpc.c,v 1.9 2008/02/06 08:28:10 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static const char procedure_sql[] = @@ -38,7 +38,7 @@ init_proc(const char *name) static char cmd[4096]; if (name[0] != '#') { - fprintf(stdout, "Dropping procedure %s\n", name); + 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); if (!SQL_SUCCEEDED(SQLExecDirect(Statement, (SQLCHAR *) cmd, SQL_NTS))) { @@ -47,14 +47,14 @@ init_proc(const char *name) } } - fprintf(stdout, "Creating procedure %s\n", name); + printf("Creating procedure %s\n", name); sprintf(cmd, procedure_sql, name); if (!SQL_SUCCEEDED(SQLExecDirect(Statement, (SQLCHAR *) cmd, SQL_NTS))) { if (name[0] == '#') - fprintf(stdout, "Failed to create procedure %s. Wrong permission or not MSSQL.\n", name); + printf("Failed to create procedure %s. Wrong permission or not MSSQL.\n", name); else - fprintf(stdout, "Failed to create procedure %s. Wrong permission.\n", name); + printf("Failed to create procedure %s. Wrong permission.\n", name); CheckReturn(); exit(1); } commit 33ba1e2143a8cdf5a80e28dc0b3e1641d1190c2c Author: freddy77 Date: Wed Feb 6 08:29:53 2008 +0000 simplify test diff --git a/ChangeLog b/ChangeLog index d6e621a..49811a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Wed Feb 06 09:28:55 CET 2008 Frediano Ziglio + * src/odbc/unittests/testodbc.c: simplify + Wed Feb 06 09:27:10 CET 2008 Frediano Ziglio * src/odbc/unittests/rpc.c src/odbc/unittests/cursor5.c: * src/odbc/unittests/cursor4.c src/odbc/unittests/cursor3.c: @@ -144,4 +147,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2484 2008/02/06 08:28:10 freddy77 Exp $ +$Id: ChangeLog,v 1.2485 2008/02/06 08:29:53 freddy77 Exp $ diff --git a/src/odbc/unittests/testodbc.c b/src/odbc/unittests/testodbc.c index c800bcb..5ab9325 100644 --- a/src/odbc/unittests/testodbc.c +++ b/src/odbc/unittests/testodbc.c @@ -10,7 +10,7 @@ #include "common.h" -static char software_version[] = "$Id: testodbc.c,v 1.9 2005/06/29 07:21:24 freddy77 Exp $"; +static char software_version[] = "$Id: testodbc.c,v 1.10 2008/02/06 08:29:53 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #ifdef DEBUG @@ -40,25 +40,25 @@ typedef struct * Output ODBC errors. */ static void -DispODBCErrs(SQLHENV envHandle, SQLHDBC connHandle, SQLHSTMT statementHandle) +DispODBCErrs(void) { SQLCHAR buffer[256]; SQLCHAR sqlState[16]; /* Statement errors */ - if (statementHandle) { - while (SQLError(envHandle, connHandle, statementHandle, sqlState, 0, buffer, sizeof(buffer), 0) == SQL_SUCCESS) { + if (Statement) { + while (SQLError(Environment, Connection, Statement, sqlState, 0, buffer, sizeof(buffer), 0) == SQL_SUCCESS) { AB_ERROR(("%s, SQLSTATE=%s", buffer, sqlState)); } } /* Connection errors */ - while (SQLError(envHandle, connHandle, SQL_NULL_HSTMT, sqlState, 0, buffer, sizeof(buffer), 0) == SQL_SUCCESS) { + while (SQLError(Environment, Connection, SQL_NULL_HSTMT, sqlState, 0, buffer, sizeof(buffer), 0) == SQL_SUCCESS) { AB_ERROR(("%s, SQLSTATE=%s", buffer, sqlState)); } /* Environmental errors */ - while (SQLError(envHandle, SQL_NULL_HDBC, SQL_NULL_HSTMT, sqlState, 0, buffer, sizeof(buffer), 0) == SQL_SUCCESS) { + while (SQLError(Environment, SQL_NULL_HDBC, SQL_NULL_HSTMT, sqlState, 0, buffer, sizeof(buffer), 0) == SQL_SUCCESS) { AB_ERROR(("%s, SQLSTATE=%s", buffer, sqlState)); } } @@ -67,7 +67,7 @@ DispODBCErrs(SQLHENV envHandle, SQLHDBC connHandle, SQLHSTMT statementHandle) * Output ODBC diagnostics. Only used for 'raw' ODBC tests. */ static void -DispODBCDiags(SQLHSTMT statementHandle) +DispODBCDiags(void) { SQLSMALLINT recNumber; SQLCHAR sqlState[10]; @@ -82,7 +82,7 @@ DispODBCDiags(SQLHSTMT statementHandle) AB_FUNCT(("DispODBCDiags (in)")); do { - status = SQLGetDiagRec(SQL_HANDLE_STMT, statementHandle, recNumber, + status = SQLGetDiagRec(SQL_HANDLE_STMT, Statement, recNumber, sqlState, &nativeError, messageText, bufferLength, &textLength); if (status != SQL_SUCCESS) { /* No data mean normal end of iteration. Anything else is error. */ @@ -137,13 +137,13 @@ TestRawODBCPreparedQuery(void) "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(Statement) == SQL_SUCCESS); - strcpy((char *) (queryString), "SELECT * FROM #Products WHERE SupplierID = ?"); + strcpy((char *) queryString, "SELECT * FROM #Products WHERE SupplierID = ?"); status = SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &supplierId, 0, &lenOrInd); if (status != SQL_SUCCESS) { AB_ERROR(("SQLBindParameter failed")); - DispODBCErrs(Environment, Connection, Statement); - DispODBCDiags(Statement); + DispODBCErrs(); + DispODBCDiags(); AB_FUNCT(("TestRawODBCPreparedQuery (out): error")); return FALSE; } @@ -158,8 +158,8 @@ TestRawODBCPreparedQuery(void) status = SQLExecute(Statement); if (status != SQL_SUCCESS) { AB_ERROR(("Execute failed")); - DispODBCErrs(Environment, Connection, Statement); - DispODBCDiags(Statement); + DispODBCErrs(); + DispODBCDiags(); AB_FUNCT(("TestRawODBCPreparedQuery (out): error")); return FALSE; } @@ -228,13 +228,13 @@ TestRawODBCDirectQuery(void) "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(Statement) == SQL_SUCCESS); - strcpy((char *) (queryString), "SELECT * FROM #Products WHERE SupplierID = ?"); + strcpy((char *) queryString, "SELECT * FROM #Products WHERE SupplierID = ?"); status = SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &supplierId, 0, &lenOrInd); if (status != SQL_SUCCESS) { AB_ERROR(("SQLBindParameter failed")); - DispODBCErrs(Environment, Connection, Statement); - DispODBCDiags(Statement); + DispODBCErrs(); + DispODBCDiags(); AB_FUNCT(("TestRawODBCDirectQuery (out): error")); return FALSE; } @@ -242,8 +242,8 @@ TestRawODBCDirectQuery(void) status = SQLExecDirect(Statement, queryString, SQL_NTS); if (status != SQL_SUCCESS) { AB_ERROR(("Execute failed")); - DispODBCErrs(Environment, Connection, Statement); - DispODBCDiags(Statement); + DispODBCErrs(); + DispODBCDiags(); AB_FUNCT(("TestRawODBCDirectQuery (out): error")); return FALSE; } @@ -581,8 +581,8 @@ TestRawODBCGuid(void) return TRUE; odbcfail: - DispODBCErrs(Environment, Connection, Statement); - DispODBCDiags(Statement); + DispODBCErrs(); + DispODBCDiags(); AB_FUNCT(("TestRawODBCGuid (out): error")); return FALSE; } commit d7c53b3a37cdfc0160316ccfb2f86d0668b2fbbd Author: freddy77 Date: Thu Feb 7 22:05:36 2008 +0000 improve bigint test diff --git a/src/tds/unittests/t0007.c b/src/tds/unittests/t0007.c index 1c20101..161280b 100644 --- a/src/tds/unittests/t0007.c +++ b/src/tds/unittests/t0007.c @@ -20,7 +20,7 @@ #include "common.h" #include -static char software_version[] = "$Id: t0007.c,v 1.15 2008/02/05 15:01:29 freddy77 Exp $"; +static char software_version[] = "$Id: t0007.c,v 1.16 2008/02/07 22:05:36 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static TDSCONTEXT ctx; @@ -111,6 +111,7 @@ main(int argc, char **argv) test(" - ", SYBINT4, "error"); test(" - 1234 ", SYBINT8, "0xfffffffffffffb2e"); + test("1234x", SYBINT8, "error"); test(" - 1234 a", SYBINT8, "error"); test("", SYBINT8, "0x0000000000000000"); test(" ", SYBINT8, "0x0000000000000000"); @@ -155,6 +156,10 @@ main(int argc, char **argv) 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"); /* test not terminated string */ test0("1234", 2, SYBINT4, "12"); commit 47a97f5e23af4b3281f5f710d0ee14e3541b949f Author: freddy77 Date: Fri Feb 8 08:31:19 2008 +0000 reuse code and macros diff --git a/ChangeLog b/ChangeLog index 49811a7..cc65a1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Fri Feb 08 09:30:48 CET 2008 Frediano Ziglio + * src/odbc/unittests/rpc.c: reuse code and macros + Wed Feb 06 09:28:55 CET 2008 Frediano Ziglio * src/odbc/unittests/testodbc.c: simplify @@ -147,4 +150,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2485 2008/02/06 08:29:53 freddy77 Exp $ +$Id: ChangeLog,v 1.2486 2008/02/08 08:31:19 freddy77 Exp $ diff --git a/src/odbc/unittests/rpc.c b/src/odbc/unittests/rpc.c index 23d8436..3b58e29 100644 --- a/src/odbc/unittests/rpc.c +++ b/src/odbc/unittests/rpc.c @@ -6,7 +6,7 @@ #include "common.h" #include -static char software_version[] = "$Id: rpc.c,v 1.9 2008/02/06 08:28:10 freddy77 Exp $"; +static char software_version[] = "$Id: rpc.c,v 1.10 2008/02/08 08:31:19 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static const char procedure_sql[] = @@ -97,8 +97,7 @@ Test(const char *name) printf("executing SQLAllocStmt\n"); - if (SQLAllocStmt(Connection, &stmt) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to allocate statement"); + CHK(SQLAllocStmt, (Connection, &stmt)); for( ipar=0; ipar < sizeof(args)/sizeof(args[0]); ipar++ ) { printf("executing SQLBindParameter for parameter %d\n", 1+ipar); @@ -108,7 +107,7 @@ Test(const char *name) memset(args[ipar].ParameterValuePtr, 0, args[ipar].BufferLength); memset(args[ipar].ParameterValuePtr, 'a', args[ipar].BufferLength - 1); } - erc = SQLBindParameter ( stmt, 1+ipar + CHK(SQLBindParameter, ( stmt, 1+ipar , args[ipar].InputOutputType , args[ipar].ValueType , args[ipar].ParameterType @@ -117,58 +116,41 @@ Test(const char *name) , args[ipar].ParameterValuePtr , args[ipar].BufferLength , &args[ipar].ind - ); - if (erc != SQL_SUCCESS) { - fprintf(stderr, "Failed: SQLBindParameter\n"); - exit(1); - } + )); } - - sprintf(call_cmd, "{?=call %s(?,?,?,?,?)}", name ); printf("executing SQLPrepare: %s\n", call_cmd); - if (SQLPrepare(stmt, (SQLCHAR *) call_cmd, SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to prepare statement"); + CHK(SQLPrepare, (stmt, (SQLCHAR *) call_cmd, SQL_NTS)); printf("executing SQLExecute\n"); if (! SQL_SUCCEEDED(SQLExecute(stmt))) { erc = SQLGetDiagRec(SQL_HANDLE_STMT, stmt, 1, sqlstate, NULL, msg, sizeof(msg), NULL); fprintf(stderr, "SQL error %s -- %s\n", sqlstate, msg); ODBC_REPORT_ERROR("Unable to execute SQLExecute\n"); - } do { - static const char dashes[] = "------------------------------", - *dashes5 = &dashes[25], - *dashes15 = &dashes[15]; + static const char dashes[] = "------------------------------"; int nrows; SQLSMALLINT icol, ncols; - SQLCHAR name[256] = ""; - SQLSMALLINT namelen; - SQLSMALLINT type; - SQLSMALLINT scale; - SQLSMALLINT nullable; - + SQLCHAR name[256] = ""; + SQLSMALLINT namelen; + SQLSMALLINT type; + SQLSMALLINT scale; + SQLSMALLINT nullable; + printf("executing SQLNumResultCols for result set %d\n", ++iresults); - if((erc = SQLNumResultCols(stmt, &ncols)) != SQL_SUCCESS) { - ODBC_REPORT_ERROR("Unable to execute SQLNumResultCols\n"); - } + CHK(SQLNumResultCols, (stmt, &ncols)); printf("executing SQLDescribeCol for %d column%c\n", ncols, (ncols == 1? ' ' : 's')); - printf("%-5s %-15s %5s %5s %5s %8s\n", "col", "name", "type", "size", "scale", "nullable"); - printf("%-5s %-15s %5s %5s %5s %8s\n", dashes5, dashes15, dashes5, dashes5, dashes5, &dashes[30-8]); + 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; - erc = SQLDescribeCol( stmt, icol, name, sizeof(name), - &namelen, &type, &size, &scale, &nullable); - if (erc != SQL_SUCCESS) { - erc = SQLGetDiagRec(SQL_HANDLE_STMT, stmt, 1, sqlstate, NULL, msg, sizeof(msg), NULL); - fprintf(stderr, "SQL error %s -- %s\n", sqlstate, msg); - ODBC_REPORT_ERROR("Unable to execute SQLDescribeCol\n"); - } + SQLULEN size; + CHK(SQLDescribeCol, (stmt, icol, name, sizeof(name), + &namelen, &type, &size, &scale, &nullable)); printf("%-5d %-15s %5d %5ld %5d %8c\n", icol, name, type, (long int)size, scale, (nullable? 'Y' : 'N')); } @@ -238,8 +220,7 @@ Test(const char *name) } printf("executing SQLFreeStmt\n"); - if (SQLFreeStmt(stmt, SQL_DROP) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to free statement"); + CHK(SQLFreeStmt, (stmt, SQL_DROP)); for (ipar = 0; ipar < sizeof(args)/sizeof(args[0]); ++ipar) if (args[ipar].BufferLength > 0) @@ -268,12 +249,7 @@ main(int argc, char *argv[]) Test(proc_name); printf("dropping procedure\n"); - if (!SQL_SUCCEEDED(SQLExecDirect(Statement, (SQLCHAR *) drop_proc, SQL_NTS))) { - printf("Unable to drop procedure\n"); - CheckReturn(); - exit(1); - } - + Command(Statement, drop_proc); Disconnect(); commit 4c9b9c1626339d75cbf2cc077fbdebd3674408c8 Author: freddy77 Date: Fri Feb 8 08:33:09 2008 +0000 *** empty log message *** diff --git a/src/odbc/unittests/.cvsignore b/src/odbc/unittests/.cvsignore index 2aea2d3..fb6855d 100644 --- a/src/odbc/unittests/.cvsignore +++ b/src/odbc/unittests/.cvsignore @@ -66,3 +66,4 @@ hidden blob1 cancel test64 +wchar commit 656c4bad229439cc87140c70429165dcfa1881ea Author: freddy77 Date: Fri Feb 8 09:28:01 2008 +0000 more reuse in tests diff --git a/ChangeLog b/ChangeLog index cc65a1b..393b4a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Feb 08 10:26:36 CET 2008 Frediano Ziglio + * src/odbc/unittests/Makefile.am src/odbc/unittests/describecol.in: + * src/odbc/unittests/params.c src/odbc/unittests/putdata.c: + * src/odbc/unittests/raiserror.c src/odbc/unittests/rownumber.c: + * src/odbc/unittests/t0001.c src/odbc/unittests/t0002.c: + * src/odbc/unittests/testodbc.c src/odbc/unittests/timeout3.c: + - more reuse and unification + Fri Feb 08 09:30:48 CET 2008 Frediano Ziglio * src/odbc/unittests/rpc.c: reuse code and macros @@ -150,4 +158,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2486 2008/02/08 08:31:19 freddy77 Exp $ +$Id: ChangeLog,v 1.2487 2008/02/08 09:28:01 freddy77 Exp $ diff --git a/src/odbc/unittests/Makefile.am b/src/odbc/unittests/Makefile.am index 7fca97b..f9e14f9 100644 --- a/src/odbc/unittests/Makefile.am +++ b/src/odbc/unittests/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.71 2008/01/10 16:05:59 freddy77 Exp $ +# $Id: Makefile.am,v 1.72 2008/02/08 09:28:03 freddy77 Exp $ TESTS = \ t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT)\ t0004$(EXEEXT) connect$(EXEEXT) print$(EXEEXT)\ @@ -21,7 +21,7 @@ TESTS = \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) \ - cancel$(EXEEXT) + cancel$(EXEEXT) wchar$(EXEEXT) check_PROGRAMS = $(TESTS) @@ -81,6 +81,7 @@ attributes_SOURCES = attributes.c common.c common.h hidden_SOURCES = hidden.c common.c common.h blob1_SOURCES = blob1.c common.c common.h cancel_SOURCES = cancel.c common.c common.h +wchar_SOURCES = wchar.c common.c common.h AM_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) -DFREETDS_SRCDIR=\"$(srcdir)\" if MINGW32 diff --git a/src/odbc/unittests/describecol.in b/src/odbc/unittests/describecol.in index aa6a63a..b1aaa7f 100644 --- a/src/odbc/unittests/describecol.in +++ b/src/odbc/unittests/describecol.in @@ -153,25 +153,21 @@ attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 11 select nchar(12) 'hi!' -## TODO -#attr SQL_COLUMN_LENGTH 24 +attr SQL_COLUMN_LENGTH 24 attr SQL_COLUMN_PRECISION 12 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 12 -## TODO -#attr SQL_DESC_OCTET_LENGTH 24 +attr SQL_DESC_OCTET_LENGTH 24 attr SQL_DESC_PRECISION 12 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 12 select nvarchar(13) 'hi!' -## TODO -#attr SQL_COLUMN_LENGTH 26 +attr SQL_COLUMN_LENGTH 26 attr SQL_COLUMN_PRECISION 13 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 13 -## TODO -#attr SQL_DESC_OCTET_LENGTH 26 +attr SQL_DESC_OCTET_LENGTH 26 attr SQL_DESC_PRECISION 13 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 13 @@ -187,13 +183,11 @@ attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 4096 select ntext 'hi!' -## TODO -#attr SQL_COLUMN_LENGTH 4096 +attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 2048 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 2048 -## TODO -#attr SQL_DESC_OCTET_LENGTH 4096 +attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 2048 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 2048 @@ -385,25 +379,21 @@ attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 11 select nchar(12) 'hi!' -## TODO -#attr SQL_COLUMN_LENGTH 24 +attr SQL_COLUMN_LENGTH 24 attr SQL_COLUMN_PRECISION 12 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 12 -## TODO -#attr SQL_DESC_OCTET_LENGTH 24 +attr SQL_DESC_OCTET_LENGTH 24 attr SQL_DESC_PRECISION 12 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 12 select nvarchar(13) 'hi!' -## TODO -#attr SQL_COLUMN_LENGTH 26 +attr SQL_COLUMN_LENGTH 26 attr SQL_COLUMN_PRECISION 13 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 13 -## TODO -#attr SQL_DESC_OCTET_LENGTH 26 +attr SQL_DESC_OCTET_LENGTH 26 attr SQL_DESC_PRECISION 13 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 13 @@ -419,13 +409,11 @@ attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 4096 select ntext 'hi!' -## TODO -#attr SQL_COLUMN_LENGTH 4096 +attr SQL_COLUMN_LENGTH 4096 attr SQL_COLUMN_PRECISION 2048 attr SQL_COLUMN_SCALE 0 attr SQL_DESC_LENGTH 2048 -## TODO -#attr SQL_DESC_OCTET_LENGTH 4096 +attr SQL_DESC_OCTET_LENGTH 4096 attr SQL_DESC_PRECISION 2048 attr SQL_DESC_SCALE 0 attr SQL_DESC_DISPLAY_SIZE 2048 diff --git a/src/odbc/unittests/params.c b/src/odbc/unittests/params.c index 191066c..dc382cb 100644 --- a/src/odbc/unittests/params.c +++ b/src/odbc/unittests/params.c @@ -3,7 +3,7 @@ /* Test for store procedure and params */ /* Test from Tom Rogers */ -static char software_version[] = "$Id: params.c,v 1.8 2008/01/29 14:30:48 freddy77 Exp $"; +static char software_version[] = "$Id: params.c,v 1.9 2008/02/08 09:28:03 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; /* SP definition */ @@ -33,8 +33,7 @@ Test(int bind_before) Connect(); /* drop proc */ - if (CommandWithResult(Statement, "drop proc spTestProc") != SQL_SUCCESS) - printf("Unable to execute statement\n"); + Command(Statement, "IF OBJECT_ID('spTestProc') IS NOT NULL DROP PROC spTestProc"); /* create proc */ Command(Statement, sp_define); @@ -56,7 +55,7 @@ Test(int bind_before) CHK(SQLExecute, (Statement)); - Command(Statement, "drop proc spTestProc"); + Command(Statement, "DROP PROC spTestProc"); printf("Output:\n"); printf(" Return Code = %d\n", (int) ReturnCode); diff --git a/src/odbc/unittests/putdata.c b/src/odbc/unittests/putdata.c index a9d3878..3eff23f 100644 --- a/src/odbc/unittests/putdata.c +++ b/src/odbc/unittests/putdata.c @@ -2,7 +2,7 @@ /* Test for SQLPutData */ -static char software_version[] = "$Id: putdata.c,v 1.10 2008/01/29 14:30:48 freddy77 Exp $"; +static char software_version[] = "$Id: putdata.c,v 1.11 2008/02/08 09:28:04 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static const char test_text[] = @@ -49,8 +49,7 @@ main(int argc, char *argv[]) if (l < n) n = l; - if (SQLPutData(Statement, (char *) p, n) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Wrong result from SQLPutData"); + CHK(SQLPutData, (Statement, (char *) p, n)); p += n; n *= 2; } diff --git a/src/odbc/unittests/raiserror.c b/src/odbc/unittests/raiserror.c index 76fd66f..3395ad4 100644 --- a/src/odbc/unittests/raiserror.c +++ b/src/odbc/unittests/raiserror.c @@ -4,7 +4,7 @@ /* TODO add support for Sybase */ -static char software_version[] = "$Id: raiserror.c,v 1.20 2008/01/29 14:30:48 freddy77 Exp $"; +static char software_version[] = "$Id: raiserror.c,v 1.21 2008/02/08 09:28:04 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #define SP_TEXT "{?=call #tmp1(?,?,?)}" @@ -209,9 +209,8 @@ Test(int level) } if (!use_odbc_version3 || !g_nocount) { - result = SQLMoreResults(Statement); - if (result != SQL_SUCCESS) - ODBC_REPORT_ERROR("SQLMoreResults returned failure"); + CHK(SQLMoreResults, (Statement)); + result = SQL_SUCCESS; } CheckReturnCode(result, INVALID_RETURN); diff --git a/src/odbc/unittests/rownumber.c b/src/odbc/unittests/rownumber.c index d2c213f..55eddaf 100644 --- a/src/odbc/unittests/rownumber.c +++ b/src/odbc/unittests/rownumber.c @@ -7,7 +7,7 @@ * TODO make it work and add to Makefile.am */ -static char software_version[] = "$Id: rownumber.c,v 1.2 2005/01/14 15:03:12 freddy77 Exp $"; +static char software_version[] = "$Id: rownumber.c,v 1.3 2008/02/08 09:28:04 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void @@ -62,8 +62,8 @@ DoTest() static const char query[] = "SELECT * FROM #tmp1 ORDER BY i SELECT * FROM #tmp1 WHERE i < 3 ORDER BY i"; /* execute a batch command and check row number */ - if (SQLExecDirect(Statement, (SQLCHAR *) query, SQL_NTS) != SQL_SUCCESS) - ODBC_REPORT_ERROR("Unable to execute direct statement"); + CHK(SQLExecDirect, (Statement, (SQLCHAR *) query, SQL_NTS)); + CHECK_ROWS(-1); printf("Result %d\n", ++n); Fetch(SQL_SUCCESS); diff --git a/src/odbc/unittests/t0001.c b/src/odbc/unittests/t0001.c index 6ca6c8d..a51adea 100644 --- a/src/odbc/unittests/t0001.c +++ b/src/odbc/unittests/t0001.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: t0001.c,v 1.15 2008/01/29 14:30:49 freddy77 Exp $"; +static char software_version[] = "$Id: t0001.c,v 1.16 2008/02/08 09:28:04 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int @@ -17,8 +17,7 @@ main(int argc, char *argv[]) Connect(); - if (CommandWithResult(Statement, "drop table #odbctestdata") != SQL_SUCCESS) - printf("Unable to execute statement\n"); + Command(Statement, "if object_id('tempdb..#odbctestdata') is not null drop table #odbctestdata"); command = "create table #odbctestdata (" "col1 varchar(30) not null," diff --git a/src/odbc/unittests/t0002.c b/src/odbc/unittests/t0002.c index 8fa2830..af7cfc3 100644 --- a/src/odbc/unittests/t0002.c +++ b/src/odbc/unittests/t0002.c @@ -1,6 +1,6 @@ #include "common.h" -static char software_version[] = "$Id: t0002.c,v 1.13 2008/01/29 14:30:49 freddy77 Exp $"; +static char software_version[] = "$Id: t0002.c,v 1.14 2008/02/08 09:28:04 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int @@ -12,8 +12,7 @@ main(int argc, char *argv[]) Connect(); - if (CommandWithResult(Statement, "drop table #odbctestdata") != SQL_SUCCESS) - printf("Unable to execute statement\n"); + Command(Statement, "if object_id('tempdb..#odbctestdata') is not null drop table #odbctestdata"); Command(Statement, "create table #odbctestdata (i int)"); Command(Statement, "insert #odbctestdata values (123)"); diff --git a/src/odbc/unittests/testodbc.c b/src/odbc/unittests/testodbc.c index 5ab9325..61e80bb 100644 --- a/src/odbc/unittests/testodbc.c +++ b/src/odbc/unittests/testodbc.c @@ -10,7 +10,7 @@ #include "common.h" -static char software_version[] = "$Id: testodbc.c,v 1.10 2008/02/06 08:29:53 freddy77 Exp $"; +static char software_version[] = "$Id: testodbc.c,v 1.11 2008/02/08 09:28:04 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #ifdef DEBUG @@ -139,30 +139,11 @@ TestRawODBCPreparedQuery(void) strcpy((char *) queryString, "SELECT * FROM #Products WHERE SupplierID = ?"); - status = SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &supplierId, 0, &lenOrInd); - if (status != SQL_SUCCESS) { - AB_ERROR(("SQLBindParameter failed")); - DispODBCErrs(); - DispODBCDiags(); - AB_FUNCT(("TestRawODBCPreparedQuery (out): error")); - return FALSE; - } + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &supplierId, 0, &lenOrInd)); - status = SQLPrepare(Statement, queryString, SQL_NTS); - if (status != SQL_SUCCESS) { - AB_ERROR(("Prepare failed")); - AB_FUNCT(("TestRawODBCPreparedQuery (out): error")); - return FALSE; - } + CHK(SQLPrepare, (Statement, queryString, SQL_NTS)); - status = SQLExecute(Statement); - if (status != SQL_SUCCESS) { - AB_ERROR(("Execute failed")); - DispODBCErrs(); - DispODBCDiags(); - AB_FUNCT(("TestRawODBCPreparedQuery (out): error")); - return FALSE; - } + CHK(SQLExecute, (Statement)); count = 0; @@ -230,23 +211,9 @@ TestRawODBCDirectQuery(void) strcpy((char *) queryString, "SELECT * FROM #Products WHERE SupplierID = ?"); - status = SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &supplierId, 0, &lenOrInd); - if (status != SQL_SUCCESS) { - AB_ERROR(("SQLBindParameter failed")); - DispODBCErrs(); - DispODBCDiags(); - AB_FUNCT(("TestRawODBCDirectQuery (out): error")); - return FALSE; - } + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &supplierId, 0, &lenOrInd)); - status = SQLExecDirect(Statement, queryString, SQL_NTS); - if (status != SQL_SUCCESS) { - AB_ERROR(("Execute failed")); - DispODBCErrs(); - DispODBCDiags(); - AB_FUNCT(("TestRawODBCDirectQuery (out): error")); - return FALSE; - } + CHK(SQLExecDirect, (Statement, queryString, SQL_NTS)); count = 0; @@ -326,11 +293,7 @@ TestRawODBCGuid(void) strcpy((char *) (queryString), "INSERT INTO #pet( name, owner, species, sex, age ) \ VALUES ( 'Fang', 'Mike', 'dog', 'm', 12 );"); - status = SQLExecDirect(Statement, queryString, SQL_NTS); - if (status != SQL_SUCCESS) { - AB_ERROR(("Insert row 1 failed")); - goto odbcfail; - } + CHK(SQLExecDirect, (Statement, queryString, SQL_NTS)); AB_PRINT(("Insert row 2")); @@ -343,21 +306,10 @@ TestRawODBCGuid(void) lenOrInd = 0; age = 3; - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &age, 0, &lenOrInd) - != SQL_SUCCESS) { - AB_ERROR(("SQLBindParameter failed")); - goto odbcfail; - } + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &age, 0, &lenOrInd)); - status = SQLExecDirect(Statement, queryString, SQL_NTS); - if (status != SQL_SUCCESS) { - AB_ERROR(("Insert row 2 failed")); - goto odbcfail; - } - if (SQLFreeStmt(Statement, SQL_CLOSE) != SQL_SUCCESS) { - AB_ERROR(("Free statement failed (5)")); - goto odbcfail; - } + CHK(SQLExecDirect, (Statement, queryString, SQL_NTS)); + CHK(SQLFreeStmt, (Statement, SQL_CLOSE)); AB_PRINT(("Insert row 3")); /* @@ -369,16 +321,8 @@ TestRawODBCGuid(void) lenOrInd = SQL_NTS; strcpy((char *) (guid), "87654321-4321-4321-4321-123456789abc"); - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_GUID, 0, 0, guid, 0, &lenOrInd) - != SQL_SUCCESS) { - AB_ERROR(("SQLBindParameter failed")); - goto odbcfail; - } - status = SQLExecDirect(Statement, queryString, SQL_NTS); - if (status != SQL_SUCCESS) { - AB_ERROR(("Insert row 3 failed")); - goto odbcfail; - } + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_GUID, 0, 0, guid, 0, &lenOrInd)); + CHK(SQLExecDirect, (Statement, queryString, SQL_NTS)); AB_PRINT(("Insert row 4")); /* @@ -390,16 +334,8 @@ TestRawODBCGuid(void) lenOrInd = SQL_NTS; strcpy((char *) (guid), "1234abcd-abcd-abcd-abcd-123456789abc"); - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 36, 0, guid, 0, &lenOrInd) - != SQL_SUCCESS) { - AB_ERROR(("SQLBindParameter failed")); - goto odbcfail; - } - status = SQLExecDirect(Statement, queryString, SQL_NTS); - if (status != SQL_SUCCESS) { - AB_ERROR(("Insert row 4 failed")); - goto odbcfail; - } + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 36, 0, guid, 0, &lenOrInd)); + CHK(SQLExecDirect, (Statement, queryString, SQL_NTS)); AB_PRINT(("Insert row 5")); /* @@ -423,11 +359,7 @@ TestRawODBCGuid(void) lenOrInd = 16; strcpy((char *) (guid), "1234abcd-abcd-abcd-abcd-123456789abc"); - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_GUID, SQL_GUID, 16, 0, &sqlguid, 16, &lenOrInd) - != SQL_SUCCESS) { - AB_ERROR(("SQLBindParameter failed")); - goto odbcfail; - } + CHK(SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_GUID, SQL_GUID, 16, 0, &sqlguid, 16, &lenOrInd)); status = SQLExecDirect(Statement, queryString, SQL_NTS); if (status != SQL_SUCCESS) { AB_ERROR(("Insert row 5 failed")); @@ -439,23 +371,11 @@ TestRawODBCGuid(void) */ AB_PRINT(("retrieving name and guid")); strcpy((char *) (queryString), "SELECT name, guid FROM #pet"); - status = SQLExecDirect(Statement, queryString, SQL_NTS); - if (status != SQL_SUCCESS) { - AB_ERROR(("SELECT failed")); - goto odbcfail; - } + CHK(SQLExecDirect, (Statement, queryString, SQL_NTS)); while (SQLFetch(Statement) == SQL_SUCCESS) { count++; - if (SQLGetData(Statement, 1, SQL_CHAR, name, 20, 0) - != SQL_SUCCESS) { - AB_ERROR(("Get row %d, name column failed", count)); - goto odbcfail; - } - if (SQLGetData(Statement, 2, SQL_CHAR, guid, 37, 0) - != SQL_SUCCESS) { - AB_ERROR(("Get row %d, guid column failed", count)); - goto odbcfail; - } + CHK(SQLGetData, (Statement, 1, SQL_CHAR, name, 20, 0)); + CHK(SQLGetData, (Statement, 2, SQL_CHAR, guid, 37, 0)); AB_PRINT(("name: %-10s guid: %s", name, guid)); } @@ -464,15 +384,8 @@ TestRawODBCGuid(void) * Realloc cursor handle - (Windows ODBC considers it an invalid cursor * state if we try SELECT again). */ - if (SQLFreeStmt(Statement, SQL_CLOSE) != SQL_SUCCESS) { - AB_ERROR(("Free statement failed (5)")); - goto odbcfail; - } - if (SQLAllocHandle(SQL_HANDLE_STMT, Connection, &Statement) - != SQL_SUCCESS) { - AB_ERROR(("SQLAllocStmt failed(1)")); - goto odbcfail; - } + CHK(SQLFreeStmt, (Statement, SQL_CLOSE)); + CHK(SQLAllocHandle, (SQL_HANDLE_STMT, Connection, &Statement)); /* @@ -481,23 +394,11 @@ TestRawODBCGuid(void) AB_PRINT(("retrieving name and guid again")); strcpy((char *) (queryString), "SELECT name, guid FROM #pet"); - status = SQLExecDirect(Statement, queryString, SQL_NTS); - if (status != SQL_SUCCESS) { - AB_ERROR(("SELECT failed")); - goto odbcfail; - } + CHK(SQLExecDirect, (Statement, queryString, SQL_NTS)); while (SQLFetch(Statement) == SQL_SUCCESS) { count++; - if (SQLGetData(Statement, 1, SQL_CHAR, name, 20, 0) - != SQL_SUCCESS) { - AB_ERROR(("Get row %d, name column failed", count)); - goto odbcfail; - } - if (SQLGetData(Statement, 2, SQL_GUID, &sqlguid, 16, 0) - != SQL_SUCCESS) { - AB_ERROR(("Get row %d, guid column failed", count)); - goto odbcfail; - } + CHK(SQLGetData, (Statement, 1, SQL_CHAR, name, 20, 0)); + CHK(SQLGetData, (Statement, 2, SQL_GUID, &sqlguid, 16, 0)); AB_PRINT(("%-10s %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", name, @@ -511,15 +412,8 @@ TestRawODBCGuid(void) * Realloc cursor handle - (Windows ODBC considers it an invalid cursor * state if we try SELECT again). */ - if (SQLFreeStmt(Statement, SQL_CLOSE) != SQL_SUCCESS) { - AB_ERROR(("Free statement failed (5)")); - goto odbcfail; - } - if (SQLAllocHandle(SQL_HANDLE_STMT, Connection, &Statement) - != SQL_SUCCESS) { - AB_ERROR(("SQLAllocStmt failed(1)")); - goto odbcfail; - } + CHK(SQLFreeStmt, (Statement, SQL_CLOSE)); + CHK(SQLAllocHandle, (SQL_HANDLE_STMT, Connection, &Statement)); /* * Now retrieve rows via stored procedure passing GUID as param. @@ -530,28 +424,12 @@ TestRawODBCGuid(void) lenOrInd = SQL_NTS; strcpy((char *) (guid), "87654321-4321-4321-4321-123456789abc"); - if (SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_GUID, 0, 0, guid, 0, &lenOrInd) - != SQL_SUCCESS) { - AB_ERROR(("SQLBindParameter failed")); - goto odbcfail; - } - status = SQLExecDirect(Statement, queryString, SQL_NTS); - if (status != SQL_SUCCESS) { - AB_ERROR(("SELECT failed")); - goto odbcfail; - } + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_GUID, 0, 0, guid, 0, &lenOrInd)); + CHK(SQLExecDirect, (Statement, queryString, SQL_NTS)); while (SQLFetch(Statement) == SQL_SUCCESS) { count++; - if (SQLGetData(Statement, 1, SQL_CHAR, name, 20, 0) - != SQL_SUCCESS) { - AB_ERROR(("Get row %d, name column failed", count)); - goto odbcfail; - } - if (SQLGetData(Statement, 2, SQL_CHAR, guid, 37, 0) - != SQL_SUCCESS) { - AB_ERROR(("Get row %d, guid column failed", count)); - goto odbcfail; - } + CHK(SQLGetData, (Statement, 1, SQL_CHAR, name, 20, 0)); + CHK(SQLGetData, (Statement, 2, SQL_CHAR, guid, 37, 0)); AB_PRINT(("%-10s %s", name, guid)); } @@ -560,15 +438,8 @@ TestRawODBCGuid(void) * Realloc cursor handle - (Windows ODBC considers it an invalid cursor * state after a previous SELECT has occurred). */ - if (SQLFreeStmt(Statement, SQL_CLOSE) != SQL_SUCCESS) { - AB_ERROR(("Free statement failed (5)")); - goto odbcfail; - } - if (SQLAllocHandle(SQL_HANDLE_STMT, Connection, &Statement) - != SQL_SUCCESS) { - AB_ERROR(("SQLAllocStmt failed(1)")); - goto odbcfail; - } + CHK(SQLFreeStmt, (Statement, SQL_CLOSE)); + CHK(SQLAllocHandle, (SQL_HANDLE_STMT, Connection, &Statement)); /* cleanup */ CommandWithResult(Statement, "DROP PROC GetGUIDRows"); diff --git a/src/odbc/unittests/timeout3.c b/src/odbc/unittests/timeout3.c index edb7d37..8fdeff3 100644 --- a/src/odbc/unittests/timeout3.c +++ b/src/odbc/unittests/timeout3.c @@ -40,7 +40,7 @@ test connection timeout */ -static char software_version[] = "$Id: timeout3.c,v 1.6 2007/11/26 18:12:31 freddy77 Exp $"; +static char software_version[] = "$Id: timeout3.c,v 1.7 2008/02/08 09:28:05 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static void init_connect(void); @@ -49,14 +49,14 @@ static void init_connect(void) { if (SQLAllocEnv(&Environment) != SQL_SUCCESS) { - printf("Unable to allocate env\n"); + fprintf(stderr, "Unable to allocate env\n"); exit(1); } SQLSetEnvAttr(Environment, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) (SQL_OV_ODBC3), SQL_IS_UINTEGER); if (SQLAllocConnect(Environment, &Connection) != SQL_SUCCESS) { - printf("Unable to allocate connection\n"); + fprintf(stderr, "Unable to allocate connection\n"); SQLFreeEnv(Environment); exit(1); } commit 1f0c7cafa73fb9e09ea9ebdceef4099fae62cca1 Author: freddy77 Date: Fri Feb 8 09:32:06 2008 +0000 add a comment diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index b7b8235..a897f93 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.470 2008/01/29 09:35:25 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.471 2008/02/08 09:32:06 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -3343,6 +3343,10 @@ odbc_process_tokens(TDS_STMT * stmt, unsigned flag) static 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); commit 7b994c7e6ac231e2f269b028fe3ca0cfe74d095b Author: freddy77 Date: Fri Feb 8 10:20:23 2008 +0000 let it compile diff --git a/src/odbc/unittests/testodbc.c b/src/odbc/unittests/testodbc.c index 61e80bb..96c28f5 100644 --- a/src/odbc/unittests/testodbc.c +++ b/src/odbc/unittests/testodbc.c @@ -10,7 +10,7 @@ #include "common.h" -static char software_version[] = "$Id: testodbc.c,v 1.11 2008/02/08 09:28:04 freddy77 Exp $"; +static char software_version[] = "$Id: testodbc.c,v 1.12 2008/02/08 10:20:23 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; #ifdef DEBUG @@ -104,7 +104,6 @@ DispODBCDiags(void) static int TestRawODBCPreparedQuery(void) { - SQLRETURN status; SQLCHAR queryString[200]; SQLLEN lenOrInd = 0; SQLSMALLINT supplierId = 4; @@ -176,7 +175,6 @@ TestRawODBCPreparedQuery(void) static int TestRawODBCDirectQuery(void) { - SQLRETURN status; SQLCHAR queryString[200]; SQLLEN lenOrInd = 0; SQLSMALLINT supplierId = 1; @@ -359,7 +357,7 @@ TestRawODBCGuid(void) lenOrInd = 16; strcpy((char *) (guid), "1234abcd-abcd-abcd-abcd-123456789abc"); - CHK(SQLBindParameter(Statement, 1, SQL_PARAM_INPUT, SQL_C_GUID, SQL_GUID, 16, 0, &sqlguid, 16, &lenOrInd)); + CHK(SQLBindParameter, (Statement, 1, SQL_PARAM_INPUT, SQL_C_GUID, SQL_GUID, 16, 0, &sqlguid, 16, &lenOrInd)); status = SQLExecDirect(Statement, queryString, SQL_NTS); if (status != SQL_SUCCESS) { AB_ERROR(("Insert row 5 failed")); commit 862f3b5f92558517a616e14fab0a83ad6fcc24ef Author: freddy77 Date: Wed Feb 13 08:52:08 2008 +0000 merged small memory issues, fix test64 test output diff --git a/ChangeLog b/ChangeLog index 393b4a0..bd126d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Feb 13 09:50:35 CET 2008 Frediano Ziglio + * src/apps/bsqlodbc.c: fix memory error + * src/tds/query.c: remove possible buffer underflow + * src/odbc/unittests/test64.c: truncate upper part for low + Fri Feb 08 10:26:36 CET 2008 Frediano Ziglio * src/odbc/unittests/Makefile.am src/odbc/unittests/describecol.in: * src/odbc/unittests/params.c src/odbc/unittests/putdata.c: @@ -158,4 +163,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2487 2008/02/08 09:28:01 freddy77 Exp $ +$Id: ChangeLog,v 1.2488 2008/02/13 08:52:08 freddy77 Exp $ diff --git a/src/apps/bsqlodbc.c b/src/apps/bsqlodbc.c index 1050550..89d9c19 100644 --- a/src/apps/bsqlodbc.c +++ b/src/apps/bsqlodbc.c @@ -50,7 +50,7 @@ #include #include "replacements.h" -static char software_version[] = "$Id: bsqlodbc.c,v 1.9 2007/11/26 06:25:57 freddy77 Exp $"; +static char software_version[] = "$Id: bsqlodbc.c,v 1.10 2008/02/13 08:52:09 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static char * next_query(void); @@ -339,6 +339,10 @@ main(int argc, char *argv[]) } } + SQLDisconnect(hDbc); + SQLFreeHandle(SQL_HANDLE_DBC, hDbc); + SQLFreeHandle(SQL_HANDLE_ENV, hEnv); + return 0; } @@ -347,14 +351,15 @@ 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; diff --git a/src/odbc/unittests/test64.c b/src/odbc/unittests/test64.c index 8d0dd75..4078cd8 100644 --- a/src/odbc/unittests/test64.c +++ b/src/odbc/unittests/test64.c @@ -1,7 +1,7 @@ /* test win64 consistency */ #include "common.h" -static char software_version[] = "$Id: test64.c,v 1.4 2008/01/29 14:30:49 freddy77 Exp $"; +static char software_version[] = "$Id: test64.c,v 1.5 2008/02/13 08:52:09 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; /* @@ -110,6 +110,7 @@ test_params(void) l = len; len >>= 16; h = len >> 16; + l &= 0xfffffffflu; if (h != 0 || l != 2) { fprintf(stderr, "Wrong number returned in param rows high %lu low %lu\n", h, l); exit(1); @@ -223,6 +224,7 @@ test_rows(void) l = len; len >>= 16; h = len >> 16; + l &= 0xfffffffflu; if (h != 0 || l != 2) { fprintf(stderr, "Wrong number returned in rows high %lu(0x%lx) low %lu(0x%lx)\n", h, h, l, l); exit(1); diff --git a/src/tds/query.c b/src/tds/query.c index 61c266d..3cd8c5f 100644 --- a/src/tds/query.c +++ b/src/tds/query.c @@ -46,7 +46,7 @@ #include -TDS_RCSID(var, "$Id: query.c,v 1.218 2008/01/20 14:23:59 freddy77 Exp $"); +TDS_RCSID(var, "$Id: query.c,v 1.219 2008/02/13 08:52:09 freddy77 Exp $"); static void tds_put_params(TDSSOCKET * tds, TDSPARAMINFO * info, int flags); static void tds7_put_query_params(TDSSOCKET * tds, const char *query, int query_len); @@ -577,7 +577,7 @@ tds_next_placeholder_ucs2le(const char *start, const char *end, int named) case '?': return p; case '@': - if (named && !isalnum(prev)) + if (named && !isalnum((unsigned char) prev)) return p; default: p += 2; @@ -849,7 +849,7 @@ tds7_build_param_def_from_params(TDSSOCKET * tds, const char* query, size_t quer 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(id_end[0]))) + 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; commit e0694937b57d4d27978d4866298b98410d9c68e8 Author: freddy77 Date: Fri Feb 15 11:00:40 2008 +0000 fix an ABI problem under HP-UX diff --git a/ChangeLog b/ChangeLog index bd126d0..2dec974 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Fri Feb 15 11:53:41 CET 2008 Frediano Ziglio + * configure.ac: fix nasty problem with HP-UX + Wed Feb 13 09:50:35 CET 2008 Frediano Ziglio * src/apps/bsqlodbc.c: fix memory error * src/tds/query.c: remove possible buffer underflow @@ -163,4 +166,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2488 2008/02/13 08:52:08 freddy77 Exp $ +$Id: ChangeLog,v 1.2489 2008/02/15 11:00:40 freddy77 Exp $ diff --git a/configure.ac b/configure.ac index 77740fc..26bf18f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.33 2008/01/20 14:23:58 freddy77 Exp $ +dnl $Id: configure.ac,v 1.34 2008/02/15 11:00:40 freddy77 Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -15,7 +15,7 @@ dnl ------------------------------------------------------------ AC_INIT(FreeTDS, 0.83.dev.esyscmd(echo -n $(date +"%Y%m%d"))) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.33 $) +AC_REVISION($Revision: 1.34 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -47,7 +47,6 @@ case $host in netdb_reentrant=yes ;; *-*-hpux11*) - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" netdb_reentrant=yes ;; *-*-cygwin*) @@ -151,6 +150,27 @@ case $host in fi 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) + if test "$enable_krb5" = "yes" ; then + 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 + fi + + AM_CONDITIONAL(MINGW32, false) + ;; *) AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(gethostbyname, nsl) commit 03780ab494ed3fe0192268b97fdbc595f3f5fd0a Author: freddy77 Date: Fri Feb 15 11:06:39 2008 +0000 fix SQL_ATTR_CONNECTION_DEAD diff --git a/ChangeLog b/ChangeLog index 2dec974..0373661 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Fri Feb 15 12:05:48 CET 2008 Frediano Ziglio + * src/odbc/odbc.c: fix SQL_ATTR_CONNECTION_DEAD + Fri Feb 15 11:53:41 CET 2008 Frediano Ziglio * configure.ac: fix nasty problem with HP-UX @@ -166,4 +169,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2489 2008/02/15 11:00:40 freddy77 Exp $ +$Id: ChangeLog,v 1.2490 2008/02/15 11:06:39 freddy77 Exp $ diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index a897f93..9438336 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.471 2008/02/08 09:32:06 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.472 2008/02/15 11:06:39 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -4471,6 +4471,7 @@ _SQLGetConnectAttr(SQLHDBC hdbc, SQLINTEGER Attribute, SQLPOINTER Value, SQLINTE ODBC_RETURN_(dbc); 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; ODBC_RETURN_(dbc); break; commit e355230cc6c9e491c13a7cd2fbeb9828109a0f2a Author: jklowden Date: Fri Feb 15 16:27:38 2008 +0000 support SYBUNIQUE printable width diff --git a/ChangeLog b/ChangeLog index 0373661..77bc6c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri Feb 15 11:25:46 EST 2008 JK Lowden + * src/dblib/dblib.c src/tds/convert.c + - support SYBUNIQUE printable width + Fri Feb 15 12:05:48 CET 2008 Frediano Ziglio * src/odbc/odbc.c: fix SQL_ATTR_CONNECTION_DEAD @@ -169,4 +173,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2490 2008/02/15 11:06:39 freddy77 Exp $ +$Id: ChangeLog,v 1.2491 2008/02/15 16:27:38 jklowden Exp $ diff --git a/src/dblib/dblib.c b/src/dblib/dblib.c index b6950aa..b9baa7e 100644 --- a/src/dblib/dblib.c +++ b/src/dblib/dblib.c @@ -76,7 +76,7 @@ #include #endif -TDS_RCSID(var, "$Id: dblib.c,v 1.321 2008/01/24 21:14:55 freddy77 Exp $"); +TDS_RCSID(var, "$Id: dblib.c,v 1.322 2008/02/15 16:27:38 jklowden Exp $"); static RETCODE _dbresults(DBPROCESS * dbproc); static int _db_get_server_type(int bindtype); @@ -3469,6 +3469,10 @@ dbprrow(DBPROCESS * dbproc) return SUCCEED; } +/* + * src/tds/convert.c::tds_willconvert() returns same information. + * Available to user via dbwillconvert(). + */ static int _get_printable_size(TDSCOLUMN * colinfo) { @@ -3496,17 +3500,16 @@ _get_printable_size(TDSCOLUMN * colinfo) case SYBCHAR: return colinfo->column_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 */ + return 12; case SYBDATETIME: - return 26; /* FIX ME */ case SYBDATETIME4: - return 26; /* FIX ME */ + return 26; + case SYBUNIQUE: + return 36; case SYBBIT: case SYBBITN: return 1; @@ -3514,7 +3517,6 @@ _get_printable_size(TDSCOLUMN * colinfo) default: return 0; } - } /** diff --git a/src/tds/convert.c b/src/tds/convert.c index 67ea545..2283097 100644 --- a/src/tds/convert.c +++ b/src/tds/convert.c @@ -64,7 +64,7 @@ #include #endif -TDS_RCSID(var, "$Id: convert.c,v 1.180 2008/02/04 07:51:11 freddy77 Exp $"); +TDS_RCSID(var, "$Id: convert.c,v 1.181 2008/02/15 16:27:39 jklowden Exp $"); typedef unsigned short utf16_t; @@ -2896,6 +2896,8 @@ tds_willconvert(int srctype, int desttype) case SYBMONEY: case SYBMONEY4: return 12; + case SYBUNIQUE: + return 36; /* non-fixed types have variable data sizes, just return 0xff */ case SYBCHAR: case SYBBINARY: @@ -2919,7 +2921,6 @@ tds_willconvert(int srctype, int desttype) case SYBINTERVAL: case SYBSENSITIVITY: case SYBTIME: - case SYBUNIQUE: case SYBUNITEXT: case SYBVARIANT: case SYBVOID: commit b0a20c0ee8ab8a10f8a189c8f8963870b49e245d Author: freddy77 Date: Wed Feb 20 08:04:31 2008 +0000 avoid duplicate case diff --git a/ChangeLog b/ChangeLog index 77bc6c3..96cd21e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Wed Feb 20 09:04:58 CET 2008 Frediano Ziglio + * src/tds/convert.c: avoid duplicate case + Fri Feb 15 11:25:46 EST 2008 JK Lowden * src/dblib/dblib.c src/tds/convert.c - support SYBUNIQUE printable width @@ -173,4 +176,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2491 2008/02/15 16:27:38 jklowden Exp $ +$Id: ChangeLog,v 1.2492 2008/02/20 08:04:31 freddy77 Exp $ diff --git a/src/tds/convert.c b/src/tds/convert.c index 2283097..6c6b985 100644 --- a/src/tds/convert.c +++ b/src/tds/convert.c @@ -64,7 +64,7 @@ #include #endif -TDS_RCSID(var, "$Id: convert.c,v 1.181 2008/02/15 16:27:39 jklowden Exp $"); +TDS_RCSID(var, "$Id: convert.c,v 1.182 2008/02/20 08:04:32 freddy77 Exp $"); typedef unsigned short utf16_t; @@ -2896,12 +2896,12 @@ tds_willconvert(int srctype, int desttype) case SYBMONEY: case SYBMONEY4: return 12; + /* TODO SYBBLOB has the same value */ case SYBUNIQUE: return 36; /* non-fixed types have variable data sizes, just return 0xff */ case SYBCHAR: case SYBBINARY: - case SYBBLOB: case SYBLONGBINARY: case SYBLONGCHAR: case SYBTEXT: commit 85f0d20666452ef19da29d3d368bc04e121603b2 Author: jklowden Date: Thu Feb 28 23:27:10 2008 +0000 announced 0.82RC2 diff --git a/ChangeLog b/ChangeLog index 96cd21e..da12d08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Feb 28 18:24:31 EST 2008 JK Lowden + * doc/htdoc/news.html announced 0.82RC2 + * vms/configure.com turn off iconv by default + Wed Feb 20 09:04:58 CET 2008 Frediano Ziglio * src/tds/convert.c: avoid duplicate case @@ -176,4 +180,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2492 2008/02/20 08:04:31 freddy77 Exp $ +$Id: ChangeLog,v 1.2493 2008/02/28 23:27:10 jklowden Exp $ diff --git a/doc/htdoc/news.html b/doc/htdoc/news.html index 5dbbcee..b940620 100644 --- a/doc/htdoc/news.html +++ b/doc/htdoc/news.html @@ -1,7 +1,7 @@ - + FreeTDS.org @@ -33,6 +33,19 @@ News  |  + + + + + + + + + + + + @@ -56,7 +70,7 @@ ftp.ibiblio.org. This important release will incorporate many new features, 23,710 lines of code. Detailed information can be found in the NEWS file included in the the distribution.

Version 0.82 will be the successor to 0.64, released in July 2006. The jump in version -number represents the progress toward version 1.0. +number represents the progress toward version 1.0. (17 January 2008)

commit 0e00d0b2474183daa11ee1f18cab3e6fba2ebc18 Author: freddy77 Date: Thu Mar 13 13:23:30 2008 +0000 simplify error.c diff --git a/ChangeLog b/ChangeLog index 0735575..cfa0bba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Mar 13 14:22:28 CET 2008 Frediano Ziglio + * include/tdsodbc.h src/odbc/error.c: + - make errs offset constant in all odbc structures to make + error.c simpler + - support SQL_HANDLE_DESC in SQLGetDiagField + * src/odbc/odbc.c: remove TODO comment + * src/odbc/odbc_checks.c: typo + Wed Mar 12 15:25:11 CET 2008 Frediano Ziglio * src/odbc/error.c: check proper handle type @@ -219,4 +227,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2503 2008/03/12 14:26:07 freddy77 Exp $ +$Id: ChangeLog,v 1.2504 2008/03/13 13:23:30 freddy77 Exp $ diff --git a/include/tdsodbc.h b/include/tdsodbc.h index a58d547..5efd600 100644 --- a/include/tdsodbc.h +++ b/include/tdsodbc.h @@ -66,7 +66,7 @@ extern "C" #endif #endif -/* $Id: tdsodbc.h,v 1.104 2008/01/14 19:21:06 freddy77 Exp $ */ +/* $Id: tdsodbc.h,v 1.105 2008/03/13 13:23:31 freddy77 Exp $ */ #if defined(__GNUC__) && __GNUC__ >= 4 #pragma GCC visibility push(hidden) @@ -177,11 +177,11 @@ struct _drecord struct _hdesc { SQLSMALLINT htype; /* do not reorder this field */ + struct _sql_errors errs; /* do not reorder this field */ int type; SQLHANDLE parent; struct _dheader header; struct _drecord *records; - struct _sql_errors errs; }; typedef struct _hdesc TDS_DESC; @@ -202,13 +202,14 @@ struct _heattr struct _hchk { SQLSMALLINT htype; /* do not reorder this field */ + struct _sql_errors errs; /* do not reorder this field */ }; struct _henv { SQLSMALLINT htype; /* do not reorder this field */ + struct _sql_errors errs; /* do not reorder this field */ TDSCONTEXT *tds_ctx; - struct _sql_errors errs; struct _heattr attr; }; @@ -242,6 +243,7 @@ struct _hstmt; struct _hdbc { SQLSMALLINT htype; /* do not reorder this field */ + struct _sql_errors errs; /* do not reorder this field */ struct _henv *env; TDSSOCKET *tds_socket; DSTR dsn; @@ -254,7 +256,6 @@ struct _hdbc struct _hstmt *current_statement; /** list of all statements allocated from this connection */ struct _hstmt *stmt_list; - struct _sql_errors errs; struct _hcattr attr; /** descriptors associated to connection */ TDS_DESC *uad[TDS_MAX_APP_DESC]; @@ -326,6 +327,7 @@ typedef enum struct _hstmt { SQLSMALLINT htype; /* do not reorder this field */ + struct _sql_errors errs; /* do not reorder this field */ struct _hdbc *dbc; /** query to execute */ char *query; @@ -361,7 +363,6 @@ struct _hstmt TDS_ODBC_ROW_STATUS row_status; /* do NOT free dynamic, free from socket or attach to connection */ TDSDYNAMIC *dyn; - struct _sql_errors errs; TDS_DESC *ard, *ird, *apd, *ipd; TDS_DESC *orig_ard, *orig_apd; SQLULEN sql_rowset_size; diff --git a/src/odbc/error.c b/src/odbc/error.c index 260e475..c9e0772 100644 --- a/src/odbc/error.c +++ b/src/odbc/error.c @@ -47,7 +47,7 @@ #include #endif -TDS_RCSID(var, "$Id: error.c,v 1.50 2008/03/12 14:26:07 freddy77 Exp $"); +TDS_RCSID(var, "$Id: error.c,v 1.51 2008/03/13 13:23:31 freddy77 Exp $"); static void odbc_errs_pop(struct _sql_errors *errs); static const char *odbc_get_msg(const char *sqlstate); @@ -503,7 +503,7 @@ _SQLGetDiagRec(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, SQLINTEGER FAR * pfNativeError, SQLCHAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR * pcbErrorMsg) { SQLRETURN result; - struct _sql_errors *errs = NULL; + struct _sql_errors *errs; const char *msg; char *p; @@ -518,31 +518,28 @@ _SQLGetDiagRec(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, if (numRecord <= 0 || cbErrorMsgMax < 0) return SQL_ERROR; - if (!handle || ((struct _hchk *) handle)->htype != handleType) + if (!handle || ((TDS_CHK *) handle)->htype != handleType) return SQL_INVALID_HANDLE; + errs = &((TDS_CHK *) handle)->errs; switch (handleType) { case SQL_HANDLE_STMT: odbc_ver = ((TDS_STMT *) handle)->dbc->env->attr.odbc_version; - errs = &((TDS_STMT *) handle)->errs; break; case SQL_HANDLE_DBC: odbc_ver = ((TDS_DBC *) handle)->env->attr.odbc_version; - errs = &((TDS_DBC *) handle)->errs; break; case SQL_HANDLE_ENV: odbc_ver = ((TDS_ENV *) handle)->attr.odbc_version; - errs = &((TDS_ENV *) handle)->errs; break; case SQL_HANDLE_DESC: parent = ((TDS_DESC *) handle)->parent; - if (((struct _hchk *) parent)->htype == SQL_HANDLE_DBC) + if (((TDS_CHK *) parent)->htype == SQL_HANDLE_DBC) odbc_ver = ((TDS_DBC *) parent)->env->attr.odbc_version; else odbc_ver = ((TDS_STMT *) parent)->dbc->env->attr.odbc_version; - errs = &((TDS_DESC *) handle)->errs; break; default: return SQL_INVALID_HANDLE; @@ -579,7 +576,6 @@ SQLError(SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, SQLCHAR FAR * szSqlState, S SQLCHAR FAR * szErrorMsg, SQLSMALLINT cbErrorMsgMax, SQLSMALLINT FAR * pcbErrorMsg) { SQLRETURN result; - struct _sql_errors *errs = NULL; SQLSMALLINT type; SQLHANDLE handle; @@ -587,15 +583,12 @@ SQLError(SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, SQLCHAR FAR * szSqlState, S henv, hdbc, hstmt, szSqlState, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg); if (hstmt) { - errs = &((TDS_STMT *) hstmt)->errs; handle = hstmt; type = SQL_HANDLE_STMT; } else if (hdbc) { - errs = &((TDS_DBC *) hdbc)->errs; handle = hdbc; type = SQL_HANDLE_DBC; } else if (henv) { - errs = &((TDS_ENV *) henv)->errs; handle = henv; type = SQL_HANDLE_ENV; } else @@ -605,7 +598,7 @@ SQLError(SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, SQLCHAR FAR * szSqlState, S if (result == SQL_SUCCESS) { /* remove first error */ - odbc_errs_pop(errs); + odbc_errs_pop(&((TDS_CHK *) handle)->errs); } return result; @@ -627,7 +620,7 @@ SQLGetDiagField(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, SQLSMALLINT cbBuffer, SQLSMALLINT FAR * pcbBuffer) { SQLRETURN result = SQL_SUCCESS; - struct _sql_errors *errs = NULL; + struct _sql_errors *errs; const char *msg; SQLINTEGER odbc_ver = SQL_OV_ODBC2; @@ -635,6 +628,7 @@ SQLGetDiagField(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, TDS_STMT *stmt = NULL; TDS_DBC *dbc = NULL; TDS_ENV *env = NULL; + SQLHANDLE parent; char tmp[16]; tdsdump_log(TDS_DBG_FUNC, "SQLGetDiagField(%d, %p, %d, %d, %p, %d, %p)\n", @@ -643,7 +637,7 @@ SQLGetDiagField(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, if (cbBuffer < 0) return SQL_ERROR; - if (!handle || ((struct _hchk *) handle)->htype != handleType) + if (!handle || ((TDS_CHK *) handle)->htype != handleType) return SQL_INVALID_HANDLE; switch (handleType) { @@ -651,23 +645,32 @@ SQLGetDiagField(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, stmt = ((TDS_STMT *) handle); dbc = stmt->dbc; env = dbc->env; - errs = &stmt->errs; break; case SQL_HANDLE_DBC: dbc = ((TDS_DBC *) handle); env = dbc->env; - errs = &dbc->errs; break; case SQL_HANDLE_ENV: env = ((TDS_ENV *) handle); - errs = &env->errs; + break; + + case SQL_HANDLE_DESC: + parent = ((TDS_DESC *) handle)->parent; + if (((TDS_CHK *) parent)->htype == SQL_HANDLE_DBC) { + dbc = (TDS_DBC *) parent; + } else { + stmt = (TDS_STMT *) parent; + dbc = stmt->dbc; + } + env = dbc->env; break; default: return SQL_INVALID_HANDLE; } + errs = &((TDS_CHK *) handle)->errs; odbc_ver = env->attr.odbc_version; /* header (numRecord ignored) */ diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index 6529b73..0938e37 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.477 2008/03/12 13:54:33 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.478 2008/03/13 13:23:31 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -5602,7 +5602,6 @@ _SQLGetInfo(TDS_DBC * dbc, SQLUSMALLINT fInfoType, SQLPOINTER rgbInfoValue, SQLS SIVAL = SQL_TC_ALL; break; case SQL_TXN_ISOLATION_OPTION: - /* TODO check SQLSetConnectAttr support */ UIVAL = SQL_TXN_READ_COMMITTED | SQL_TXN_READ_UNCOMMITTED | SQL_TXN_REPEATABLE_READ | SQL_TXN_SERIALIZABLE; break; case SQL_UNION: diff --git a/src/odbc/odbc_checks.c b/src/odbc/odbc_checks.c index a55e1a7..713bdcc 100644 --- a/src/odbc/odbc_checks.c +++ b/src/odbc/odbc_checks.c @@ -40,7 +40,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc_checks.c,v 1.19 2007/05/17 10:33:21 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc_checks.c,v 1.20 2008/03/13 13:23:31 freddy77 Exp $"); #if ENABLE_EXTRA_CHECKS @@ -113,7 +113,7 @@ odbc_check_struct_extra(void *p) { const int invalid_htype = 0; - switch (((struct _hchk *) p)->htype) { + switch (((TDS_CHK *) p)->htype) { case SQL_HANDLE_ENV: odbc_check_env_extra((TDS_ENV *) p); break; commit 02c780a076896bb6b3a36c379d11b4fa3add8231 Author: freddy77 Date: Tue Mar 18 08:19:25 2008 +0000 update diff --git a/doc/tds.html b/doc/tds.html index a0bdf38..28ab6de 100644 --- a/doc/tds.html +++ b/doc/tds.html @@ -389,7 +389,7 @@ auth authentication data

- + @@ -416,10 +416,10 @@ auth authentication data - + - + @@ -431,13 +431,23 @@ auth authentication data - +
Second Release Candidate available for 0.82
+
+Version 0.82RC2 is now available from + +ftp.ibiblio.org. +
+
+
FreeTDS enters release process for Version 0.82
commit ba520b40b0b671c6a12e26d6368ea56a3e32f319 Author: jklowden Date: Thu Feb 28 23:27:14 2008 +0000 turn off iconv by default diff --git a/vms/configure.com b/vms/configure.com index 37b59b3..ca0d413 100644 --- a/vms/configure.com +++ b/vms/configure.com @@ -16,7 +16,7 @@ $! 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: configure.com,v 1.5 2005/12/29 10:24:34 freddy77 Exp $ +$! $Id: configure.com,v 1.6 2008/02/28 23:27:14 jklowden Exp $ $! $! CONFIGURE.COM -- run from top level source directory as @[.vms]configure $! @@ -38,7 +38,9 @@ $! 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 F$SEARCH("SYS$I18N_ICONV:UCS-2_ISO8859-1.ICONV") .NES. "" - +$ 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. "" commit a8b0c6b4ee8c579b2a76bceb742ad486b6d08747 Author: freddy77 Date: Fri Feb 29 10:54:53 2008 +0000 ported tests and SQL_ROWSET_SIZE fix diff --git a/ChangeLog b/ChangeLog index da12d08..e91b2b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Feb 29 11:50:06 CET 2008 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/.cvsignore: + * src/odbc/unittests/Makefile.am src/odbc/unittests/rowset.c(added): + - ported tests and SQL_ROWSET_SIZE fix + Thu Feb 28 18:24:31 EST 2008 JK Lowden * doc/htdoc/news.html announced 0.82RC2 * vms/configure.com turn off iconv by default @@ -180,4 +185,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2493 2008/02/28 23:27:10 jklowden Exp $ +$Id: ChangeLog,v 1.2494 2008/02/29 10:54:53 freddy77 Exp $ diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index 9438336..51a0658 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.472 2008/02/15 11:06:39 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.473 2008/02/29 10:54:53 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -1472,8 +1472,7 @@ _SQLAllocStmt(SQLHDBC hdbc, SQLHSTMT FAR * phstmt) stmt->attr.simulate_cursor = SQL_SC_NON_UNIQUE; stmt->attr.use_bookmarks = SQL_UB_OFF; - /* is not the same of using APD sql_desc_bind_type */ - stmt->sql_rowset_size = SQL_BIND_BY_COLUMN; + stmt->sql_rowset_size = 1; stmt->row_count = TDS_NO_COUNT; stmt->row_status = NOT_IN_ROW; @@ -6189,6 +6188,10 @@ _SQLSetStmtAttr(SQLHSTMT hstmt, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLIN 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); + ODBC_RETURN(stmt, SQL_ERROR); + } stmt->sql_rowset_size = ui; break; default: diff --git a/src/odbc/unittests/.cvsignore b/src/odbc/unittests/.cvsignore index fb6855d..4d90945 100644 --- a/src/odbc/unittests/.cvsignore +++ b/src/odbc/unittests/.cvsignore @@ -64,6 +64,7 @@ cursor5 attributes hidden blob1 +rowset cancel test64 wchar diff --git a/src/odbc/unittests/Makefile.am b/src/odbc/unittests/Makefile.am index f9e14f9..f6bb215 100644 --- a/src/odbc/unittests/Makefile.am +++ b/src/odbc/unittests/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.72 2008/02/08 09:28:03 freddy77 Exp $ +# $Id: Makefile.am,v 1.73 2008/02/29 10:54:53 freddy77 Exp $ TESTS = \ t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT)\ t0004$(EXEEXT) connect$(EXEEXT) print$(EXEEXT)\ @@ -21,7 +21,7 @@ TESTS = \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) \ - cancel$(EXEEXT) wchar$(EXEEXT) + cancel$(EXEEXT) wchar$(EXEEXT) rowset$(EXEEXT) check_PROGRAMS = $(TESTS) @@ -80,6 +80,7 @@ cursor5_SOURCES = cursor5.c common.c common.h attributes_SOURCES = attributes.c common.c common.h hidden_SOURCES = hidden.c common.c common.h blob1_SOURCES = blob1.c common.c common.h +rowset_SOURCES = rowset.c common.c common.h cancel_SOURCES = cancel.c common.c common.h wchar_SOURCES = wchar.c common.c common.h diff --git a/src/odbc/unittests/rowset.c b/src/odbc/unittests/rowset.c new file mode 100644 index 0000000..93a0b2f --- /dev/null +++ b/src/odbc/unittests/rowset.c @@ -0,0 +1,108 @@ +#include "common.h" + +static char software_version[] = "$Id: rowset.c,v 1.2 2008/02/29 10:54:53 freddy77 Exp $"; +static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; + +static char odbc_err[256]; +static char odbc_sqlstate[6]; + +static void +ReadError(void) +{ + memset(odbc_err, 0, sizeof(odbc_err)); + memset(odbc_sqlstate, 0, sizeof(odbc_sqlstate)); + if (!SQL_SUCCEEDED(SQLGetDiagRec(SQL_HANDLE_STMT, Statement, 1, (SQLCHAR *) odbc_sqlstate, NULL, (SQLCHAR *) odbc_err, sizeof(odbc_err), NULL))) { + printf("SQLGetDiagRec should not fail\n"); + exit(1); + } + printf("Message: '%s' %s\n", odbc_sqlstate, odbc_err); +} + +static void +test_err(int n) +{ + SQLRETURN rc; + + rc = SQLSetStmtAttr(Statement, SQL_ROWSET_SIZE, (SQLPOINTER) int2ptr(n), 0); + if (rc != SQL_ERROR) { + fprintf(stderr, "SQLSetStmtAttr should fail\n"); + Disconnect(); + exit(1); + } + ReadError(); + if (strcmp(odbc_sqlstate, "HY024") != 0) { + fprintf(stderr, "Unexpected sql state returned\n"); + 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]; + SQLRETURN rc; + + use_odbc_version3 = 1; + Connect(); + + /* initial value should be 1 */ + CHK(SQLGetStmtAttr, (Statement, SQL_ROWSET_SIZE, &len, sizeof(len), NULL)); + if (len != 1) { + fprintf(stderr, "len should be 1\n"); + Disconnect(); + return 1; + } + + /* check invalid parameter values */ + test_err(-123); + test_err(-1); + test_err(0); + + /* set some correct values */ + CHK(SQLSetStmtAttr, (Statement, SQL_ROWSET_SIZE, (SQLPOINTER) int2ptr(2), 0)); + CHK(SQLSetStmtAttr, (Statement, SQL_ROWSET_SIZE, (SQLPOINTER) int2ptr(1), 0)); + + /* now check that SQLExtendedFetch works as expected */ + Command(Statement, "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); + Command(Statement, sql); + } + + ResetStatement(); + CHK(SQLSetStmtOption, (Statement, SQL_ATTR_CURSOR_TYPE, SQL_CURSOR_DYNAMIC)); + rc = CommandWithResult(Statement, "SELECT * FROM #rowset ORDER BY n"); + if (!SQL_SUCCEEDED(rc)) + ODBC_REPORT_ERROR("SQLExecDirect error"); + + CHK(SQLBindCol, (Statement, 2, SQL_C_CHAR, buf, sizeof(buf), &len)); + + row_count = 0xdeadbeef; + memset(statuses, 0x55, sizeof(statuses)); + CHK(SQLExtendedFetch, (Statement, SQL_FETCH_NEXT, 1, &row_count, statuses)); + + if (row_count != 1 || statuses[0] != SQL_ROW_SUCCESS || strcmp(buf, "aaaaaaaaa") != 0) { + fprintf(stderr, "Invalid result\n"); + Disconnect(); + return 1; + } + + Disconnect(); + + printf("Done.\n"); + return 0; +} commit 281d4a6963bfe2d187caaa4d1adde6e96c382285 Author: freddy77 Date: Wed Mar 5 11:01:15 2008 +0000 change some vc6 build options diff --git a/ChangeLog b/ChangeLog index e91b2b1..c274c53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Wed Mar 05 12:0:43 CET 2008 Frediano Ziglio + * win32/build_dsw.pl: change some build options + Fri Feb 29 11:50:06 CET 2008 Frediano Ziglio * src/odbc/odbc.c src/odbc/unittests/.cvsignore: * src/odbc/unittests/Makefile.am src/odbc/unittests/rowset.c(added): @@ -185,4 +188,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2494 2008/02/29 10:54:53 freddy77 Exp $ +$Id: ChangeLog,v 1.2495 2008/03/05 11:01:15 freddy77 Exp $ diff --git a/win32/build_dsw.pl b/win32/build_dsw.pl index a52e303..3a5dc9d 100644 --- a/win32/build_dsw.pl +++ b/win32/build_dsw.pl @@ -48,8 +48,8 @@ RSC=rc.exe # PROP Output_Dir "..\\Release" # PROP Intermediate_Dir "..\\Release" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D FREETDS_SRCDIR=\\"..\\" /D DBNTWIN32 /YX /FD /c +# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D FREETDS_SRCDIR=\\"..\\" /D DBNTWIN32 /YX /FD /c # ADD BASE RSC /l 0x410 /d "NDEBUG" # ADD RSC /l 0x410 /d "NDEBUG" BSC32=bscmake.exe @@ -71,8 +71,8 @@ LINK32=link.exe # PROP Output_Dir "..\\Debug" # PROP Intermediate_Dir "..\\Debug" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D FREETDS_SRCDIR=\\"..\\" /D DBNTWIN32 /YX /FD /GZ /c +# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D FREETDS_SRCDIR=\\"..\\" /D DBNTWIN32 /YX /FD /GZ /c # ADD BASE RSC /l 0x410 /d "_DEBUG" # ADD RSC /l 0x410 /d "_DEBUG" BSC32=bscmake.exe commit e1a31eedce73a87474310ac8cd3fe98bdaafff60 Author: freddy77 Date: Fri Mar 7 08:56:34 2008 +0000 updated protocol doc diff --git a/ChangeLog b/ChangeLog index c274c53..0e5937f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Fri Mar 07 09:55:57 CET 2008 Frediano Ziglio + * doc/tds.html: updated + Wed Mar 05 12:0:43 CET 2008 Frediano Ziglio * win32/build_dsw.pl: change some build options @@ -188,4 +191,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2495 2008/03/05 11:01:15 freddy77 Exp $ +$Id: ChangeLog,v 1.2496 2008/03/07 08:56:34 freddy77 Exp $ diff --git a/doc/tds.html b/doc/tds.html index f1dc00e..a0bdf38 100644 --- a/doc/tds.html +++ b/doc/tds.html @@ -94,7 +94,8 @@ of what goes on.

The packet format

-All packets start with the following 8 byte header. +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
@@ -134,9 +135,11 @@ 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. (I - believe the 512 is the block_size in the login packet, so it could be set to a - different value. *mjs*)

+ 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. + TDS7+ use a default of 4096 as block size.


commit c22ed544f1f569190b92587eb990ac69c875b2c0 Author: freddy77 Date: Fri Mar 7 10:57:54 2008 +0000 added transaction level support diff --git a/ChangeLog b/ChangeLog index 0e5937f..22bac52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Mar 07 11:57:00 CET 2008 Frediano Ziglio + * src/odbc/odbc.c src/odbc/unittests/.cvsignore: + * src/odbc/unittests/Makefile.am: + * src/odbc/unittests/transaction2.c(added): + - transaction level support + Fri Mar 07 09:55:57 CET 2008 Frediano Ziglio * doc/tds.html: updated @@ -191,4 +197,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2496 2008/03/07 08:56:34 freddy77 Exp $ +$Id: ChangeLog,v 1.2497 2008/03/07 10:57:54 freddy77 Exp $ diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index 51a0658..190efbc 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.473 2008/02/29 10:54:53 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.474 2008/03/07 10:57:54 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -270,6 +270,40 @@ change_database(TDS_DBC * dbc, char *database, int database_len) ODBC_RETURN_(dbc); } +static SQLRETURN +change_txn(TDS_DBC * dbc, SQLUINTEGER txn_isolation) +{ + char query[64]; + const char *level; + TDSSOCKET *tds = dbc->tds_socket; + + if (!tds) + ODBC_RETURN(dbc, SQL_ERROR); + + level = "READ COMMITTED"; + switch (txn_isolation) { + 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; + } + sprintf(query, "SET TRANSACTION ISOLATION LEVEL %s", level); + + if (tds->state == TDS_IDLE) + tds->query_timeout = dbc->default_query_timeout; + if (tds_submit_query(tds, query) != TDS_SUCCEED) + ODBC_RETURN(dbc, SQL_ERROR); + if (tds_process_simple_query(tds) != TDS_SUCCEED) + ODBC_RETURN(dbc, SQL_ERROR); + + ODBC_RETURN_(dbc); +} + static void odbc_env_change(TDSSOCKET * tds, int type, char *oldval, char *newval) { @@ -323,6 +357,10 @@ odbc_connect(TDS_DBC * dbc, TDSCONNECTION * connection) if (IS_TDS7_PLUS(dbc->tds_socket)) dbc->cursor_support = 1; + if (dbc->attr.txn_isolation != SQL_TXN_READ_COMMITTED) + if (change_txn(dbc, dbc->attr.txn_isolation) != SQL_SUCCESS) + ODBC_RETURN_(dbc); + /* this overwrite any error arrived (wanted behavior, Sybase return error for conversion errors) */ ODBC_RETURN(dbc, SQL_SUCCESS); } @@ -5890,7 +5928,10 @@ _SQLSetConnectAttr(SQLHDBC hdbc, SQLINTEGER Attribute, SQLPOINTER ValuePtr, SQLI break; #endif case SQL_ATTR_TXN_ISOLATION: - dbc->attr.txn_isolation = u_value; + if (u_value != dbc->attr.txn_isolation) { + if (change_txn(dbc, u_value) == SQL_SUCCESS) + dbc->attr.txn_isolation = u_value; + } ODBC_RETURN_(dbc); break; case SQL_ATTR_TRANSLATE_LIB: diff --git a/src/odbc/unittests/.cvsignore b/src/odbc/unittests/.cvsignore index 4d90945..b8adb7f 100644 --- a/src/odbc/unittests/.cvsignore +++ b/src/odbc/unittests/.cvsignore @@ -68,3 +68,4 @@ rowset cancel test64 wchar +transaction2 diff --git a/src/odbc/unittests/Makefile.am b/src/odbc/unittests/Makefile.am index f6bb215..6254689 100644 --- a/src/odbc/unittests/Makefile.am +++ b/src/odbc/unittests/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.73 2008/02/29 10:54:53 freddy77 Exp $ +# $Id: Makefile.am,v 1.74 2008/03/07 10:57:54 freddy77 Exp $ TESTS = \ t0001$(EXEEXT) t0002$(EXEEXT) t0003$(EXEEXT)\ t0004$(EXEEXT) connect$(EXEEXT) print$(EXEEXT)\ @@ -21,7 +21,7 @@ TESTS = \ connect2$(EXEEXT) timeout4$(EXEEXT) freeclose$(EXEEXT) \ cursor3$(EXEEXT) cursor4$(EXEEXT) cursor5$(EXEEXT) \ attributes$(EXEEXT) hidden$(EXEEXT) blob1$(EXEEXT) \ - cancel$(EXEEXT) wchar$(EXEEXT) rowset$(EXEEXT) + cancel$(EXEEXT) wchar$(EXEEXT) rowset$(EXEEXT) transaction2$(EXEEXT) check_PROGRAMS = $(TESTS) @@ -83,6 +83,7 @@ blob1_SOURCES = blob1.c common.c common.h rowset_SOURCES = rowset.c common.c common.h cancel_SOURCES = cancel.c common.c common.h wchar_SOURCES = wchar.c common.c common.h +transaction2_SOURCES = transaction2.c common.c common.h AM_CPPFLAGS = -I$(top_srcdir)/include $(ODBC_INC) -DFREETDS_SRCDIR=\"$(srcdir)\" if MINGW32 diff --git a/src/odbc/unittests/transaction2.c b/src/odbc/unittests/transaction2.c new file mode 100644 index 0000000..c7a0fae --- /dev/null +++ b/src/odbc/unittests/transaction2.c @@ -0,0 +1,205 @@ +#include "common.h" +#include + +/* Test transaction types */ + +static char software_version[] = "$Id: transaction2.c,v 1.1 2008/03/07 10:57:54 freddy77 Exp $"; +static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; + +static void +AutoCommit(int onoff) +{ + CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_AUTOCOMMIT, int2ptr(onoff), 0)); +} + +static void +EndTransaction(SQLSMALLINT type) +{ + CHK(SQLEndTran, (SQL_HANDLE_DBC, Connection, type)); +} + +#define SWAP(t,a,b) do { t xyz = a; a = b; b = xyz; } while(0) +#define SWAP_CONN() do { SWAP(HENV,env,Environment); SWAP(HDBC,dbc,Connection); SWAP(HSTMT,stmt,Statement);} 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 ret; + + /* transaction 1 try to change a row but not commit */ + Command(Statement, "UPDATE test_transaction SET t = 'second' WHERE n = 1"); + + SWAP_CONN(); + + /* second transaction try to fetch uncommited row */ + ret = CommandWithResult(Statement, "SELECT * FROM test_transaction WHERE t = 'second' AND n = 1"); + if (ret == SQL_ERROR) { + EndTransaction(SQL_ROLLBACK); + SWAP_CONN(); + EndTransaction(SQL_ROLLBACK); + return 0; /* no dirty read */ + } + + CHK(SQLFetch, (Statement)); + ret = SQLFetch(Statement); + if (ret != SQL_NO_DATA) + ODBC_REPORT_ERROR("other rows ??"); + SQLMoreResults(Statement); + EndTransaction(SQL_ROLLBACK); + SWAP_CONN(); + EndTransaction(SQL_ROLLBACK); + return 1; +} + +static int +CheckNonrepeatableRead(void) +{ + SQLRETURN ret; + + /* transaction 2 read a row */ + SWAP_CONN(); + CHK(CommandWithResult, (Statement, "SELECT * FROM test_transaction WHERE t = 'initial' AND n = 1")); + SQLMoreResults(Statement); + + /* transaction 1 change a row and commit */ + SWAP_CONN(); + ret = CommandWithResult(Statement, "UPDATE test_transaction SET t = 'second' WHERE n = 1"); + if (ret == 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 */ + Command(Statement, "SELECT * FROM test_transaction WHERE t = 'second' AND n = 1"); + + CHK(SQLFetch, (Statement)); + ret = SQLFetch(Statement); + if (ret != SQL_NO_DATA) + ODBC_REPORT_ERROR("other rows ??"); + SQLMoreResults(Statement); + EndTransaction(SQL_ROLLBACK); + SWAP_CONN(); + Command(Statement, "UPDATE test_transaction SET t = 'initial' WHERE n = 1"); + EndTransaction(SQL_COMMIT); + return 1; +} + +static int +CheckPhantom(void) +{ + SQLRETURN ret; + + /* transaction 2 read a row */ + SWAP_CONN(); + CHK(CommandWithResult, (Statement, "SELECT * FROM test_transaction WHERE t = 'initial'")); + SQLMoreResults(Statement); + + /* transaction 1 insert a row that match critera */ + SWAP_CONN(); + ret = CommandWithResult(Statement, "INSERT INTO test_transaction(n, t) VALUES(2, 'initial')"); + if (ret == 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 */ + Command(Statement, "SELECT * FROM test_transaction WHERE t = 'initial'"); + + CHK(SQLFetch, (Statement)); + CHK(SQLFetch, (Statement)); + ret = SQLFetch(Statement); + if (ret != SQL_NO_DATA) + ODBC_REPORT_ERROR("other rows ??"); + SQLMoreResults(Statement); + EndTransaction(SQL_ROLLBACK); + SWAP_CONN(); + Command(Statement, "DELETE test_transaction WHERE n = 2"); + EndTransaction(SQL_COMMIT); + return 1; +} + +static void +Test(int txn, const char *expected) +{ + int dirty, repeatable, phantom; + char buf[128]; + + SWAP_CONN(); + CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(txn), 0)); + 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) { + fprintf(stderr, "detected wrong TXN\nexpected '%s' got '%s'\n", expected, buf); + exit(1); + } +} + +int +main(int argc, char *argv[]) +{ + Connect(); + + /* here we can't use temporary table cause we use two connection */ + Command(Statement, "IF OBJECT_ID('test_transaction') IS NOT NULL DROP TABLE test_transaction"); + Command(Statement, "CREATE TABLE test_transaction(n NUMERIC(18,0) PRIMARY KEY, t VARCHAR(30))"); + Command(Statement, "INSERT INTO test_transaction(n, t) VALUES(1, 'initial')"); + + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0)); + + /* TODO test returned error */ +#if 0 + /* SQL error S1009 -- Invalid argument value */ + CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(SQL_TXN_REPEATABLE_READ | SQL_TXN_READ_COMMITTED), 0)); +#endif + + AutoCommit(SQL_AUTOCOMMIT_OFF); + + /* save this connection and do another */ + SWAP_CONN(); + + Connect(); + + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0)); + AutoCommit(SQL_AUTOCOMMIT_OFF); + + SWAP_CONN(); + + Test(SQL_TXN_READ_UNCOMMITTED, "dirty 1 non repeatable 1 phantom 1"); + Test(SQL_TXN_READ_COMMITTED, "dirty 0 non repeatable 1 phantom 1"); + Test(SQL_TXN_REPEATABLE_READ, "dirty 0 non repeatable 0 phantom 1"); + Test(SQL_TXN_SERIALIZABLE, "dirty 0 non repeatable 0 phantom 0"); + + Disconnect(); + + SWAP_CONN(); + + EndTransaction(SQL_COMMIT); + + /* Sybase do not accept DROP TABLE during a transaction */ + AutoCommit(SQL_AUTOCOMMIT_ON); + Command(Statement, "DROP TABLE test_transaction"); + + Disconnect(); + return 0; +} commit 336e1d70c3f0bf03429a18400bf4889b3adeaef7 Author: freddy77 Date: Fri Mar 7 15:40:57 2008 +0000 improved transaction2 odbc test diff --git a/ChangeLog b/ChangeLog index 22bac52..5c9aed3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Fri Mar 07 16:40:16 CET 2008 Frediano Ziglio + * src/odbc/unittests/transaction2.c: improved + Fri Mar 07 11:57:00 CET 2008 Frediano Ziglio * src/odbc/odbc.c src/odbc/unittests/.cvsignore: * src/odbc/unittests/Makefile.am: @@ -197,4 +200,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2497 2008/03/07 10:57:54 freddy77 Exp $ +$Id: ChangeLog,v 1.2498 2008/03/07 15:40:57 freddy77 Exp $ diff --git a/src/odbc/unittests/transaction2.c b/src/odbc/unittests/transaction2.c index c7a0fae..3842615 100644 --- a/src/odbc/unittests/transaction2.c +++ b/src/odbc/unittests/transaction2.c @@ -3,9 +3,26 @@ /* Test transaction types */ -static char software_version[] = "$Id: transaction2.c,v 1.1 2008/03/07 10:57:54 freddy77 Exp $"; +static char software_version[] = "$Id: transaction2.c,v 1.2 2008/03/07 15:40:57 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; +static char odbc_err[256]; +static char odbc_sqlstate[6]; + +static void +ReadError(void) +{ + memset(odbc_err, 0, sizeof(odbc_err)); + memset(odbc_sqlstate, 0, sizeof(odbc_sqlstate)); + if (!SQL_SUCCEEDED + (SQLGetDiagRec + (SQL_HANDLE_DBC, Connection, 1, (SQLCHAR *) odbc_sqlstate, NULL, (SQLCHAR *) odbc_err, sizeof(odbc_err), NULL))) { + printf("SQLGetDiagRec should not fail\n"); + exit(1); + } + printf("Message: '%s' %s\n", odbc_sqlstate, odbc_err); +} + static void AutoCommit(int onoff) { @@ -134,6 +151,36 @@ CheckPhantom(void) return 1; } +static int test_with_connect = 0; + +static void +ConnectWithTxn(int txn) +{ + int res; + char command[512]; + + CHK(SQLAllocEnv, (&Environment)); + CHK(SQLSetEnvAttr, (Environment, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) (SQL_OV_ODBC3), SQL_IS_UINTEGER)); + + CHK(SQLAllocConnect, (Environment, &Connection)); + + CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(txn), 0)); + res = SQLConnect(Connection, (SQLCHAR *) SERVER, SQL_NTS, (SQLCHAR *) USER, SQL_NTS, (SQLCHAR *) PASSWORD, SQL_NTS); + if (!SQL_SUCCEEDED(res)) + ODBC_REPORT_ERROR("Unable to open data source\n"); + + CHK(SQLAllocStmt, (Connection, &Statement)); + + sprintf(command, "use %s", DATABASE); + if (!SQL_SUCCEEDED(SQLExecDirect(Statement, (SQLCHAR *) command, SQL_NTS))) + ODBC_REPORT_ERROR("Unable to execute statement\n"); + +#ifndef TDS_NO_DM + /* unixODBC seems to require it */ + SQLMoreResults(Statement); +#endif +} + static void Test(int txn, const char *expected) { @@ -141,7 +188,14 @@ Test(int txn, const char *expected) char buf[128]; SWAP_CONN(); - CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(txn), 0)); + if (test_with_connect) { + Disconnect(); + ConnectWithTxn(txn); + CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0)); + AutoCommit(SQL_AUTOCOMMIT_OFF); + } else { + CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(txn), 0)); + } SWAP_CONN(); dirty = CheckDirtyRead(); @@ -158,22 +212,55 @@ Test(int txn, const char *expected) int main(int argc, char *argv[]) { + SQLRETURN ret; + + use_odbc_version3 = 1; Connect(); + /* Invalid argument value */ + ret = SQLSetConnectAttr(Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(SQL_TXN_REPEATABLE_READ | SQL_TXN_READ_COMMITTED), 0); + ReadError(); + if (ret != SQL_ERROR || strcmp(odbc_sqlstate, "HY024") != 0) { + Disconnect(); + fprintf(stderr, "Unexpected success\n"); + return 1; + } + /* here we can't use temporary table cause we use two connection */ Command(Statement, "IF OBJECT_ID('test_transaction') IS NOT NULL DROP TABLE test_transaction"); Command(Statement, "CREATE TABLE test_transaction(n NUMERIC(18,0) PRIMARY KEY, t VARCHAR(30))"); - Command(Statement, "INSERT INTO test_transaction(n, t) VALUES(1, 'initial')"); CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0)); - /* TODO test returned error */ -#if 0 - /* SQL error S1009 -- Invalid argument value */ - CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(SQL_TXN_REPEATABLE_READ | SQL_TXN_READ_COMMITTED), 0)); -#endif - AutoCommit(SQL_AUTOCOMMIT_OFF); + Command(Statement, "INSERT INTO test_transaction(n, t) VALUES(1, 'initial')"); + + /* test setting with active transaction "Operation invalid at this time" */ + ret = SQLSetConnectAttr(Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(SQL_TXN_REPEATABLE_READ), 0); + ReadError(); + if (ret != SQL_ERROR || strcmp(odbc_sqlstate, "HY011") != 0) { + Disconnect(); + fprintf(stderr, "Unexpected success\n"); + return 1; + } + + EndTransaction(SQL_COMMIT); + + Command(Statement, "SELECT * FROM test_transaction"); + + /* test setting with pending data */ + ret = SQLSetConnectAttr(Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(SQL_TXN_REPEATABLE_READ), 0); + ReadError(); + if (ret != SQL_ERROR || strcmp(odbc_sqlstate, "HY011") != 0) { + Disconnect(); + fprintf(stderr, "Unexpected success\n"); + return 1; + } + + SQLMoreResults(Statement); + + EndTransaction(SQL_COMMIT); + /* save this connection and do another */ SWAP_CONN(); @@ -190,6 +277,13 @@ main(int argc, char *argv[]) Test(SQL_TXN_REPEATABLE_READ, "dirty 0 non repeatable 0 phantom 1"); Test(SQL_TXN_SERIALIZABLE, "dirty 0 non repeatable 0 phantom 0"); + test_with_connect = 1; + + Test(SQL_TXN_READ_UNCOMMITTED, "dirty 1 non repeatable 1 phantom 1"); + Test(SQL_TXN_READ_COMMITTED, "dirty 0 non repeatable 1 phantom 1"); + Test(SQL_TXN_REPEATABLE_READ, "dirty 0 non repeatable 0 phantom 1"); + Test(SQL_TXN_SERIALIZABLE, "dirty 0 non repeatable 0 phantom 0"); + Disconnect(); SWAP_CONN(); commit c1b8c70982ac0f6b1942c1f0a5e569f4dea2ed0f Author: freddy77 Date: Tue Mar 11 08:36:41 2008 +0000 fix a problem with cvs and branches diff --git a/ChangeLog b/ChangeLog index 5c9aed3..f49e197 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Tue Mar 11 09:36:11 CET 2008 Frediano Ziglio + * src/tds/encodings.pl: fix a problem with cvs and branches + Fri Mar 07 16:40:16 CET 2008 Frediano Ziglio * src/odbc/unittests/transaction2.c: improved @@ -200,4 +203,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2498 2008/03/07 15:40:57 freddy77 Exp $ +$Id: ChangeLog,v 1.2499 2008/03/11 08:36:41 freddy77 Exp $ diff --git a/src/tds/encodings.pl b/src/tds/encodings.pl index 2346c18..719482e 100755 --- a/src/tds/encodings.pl +++ b/src/tds/encodings.pl @@ -30,7 +30,7 @@ $filename = "${srcdir}sybase_character_sets.h"; open(OUT, ">$filename") or die qq($basename: could not open "$filename"\n); print OUT "/*\n"; print OUT " * This file produced from $0\n"; -print OUT ' * $Id: encodings.pl,v 1.10 2005/04/06 06:44:33 jklowden Exp $', "\n"; +print OUT ' * $Id: encodings.pl,v 1.11 2008/03/11 08:36:41 freddy77 Exp $', "\n"; print OUT " */\n"; # look up the canonical name @@ -64,7 +64,7 @@ while(){ # grep for similar names, as an aid to the to programmer. $name =~ s/[\-\_]+//g; - print STDERR "$Name: $name alternative_character_sets.h\n"; + print STDERR $Name.": $name alternative_character_sets.h\n"; } $comma = ','; } @@ -77,7 +77,7 @@ close(OUT); print "/*\n"; $date = localtime; print " * This file produced from $0 on $date\n"; -print ' * $Id: encodings.pl,v 1.10 2005/04/06 06:44:33 jklowden Exp $', "\n"; +print ' * $Id: encodings.pl,v 1.11 2008/03/11 08:36:41 freddy77 Exp $', "\n"; print " */\n"; %charsets = (); commit d40b619026bc96201e99ff093608c20dd3816867 Author: freddy77 Date: Tue Mar 11 08:42:30 2008 +0000 fix auto-commit off before connection diff --git a/ChangeLog b/ChangeLog index f49e197..127da9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Tue Mar 11 09:42:04 CET 2008 Frediano Ziglio + * src/odbc/odbc.c: fix auto-commit off before connection + Tue Mar 11 09:36:11 CET 2008 Frediano Ziglio * src/tds/encodings.pl: fix a problem with cvs and branches @@ -203,4 +206,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2499 2008/03/11 08:36:41 freddy77 Exp $ +$Id: ChangeLog,v 1.2500 2008/03/11 08:42:30 freddy77 Exp $ diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index 190efbc..57d078c 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.474 2008/03/07 10:57:54 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.475 2008/03/11 08:42:30 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -224,6 +224,9 @@ change_autocommit(TDS_DBC * dbc, int state) ODBC_RETURN(dbc, SQL_ERROR); } dbc->attr.autocommit = state; + } else { + /* if not connected we will change auto-commit after login */ + dbc->attr.autocommit = state; } ODBC_RETURN_(dbc); } @@ -358,7 +361,11 @@ odbc_connect(TDS_DBC * dbc, TDSCONNECTION * connection) dbc->cursor_support = 1; if (dbc->attr.txn_isolation != SQL_TXN_READ_COMMITTED) - if (change_txn(dbc, dbc->attr.txn_isolation) != SQL_SUCCESS) + if (!SQL_SUCCEEDED(change_txn(dbc, dbc->attr.txn_isolation))) + ODBC_RETURN_(dbc); + + if (dbc->attr.autocommit != SQL_AUTOCOMMIT_ON) + if (!SQL_SUCCEEDED(change_autocommit(dbc, dbc->attr.autocommit))) ODBC_RETURN_(dbc); /* this overwrite any error arrived (wanted behavior, Sybase return error for conversion errors) */ commit 265159a73de9867b225f5b6887466d299e1e7492 Author: freddy77 Date: Wed Mar 12 13:35:48 2008 +0000 improve auto-commit diff --git a/ChangeLog b/ChangeLog index 127da9b..7122046 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Mar 12 14:34:21 CET 2008 Frediano Ziglio + * src/odbc/odbc.c: fix auto-commit set + * src/odbc/unittests/common.c src/odbc/unittests/common.h: + - make possible to override connection attributes + * src/odbc/unittests/transaction2.c: + - improve + Tue Mar 11 09:42:04 CET 2008 Frediano Ziglio * src/odbc/odbc.c: fix auto-commit off before connection @@ -206,4 +213,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2500 2008/03/11 08:42:30 freddy77 Exp $ +$Id: ChangeLog,v 1.2501 2008/03/12 13:35:48 freddy77 Exp $ diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index 57d078c..12682e8 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.475 2008/03/11 08:42:30 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.476 2008/03/12 13:35:49 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -280,11 +280,10 @@ change_txn(TDS_DBC * dbc, SQLUINTEGER txn_isolation) const char *level; TDSSOCKET *tds = dbc->tds_socket; - if (!tds) - ODBC_RETURN(dbc, SQL_ERROR); - - level = "READ COMMITTED"; switch (txn_isolation) { + case SQL_TXN_READ_COMMITTED: + level = "READ COMMITTED"; + break; case SQL_TXN_READ_UNCOMMITTED: level = "READ UNCOMMITTED"; break; @@ -294,17 +293,28 @@ change_txn(TDS_DBC * dbc, SQLUINTEGER txn_isolation) case SQL_TXN_SERIALIZABLE: level = "SERIALIZABLE"; break; + default: + odbc_errs_add(&dbc->errs, "HY024", NULL); + ODBC_RETURN(dbc, SQL_ERROR); } - sprintf(query, "SET TRANSACTION ISOLATION LEVEL %s", level); - if (tds->state == TDS_IDLE) - tds->query_timeout = dbc->default_query_timeout; + /* 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); + ODBC_RETURN(dbc, SQL_ERROR); + } + + tds->query_timeout = dbc->default_query_timeout; + sprintf(query, "SET TRANSACTION ISOLATION LEVEL %s", level); if (tds_submit_query(tds, query) != TDS_SUCCEED) ODBC_RETURN(dbc, SQL_ERROR); if (tds_process_simple_query(tds) != TDS_SUCCEED) ODBC_RETURN(dbc, SQL_ERROR); - ODBC_RETURN_(dbc); + return SQL_SUCCESS; } static void @@ -361,7 +371,7 @@ odbc_connect(TDS_DBC * dbc, TDSCONNECTION * connection) dbc->cursor_support = 1; if (dbc->attr.txn_isolation != SQL_TXN_READ_COMMITTED) - if (!SQL_SUCCEEDED(change_txn(dbc, dbc->attr.txn_isolation))) + if (change_txn(dbc, dbc->attr.txn_isolation) != SQL_SUCCESS) ODBC_RETURN_(dbc); if (dbc->attr.autocommit != SQL_AUTOCOMMIT_ON) diff --git a/src/odbc/unittests/common.c b/src/odbc/unittests/common.c index 78f58fe..f7b3283 100644 --- a/src/odbc/unittests/common.c +++ b/src/odbc/unittests/common.c @@ -12,13 +12,14 @@ #define TDS_SDIR_SEPARATOR "\\" #endif -static char software_version[] = "$Id: common.c,v 1.43 2008/01/29 14:30:48 freddy77 Exp $"; +static char software_version[] = "$Id: common.c,v 1.44 2008/03/12 13:35:49 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; HENV Environment; HDBC Connection; HSTMT Statement; int use_odbc_version3 = 0; +void (*odbc_set_conn_attr)(void) = NULL; char USER[512]; char SERVER[512]; @@ -193,17 +194,18 @@ Connect(void) printf("connection parameters:\nserver: '%s'\nuser: '%s'\npassword: '%s'\ndatabase: '%s'\n", SERVER, USER, "????" /* PASSWORD */ , DATABASE); + if (odbc_set_conn_attr) + (*odbc_set_conn_attr)(); + res = SQLConnect(Connection, (SQLCHAR *) SERVER, SQL_NTS, (SQLCHAR *) USER, SQL_NTS, (SQLCHAR *) PASSWORD, SQL_NTS); if (!SQL_SUCCEEDED(res)) { printf("Unable to open data source (ret=%d)\n", res); CheckReturn(); - exit(1); } if (SQLAllocStmt(Connection, &Statement) != SQL_SUCCESS) { printf("Unable to allocate statement\n"); CheckReturn(); - exit(1); } sprintf(command, "use %s", DATABASE); @@ -212,7 +214,6 @@ Connect(void) if (!SQL_SUCCEEDED(SQLExecDirect(Statement, (SQLCHAR *) command, SQL_NTS))) { printf("Unable to execute statement\n"); CheckReturn(); - exit(1); } #ifndef TDS_NO_DM @@ -311,8 +312,6 @@ CheckCols(int n, int line, const char * file) return; fprintf(stderr, "%s:%d: Unable to get column numbers\n", file, line); CheckReturn(); - Disconnect(); - exit(1); } if (cols != n) { @@ -334,8 +333,6 @@ CheckRows(int n, int line, const char * file) return; fprintf(stderr, "%s:%d: Unable to get row\n", file, line); CheckReturn(); - Disconnect(); - exit(1); } if (rows != n) { diff --git a/src/odbc/unittests/common.h b/src/odbc/unittests/common.h index b74e162..5e89ddf 100644 --- a/src/odbc/unittests/common.h +++ b/src/odbc/unittests/common.h @@ -21,7 +21,7 @@ #include #include -static char rcsid_common_h[] = "$Id: common.h,v 1.22 2008/01/29 14:30:48 freddy77 Exp $"; +static char rcsid_common_h[] = "$Id: common.h,v 1.23 2008/03/12 13:35:50 freddy77 Exp $"; static void *no_unused_common_h_warn[] = { rcsid_common_h, no_unused_common_h_warn }; #ifndef HAVE_SQLLEN @@ -37,6 +37,7 @@ extern HENV Environment; extern HDBC Connection; extern HSTMT Statement; extern int use_odbc_version3; +extern void (*odbc_set_conn_attr)(void); extern char USER[512]; extern char SERVER[512]; diff --git a/src/odbc/unittests/transaction2.c b/src/odbc/unittests/transaction2.c index 3842615..27353c4 100644 --- a/src/odbc/unittests/transaction2.c +++ b/src/odbc/unittests/transaction2.c @@ -3,7 +3,7 @@ /* Test transaction types */ -static char software_version[] = "$Id: transaction2.c,v 1.2 2008/03/07 15:40:57 freddy77 Exp $"; +static char software_version[] = "$Id: transaction2.c,v 1.3 2008/03/12 13:35:50 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static char odbc_err[256]; @@ -153,32 +153,22 @@ CheckPhantom(void) static int test_with_connect = 0; +static int global_txn; + static void -ConnectWithTxn(int txn) +my_attrs(void) { - int res; - char command[512]; - - CHK(SQLAllocEnv, (&Environment)); - CHK(SQLSetEnvAttr, (Environment, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) (SQL_OV_ODBC3), SQL_IS_UINTEGER)); - - CHK(SQLAllocConnect, (Environment, &Connection)); - - CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(txn), 0)); - res = SQLConnect(Connection, (SQLCHAR *) SERVER, SQL_NTS, (SQLCHAR *) USER, SQL_NTS, (SQLCHAR *) PASSWORD, SQL_NTS); - if (!SQL_SUCCEEDED(res)) - ODBC_REPORT_ERROR("Unable to open data source\n"); - - CHK(SQLAllocStmt, (Connection, &Statement)); - - sprintf(command, "use %s", DATABASE); - if (!SQL_SUCCEEDED(SQLExecDirect(Statement, (SQLCHAR *) command, SQL_NTS))) - ODBC_REPORT_ERROR("Unable to execute statement\n"); + CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(global_txn), 0)); + AutoCommit(SQL_AUTOCOMMIT_OFF); +} -#ifndef TDS_NO_DM - /* unixODBC seems to require it */ - SQLMoreResults(Statement); -#endif +static void +ConnectWithTxn(int txn) +{ + global_txn = txn; + odbc_set_conn_attr = my_attrs; + Connect(); + odbc_set_conn_attr = NULL; } static void @@ -192,7 +182,6 @@ Test(int txn, const char *expected) Disconnect(); ConnectWithTxn(txn); CHK(SQLSetStmtAttr, (Statement, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER) 2, 0)); - AutoCommit(SQL_AUTOCOMMIT_OFF); } else { CHK(SQLSetConnectAttr, (Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(txn), 0)); } @@ -235,6 +224,7 @@ main(int argc, char *argv[]) AutoCommit(SQL_AUTOCOMMIT_OFF); Command(Statement, "INSERT INTO test_transaction(n, t) VALUES(1, 'initial')"); +#if ENABLE_DEVELOPING /* test setting with active transaction "Operation invalid at this time" */ ret = SQLSetConnectAttr(Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(SQL_TXN_REPEATABLE_READ), 0); ReadError(); @@ -243,6 +233,7 @@ main(int argc, char *argv[]) fprintf(stderr, "Unexpected success\n"); return 1; } +#endif EndTransaction(SQL_COMMIT); commit ec8cc96a5acd3d0ab0743a190ca77d0d04bf5ed2 Author: freddy77 Date: Wed Mar 12 13:54:32 2008 +0000 handle SQL_TIMESTAMP like SQL_TYPE_TIMESTAMP diff --git a/ChangeLog b/ChangeLog index 7122046..b2ec0c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Wed Mar 12 14:53:50 CET 2008 Frediano Ziglio + * src/odbc/odbc.c: handle SQL_TIMESTAMP like SQL_TYPE_TIMESTAMP + Wed Mar 12 14:34:21 CET 2008 Frediano Ziglio * src/odbc/odbc.c: fix auto-commit set * src/odbc/unittests/common.c src/odbc/unittests/common.h: @@ -213,4 +216,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2501 2008/03/12 13:35:48 freddy77 Exp $ +$Id: ChangeLog,v 1.2502 2008/03/12 13:54:32 freddy77 Exp $ diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index 12682e8..6529b73 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.476 2008/03/12 13:35:49 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.477 2008/03/12 13:54:33 freddy77 Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -1954,13 +1954,14 @@ _SQLColAttribute(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, SQLP *pfDesc = 15; break; } - if (drec->sql_desc_concise_type == SQL_TYPE_TIMESTAMP) { + 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_TIMESTAMP + || drec->sql_desc_concise_type == SQL_TIMESTAMP) IOUT(SQLSMALLINT, drec->sql_desc_precision); else *pfDesc = drec->sql_desc_length; @@ -1969,7 +1970,9 @@ _SQLColAttribute(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLUSMALLINT fDescType, SQLP 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_FLOAT) + || 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 *pfDesc = 0; @@ -2403,7 +2406,9 @@ SQLGetDescField(SQLHDESC hdesc, SQLSMALLINT icol, SQLSMALLINT fDescType, SQLPOIN 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) + 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 */ @@ -2416,7 +2421,9 @@ SQLGetDescField(SQLHDESC hdesc, SQLSMALLINT icol, SQLSMALLINT fDescType, SQLPOIN #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_FLOAT) + || 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; @@ -2814,7 +2821,7 @@ odbc_populate_ird(TDS_STMT * stmt) return SQL_ERROR; /* TODO other types for date ?? SQL_TYPE_DATE, SQL_TYPE_TIME */ - if (drec->sql_desc_concise_type == SQL_TIMESTAMP) + if (drec->sql_desc_concise_type == SQL_TIMESTAMP || drec->sql_desc_concise_type == SQL_TYPE_TIMESTAMP) drec->sql_desc_length = sizeof("2000-01-01 12:00:00.0000")-1; else drec->sql_desc_length = col->column_size; commit fef64066a20e845bb7db85a5dd0dbb620d636cee Author: freddy77 Date: Wed Mar 12 14:26:07 2008 +0000 test proper handle type diff --git a/ChangeLog b/ChangeLog index b2ec0c6..0735575 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Wed Mar 12 15:25:11 CET 2008 Frediano Ziglio + * src/odbc/error.c: check proper handle type + Wed Mar 12 14:53:50 CET 2008 Frediano Ziglio * src/odbc/odbc.c: handle SQL_TIMESTAMP like SQL_TYPE_TIMESTAMP @@ -216,4 +219,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2502 2008/03/12 13:54:32 freddy77 Exp $ +$Id: ChangeLog,v 1.2503 2008/03/12 14:26:07 freddy77 Exp $ diff --git a/src/odbc/error.c b/src/odbc/error.c index f06d7d0..260e475 100644 --- a/src/odbc/error.c +++ b/src/odbc/error.c @@ -47,7 +47,7 @@ #include #endif -TDS_RCSID(var, "$Id: error.c,v 1.49 2007/10/16 15:12:21 freddy77 Exp $"); +TDS_RCSID(var, "$Id: error.c,v 1.50 2008/03/12 14:26:07 freddy77 Exp $"); static void odbc_errs_pop(struct _sql_errors *errs); static const char *odbc_get_msg(const char *sqlstate); @@ -250,60 +250,64 @@ rank_errors(struct _sql_errors *errs) struct _sql_error swapbuf; char istrans; - if (errs->ranked == 0 && errs->num_errors > 1) { - /* Find the highest of all unranked errors until there are none left */ - for (settled = 0; settled < errs->num_errors; settled++) { - best = -1; - for (current = settled; current < errs->num_errors; current++) { - 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: + /* 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 = -1; + for (current = settled; current < errs->num_errors; current++) { + 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; - 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; - } - - if (best == -1) - best = current; - - /* 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; + /* Transaction errors are always best */ + if (istrans == 1 && errs->errs[current].msgstate >= 10) { + best = current; + break; } + + if (best == -1) + best = current; + + /* 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; @@ -506,6 +510,7 @@ _SQLGetDiagRec(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, static const char msgprefix[] = "[FreeTDS][SQL Server]"; SQLINTEGER odbc_ver = SQL_OV_ODBC2; + SQLHANDLE parent; tdsdump_log(TDS_DBG_FUNC, "_SQLGetDiagRec(%d, %p, %d, %p, %p, %p, %d, %p)\n", handleType, handle, numRecord, szSqlState, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg); @@ -513,7 +518,7 @@ _SQLGetDiagRec(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, if (numRecord <= 0 || cbErrorMsgMax < 0) return SQL_ERROR; - if (!handle) + if (!handle || ((struct _hchk *) handle)->htype != handleType) return SQL_INVALID_HANDLE; switch (handleType) { @@ -531,7 +536,14 @@ _SQLGetDiagRec(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, odbc_ver = ((TDS_ENV *) handle)->attr.odbc_version; errs = &((TDS_ENV *) handle)->errs; break; - + case SQL_HANDLE_DESC: + parent = ((TDS_DESC *) handle)->parent; + if (((struct _hchk *) parent)->htype == SQL_HANDLE_DBC) + odbc_ver = ((TDS_DBC *) parent)->env->attr.odbc_version; + else + odbc_ver = ((TDS_STMT *) parent)->dbc->env->attr.odbc_version; + errs = &((TDS_DESC *) handle)->errs; + break; default: return SQL_INVALID_HANDLE; } @@ -589,8 +601,6 @@ SQLError(SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, SQLCHAR FAR * szSqlState, S } else return SQL_INVALID_HANDLE; - rank_errors(errs); - result = _SQLGetDiagRec(type, handle, 1, szSqlState, pfNativeError, szErrorMsg, cbErrorMsgMax, pcbErrorMsg); if (result == SQL_SUCCESS) { @@ -633,7 +643,7 @@ SQLGetDiagField(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT numRecord, if (cbBuffer < 0) return SQL_ERROR; - if (!handle) + if (!handle || ((struct _hchk *) handle)->htype != handleType) return SQL_INVALID_HANDLE; switch (handleType) { commit 29a5ac91b1b3aa94cfcf116f1f8f755767865ee5 Author: jklowden Date: Wed Mar 12 21:34:09 2008 +0000 Posted 0.82RC3 diff --git a/doc/htdoc/news.html b/doc/htdoc/news.html index b940620..d68c673 100644 --- a/doc/htdoc/news.html +++ b/doc/htdoc/news.html @@ -1,7 +1,7 @@ - + FreeTDS.org @@ -37,9 +37,23 @@ News  | 


+Version 0.82RC3 is now available from + +ftp.ibiblio.org. (12 March 2008) + +
+
+
Second Release Candidate available for 0.82
+
Version 0.82RC2 is now available from -ftp.ibiblio.org. +ftp.ibiblio.org. (28 February 2008)

0x6399SYBNTEXT7+yes4yes
0x67103SYBNVARCHAR7+yes2??0x67103SYBNVARCHAR7+yes1
0x68104SYBBITNyes10x7F127SYBINT8no0
0xA5165XSYBVARBINARY7+yes20xA5165XSYBVARBINARY7+yes2 *
0xA7167XSYBVARCHAR7+yes2yes0xA7167XSYBVARCHAR7+yes2 *yes
0xAD173XSYBBINARY7+yes20xE1225SYBLONGBINARY5yes4
0xE7231XSYBNVARCHAR7+yes2yes0xE7231XSYBNVARCHAR7+yes2 *yes
0xEF239XSYBNCHAR7+yes2yes

+

* Under TDS9+ these types allow size to be -1. These types represents varchar(max), varbinary(max) and nvarchar(max). +Data representation for these types change in this way: +

    +
  • size is 64 bit not 16 bit
  • +
  • if size is -1 meaning NULL
  • +
  • if size is -2 size is unknown
  • +
  • data is splitted in chunks where ever chunk start with a 32 bit size
  • +
  • a chunk with size <= 0 is the terminal chunk
  • +
+

Collate type - TDS8

commit 69922d6709c73175d82bc4535850ed11e3a9fa54 Author: freddy77 Date: Tue Mar 18 08:22:23 2008 +0000 consistent test diff --git a/src/odbc/unittests/transaction2.c b/src/odbc/unittests/transaction2.c index 27353c4..8c54082 100644 --- a/src/odbc/unittests/transaction2.c +++ b/src/odbc/unittests/transaction2.c @@ -3,7 +3,7 @@ /* Test transaction types */ -static char software_version[] = "$Id: transaction2.c,v 1.3 2008/03/12 13:35:50 freddy77 Exp $"; +static char software_version[] = "$Id: transaction2.c,v 1.4 2008/03/18 08:22:23 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; static char odbc_err[256]; @@ -224,7 +224,7 @@ main(int argc, char *argv[]) AutoCommit(SQL_AUTOCOMMIT_OFF); Command(Statement, "INSERT INTO test_transaction(n, t) VALUES(1, 'initial')"); -#if ENABLE_DEVELOPING +#ifdef ENABLE_DEVELOPING /* test setting with active transaction "Operation invalid at this time" */ ret = SQLSetConnectAttr(Connection, SQL_ATTR_TXN_ISOLATION, int2ptr(SQL_TXN_REPEATABLE_READ), 0); ReadError(); commit caa5c9a05d262e85f96275bcebcddc27d148b877 Author: jklowden Date: Sun Mar 23 17:29:57 2008 +0000 applied ML patches from Johnny C. Lam for calout locations and gnutls test diff --git a/ChangeLog b/ChangeLog index cfa0bba..e822060 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Mar 23 13:14:05 EDT 2008 JK Lowden + * configure.ac doc/Makefile.am + - applied ML patches from Johnny C. Lam for calout locations + - and gnutls test + Thu Mar 13 14:22:28 CET 2008 Frediano Ziglio * include/tdsodbc.h src/odbc/error.c: - make errs offset constant in all odbc structures to make @@ -227,4 +232,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2504 2008/03/13 13:23:30 freddy77 Exp $ +$Id: ChangeLog,v 1.2505 2008/03/23 17:29:57 jklowden Exp $ diff --git a/configure.ac b/configure.ac index 26bf18f..8fed8b9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl ------------------------------------------------------------ -dnl $Id: configure.ac,v 1.34 2008/02/15 11:00:40 freddy77 Exp $ +dnl $Id: configure.ac,v 1.35 2008/03/23 17:29:57 jklowden Exp $ dnl If you're trying to create a new configure test, try dnl dnl http://autogen.sourceforge.net/conftest.html @@ -15,7 +15,7 @@ dnl ------------------------------------------------------------ AC_INIT(FreeTDS, 0.83.dev.esyscmd(echo -n $(date +"%Y%m%d"))) AC_CONFIG_SRCDIR(src/dblib/dblib.c) AC_PREREQ(2.53) -AC_REVISION($Revision: 1.34 $) +AC_REVISION($Revision: 1.35 $) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS(include/config.h) @@ -621,7 +621,7 @@ AC_SUBST(ODBCNODMLIBAPP) AC_ARG_WITH(gnutls, AS_HELP_STRING([--with-gnutls], [build with TLS support])) -if test "$with_gnutls"; then +if test "$with_gnutls" = "yes"; then AC_DEFINE(HAVE_GNUTLS, 1, [Define to 1 if you have GNU tls.]) CPPFLAGS="$CPPFLAGS `libgnutls-config --cflags`" NETWORK_LIBS="$NETWORK_LIBS `libgnutls-config --libs`" diff --git a/doc/Makefile.am b/doc/Makefile.am index d416361..cec6568 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -2,7 +2,7 @@ # Converting DocBook to HTML (several small files) # http://www.freebsd.org/tutorials/docproj-primer/x3132.html#AEN3140 -# $Id: Makefile.am,v 1.62 2008/01/08 15:38:23 jklowden Exp $ +# $Id: Makefile.am,v 1.63 2008/03/23 17:29:57 jklowden Exp $ SHELL = /bin/sh TXT2MAN = $(srcdir)/txt2man @@ -55,7 +55,8 @@ man: $(man_MANS) installdirs: $(mkinstalldirs) $(TARGET_DOCDIR)/userguide \ $(TARGET_DOCDIR)/reference \ - $(TARGET_DOCDIR)/images 2>&1 + $(TARGET_DOCDIR)/images \ + $(TARGET_DOCDIR)/images/callouts 2>&1 MANOPTS = -I 'FreeTDS User Guide' -v 'FreeTDS Utilities' -t $(PRODUCT) -r $(VERSION) @@ -117,8 +118,8 @@ install-data-local: installdirs $(DOCDIR)/reference/index.html $(DOCDIR)/usergui if test -r $(DOCDIR)/reference ; then d=.; else d="$(srcdir)"; fi; \ find $$d/$(DOCDIR)/reference \( -type f -o -type l \) -exec \ $(INSTALL_DATA) {} $(TARGET_DOCDIR)/reference ';' - find $(srcdir)/images -name \*.gif -exec \ - $(INSTALL_DATA) {} $(TARGET_DOCDIR)/images ';' + cd $(srcdir) && find images -name \*.gif -exec \ + $(INSTALL_DATA) {} $(TARGET_DOCDIR)/{} ';' uninstall-local: rm -rf $(TARGET_DOCDIR) commit f64622af5a476514192cb713991cac89269b06e3 Author: jklowden Date: Sun Mar 23 17:42:36 2008 +0000 s/calout/callout/ diff --git a/ChangeLog b/ChangeLog index e822060..09d37bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ Sun Mar 23 13:14:05 EDT 2008 JK Lowden * configure.ac doc/Makefile.am - - applied ML patches from Johnny C. Lam for calout locations + - applied ML patches from Johnny C. Lam for callout locations - and gnutls test Thu Mar 13 14:22:28 CET 2008 Frediano Ziglio @@ -232,4 +232,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2505 2008/03/23 17:29:57 jklowden Exp $ +$Id: ChangeLog,v 1.2506 2008/03/23 17:42:36 jklowden Exp $ commit 11557109942abc5e139a6bb8be76498d70edcd32 Author: jklowden Date: Sun Mar 23 20:56:37 2008 +0000 clarified localization diff --git a/ChangeLog b/ChangeLog index 09d37bf..9ceb525 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Sun Mar 23 16:55:08 EDT 2008 JK Lowden + * doc/userguide.sgml clarified localization + Sun Mar 23 13:14:05 EDT 2008 JK Lowden * configure.ac doc/Makefile.am - applied ML patches from Johnny C. Lam for callout locations @@ -232,4 +235,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2506 2008/03/23 17:42:36 jklowden Exp $ +$Id: ChangeLog,v 1.2507 2008/03/23 20:56:37 jklowden Exp $ diff --git a/doc/userguide.sgml b/doc/userguide.sgml index e8d4c79..647648e 100644 --- a/doc/userguide.sgml +++ b/doc/userguide.sgml @@ -5,8 +5,8 @@ ]> - $Date: 2008/01/10 22:57:39 $ - $Revision: 1.111 $ + $Date: 2008/03/23 20:56:38 $ + $Revision: 1.112 $ <productname>FreeTDS</productname> User Guide A Guide to Installing, Configuring, and Running FreeTDS @@ -56,9 +56,9 @@ This guide is here for you, and we hope that you will be here for it, that other The version you're reading is: -$Revision: 1.111 $ -$Date: 2008/01/10 22:57:39 $ -CVS control number $Id: userguide.sgml,v 1.111 2008/01/10 22:57:39 jklowden Exp $. +$Revision: 1.112 $ +$Date: 2008/03/23 20:56:38 $ +CVS control number $Id: userguide.sgml,v 1.112 2008/03/23 20:56:38 jklowden Exp $. can be found on the FreeTDS @@ -568,7 +568,7 @@ url="http://www.madgoat.com">www.madgoat.com). OS X® - As of this writing ($Date: 2008/01/10 22:57:39 $), the regular distribution compiles on OS X. Releases prior to 0.63 either did not compile or required patching. + As of this writing ($Date: 2008/03/23 20:56:38 $), the regular distribution compiles on OS X. Releases prior to 0.63 either did not compile or required patching. Alternative build procedure @@ -928,7 +928,7 @@ It bears mentioning here that prior versions of FreeTDS client charset any valid iconv character set - ISO-8859-1Valid for ISO 8859-1 character set. See TDS 7.0 for Nonwestern Languages for more information. + 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/8.0. As of 0.62 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. @@ -1029,7 +1029,7 @@ As of 0.62 FreeTDS uses iconv to convert all character data, so there's no need
- For more about the wonder world of FreeTDSlogs, see Logging. + For more about the wonderful world of FreeTDS logs, see Logging.
Deprecated options</> @@ -1236,7 +1236,7 @@ When you're done, you should see something very like this: <para>If you specify <literal><replaceable>dataserver</replaceable>\<replaceable>instance</replaceable></literal> as dataserver during login, <productname>FreeTDS</productname> will attempt to connect to specified instance. - Only Microsoft SQL Server instances are supported. (This server feature was introduced with SQL Server 2000). + Only Microsoft SQL Server instances are supported. (This server feature was introduced with SQL Server 2000.) </para> <para>Note that other <filename>freetds.conf</> properties still apply. @@ -1249,8 +1249,8 @@ When you're done, you should see something very like this: <sect2 id="tsql"><title><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., db-lib). tsql can either use or bypass the configuration files, allowing you to see if it's your dataserver that's not responding, or your configuration files that are messed up. + 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-lib). + tsql can either use or bypass the configuration files. By trying both options, you can usually determine if it's your dataserver that's not responding, or your configuration files that are messed up. Using freetds.conf: @@ -1263,18 +1263,6 @@ The tsql utility is provided as part of FreeTDS expressly for trou - Bypassing freetds.conf: - - - tsql - -H hostname - -p port - -U username - -Ppassword - -C - - - Failing to connect with tsql @@ -1300,6 +1288,20 @@ 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. + + Connect with <command>tsql</> using a hostname and port number @@ -1491,7 +1493,7 @@ The following table defines all possible ODBC connection attributes for the -Connection attributes that may appear in <filename>freetds.conf</> +
Connection attributes that may appear in <filename>odbc.ini</> @@ -1746,7 +1748,7 @@ This chapter details some advanced configurations that need expanded explanation 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. SQL Server 2000 is also reported not to work from big endian clients without little endian emulation turned on. -If you are unfamiliar with the terms big endian and little endian, they are terms that come originally from Gulliver's Travels. What they refer to in computer science is the the order in which bytes are stored by a processor. Big endian machines such as Sparc and PowerPC store the most significant byte in the first memory location of a multi-byte integer. Little endian machines 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. +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 and 8.0 will automatically emulate little endian mode regardless of the freetds.conf setting. @@ -1763,16 +1765,16 @@ In this example we want to force connections to a server named mssql - - <acronym>TDS</> 7.0 for Nonwestern Languages + + Localization and <acronym>TDS</> 7.0 -TDS 7.0 uses 2-byte Unicode (technically, UCS-2) 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. +TDS 7.0 uses 2-byte Unicode (technically, UCS-2) 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.) -Since most Unix tools and languages do not support UCS-2, FreeTDS allows conversion by the client to other character sets using the iconv standard. Background information on Unicode and how it affects FreeTDS can be found in the appendix. 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 between only ISO-8859-1 and UCS-2. +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, and UCS-2. -To learn what character set the client is using, FreeTDS examines the freetds.conf entry. If it finds nothing there, it assumes the client is using ISO-8859-1. That is generally a safe assumption for western languages such as English or French, but produces garbage for other languages. +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 replacment). 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. @@ -1801,10 +1803,9 @@ In this example a server named mssql will return data encoded 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. +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. Extreme care should be taken with testing applications using these encodings. Specifically, many applications do not expect the number of characters returned to exceed the column size (in bytes). On the other hand, support of UTF-8 and UCS-2 is a high priority for the developers. Patches and bug reports in this area are especially welcome. - +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. @@ -3483,7 +3484,7 @@ But check! No point in trying to use a null pointer. - Typically it's more convenient to have db-lib convert the data into the desired for. The function that does that is dbind(). So: after fetching the metadata, and before fetching the data, we usually prepare the bound columns. + Typically it's more convenient to have db-lib 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 commit 57b81538c6041f8b6534fbe6511a070739770115 Author: jklowden Date: Fri Apr 18 19:43:52 2008 +0000 added version lable diff --git a/doc/tds.html b/doc/tds.html index 28ab6de..b6ecd7a 100644 --- a/doc/tds.html +++ b/doc/tds.html @@ -439,7 +439,7 @@ auth authentication data

* Under TDS9+ these types allow size to be -1. These types represents varchar(max), varbinary(max) and nvarchar(max). -Data representation for these types change in this way: +Data representation for these types change in this way:

  • size is 64 bit not 16 bit
  • if size is -1 meaning NULL
  • @@ -447,7 +447,6 @@ Data representation for these types change in this way:
  • data is splitted in chunks where ever chunk start with a 32 bit size
  • a chunk with size <= 0 is the terminal chunk
-

Collate type - TDS8

@@ -1516,6 +1515,8 @@ The following people have contributed to this document:

(short list) +

Document Status

+

$Id: tds.html,v 1.37 2008/04/18 19:43:52 jklowden Exp $

Date: Wed Apr 23 21:35:45 2008 +0000 removed spurious 0xA0 from output diff --git a/ChangeLog b/ChangeLog index 9ceb525..33b692a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Apr 23 17:25:58 EDT 2008 JK Lowden + * src/apps/bsqldb.c removed spurious 0xA0 from output + * src/odbc/odbc.c add error diagnostic to SQLGetData + * include/tds.h src/tds/log.c src/tds/login.c + * src/tds/token.c + - add tdsdump_col() + Sun Mar 23 16:55:08 EDT 2008 JK Lowden * doc/userguide.sgml clarified localization @@ -235,4 +242,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2507 2008/03/23 20:56:37 jklowden Exp $ +$Id: ChangeLog,v 1.2508 2008/04/23 21:35:45 jklowden Exp $ diff --git a/src/apps/bsqldb.c b/src/apps/bsqldb.c index aa87180..ba4f26b 100644 --- a/src/apps/bsqldb.c +++ b/src/apps/bsqldb.c @@ -45,7 +45,7 @@ #include #include "replacements.h" -static char software_version[] = "$Id: bsqldb.c,v 1.32 2007/12/06 19:00:24 freddy77 Exp $"; +static char software_version[] = "$Id: bsqldb.c,v 1.33 2008/04/23 21:35:45 jklowden Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; int err_handler(DBPROCESS * dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr); @@ -869,7 +869,7 @@ msg_handler(DBPROCESS * dbproc, DBINT msgno, int msgstate, int severity, char *m fprintf(stderr, "%s\n", msgtext); if (severity > 10) { - fprintf(stderr, "%s: error: severity %d > 10, exiting\n", options.appname, severity); + fprintf(stderr, "%s: error: severity %d > 10, exiting\n", options.appname, severity); exit(severity); } commit f991c8282649826762b9dbd0c17215bcea1c373c Author: jklowden Date: Wed Apr 23 21:35:54 2008 +0000 add error diagnostic to SQLGetData diff --git a/src/odbc/odbc.c b/src/odbc/odbc.c index 0938e37..62f7222 100644 --- a/src/odbc/odbc.c +++ b/src/odbc/odbc.c @@ -60,7 +60,7 @@ #include #endif -TDS_RCSID(var, "$Id: odbc.c,v 1.478 2008/03/13 13:23:31 freddy77 Exp $"); +TDS_RCSID(var, "$Id: odbc.c,v 1.479 2008/04/23 21:35:54 jklowden Exp $"); static SQLRETURN _SQLAllocConnect(SQLHENV henv, SQLHDBC FAR * phdbc); static SQLRETURN _SQLAllocEnv(SQLHENV FAR * phenv); @@ -4637,7 +4637,10 @@ SQLGetData(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgb } /* read data from TDS only if current statement */ - if ((stmt->cursor == NULL && stmt->dbc->current_statement != stmt) || stmt->row_status == PRE_NORMAL_ROW || stmt->row_status == NOT_IN_ROW) { + if ((stmt->cursor == NULL && stmt->dbc->current_statement != stmt) + || stmt->row_status == PRE_NORMAL_ROW + || stmt->row_status == NOT_IN_ROW) + { odbc_errs_add(&stmt->errs, "24000", NULL); ODBC_RETURN(stmt, SQL_ERROR); } @@ -4649,16 +4652,16 @@ SQLGetData(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgb tds = stmt->dbc->tds_socket; context = stmt->dbc->env->tds_ctx; - resinfo = tds->current_results; - if (!resinfo) { + + if (!tds->current_results) { odbc_errs_add(&stmt->errs, "HY010", NULL); ODBC_RETURN(stmt, SQL_ERROR); } - if (icol <= 0 || icol > resinfo->num_cols) { + if (icol <= 0 || icol > tds->current_results->num_cols) { odbc_errs_add(&stmt->errs, "07009", "Column out of range"); ODBC_RETURN(stmt, SQL_ERROR); } - colinfo = resinfo->columns[icol - 1]; + colinfo = tds->current_results->columns[icol - 1]; if (colinfo->column_cur_size < 0) { *pcbValue = SQL_NULL_DATA; @@ -4700,22 +4703,23 @@ SQLGetData(SQLHSTMT hstmt, SQLUSMALLINT icol, SQLSMALLINT fCType, SQLPOINTER rgb } if (is_variable_type(colinfo->column_type) && (fCType == SQL_C_CHAR || fCType == SQL_C_BINARY)) { - /* calc how many bytes was readed */ - int readed = cbValueMax; + /* calculate how many bytes were read */ + int remaining = cbValueMax; /* FIXME test on destination char ??? */ - if (stmt->dbc->env->attr.output_nts != SQL_FALSE && fCType == SQL_C_CHAR && readed > 0) - --readed; - if (readed > *pcbValue) - readed = *pcbValue; - colinfo->column_text_sqlgetdatapos += readed; + if (stmt->dbc->env->attr.output_nts != SQL_FALSE && fCType == SQL_C_CHAR && remaining > 0) + --remaining; + if (remaining > *pcbValue) + remaining = *pcbValue; + colinfo->column_text_sqlgetdatapos += remaining; /* avoid infinite SQL_SUCCESS on empty strings */ if (colinfo->column_text_sqlgetdatapos == 0 && cbValueMax > 0) ++colinfo->column_text_sqlgetdatapos; - /* not all readed ?? */ - if (colinfo->column_text_sqlgetdatapos < colinfo->column_cur_size) - /* TODO add diagnostic */ + + if (colinfo->column_text_sqlgetdatapos < colinfo->column_cur_size) { /* not all read ?? */ + odbc_errs_add(&stmt->errs, "1004", "String data, right truncated"); ODBC_RETURN(stmt, SQL_SUCCESS_WITH_INFO); + } } else { colinfo->column_text_sqlgetdatapos = colinfo->column_size; } commit f0a6eca4f74069613ae324b645498827b96a7679 Author: jklowden Date: Wed Apr 23 21:36:01 2008 +0000 add tdsdump_col() diff --git a/include/tds.h b/include/tds.h index 1a5eafa..50d0282 100644 --- a/include/tds.h +++ b/include/tds.h @@ -20,7 +20,7 @@ #ifndef _tds_h_ #define _tds_h_ -/* $Id: tds.h,v 1.285 2008/01/18 13:37:12 freddy77 Exp $ */ +/* $Id: tds.h,v 1.286 2008/04/23 21:36:01 jklowden Exp $ */ #include #include @@ -1535,18 +1535,22 @@ void tds_set_parent(TDSSOCKET * tds, void *the_parent); void *tds_get_parent(TDSSOCKET * tds); int tds_swap_bytes(unsigned char *buf, int bytes); int tds_version(TDSSOCKET * tds_socket, char *pversion_string); +unsigned int tds_gettime_ms(void); + +/* log.c */ void tdsdump_off(void); void tdsdump_on(void); int tdsdump_open(const char *filename); void tdsdump_close(void); void tdsdump_dump_buf(const char* file, unsigned int level_line, const char *msg, const void *buf, int length); -void tdsdump_log(const char* file, unsigned int level_line, const char *fmt, ...) +void tdsdump_col(const TDSCOLUMN *col); +void tdsdump_log(const char* file, unsigned int level_line, const char *fmt, ...) + #if defined(__GNUC__) && __GNUC__ >= 2 __attribute__ ((__format__ (__printf__, 3, 4))) #endif ; extern int tds_debug_flags; -unsigned int tds_gettime_ms(void); /* net.c */ int tds_open_socket(TDSSOCKET * tds, const char *ip_addr, unsigned int port, int timeout); diff --git a/src/tds/log.c b/src/tds/log.c index 2de151f..4c9ee5d 100644 --- a/src/tds/log.c +++ b/src/tds/log.c @@ -66,7 +66,7 @@ #include #endif -TDS_RCSID(var, "$Id: log.c,v 1.4 2007/11/12 22:17:28 jklowden Exp $"); +TDS_RCSID(var, "$Id: log.c,v 1.5 2008/04/23 21:36:01 jklowden Exp $"); /* for now all messages go to the log */ int tds_debug_flags = TDS_DBGFLAG_ALLLVL | TDS_DBGFLAG_SOURCE; @@ -111,7 +111,7 @@ tdsdump_on(void) /** - * This creates and truncates a human readable dump file for the TDS + * 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. @@ -362,7 +362,7 @@ tdsdump_dump_buf(const char* file, unsigned int level_line, const char *msg, con /** - * This function write a message to the debug 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 @@ -415,3 +415,79 @@ tdsdump_log(const char* file, unsigned int level_line, const char *fmt, ...) TDS_MUTEX_UNLOCK(&g_dump_mutex); } /* tdsdump_log() */ +/** + * Write a column value to the debug log. + * \param file name of the log file + * \param col column to dump + */ +void +tdsdump_col(const TDSCOLUMN *col) +{ + const char* typename; + char* data; + TDS_SMALLINT type; + + assert(col); + assert(col->column_data); + + typename = tds_prtype(col->column_type); + type = col->column_type; + + switch(type) { + case SYBINTN: + switch(col->column_cur_size) { + case sizeof(TDS_INT): + type = SYBINT4; + break; + case sizeof(TDS_SMALLINT): + type = SYBINT2; + break; + case sizeof(TDS_TINYINT): + type = SYBINT1; + break; + } + break; + case SYBFLTN: + switch(col->column_cur_size) { + case sizeof(TDS_REAL): + type = SYBREAL; + break; + case sizeof(TDS_FLOAT): + type = SYBFLT8; + break; + } + break; + } + + switch(type) { + case SYBCHAR: + case SYBVARCHAR: + data = calloc(1, 1 + col->column_cur_size); + if( !data ) { + tdsdump_log(TDS_DBG_FUNC, "no memory to log data for type %s\n", typename); + return; + } + memcpy(data, col->column_data, col->column_cur_size); + tdsdump_log(TDS_DBG_FUNC, "type %s has value \"%s\"\n", typename, data); + free(data); + break; + case SYBINT1: + tdsdump_log(TDS_DBG_FUNC, "type %s has value %d\n", typename, (int)*(TDS_TINYINT*)col->column_data); + break; + case SYBINT2: + tdsdump_log(TDS_DBG_FUNC, "type %s has value %d\n", typename, (int)*(TDS_SMALLINT*)col->column_data); + break; + case SYBINT4: + tdsdump_log(TDS_DBG_FUNC, "type %s has value %d\n", typename, (int)*(TDS_INT*)col->column_data); + break; + case SYBREAL: + tdsdump_log(TDS_DBG_FUNC, "type %s has value %f\n", typename, (double)*(TDS_REAL*)col->column_data); + break; + case SYBFLT8: + tdsdump_log(TDS_DBG_FUNC, "type %s has value %d\n", typename, (double)*(TDS_FLOAT*)col->column_data); + break; + default: + tdsdump_log(TDS_DBG_FUNC, "cannot log data for type %s\n", typename); + break; + } +} diff --git a/src/tds/login.c b/src/tds/login.c index 1bcbd0c..58deec6 100644 --- a/src/tds/login.c +++ b/src/tds/login.c @@ -51,7 +51,7 @@ #include #endif -TDS_RCSID(var, "$Id: login.c,v 1.172 2007/12/31 10:06:50 freddy77 Exp $"); +TDS_RCSID(var, "$Id: login.c,v 1.173 2008/04/23 21:36:01 jklowden Exp $"); static int tds_send_login(TDSSOCKET * tds, TDSCONNECTION * connection); static int tds8_do_login(TDSSOCKET * tds, TDSCONNECTION * connection); @@ -533,6 +533,9 @@ tds_send_login(TDSSOCKET * tds, TDSCONNECTION * connection) int len; char blockstr[16]; + /* override lservname field for ASA servers */ + const char *lservname = getenv("ASA_DATABASE")? getenv("ASA_DATABASE") : tds_dstr_cstr(&connection->server_name); + if (strchr(tds_dstr_cstr(&connection->user_name), '\\') != NULL) { tdsdump_log(TDS_DBG_ERROR, "NT login not support using TDS 4.x or 5.0\n"); return TDS_FAIL; @@ -579,7 +582,7 @@ tds_send_login(TDSSOCKET * tds, TDSCONNECTION * connection) } tds_put_n(tds, magic3, 3); tds_put_login_string(tds, tds_dstr_cstr(&connection->app_name), TDS_MAX_LOGIN_STR_SZ); - tds_put_login_string(tds, tds_dstr_cstr(&connection->server_name), TDS_MAX_LOGIN_STR_SZ); + tds_put_login_string(tds, lservname, TDS_MAX_LOGIN_STR_SZ); if (IS_TDS42(tds)) { tds_put_login_string(tds, tds_dstr_cstr(&connection->password), 255); } else { diff --git a/src/tds/token.c b/src/tds/token.c index e6d5a6d..445c4b1 100644 --- a/src/tds/token.c +++ b/src/tds/token.c @@ -42,7 +42,7 @@ #include #endif -TDS_RCSID(var, "$Id: token.c,v 1.344 2008/01/13 20:01:45 freddy77 Exp $"); +TDS_RCSID(var, "$Id: token.c,v 1.345 2008/04/23 21:36:01 jklowden Exp $"); static int tds_process_msg(TDSSOCKET * tds, int marker); static int tds_process_compute_result(TDSSOCKET * tds); @@ -1223,6 +1223,7 @@ tds_process_param_result(TDSSOCKET * tds, TDSPARAMINFO ** pinfo) return TDS_FAIL; token = tds_get_data(tds, curparam); + tdsdump_col(curparam); /* * Real output parameters will either be unnamed or will have a valid @@ -1573,6 +1574,8 @@ 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", tds, curcol, is_param, is_param? "[for parameter]" : ""); + curcol->column_namelen = tds_get_string(tds, tds_get_byte(tds), curcol->column_name, sizeof(curcol->column_name) - 1); curcol->column_name[curcol->column_namelen] = '\0'; @@ -1585,11 +1588,52 @@ tds_get_data_info(TDSSOCKET * tds, TDSCOLUMN * curcol, int is_param) curcol->column_writeable = (curcol->column_flags & 0x10) > 1; curcol->column_nullable = (curcol->column_flags & 0x20) > 1; curcol->column_identity = (curcol->column_flags & 0x40) > 1; - } - /* TODO what's these bytes ?? */ - if (IS_TDS90(tds)) - tds_get_n(tds, NULL, 2); +#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_TDS90(tds)) { + 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_TDS90(tds)) { + 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_set_column_type(tds, curcol, tds_get_byte(tds)); commit 48d88d459db8323e2d69866ccd0862856e1d331e Author: jklowden Date: Thu Apr 24 15:59:29 2008 +0000 small clarifications diff --git a/ChangeLog b/ChangeLog index 33b692a..0357601 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Thu Apr 24 11:57:24 EDT 2008 JK Lowden + * doc/htdoc/faq.html small clarifications + Wed Apr 23 17:25:58 EDT 2008 JK Lowden * src/apps/bsqldb.c removed spurious 0xA0 from output * src/odbc/odbc.c add error diagnostic to SQLGetData @@ -242,4 +245,4 @@ Wed Jan 9 19:54:43 EST 2008 JK Lowden * ChangeLog truncated because of release * ChangeLog-0.82 added because of release -$Id: ChangeLog,v 1.2508 2008/04/23 21:35:45 jklowden Exp $ +$Id: ChangeLog,v 1.2509 2008/04/24 15:59:29 jklowden Exp $ diff --git a/doc/htdoc/faq.html b/doc/htdoc/faq.html index 76126b3..d49ac66 100644 --- a/doc/htdoc/faq.html +++ b/doc/htdoc/faq.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + -

-
  1. General Questions @@ -126,18 +122,12 @@
  2. -
  3. Problems Running - -