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]
14 ifcapable !fts5 { finish_test ; return }
15 set ::testprefix fts5secure6
17 db progress 1 progress_handler
19 proc progress_handler {args} {
21 # if {($::PHC % 100000)==0} breakpoint
27 DROP TABLE IF EXISTS t1;
28 CREATE VIRTUAL TABLE t1 USING fts5(x);
30 VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1000
32 INSERT INTO t1 SELECT 'a b c d e f g h i j k' FROM s;
41 do_execsql_test 1.$tn.0 {
42 INSERT INTO t1(t1, rank) VALUES('secure-delete', $sd)
45 do_execsql_test 1.$tn.1 { DELETE FROM t1; }
50 expr $phc(1)*5 < $phc(2)
53 #-------------------------------------------------------------------------
57 CREATE VIRTUAL TABLE t1 USING fts5(x);
58 INSERT INTO t1(t1, rank) VALUES('secure-delete', $sd)
63 INSERT INTO t1(rowid, x) VALUES(-100000, 'abc def ghi');
64 INSERT INTO t1(rowid, x) VALUES(-99999, 'abc def ghi');
65 INSERT INTO t1(rowid, x) VALUES(9223372036854775800, 'abc def ghi');
70 SELECT rowid FROM t1('def')
71 } {-100000 -99999 9223372036854775800}
73 #-------------------------------------------------------------------------
77 CREATE VIRTUAL TABLE t1 USING fts5(x);
78 INSERT INTO t1(t1, rank) VALUES('secure-delete', $sd)
83 INSERT INTO t1(rowid, x)
84 VALUES(51869, 'when whenever where weress what turn'),
90 DELETE FROM t1 WHERE rowid=51871;
91 INSERT INTO t1(t1) VALUES('integrity-check');
94 #-------------------------------------------------------------------------
98 CREATE VIRTUAL TABLE t1 USING fts5(x);
99 INSERT INTO t1(rowid, x) VALUES(10, 'one two');
101 do_execsql_test 4.1 {
102 UPDATE t1 SET x = 'one three' WHERE rowid=10;
103 INSERT INTO t1(t1, rank) VALUES('secure-delete', 1);
105 do_execsql_test 4.2 {
106 DELETE FROM t1 WHERE rowid=10;
108 do_execsql_test 4.3 {
109 INSERT INTO t1(t1) VALUES('integrity-check');
112 #-------------------------------------------------------------------------
115 do_execsql_test 5.0 {
116 CREATE VIRTUAL TABLE t1 USING fts5(content);
118 INSERT INTO t1(t1,rank) VALUES('secure-delete',1);
119 INSERT INTO t1 VALUES('active'),('boomer'),('atom'),('atomic'),
120 ('alpha channel backup abandon test aback boomer atom alpha active');
121 DELETE FROM t1 WHERE t1 MATCH 'abandon';
124 do_execsql_test 5.1 {
125 INSERT INTO t1(t1) VALUES('rebuild');
128 do_execsql_test 5.2 {
129 DELETE FROM t1 WHERE rowid NOTNULL<5;
135 do_execsql_test 5.3 {
136 PRAGMA integrity_check;