Fossil SCM

minor th1 doc and script code cleanups.

stephan 2012-07-22 11:39 th1-query-api
Commit 2b4b2a5091dc81ae770c47f915210d4be3275710
--- test/th1-query-api-1.th1
+++ test/th1-query-api-1.th1
@@ -19,11 +19,11 @@
1919
for {set i 0} {$i < $colCount} {incr i} {
2020
set colNames($i) [query $stmt col name $i]
2121
puts "colNames($i)=" $colNames($i) "\n"
2222
}
2323
24
-for {set row 0} {0 < [query $stmt step]} {incr row} {
24
+for {set row 0} {[query $stmt step]} {incr row} {
2525
for {set i 0} {$i < $colCount} {incr i} {
2626
if {$i > 0} {
2727
puts $sep
2828
} else {
2929
puts "#$row: $sep"
@@ -43,11 +43,11 @@
4343
set colCount [query $stmt col count]
4444
for {set i 0} {$i < $colCount} {incr i} {
4545
set colNames($i) [query $stmt col name $i]
4646
}
4747
upvar cb $callback
48
- for {set row 0} {0 < [query $stmt step]} {incr row} {
48
+ for {set row 0} {[query $stmt step]} {incr row} {
4949
#puts "Calling callback: $stmt $colCount colNames\n"
5050
$callback $stmt $colCount
5151
}
5252
}
5353
5454
--- test/th1-query-api-1.th1
+++ test/th1-query-api-1.th1
@@ -19,11 +19,11 @@
19 for {set i 0} {$i < $colCount} {incr i} {
20 set colNames($i) [query $stmt col name $i]
21 puts "colNames($i)=" $colNames($i) "\n"
22 }
23
24 for {set row 0} {0 < [query $stmt step]} {incr row} {
25 for {set i 0} {$i < $colCount} {incr i} {
26 if {$i > 0} {
27 puts $sep
28 } else {
29 puts "#$row: $sep"
@@ -43,11 +43,11 @@
43 set colCount [query $stmt col count]
44 for {set i 0} {$i < $colCount} {incr i} {
45 set colNames($i) [query $stmt col name $i]
46 }
47 upvar cb $callback
48 for {set row 0} {0 < [query $stmt step]} {incr row} {
49 #puts "Calling callback: $stmt $colCount colNames\n"
50 $callback $stmt $colCount
51 }
52 }
53
54
--- test/th1-query-api-1.th1
+++ test/th1-query-api-1.th1
@@ -19,11 +19,11 @@
19 for {set i 0} {$i < $colCount} {incr i} {
20 set colNames($i) [query $stmt col name $i]
21 puts "colNames($i)=" $colNames($i) "\n"
22 }
23
24 for {set row 0} {[query $stmt step]} {incr row} {
25 for {set i 0} {$i < $colCount} {incr i} {
26 if {$i > 0} {
27 puts $sep
28 } else {
29 puts "#$row: $sep"
@@ -43,11 +43,11 @@
43 set colCount [query $stmt col count]
44 for {set i 0} {$i < $colCount} {incr i} {
45 set colNames($i) [query $stmt col name $i]
46 }
47 upvar cb $callback
48 for {set row 0} {[query $stmt step]} {incr row} {
49 #puts "Calling callback: $stmt $colCount colNames\n"
50 $callback $stmt $colCount
51 }
52 }
53
54
--- test/th1-query-api-2.th1
+++ test/th1-query-api-2.th1
@@ -6,14 +6,14 @@
66
AND mtime IS NOT NULL
77
}]
88
puts "stmt ID=$stmt\n"
99
# query bind int $stmt 1 2
1010
# query $stmt bind int 1 2
11
- query $stmt bind 1 int 2
11
+ query $stmt bind 1 int 5
1212
# segfault: query bind 1 int $stmt 2
1313
set sep "\n"
14
- for {} {0 < [query $stmt step]} {} {
14
+ for {} {[query $stmt step]} {} {
1515
puts [query $stmt col string 0] $sep
1616
puts [query $stmt col time 2 {%Y%m%d @ %H:%M:%S}] $sep
1717
puts [query $stmt col time 2 {%Y%m%d @ %H:%M:%S} {+10 years}] $sep
1818
puts [query $stmt col 2 time {%Y%m%d @ %H:%M:%S} {+10 years}] $sep
1919
# puts [query col time $stmt 2 %s] $sep
2020
--- test/th1-query-api-2.th1
+++ test/th1-query-api-2.th1
@@ -6,14 +6,14 @@
6 AND mtime IS NOT NULL
7 }]
8 puts "stmt ID=$stmt\n"
9 # query bind int $stmt 1 2
10 # query $stmt bind int 1 2
11 query $stmt bind 1 int 2
12 # segfault: query bind 1 int $stmt 2
13 set sep "\n"
14 for {} {0 < [query $stmt step]} {} {
15 puts [query $stmt col string 0] $sep
16 puts [query $stmt col time 2 {%Y%m%d @ %H:%M:%S}] $sep
17 puts [query $stmt col time 2 {%Y%m%d @ %H:%M:%S} {+10 years}] $sep
18 puts [query $stmt col 2 time {%Y%m%d @ %H:%M:%S} {+10 years}] $sep
19 # puts [query col time $stmt 2 %s] $sep
20
--- test/th1-query-api-2.th1
+++ test/th1-query-api-2.th1
@@ -6,14 +6,14 @@
6 AND mtime IS NOT NULL
7 }]
8 puts "stmt ID=$stmt\n"
9 # query bind int $stmt 1 2
10 # query $stmt bind int 1 2
11 query $stmt bind 1 int 5
12 # segfault: query bind 1 int $stmt 2
13 set sep "\n"
14 for {} {[query $stmt step]} {} {
15 puts [query $stmt col string 0] $sep
16 puts [query $stmt col time 2 {%Y%m%d @ %H:%M:%S}] $sep
17 puts [query $stmt col time 2 {%Y%m%d @ %H:%M:%S} {+10 years}] $sep
18 puts [query $stmt col 2 time {%Y%m%d @ %H:%M:%S} {+10 years}] $sep
19 # puts [query col time $stmt 2 %s] $sep
20
--- www/th1_query.wiki
+++ www/th1_query.wiki
@@ -8,12 +8,12 @@
88
<nowiki><pre>
99
&lt;th1>
1010
catch {
1111
set stmt [query prepare "SELECT login, cap FROM user"]
1212
puts "stmt ID=$stmt\n"
13
- for {} {0 < [query $stmt step]} {} {
14
- puts [query $stmt col string 0] ": " [query $stmt col string 1] "\n"
13
+ for {} {[query $stmt step]} {} {
14
+ puts [query $stmt col string 0] " " [query $stmt col string 1] \n
1515
}
1616
query $stmt finalize
1717
return 0
1818
} rc
1919
if {0 != $rc} {
2020
--- www/th1_query.wiki
+++ www/th1_query.wiki
@@ -8,12 +8,12 @@
8 <nowiki><pre>
9 &lt;th1>
10 catch {
11 set stmt [query prepare "SELECT login, cap FROM user"]
12 puts "stmt ID=$stmt\n"
13 for {} {0 < [query $stmt step]} {} {
14 puts [query $stmt col string 0] ": " [query $stmt col string 1] "\n"
15 }
16 query $stmt finalize
17 return 0
18 } rc
19 if {0 != $rc} {
20
--- www/th1_query.wiki
+++ www/th1_query.wiki
@@ -8,12 +8,12 @@
8 <nowiki><pre>
9 &lt;th1>
10 catch {
11 set stmt [query prepare "SELECT login, cap FROM user"]
12 puts "stmt ID=$stmt\n"
13 for {} {[query $stmt step]} {} {
14 puts [query $stmt col string 0] " " [query $stmt col string 1] \n
15 }
16 query $stmt finalize
17 return 0
18 } rc
19 if {0 != $rc} {
20

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button