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 puts $::fd "do_execsql_test $tn {"
64 puts $::fd " [string trim $sql]"
69 # Same as [execsql_test], except coerce all results to floating point values
70 # with two decimal points.
72 proc execsql_float_test
{tn sql
} {
74 set res
[execsql
$sql]
76 foreach r
$res { lappend res2
[format $F $r] }
78 puts $::fd "do_test $tn {"
79 puts $::fd " set myres {}"
80 puts $::fd " foreach r \[db eval {[string trim $sql]}\] {"
81 puts $::fd " lappend myres \[format $F \[set r\]\]"
83 puts $::fd " set myres"
84 puts $::fd "} {$res2}"
88 proc start_test
{name date
} {
89 set dir
[file dirname
$::argv0]
90 set output
[file join $dir $name.test
]
91 set ::fd [open $output w
]
92 puts $::fd [string trimleft
"
95 # The author disclaims copyright to this source code. In place of
96 # a legal notice, here is a blessing:
98 # May you do good and not evil.
99 # May you find forgiveness for yourself and forgive others.
100 # May you share freely, never taking more than you give.
102 #***********************************************************************
103 # This file implements regression tests for SQLite library.
106 ####################################################
107 # DO NOT EDIT! THIS FILE IS AUTOMATICALLY GENERATED!
108 ####################################################
110 puts $::fd {set testdir
[file dirname
$argv0]}
111 puts $::fd {source $testdir/tester.tcl
}
112 puts $::fd "set testprefix $name"
120 proc ========== {args
} {
121 puts $::fd "#[string repeat = 74]"
125 proc finish_test
{} {
126 puts $::fd finish_test