###=== 載入 下載回來的tclsqlite.DLL
load "C:/Tcl/lib/tclsqlite3.dll" sqlite
###=== 建立新的資料庫
sqlite db1 F:/Andre_kao/testdb.db
db1 eval {CREATE TABLE t1(a int, b text)}
###=== 寫入資料
db1 eval {INSERT INTO t1 VALUES(1,'hello')}
db1 eval {INSERT INTO t1 VALUES(2,'goodbye')}
db1 eval {INSERT INTO t1 VALUES(3,'howdy!')}
set x [db1 eval
{SELECT * FROM t1 ORDER BY a}]
###--- 傳回 1 hello 2 goodbye 3 howdy!
###=== 將資料庫中的資料排序後印出來
db1 eval {SELECT * FROM t1 ORDER BY a} values {
parray values
puts ""
}
###=== 輸出結果
###=== values(*) = a b
###=== values(a) = 1
###=== values(b) = hello
###=== values(*) = a b
###=== values(a) = 2
###=== values(b) = goodbye
###=== values(*) = a b
###=== values(a) = 3
###=== values(b) = howdy!
###=== 請參考 http://www.sqlite.org/tclsqlite.html
沒有留言:
張貼留言