diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 05:16:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 05:16:48 +0000 |
commit | 3640b21e686fef7e3f25dc775112c7d4be43f197 (patch) | |
tree | e7fec2ad45891adeada1227d655062cbd201dd5a /ext/intck/intck_common.tcl | |
parent | Releasing progress-linux version 3.45.3-1~progress7.99u1. (diff) | |
download | sqlite3-3640b21e686fef7e3f25dc775112c7d4be43f197.tar.xz sqlite3-3640b21e686fef7e3f25dc775112c7d4be43f197.zip |
Merging upstream version 3.46.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | ext/intck/intck_common.tcl | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/ext/intck/intck_common.tcl b/ext/intck/intck_common.tcl new file mode 100644 index 0000000..1e216b5 --- /dev/null +++ b/ext/intck/intck_common.tcl @@ -0,0 +1,66 @@ +# 2024 Feb 18 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# + +if {![info exists testdir]} { + set testdir [file join [file dirname [info script]] .. .. test] +} +source $testdir/tester.tcl + +ifcapable !vtab||!pragma { + proc return_if_no_intck {} { + finish_test + return -code return + } + return +} else { + proc return_if_no_intck {} {} +} + +proc do_intck {db {bSuspend 0}} { + set ic [sqlite3_intck $db main] + + set ret [list] + while {"SQLITE_OK"==[$ic step]} { + set msg [$ic message] + if {$msg!=""} { + lappend ret $msg + } + if {$bSuspend} { + $ic unlock + #puts "SQL: [$ic test_sql {}]" + #execsql_pp "EXPLAIN query plan [$ic test_sql {}]" + #explain_i [$ic test_sql {}] + } + } + + set err [$ic error] + if {[lindex $err 0]!="SQLITE_OK"} { + error $err + } + $ic close + + return $ret +} + +proc intck_sql {db tbl} { + set ic [sqlite3_intck $db main] + set sql [$ic test_sql $tbl] + $ic close + return $sql +} + +proc do_intck_test {tn expect} { + uplevel [list do_test $tn.a [list do_intck db] [list {*}$expect]] + uplevel [list do_test $tn.b [list do_intck db 1] [list {*}$expect]] +} + + |