File: sqlite3test.tcl

package info (click to toggle)
openocd 0.12.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 39,748 kB
  • sloc: ansic: 425,602; sh: 10,320; tcl: 9,539; asm: 3,895; makefile: 2,023; cpp: 1,671; perl: 1,197; python: 1,078; xml: 77; haskell: 32
file content (10 lines) | stat: -rw-r--r-- 450 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
package require sqlite3

set db [sqlite3.open :memory:]
$db query {CREATE TABLE plays (id, author, title)}
$db query {INSERT INTO plays (id, author, title) VALUES (1, 'Goethe', 'Faust');}
$db query {INSERT INTO plays (id, author, title) VALUES (2, 'Shakespeare', 'Hamlet');}
$db query {INSERT INTO plays (id, author, title) VALUES (3, 'Sophocles', 'Oedipus Rex');}
set res [$db query "SELECT * FROM plays"]
$db close
foreach r $res {puts $r(author)}