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]] fts5_common.tcl]
15 set ::testprefix fts5secure5
20 SELECT id, quote(block), fts5_decode_none(id, block) FROM ft1_data
25 CREATE VIRTUAL TABLE ft1 USING fts5(a, detail=none);
26 INSERT INTO ft1(ft1, rank) VALUES('secure-delete', 1);
31 INSERT INTO ft1(rowid, a) VALUES(1, 'abcd');
32 INSERT INTO ft1(rowid, a) VALUES(2, 'abcd');
33 INSERT INTO ft1(rowid, a) VALUES(3, 'abcd');
37 DELETE FROM ft1 WHERE rowid=1;
40 INSERT INTO ft1(ft1) VALUES('integrity-check');
43 DELETE FROM ft1 WHERE rowid=3;
46 INSERT INTO ft1(ft1) VALUES('integrity-check');
49 DELETE FROM ft1 WHERE rowid=3;
52 INSERT INTO ft1(ft1) VALUES('integrity-check');
55 #-------------------------------------------------------------------------
58 CREATE VIRTUAL TABLE ft1 USING fts5(a, detail=none);
59 INSERT INTO ft1(ft1, rank) VALUES('secure-delete', 1);
64 INSERT INTO ft1(rowid, a) VALUES(1, 'abcd one');
65 INSERT INTO ft1(rowid, a) VALUES(2, 'abcd two');
66 INSERT INTO ft1(rowid, a) VALUES(3, 'abcd two');
67 INSERT INTO ft1(rowid, a) VALUES(4, 'abcd two');
68 INSERT INTO ft1(rowid, a) VALUES(5, 'abcd three');
72 do_execsql_test 2.2a {
73 DELETE FROM ft1 WHERE rowid=3;
75 do_execsql_test 2.2b {
76 INSERT INTO ft1(ft1) VALUES('integrity-check');
78 do_execsql_test 2.3a {
79 DELETE FROM ft1 WHERE rowid=2;
81 do_execsql_test 2.3b {
82 INSERT INTO ft1(ft1) VALUES('integrity-check');
84 do_execsql_test 2.4a {
85 DELETE FROM ft1 WHERE rowid=4;
87 do_execsql_test 2.4b {
88 INSERT INTO ft1(ft1) VALUES('integrity-check');
91 #-------------------------------------------------------------------------
94 CREATE VIRTUAL TABLE ft1 USING fts5(a, detail=none, prefix=1);
95 INSERT INTO ft1(ft1, rank) VALUES('secure-delete', 1);
96 INSERT INTO ft1(ft1, rank) VALUES('pgsz', 64);
100 INSERT INTO ft1(a) VALUES('c');
103 do_execsql_test 3.2 {
104 DELETE FROM ft1 WHERE rowid IN (1);
105 INSERT INTO ft1(ft1) VALUES('integrity-check');
108 #-------------------------------------------------------------------------
110 do_execsql_test 4.0 {
111 CREATE VIRTUAL TABLE ft1 USING fts5(a, detail=none);
112 INSERT INTO ft1(ft1, rank) VALUES('secure-delete', 1);
113 INSERT INTO ft1(ft1, rank) VALUES('pgsz', 64);
116 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<500
118 INSERT INTO ft1 SELECT 'abcdefg' FROM s;
122 for {set i 500} {$i > 0} {incr i -1} {
123 execsql { DELETE FROM ft1 WHERE rowid=$i }
124 execsql { INSERT INTO ft1(ft1) VALUES('integrity-check') }