Fossil SCM

fossil-scm / test / th1-query-api-2.th1
Blame History Raw 71 lines
1
<th1>
2
catch {
3
set stmt [query prepare {
4
SELECT login, cap, cexpire, mtime, NULL FROM user
5
WHERE uid<? AND cexpire IS NOT NULL
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
puts [query col time $stmt 3 %s unixepoch] $sep
21
# puts [query strftime %s [query col string $stmt 3] unixepoch]
22
puts [query strftime %s [query col string $stmt 3] unixepoch] $sep
23
puts [query strftime {%Y%m%d @ %H:%M:%S} [query col string $stmt 2] {+10 years}] $sep
24
puts "\n"
25
puts "old isnull: " [query col isnull $stmt 4] "\n"
26
27
puts "new old isnull: " [query col 4 isnull $stmt] "\n"
28
puts "new isnull: " [query $stmt col isnull 4] "\n"
29
puts "new new isnull: " [query $stmt col 4 isnull] "\n"
30
31
puts "old col type: " [query col type $stmt 1] "\n"
32
puts "new col type: " [query $stmt col type 1] "\n"
33
puts "new new col type: " [query $stmt col 1 type] "\n"
34
35
puts "old col name: " [query col name $stmt 1] "\n"
36
puts "new col name: " [query $stmt col name 1] "\n"
37
puts "new new col name: " [query $stmt col 1 name] "\n"
38
39
puts "old col double: " [query col double $stmt 2] "\n"
40
puts "new col double: " [query $stmt col double 2] "\n"
41
puts "new new col double: " [query $stmt col 2 double] "\n"
42
43
puts "old col int: " [query col int $stmt 2] "\n"
44
puts "new col int: " [query $stmt col int 2] "\n"
45
puts "new new col int: " [query $stmt col 2 int] "\n"
46
47
puts "old col string: " [query col string $stmt 2] "\n"
48
puts "new col string: " [query $stmt col string 2] "\n"
49
puts "new new col string: " [query $stmt col 2 string] "\n"
50
51
puts "\n"
52
}
53
54
puts "alt-form col count: " [query $stmt col count] "\n"
55
query finalize $stmt
56
return 0
57
} rc
58
if {0 != $rc} {
59
puts "ERROR: $rc\n"
60
}
61
puts "Done!\n"
62
63
64
ob start
65
puts buffered
66
set x [ob get pop]
67
puts x=$x
68
69
70
</th1>
71

Keyboard Shortcuts

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