From: Pat Thoyts Date: Mon, 6 Sep 2010 20:41:09 +0000 (+0100) Subject: version 3.03 X-Git-Tag: v3.03 X-Git-Url: http://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=ed65cad66121b55dd177557cdab694f07d579924;p=mysqltcl version 3.03 Signed-off-by: Pat Thoyts --- diff --git a/COPYING b/COPYING index d2e5aee..2accc74 100644 --- a/COPYING +++ b/COPYING @@ -1,11 +1,4 @@ -Information for american jusitice/law maniacs -- do not eat this code -- the program do not makes wonder -- ... - -Artur Trzewik - not care -Please ask another authors. - Some other old historical license notes can be fond in READMY-msqltcl , mysqltcl.c and mysqltcl.n +It seems that it is BSD-like licence diff --git a/ChangeLog b/ChangeLog old mode 100644 new mode 100755 diff --git a/README-msqltcl b/README-msqltcl old mode 100644 new mode 100755 diff --git a/configure b/configure index 07d0f96..66ac37c 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for mysqltcl 3.02. +# Generated by GNU Autoconf 2.59 for mysqltcl 3.03. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation @@ -267,8 +267,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='mysqltcl' PACKAGE_TARNAME='mysqltcl' -PACKAGE_VERSION='3.02' -PACKAGE_STRING='mysqltcl 3.02' +PACKAGE_VERSION='3.03' +PACKAGE_STRING='mysqltcl 3.03' PACKAGE_BUGREPORT='' # Factoring default headers for most tests. @@ -777,7 +777,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures mysqltcl 3.02 to adapt to many kinds of systems. +\`configure' configures mysqltcl 3.03 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -834,7 +834,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mysqltcl 3.02:";; + short | recursive ) echo "Configuration of mysqltcl 3.03:";; esac cat <<\_ACEOF @@ -968,7 +968,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -mysqltcl configure 3.02 +mysqltcl configure 3.03 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -982,7 +982,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by mysqltcl $as_me 3.02, which was +It was created by mysqltcl $as_me 3.03, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -10147,7 +10147,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by mysqltcl $as_me 3.02, which was +This file was extended by mysqltcl $as_me 3.03, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -10202,7 +10202,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -mysqltcl config.status 3.02 +mysqltcl config.status 3.03 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.in b/configure.in index d14b576..ae7f3be 100755 --- a/configure.in +++ b/configure.in @@ -19,7 +19,7 @@ dnl to configure the system for the local environment. # so you can encode the package version directly into the source files. #----------------------------------------------------------------------- -AC_INIT([mysqltcl], [3.02]) +AC_INIT([mysqltcl], [3.03]) #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. diff --git a/doc/man.macros b/doc/man.macros old mode 100644 new mode 100755 diff --git a/doc/man.tcl b/doc/man.tcl old mode 100644 new mode 100755 diff --git a/doc/mysqltcl.html b/doc/mysqltcl.html old mode 100644 new mode 100755 diff --git a/doc/mysqltcl.man b/doc/mysqltcl.man old mode 100644 new mode 100755 diff --git a/doc/mysqltcl.n b/doc/mysqltcl.n old mode 100644 new mode 100755 diff --git a/generic/Makefile.org b/generic/Makefile.org old mode 100644 new mode 100755 diff --git a/generic/mysqltcl.c b/generic/mysqltcl.c old mode 100644 new mode 100755 index afcf7f0..6ff393e --- a/generic/mysqltcl.c +++ b/generic/mysqltcl.c @@ -549,7 +549,6 @@ static MysqlTclHandle *mysql_prologue(Tcl_Interp *interp,int objc,Tcl_Obj *CONST static Tcl_Obj *mysql_colinfo(Tcl_Interp *interp,int objc,Tcl_Obj *CONST objv[],MYSQL_FIELD* fld,Tcl_Obj * keyw) { - char buf[MYSQL_SMALL_SIZE]; int idx ; static CONST char* MysqlColkey[] = @@ -574,6 +573,7 @@ static Tcl_Obj *mysql_colinfo(Tcl_Interp *interp,int objc,Tcl_Obj *CONST objv[], switch (fld->type) { + case FIELD_TYPE_DECIMAL: return Tcl_NewStringObj("decimal", -1); case FIELD_TYPE_TINY: @@ -610,7 +610,6 @@ static Tcl_Obj *mysql_colinfo(Tcl_Interp *interp,int objc,Tcl_Obj *CONST objv[], return Tcl_NewStringObj("set", -1); case FIELD_TYPE_TINY_BLOB: return Tcl_NewStringObj("tiny blob", -1); - case FIELD_TYPE_MEDIUM_BLOB: return Tcl_NewStringObj("medium blob", -1); case FIELD_TYPE_LONG_BLOB: @@ -621,14 +620,16 @@ static Tcl_Obj *mysql_colinfo(Tcl_Interp *interp,int objc,Tcl_Obj *CONST objv[], return Tcl_NewStringObj("var string", -1); case FIELD_TYPE_STRING: return Tcl_NewStringObj("string", -1); +#if MYSQL_VERSION_ID >= 50000 + case MYSQL_TYPE_NEWDECIMAL: + return Tcl_NewStringObj("newdecimal", -1); + case MYSQL_TYPE_GEOMETRY: + return Tcl_NewStringObj("geometry", -1); + case MYSQL_TYPE_BIT: + return Tcl_NewStringObj("bit", -1); +#endif default: - if (strlen(fld->name)name); - } else { - sprintf(buf, "column has unknown datatype"); - } - mysql_prim_confl(interp,objc,objv,buf); - return NULL ; + return Tcl_NewStringObj("unknown", -1); } break ; case MYSQL_COL_LENGTH_K: diff --git a/generic/mysqltcl_5columns.patch b/generic/mysqltcl_5columns.patch new file mode 100644 index 0000000..038729e --- /dev/null +++ b/generic/mysqltcl_5columns.patch @@ -0,0 +1,23 @@ +575a576 +> +577,579d577 +< #if MYSQL_VERSION_ID >= 50000 +< case FIELD_TYPE_NEWDECIMAL: +< #endif +614a613 +> +625,630d623 +< case FIELD_TYPE_GEOMETRY: +< return Tcl_NewStringObj("geometry", -1); +< #if MYSQL_VERSION_ID >= 50000 +< case FIELD_TYPE_BIT: +< return Tcl_NewStringObj("bit", -1); +< #endif +633c626 +< sprintf(buf, "column '%s' has unknown datatype %d", fld->name, fld->type); +--- +> sprintf(buf, "column '%s' has unknown datatype", fld->name); +635c628 +< sprintf(buf, "column has unknown datatype %d", fld->type); +--- +> sprintf(buf, "column has unknown datatype"); diff --git a/mysqltcl_2.14.c b/mysqltcl_2.14.c old mode 100644 new mode 100755 diff --git a/tests/edv.jpg.bin b/tests/edv.jpg.bin old mode 100644 new mode 100755 diff --git a/tests/libload.tcl b/tests/libload.tcl old mode 100644 new mode 100755 index adc91fd..a9074ec --- a/tests/libload.tcl +++ b/tests/libload.tcl @@ -1,4 +1,4 @@ -set file libmysqltcl3.02 +set file libmysqltcl3.03 if {[file exists ./${file}[info sharedlibextension]]} { load ./${file}[info sharedlibextension] diff --git a/tests/regression_openclose.tcl b/tests/regression_openclose.tcl old mode 100644 new mode 100755 diff --git a/tests/test.sql b/tests/test.sql old mode 100644 new mode 100755 diff --git a/tests/test.tcl b/tests/test.tcl new file mode 100755 index 0000000..0a8e0b5 --- /dev/null +++ b/tests/test.tcl @@ -0,0 +1,428 @@ +#!/usr/bin/tcl +# Simple Test file to test all mysqltcl commands and parameters +# please create test database first +# from test.sql file +# >mysql -u root +# >create database uni; +# +# >mysql -u root 0) break + incr count + } + return +} + +tcltest::test {receive-1.2} {with error} -body { + set count 0 + mysqlreceive $handle {select MatrNr,Name from Student order by Name} {nr name} { + set res [list $nr $name] + if ($count>0) { + error "Test Error" + } + incr count + } + return +} -returnCodes error -result "Test Error" + +tcltest::test {query-1.0} {base case} -body { + set query1 [mysqlquery $handle {select MatrNr,Name From Student Order By Name}] + mysqlnext $query1 + set query2 [mysqlquery $handle {select MatrNr,Name From Student Order By Name}] + mysqlnext $query2 + mysqlendquery $query1 + mysqlnext $query2 + mysqlresult $query2 cols + mysqlresult $query2 rows + mysqlresult $query2 current + mysqlseek $query2 0 + mysqlnext $query2 + mysqlresult $query2 current + mysqlcol $query2 -current {name type length table non_null prim_key decimals numeric} + mysqlendquery $query2 + return +} + +tcltest::test {query-1.1} {endquery on handle} -body { + mysqlsel $handle {select * from Student} + mysqlendquery $handle + mysqlresult $handle current +} -returnCodes error -match glob -result "*no result*" + +tcltest::test {status-1.0} {read status array} -body { + set ret "code=$mysqlstatus(code) command=$mysqlstatus(command) message=$mysqlstatus(message) nullvalue=$mysqlstatus(nullvalue)" + return +} + +tcltest::test {insert-1.0} {new insert id check} -body { + mysqlexec $handle {INSERT INTO Student (Name,Semester) VALUES ('Artur Trzewik',11)} + set newid [mysqlinsertid $handle] + mysqlexec $handle "UPDATE Student SET Semester=12 WHERE MatrNr=$newid" + mysqlinfo $handle info + mysqlexec $handle "DELETE FROM Student WHERE MatrNr=$newid" +} -result 1 + +tcltest::test {nullvalue-1.0} {null value handling} -body { + # Test NULL Value setting + mysqlexec $handle {INSERT INTO Student (Name) VALUES (Null)} + set id [mysqlinsertid $handle] + set mysqlstatus(nullvalue) NULL + set res [lindex [mysqlsel $handle "select Name,Semester from Student where MatrNr=$id" -list] 0] + lindex $res 1 +} -result NULL + +tcltest::test {schema-1.0} {querry on schema} -body { + # Metadata querries + mysqlcol $handle Student name + mysqlcol $handle Student {name type length table non_null prim_key decimals numeric} + return +} + +tcltest::test {info-1.0} {info} -body { + mysqlinfo $handle databases + mysqlinfo $handle dbname + mysqlinfo $handle host + mysqlinfo $handle tables + mysqlinfo $handle dbname? + mysqlinfo $handle host? + return +} + +tcltest::test {state-1.0} {state} -body { + mysqlstate $handle + mysqlstate $handle -numeric + return +} + +tcltest::test {errorhandling-1.0} {not a handle} -body { + mysqlsel bad0 {select * from Student} +} -returnCodes error -match glob -result "*not mysqltcl handle*" + +tcltest::test {errorhandling-1.1} {error in sql select, no table} -body { + mysqlsel $handle {select * from Unknown} +} -returnCodes error -match glob -result "*Table*" + +tcltest::test {errorhandling-1.2} {error in sql} -body { + mysqlexec $handle {unknown command} +} -returnCodes error -match glob -result "*SQL syntax*" + +tcltest::test {errorhandling-1.3} {read after end} -body { + set rows [mysqlsel $handle {select * from Student}] + for {set x 0} {$x<$rows} {incr x} { + set res [mysqlnext $handle] + set nr [lindex $res 0] + set name [lindex $res 1] + set sem [lindex $res 2] + } + mysqlnext $handle +} -result {} + + +tcltest::test {errorhandling-1.4} {false map binding} -body { + #read after end by map + mysqlsel $handle {select * from Student} + mysqlmap $handle {nr name} { + set row [format "nr %16s name:%s" $nr $name] + } + mysqlseek $handle 0 + mysqlmap $handle {nr name err err2} { + set row [format "nr %16s name:%s" $nr $name] + } + return +} -returnCodes error -match glob -result "*too many variables*" + +tcltest::test {sel-1.2} {-list option} -body { + mysqlsel $handle {select * from Student} -list + return +} + +tcltest::test {sel-1.3} {-flatlist option} -body { + mysqlsel $handle {select * from Student} -flatlist + return +} + +tcltest::test {handle-1.0} {interanl finding handle} -body { + set shandle [string trim " $handle "] + mysqlinfo $shandle databases + return +} + +mysqlclose $handle + +tcltest::test {handle-1.1} {operation on closed handle} -body { + mysqlinfo $handle tables + return +} -returnCodes error -match glob -result "*handle already closed*" + +tcltest::test {handle-1.2} {operation on closed handle} -body { + set a " $handle " + unset handle + set a [string trim $a] + mysqlinfo $a tables +} -returnCodes error -match glob -result "*not mysqltcl handle*" + + +tcltest::test {handle-1.2} {open 20 connection, close all} -body { + for {set x 0} {$x<20} {incr x} { + lappend handles [getConnection] + } + foreach h $handles { + mysqlsel $h {select * from Student} + } + mysqlclose + return +} + +tcltest::test {handle-1.3} {10 queries, close all} -body { + set handle [getConnection] + for {set x 0} {$x<10} {incr x} { + lappend queries [mysqlquery $handle {select * from Student}] + } + for {set x 0} {$x<10} {incr x} { + mysqlquery $handle {select * from Student} + } + mysqlclose $handle + mysqlnext [lindex $queries 0] +} -returnCodes error -match glob -result "*handle already closed*" + +tcltest::test {handle-1.4} {10 queries, close all} -body { + set handle [getConnection] + mysqlquery $handle {select * from Student} + mysqlclose + return +} + +tcltest::test {handle-1.5} {Testing false connecting} -body { + mysqlconnect -user nouser -db nodb +} -returnCodes error -match glob -result "*Unknown database*" + + +set handle [getConnection] + +tcltest::test {escape-1.0} {escaping} -body { + mysqlescape "art\"ur" + mysqlescape $handle "art\"ur" + return +} + +tcltest::test {ping-1.0} {escaping} -body { + mysqlping $handle + return +} + +tcltest::test {changeuser-1.0} {escaping} -body { + mysqlchangeuser $handle root {} + mysqlchangeuser $handle root {} uni + return +} + +# does not work for mysql4.1 +tcltest::test {changeuser-1.1} {no such user} -body { + mysqlchangeuser $handle root {} nodb +} -returnCodes error -match glob -result "*Unknown database*" + +tcltest::test {interpreter-1.0} {mysqltcl in slave interpreter} -body { + set handle [getConnection] + set i1 [interp create] + $i1 eval " + package require mysqltcl + set hdl [mysqlconnect -user $dbuser -db $dbank] + " + interp delete $i1 + mysqlinfo $handle databases + mysqlclose $handle + return +} + +tcltest::cleanupTests +puts "End of test" diff --git a/tests/test41.tcl b/tests/test41.tcl old mode 100644 new mode 100755 diff --git a/tests/testMapError.tcl b/tests/testMapError.tcl old mode 100644 new mode 100755