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 #***********************************************************************
12 # This file contains tests for the RBU module.
16 if {![info exists testdir]} {
17 set testdir [file join [file dirname [info script]] .. .. test]
19 source $testdir/tester.tcl
24 # 1.*: That affinities are correctly applied to values within the
27 # 2.*: Tests for multi-column primary keys.
32 CREATE TABLE t1(a INT PRIMARY KEY, b) WITHOUT ROWID;
33 INSERT INTO t1 VALUES(1, 'abc');
34 INSERT INTO t1 VALUES(2, 'def');
40 CREATE TABLE data_t1(a, b, rbu_control);
41 INSERT INTO data_t1 VALUES('1', NULL, 1);
47 sqlite3rbu rbu test.db rbu.db
48 while { [rbu step]=="SQLITE_OK" } {}
57 #-------------------------------------------------------------------------
60 1 { CREATE TABLE t1(a, b, c, PRIMARY KEY(a, b)) WITHOUT ROWID }
61 2 { CREATE TABLE t1(a, b, c, PRIMARY KEY(a, b)) }
66 do_execsql_test 2.$tn.1 {
67 CREATE INDEX t1c ON t1(c);
68 INSERT INTO t1 VALUES(1, 1, 'a');
69 INSERT INTO t1 VALUES(1, 2, 'b');
70 INSERT INTO t1 VALUES(2, 1, 'c');
71 INSERT INTO t1 VALUES(2, 2, 'd');
78 CREATE TABLE data_t1(a, b, c, rbu_control);
79 INSERT INTO data_t1 VALUES(3, 1, 'e', 0);
80 INSERT INTO data_t1 VALUES(3, 2, 'f', 0);
81 INSERT INTO data_t1 VALUES(1, 2, NULL, 1);
82 INSERT INTO data_t1 VALUES(2, 1, 'X', '..x');
89 while {$rc == "SQLITE_OK"} {
90 sqlite3rbu rbu test.db rbu.db
97 do_execsql_test 2.$tn.1 {
98 SELECT * FROM t1 ORDER BY a, b