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
} {
75 set res
[execsql
$sql]
78 if {$r != ""} { set r
[format $F $r] }
82 puts $::fd "do_test $tn {"
83 puts $::fd " set myres {}"
84 puts $::fd " foreach r \[db eval {[string trim $sql]}\] {"
85 puts $::fd " lappend myres \[format $F \[set r\]\]"
87 puts $::fd " set myres"
88 puts $::fd "} {$res2}"
92 proc start_test
{name date
} {
93 set dir
[file dirname
$::argv0]
94 set output
[file join $dir $name.test
]
95 set ::fd [open $output w
]
96 puts $::fd [string trimleft
"
99 # The author disclaims copyright to this source code. In place of
100 # a legal notice, here is a blessing:
102 # May you do good and not evil.
103 # May you find forgiveness for yourself and forgive others.
104 # May you share freely, never taking more than you give.
106 #***********************************************************************
107 # This file implements regression tests for SQLite library.
110 ####################################################
111 # DO NOT EDIT! THIS FILE IS AUTOMATICALLY GENERATED!
112 ####################################################
114 puts $::fd {set testdir
[file dirname
$argv0]}
115 puts $::fd {source $testdir/tester.tcl
}
116 puts $::fd "set testprefix $name"
124 proc ========== {args
} {
125 puts $::fd "#[string repeat = 74]"
129 proc finish_test
{} {
130 puts $::fd finish_test
134 proc ifcapable
{arg
} {
135 puts $::fd "ifcapable $arg { finish_test ; return }"