Mysqltcl is a simple API for Mysql-Database and Tcl script language.
In order to connect to mysql in Tcl programming, we can choose mysqltcl. Mysqltcl is on this website: http://www.xdobry.de/mysqltcl/index.html.all of us can get it on this site.
For mysqltcl, it has version on windows and Linux. Today i just give the usage on windows 7.
1: install ActiveTcl and mysql server on windows.
install ActiveTcl can reference this blog: http://www.jyguagua.com/?p=427
install mysqlserver can reference this site: http://jingyan.baidu.com/article/48b558e37c20e77f38c09a16.html
2:when mysql have installed, the server user:root and password:root, I create a database "blog" and it has table "user" and table "user" has one record: "name":"ypf", "password":"ypf", "id":"1".
3:download mysqltcl for windows and install it.
mysqltcl download page:http://www.xdobry.de/mysqltcl/windows.html
I use the latest version:mysqltcl-3.03.zip
how to install it? very easy, unzip the file in your Tcl/lib dictonary. (default C:/Tcl/lib dependent on your Tcl install path).
4: Programming tcl and connect to mysql and query table "user" with sql language "select * from user;"
db.tcl:
package require mysqltcl set m [mysqlconnect -user root -db blog -password root] mysqluse $m blog foreach res [mysqlsel $m {select * from user} -list] { puts "name is [lindex $res 0]" puts "pass is [lindex $res 1]" }
then in cmd I can execute the tcl with tclsh:
all the mysqltcl API at here:
http://www.xdobry.de/mysqltcl/mysqltcl.html
you can also get more info at: http://www2.tcl.tk/6051
文章的脚注信息由WordPress的wp-posturl插件自动生成