3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
13 package require sqlite3
16 set db
[pg_connect
-conninfo "dbname=postgres user=postgres password=postgres"]
23 while {[string length
$sql]>0} {
24 set i
[string first
";" $sql]
26 append frag
[string range
$sql 0 $i]
27 set sql
[string range
$sql $i+1 end
]
28 if {[sqlite complete
$frag]} {
44 set res
[pg_exec
$::db $stmt]
45 set err
[pg_result
$res -error]
46 if {$err!=""} { error $err }
47 for {set i
0} {$i < [pg_result
$res -numTuples]} {incr i
} {
49 set ret
[pg_result
$res -getTuple 0]
51 append ret
" [pg_result $res -getTuple $i]"
53 # lappend ret {*}[pg_result $res -getTuple $i]
61 proc execsql_test
{tn sql
} {
62 set res
[execsql
$sql]
63 set sql
[string map
{string_agg group_concat
} $sql]
64 puts $::fd "do_execsql_test $tn {"
65 puts $::fd " [string trim $sql]"
70 # Same as [execsql_test], except coerce all results to floating point values
71 # with two decimal points.
73 proc execsql_float_test
{tn sql
} {
76 set res
[execsql
$sql]
79 if {$r != ""} { set r
[format $F $r] }
83 set sql
[string trim
$sql]
84 puts $::fd [subst -nocommands {
87 foreach r
[db
eval {$sql}] {
88 lappend myres
[format $F [set r
]]
91 foreach r
[set myres
] r2
[set res2
] {
92 if {[set r
]<([set r2
]-$T) ||
[set r
]>([set r2
]+$T)} {
93 error "list element [set i] does not match: got=[set r] expected=[set r2]"
101 proc start_test
{name date
} {
102 set dir
[file dirname
$::argv0]
103 set output
[file join $dir $name.test
]
104 set ::fd [open $output w
]
105 puts $::fd [string trimleft
"
108 # The author disclaims copyright to this source code. In place of
109 # a legal notice, here is a blessing:
111 # May you do good and not evil.
112 # May you find forgiveness for yourself and forgive others.
113 # May you share freely, never taking more than you give.
115 #***********************************************************************
116 # This file implements regression tests for SQLite library.
119 ####################################################
120 # DO NOT EDIT! THIS FILE IS AUTOMATICALLY GENERATED!
121 ####################################################
123 puts $::fd {set testdir
[file dirname
$argv0]}
124 puts $::fd {source $testdir/tester.tcl
}
125 puts $::fd "set testprefix $name"
133 proc ========== {args
} {
134 puts $::fd "#[string repeat = 74]"
138 proc finish_test
{} {
139 puts $::fd finish_test
143 proc ifcapable
{arg
} {
144 puts $::fd "ifcapable $arg { finish_test ; return }"