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 if_no_rbu_support { finish_test ; return }
15 set ::testprefix rbuexpr
18 CREATE TABLE t1(a, b, c PRIMARY KEY);
19 CREATE INDEX i1 ON t1(a, null, b+1);
20 CREATE INDEX i2 ON t1(a+1, b+1, c+1);
22 INSERT INTO t1 VALUES(1, 2, 3);
23 INSERT INTO t1 VALUES(4, 5, 6);
24 INSERT INTO t1 VALUES(7, 8, 9);
25 INSERT INTO t1 VALUES(10, 11, 12);
27 PRAGMA integrity_check;
32 do_execsql_test -db db2 1.1 {
33 CREATE TABLE data_t1(a, b, c, rbu_control);
34 INSERT INTO data_t1 VALUES(13, 14, 15, 0);
35 INSERT INTO data_t1 VALUES(NULL, NULL, 6, 1);
36 INSERT INTO data_t1 VALUES(NULL, 'three', 3, '.x.');
42 run_rbu test.db rbu.db
48 SELECT * FROM t1 WHERE a=4;
53 #-------------------------------------------------------------------------
57 CREATE TABLE t1(c1, c2, c3, i INTEGER PRIMARY KEY);
58 INSERT INTO t1 VALUES('one', 'one', 'one', 1);
59 INSERT INTO t1 VALUES('two', 'two', 'two', 2);
60 INSERT INTO t1 VALUES('three', 'three', 'three', 3);
61 INSERT INTO t1 VALUES('four', 'four', 'four', 4);
63 CREATE INDEX i1 ON t1( substr(c1, 1, 2) );
64 CREATE INDEX i2 ON t1( c1 || c2 || c3 );
65 CREATE INDEX i3 ON t1( length(c1) + length(c2) - 1, c3||i );
70 do_execsql_test -db db2 2.1 {
71 CREATE TABLE data_t1(c1, c2, c3, i, rbu_control);
72 INSERT INTO data_t1 VALUES(NULL, NULL, NULL, 2, 1);
73 INSERT INTO data_t1 VALUES('thirty', NULL, NULL, 3, 'xx..');
74 INSERT INTO data_t1 VALUES('five', 'five', 'five', 5, 0);
81 run_rbu test.db rbu.db