File size: 1,629 Bytes
661c4fc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# 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
|