]> git.sven.stormbind.net Git - sven/mysqltcl.git/blobdiff - tests/test2.tcl
Imported Upstream version 3.05
[sven/mysqltcl.git] / tests / test2.tcl
diff --git a/tests/test2.tcl b/tests/test2.tcl
new file mode 100755 (executable)
index 0000000..7a4477b
--- /dev/null
@@ -0,0 +1,26 @@
+#!/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 <test.sql
+# please adapt the parameters for mysqlconnect some lines above
+
+if {[file exists libload.tcl]} {
+    source libload.tcl
+} else {
+    source [file join [file dirname [info script]] libload.tcl]
+}
+
+set handle [mysqlconnect -user root]
+
+# use implicit database notation
+puts "1 rows [mysqlsel $handle {select * from uni.Student}]"
+puts "1 Table-col [mysqlcol $handle -current {name type length table non_null prim_key decimals numeric}]"
+puts "1 [mysqlnext $handle]"
+
+# Test sel and next functions
+mysqluse $handle uni
+puts "rows [mysqlsel $handle {select * from Student} -list]"