interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / fts5 / test / fts5secure2.test

87 lines · 2102 bytes Raw Blame History
1# 2023 Feb 17
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
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.
9#
10#*************************************************************************
11#
12
13source [file join [file dirname [info script]] fts5_common.tcl]
14ifcapable !fts5 { finish_test ; return }
15set ::testprefix fts5secure2
16
17do_execsql_test 1.0 {
18 CREATE VIRTUAL TABLE ft USING fts5(col);
19 INSERT INTO ft VALUES('data for the table');
20 INSERT INTO ft VALUES('more of the same');
21 INSERT INTO ft VALUES('and extra data');
22}
23
24do_execsql_test 1.1 {
25 SELECT * FROM ft_config
26} {version 4}
27
28do_execsql_test 1.2 {
29 INSERT INTO ft(ft, rank) VALUES('secure-delete', 1);
30 SELECT * FROM ft_config;
31} {secure-delete 1 version 4}
32
33do_execsql_test 1.3 {
34 INSERT INTO ft(ft, rank) VALUES('secure-delete', 1);
35 SELECT * FROM ft_config;
36} {secure-delete 1 version 4}
37
38do_execsql_test 1.4 {
39 DELETE FROM ft WHERE rowid=2;
40 SELECT * FROM ft_config;
41} {secure-delete 1 version 5}
42
43do_execsql_test 1.5 {
44 SELECT rowid, col FROM ft('data');
45} {1 {data for the table} 3 {and extra data}}
46
47db close
48sqlite3 db test.db
49
50do_execsql_test 1.6 {
51 SELECT rowid, col FROM ft('data');
52} {1 {data for the table} 3 {and extra data}}
53
54#------------------------------------------------------------------------
55
56reset_db
57do_execsql_test 2.0 {
58 CREATE VIRTUAL TABLE ft USING fts5(col);
59 INSERT INTO ft VALUES('one zero one one zero');
60 INSERT INTO ft(ft, rank) VALUES('secure-delete', 1);
61}
62
63do_execsql_test 2.1 {
64 SELECT count(*) FROM ft_data WHERE block=X'00000004';
65} {0}
66
67do_execsql_test 2.2 {
68 UPDATE ft SET col = 'zero one zero zero one' WHERE rowid=1;
69}
70
71do_execsql_test 2.3 {
72 SELECT count(*) FROM ft_data WHERE block=X'00000004';
73} {1}
74
75do_execsql_test 2.4 {
76 INSERT INTO ft VALUES('one zero zero one');
77 DELETE FROM ft WHERE rowid=1;
78}
79
80do_execsql_test 2.5 {
81 SELECT count(*) FROM ft_data WHERE block=X'00000004';
82} {2}
83
84
85finish_test
86
87