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 # Tests for the SQLITE_RECOVER_SLOWINDEXES option.
15 source [file join [file dirname [info script]] recover_common.tcl]
16 set testprefix recoverslowidx
19 PRAGMA auto_vacuum = 0;
20 CREATE TABLE t1(a, b);
21 CREATE INDEX i1 ON t1(a);
22 INSERT INTO t1 VALUES(1, 1), (2, 2), (3, 3), (4, 4);
25 proc my_sql_hook {sql} {
32 set R [sqlite3_recover_init_sql db main my_sql_hook]
33 while {[$R step]==0} { }
41 {PRAGMA writable_schema = on}
42 {PRAGMA encoding = 'UTF-8'}
43 {PRAGMA page_size = '1024'}
44 {PRAGMA auto_vacuum = '0'}
45 {PRAGMA user_version = '0'}
46 {PRAGMA application_id = '0'}
47 {CREATE TABLE t1(a, b)}
48 {INSERT OR IGNORE INTO 't1'(_rowid_, 'a', 'b') VALUES (1, 1, 1)}
49 {INSERT OR IGNORE INTO 't1'(_rowid_, 'a', 'b') VALUES (2, 2, 2)}
50 {INSERT OR IGNORE INTO 't1'(_rowid_, 'a', 'b') VALUES (3, 3, 3)}
51 {INSERT OR IGNORE INTO 't1'(_rowid_, 'a', 'b') VALUES (4, 4, 4)}
52 {CREATE INDEX i1 ON t1(a)}
53 {PRAGMA writable_schema = off}
59 set R [sqlite3_recover_init_sql db main my_sql_hook]
60 $R config slowindexes 1
61 while {[$R step]==0} { }
69 {PRAGMA writable_schema = on}
70 {PRAGMA encoding = 'UTF-8'}
71 {PRAGMA page_size = '1024'}
72 {PRAGMA auto_vacuum = '0'}
73 {PRAGMA user_version = '0'}
74 {PRAGMA application_id = '0'}
75 {CREATE TABLE t1(a, b)}
76 {CREATE INDEX i1 ON t1(a)}
77 {INSERT OR IGNORE INTO 't1'(_rowid_, 'a', 'b') VALUES (1, 1, 1)}
78 {INSERT OR IGNORE INTO 't1'(_rowid_, 'a', 'b') VALUES (2, 2, 2)}
79 {INSERT OR IGNORE INTO 't1'(_rowid_, 'a', 'b') VALUES (3, 3, 3)}
80 {INSERT OR IGNORE INTO 't1'(_rowid_, 'a', 'b') VALUES (4, 4, 4)}
81 {PRAGMA writable_schema = off}