1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00
Files
sqlite/ext/fts5/test/fts5secure8.test
dan 342984075b Add tests to restore coverage of fts5_config.c.
FossilOrigin-Name: 9d971b31df7ad4d68eb348f95d8f996071cf87d41c47033bde3fcc4dba732e06
2024-08-16 19:05:47 +00:00

72 lines
1.6 KiB
Plaintext

# 2023 Nov 23
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#*************************************************************************
#
source [file join [file dirname [info script]] fts5_common.tcl]
ifcapable !fts5 { finish_test ; return }
set ::testprefix fts5secure8
proc sql_repeat {txt n} {
string repeat $txt $n
}
db func repeat sql_repeat
do_execsql_test 1.0 {
CREATE VIRTUAL TABLE ft USING fts5(x);
INSERT INTO ft(ft, rank) VALUES('pgsz', 64);
INSERT INTO ft(rowid, x) VALUES(100, 'hello world');
INSERT INTO ft(rowid, x) VALUES(200, 'one day');
BEGIN;
INSERT INTO ft(rowid, x) VALUES(45, 'one two three');
UPDATE ft SET x = repeat('hello world ', 500) WHERE rowid=100;
COMMIT
}
do_execsql_test 1.1 {
INSERT INTO ft(ft, rank) VALUES('secure-delete', 1);
DELETE FROM ft WHERE rowid=100;
}
do_execsql_test 1.2 {
PRAGMA integrity_check;
} {ok}
do_execsql_test 2.0 {
CREATE VIRTUAL TABLE xyz USING fts5 (
name,
content=''
);
INSERT INTO xyz(xyz, rank) VALUES('secure-delete', 1);
INSERT INTO xyz (rowid, name) VALUES(1, 'A');
INSERT INTO xyz (rowid, name) VALUES(2, 'A');
INSERT INTO xyz(xyz, rowid, name) VALUES('delete', 2, 'A');
}
do_execsql_test 2.1 {
pragma quick_check;
} {ok}
do_catchsql_test 2.2 {
INSERT INTO xyz(xyz, rank) VALUES('secure-delete', 'hello world');
} {1 {SQL logic error}}
finish_test