mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-12-15 22:39:05 +00:00
9ed72eb5ae
This merges the version-3.45.1 tag from upstream SQLite git repository to libSQL with the following conflicts resolved: Conflicts: README.md ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java libsql-sqlite3/configure libsql-sqlite3/doc/jsonb.md libsql-sqlite3/ext/fts5/test/fts5faultH.test libsql-sqlite3/ext/fts5/test/fts5origintext.test libsql-sqlite3/ext/fts5/test/fts5origintext2.test libsql-sqlite3/ext/fts5/test/fts5origintext3.test libsql-sqlite3/ext/fts5/test/fts5origintext4.test libsql-sqlite3/ext/fts5/test/fts5origintext5.test libsql-sqlite3/ext/fts5/test/fts5secure8.test libsql-sqlite3/ext/fts5/test/fts5tokenizer2.test libsql-sqlite3/ext/fts5/test/fts5trigram2.test libsql-sqlite3/ext/jni/src/org/sqlite/jni/annotation/Experimental.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/capi/ConfigSqlLogCallback.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/capi/ConfigSqllogCallback.java libsql-sqlite3/ext/jni/src/org/sqlite/jni/wrapper1/WindowFunction.java libsql-sqlite3/ext/wasm/GNUmakefile libsql-sqlite3/ext/wasm/batch-runner-sahpool.html libsql-sqlite3/ext/wasm/batch-runner-sahpool.js libsql-sqlite3/src/pager.c libsql-sqlite3/src/shell.c.in libsql-sqlite3/src/sqliteInt.h libsql-sqlite3/src/wal.c libsql-sqlite3/test/fts3integrity.test libsql-sqlite3/test/json/jsonb-q1.txt libsql-sqlite3/test/json106.test libsql-sqlite3/test/json107.test libsql-sqlite3/test/jsonb01.test libsql-sqlite3/test/mmapcorrupt.test libsql-sqlite3/test/releasetest_data.tcl libsql-sqlite3/test/shell9.test libsql-sqlite3/test/wapp.tcl libsql-sqlite3/test/wapptest.tcl
88 lines
2.1 KiB
Plaintext
88 lines
2.1 KiB
Plaintext
# 2020 Dec 3
|
|
#
|
|
# 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 focused on prefix indexes.
|
|
#
|
|
|
|
source [file join [file dirname [info script]] fts5_common.tcl]
|
|
set testprefix fts5prefix2
|
|
|
|
# If SQLITE_ENABLE_FTS5 is defined, omit this file.
|
|
ifcapable !fts5 {
|
|
finish_test
|
|
return
|
|
}
|
|
|
|
foreach p {3 2 1} {
|
|
reset_db
|
|
do_execsql_test 1.$p.0 "
|
|
CREATE VIRTUAL TABLE t1 USING fts5(xyz, prefix=$p);
|
|
"
|
|
do_execsql_test 1.$p.1 {
|
|
INSERT INTO t1 VALUES
|
|
('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 f.');
|
|
}
|
|
|
|
do_execsql_test 1.$p.2 {
|
|
SELECT highlight(t1, 0, '[', ']') FROM t1('f*');
|
|
} {
|
|
{May you [find] [forgiveness] [for] yourself and [forgive] others.}
|
|
{May you share [freely], never taking more than you give [f].}
|
|
}
|
|
}
|
|
|
|
do_execsql_test 2.0 {
|
|
CREATE VIRTUAL TABLE t2 USING fts5(one, prefix=3);
|
|
INSERT INTO t2 VALUES('top');
|
|
INSERT INTO t2 VALUES('to');
|
|
INSERT INTO t2 VALUES('tommy');
|
|
}
|
|
|
|
do_execsql_test 2.1 {
|
|
SELECT * FROM t2('to*');
|
|
} {top to tommy}
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
foreach {tn newrowid} {
|
|
1 122
|
|
2 123
|
|
3 124
|
|
} {
|
|
reset_db
|
|
do_execsql_test 3.$tn.0 {
|
|
CREATE VIRTUAL TABLE t12 USING fts5(x);
|
|
INSERT INTO t12(rowid, x) VALUES(123, 'wwww');
|
|
}
|
|
do_execsql_test 3.$tn.1 {
|
|
BEGIN;
|
|
DELETE FROM t12 WHERE rowid=123;
|
|
SELECT * FROM t12('wwww*');
|
|
INSERT INTO t12(rowid, x) VALUES($newrowid, 'wwww');
|
|
SELECT * FROM t12('wwww*');
|
|
END;
|
|
} {wwww}
|
|
do_execsql_test 3.$tn.2 {
|
|
INSERT INTO t12(t12) VALUES('integrity-check');
|
|
}
|
|
do_execsql_test 3.$tn.3 {
|
|
SELECT rowid FROM t12('wwww*');
|
|
} $newrowid
|
|
}
|
|
|
|
finish_test
|
|
|
|
|
|
|
|
finish_test
|