File: sample.simple.txt

package info (click to toggle)
tcl-sql 20000621-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 612 kB
  • ctags: 81
  • sloc: cpp: 399; makefile: 60; tcl: 19; csh: 2
file content (29 lines) | stat: -rw-r--r-- 634 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

# Load the sql package:
package require sql

# Connect to the database
set conn [sql connect]

# select the database 'test' to be used.
sql selectdb $conn test

# Create a table and put some data in it:
sql exec $conn "create table junk (i integer, r real, s char(10))"

# Put some dummy data in:
for {set i 0} {$i < 10} {incr i} {
	sql exec $conn "insert into junk values ($i, $i.01, 'xx $i xx')"
}

# Do a select and display the results
sql query $conn "select * from junk where i > 3" 

while {[set row [sql fetchrow $conn]] != ""} {
	puts "row = $row"
}

sql endquery $conn

sql exec $conn "drop table junk"
sql disconnect $conn