24730de8d1
FossilOrigin-Name: b314be66b9ac0190b5373b3b6baec012382bc588c2d86c2edab796669a4303c3
79 lines
1.8 KiB
Plaintext
79 lines
1.8 KiB
Plaintext
# 2023 July 21
|
|
#
|
|
# 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.
|
|
#
|
|
#***********************************************************************
|
|
#
|
|
# This file contains tests for the content= and content_rowid= options.
|
|
#
|
|
|
|
source [file join [file dirname [info script]] fts5_common.tcl]
|
|
set testprefix fts5contentless4
|
|
|
|
# If SQLITE_ENABLE_FTS5 is defined, omit this file.
|
|
ifcapable !fts5 {
|
|
finish_test
|
|
return
|
|
}
|
|
|
|
proc document {n} {
|
|
set vocab [list A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]
|
|
set ret [list]
|
|
for {set ii 0} {$ii < $n} {incr ii} {
|
|
lappend ret [lindex $vocab [expr int(rand()*[llength $vocab])]]
|
|
}
|
|
set ret
|
|
}
|
|
db func document document
|
|
|
|
do_execsql_test 1.0 {
|
|
CREATE VIRTUAL TABLE ft USING fts5(x, content='', contentless_delete=1);
|
|
INSERT INTO ft(ft, rank) VALUES('pgsz', 240);
|
|
WITH s(i) AS (
|
|
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000
|
|
)
|
|
INSERT INTO ft SELECT document(12) FROM s;
|
|
}
|
|
|
|
do_execsql_test 1.1 {
|
|
INSERT INTO ft(ft) VALUES('optimize');
|
|
}
|
|
|
|
do_execsql_test 1.2 {
|
|
SELECT level, segment, nentry, nentrytombstone FROM fts5_structure((
|
|
SELECT block FROM ft_data WHERE id=10
|
|
))
|
|
} {0 0 1000 0}
|
|
|
|
do_execsql_test 1.3 {
|
|
DELETE FROM ft WHERE rowid < 50
|
|
}
|
|
|
|
do_execsql_test 1.4 {
|
|
SELECT level, segment, nentry, nentrytombstone FROM fts5_structure((
|
|
SELECT block FROM ft_data WHERE id=10
|
|
))
|
|
} {0 0 1000 49}
|
|
|
|
do_execsql_test 1.5 {
|
|
DELETE FROM ft WHERE rowid < 1000
|
|
}
|
|
|
|
do_execsql_test 1.6 {
|
|
SELECT level, segment, nentry, nentrytombstone FROM fts5_structure((
|
|
SELECT block FROM ft_data WHERE id=10
|
|
))
|
|
} {1 0 1 0}
|
|
|
|
finish_test
|
|
|
|
|
|
|
|
finish_test
|
|
|