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 source [file join [file dirname [info script]] rbu_common.tcl]
14 set ::testprefix rbuexpr
23 CREATE TABLE t1(a, b, c PRIMARY KEY);
24 CREATE INDEX i1 ON t1(a, null, b+1);
25 CREATE INDEX i2 ON t1(a+1, b+1, c+1);
27 INSERT INTO t1 VALUES(1, 2, 3);
28 INSERT INTO t1 VALUES(4, 5, 6);
29 INSERT INTO t1 VALUES(7, 8, 9);
30 INSERT INTO t1 VALUES(10, 11, 12);
32 PRAGMA integrity_check;
37 do_execsql_test -db db2 1.1 {
38 CREATE TABLE data_t1(a, b, c, rbu_control);
39 INSERT INTO data_t1 VALUES(13, 14, 15, 0);
40 INSERT INTO data_t1 VALUES(NULL, NULL, 6, 1);
41 INSERT INTO data_t1 VALUES(NULL, 'three', 3, '.x.');
47 run_rbu test.db rbu.db
53 SELECT * FROM t1 WHERE a=4;
58 #-------------------------------------------------------------------------
62 CREATE TABLE t1(c1, c2, c3, i INTEGER PRIMARY KEY);
63 INSERT INTO t1 VALUES('one', 'one', 'one', 1);
64 INSERT INTO t1 VALUES('two', 'two', 'two', 2);
65 INSERT INTO t1 VALUES('three', 'three', 'three', 3);
66 INSERT INTO t1 VALUES('four', 'four', 'four', 4);
68 CREATE INDEX i1 ON t1( substr(c1, 1, 2) );
69 CREATE INDEX i2 ON t1( c1 || c2 || c3 );
70 CREATE INDEX i3 ON t1( length(c1) + length(c2) - 1, c3||i );
75 do_execsql_test -db db2 2.1 {
76 CREATE TABLE data_t1(c1, c2, c3, i, rbu_control);
77 INSERT INTO data_t1 VALUES(NULL, NULL, NULL, 2, 1);
78 INSERT INTO data_t1 VALUES('thirty', NULL, NULL, 3, 'xx..');
79 INSERT INTO data_t1 VALUES('five', 'five', 'five', 5, 0);
86 run_rbu test.db rbu.db