#!/usr/bin/tclsh
package require tdbc::sqlite3
tdbc::sqlite3::connection create db "sample.db"
set statement [db prepare {drop table if exists person}]
$statement execute
$statement close
set statement [db prepare {create table person (id integer, name varchar(40))}]
$statement execute
$statement close
set statement [db prepare {insert into person values(1, 'leo')}]
$statement execute
$statement close
set statement [db prepare {insert into person values(2, 'yui')}]
$statement execute
$statement close
set statement [db prepare {SELECT * FROM person}]
$statement foreach row {
puts [dict get $row id]
puts [dict get $row name]
}
$statement close
db close
2015-01-24
tdbc::sqlite3 test script
只是測試用的 script。
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言