diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 14:07:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 14:07:11 +0000 |
commit | 63847496f14c813a5d80efd5b7de0f1294ffe1e3 (patch) | |
tree | 01c7571c7c762ceee70638549a99834fdd7c411b /ext/rbu/rbu8.test | |
parent | Initial commit. (diff) | |
download | sqlite3-63847496f14c813a5d80efd5b7de0f1294ffe1e3.tar.xz sqlite3-63847496f14c813a5d80efd5b7de0f1294ffe1e3.zip |
Adding upstream version 3.45.1.upstream/3.45.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ext/rbu/rbu8.test')
-rw-r--r-- | ext/rbu/rbu8.test | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/ext/rbu/rbu8.test b/ext/rbu/rbu8.test new file mode 100644 index 0000000..b73bde2 --- /dev/null +++ b/ext/rbu/rbu8.test @@ -0,0 +1,72 @@ +# 2014 November 20 +# +# 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. +# +#*********************************************************************** +# +# Test the rbu_delta() feature. +# + +source [file join [file dirname [info script]] rbu_common.tcl] +if_no_rbu_support { finish_test ; return } +set ::testprefix rbu8 + +do_execsql_test 1.0 { + CREATE TABLE t1(x, y PRIMARY KEY, z); + INSERT INTO t1 VALUES(NULL, 1, 'one'); + INSERT INTO t1 VALUES(NULL, 2, 'two'); + INSERT INTO t1 VALUES(NULL, 3, 'three'); + CREATE INDEX i1z ON t1(z, x); +} + +do_test 1.1 { + forcedelete rbu.db + sqlite3 db2 rbu.db + db2 eval { + CREATE TABLE data_t1(x, y, z, rbu_control); + INSERT INTO data_t1 VALUES('a', 1, '_i' , 'x.d'); + INSERT INTO data_t1 VALUES('b', 2, 2 , '..x'); + INSERT INTO data_t1 VALUES('_iii', 3, '-III' , 'd.d'); + } + db2 close +} {} + +do_test 1.2.1 { + sqlite3rbu rbu test.db rbu.db + rbu step +} {SQLITE_ERROR} +do_test 1.2.2 { + list [catch {rbu close} msg] $msg +} {1 {SQLITE_ERROR - no such function: rbu_delta}} + +proc rbu_delta {orig new} { + return "${orig}${new}" +} + +do_test 1.3.1 { + while 1 { + sqlite3rbu rbu test.db rbu.db + rbu create_rbu_delta + set rc [rbu step] + if {$rc != "SQLITE_OK"} break + rbu close + } + rbu close +} {SQLITE_DONE} + +do_execsql_test 1.3.2 { + SELECT * FROM t1 +} { + a 1 one_i + {} 2 2 + _iii 3 three-III +} +integrity_check 1.3.3 + + +finish_test |