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 set testprefix fts5simple3
16 # If SQLITE_ENABLE_FTS5 is defined, omit this file.
22 fts5_aux_test_functions db
25 CREATE VIRTUAL TABLE t1 USING fts5(a, b, c, detail=col);
26 INSERT INTO t1 VALUES('a', 'b', 'c');
27 INSERT INTO t1 VALUES('x', 'x', 'x');
31 SELECT rowid, fts5_test_collist(t1) FROM t1('a:a');
35 SELECT rowid, fts5_test_collist(t1) FROM t1('b:x');
39 SELECT rowid, fts5_test_collist(t1) FROM t1('b:a');
42 #-------------------------------------------------------------------------
43 # Create detail=col and detail=full tables with 998 columns.
45 foreach_detail_mode $testprefix {
46 if {[detail_is_none]} continue
49 execsql { DROP TABLE IF EXISTS t2 }
52 for {set i 1} {$i <= 998} {incr i} {
54 lappend vals "'val$i'"
56 execsql "CREATE VIRTUAL TABLE t2 USING fts5(detail=%DETAIL%,[join $cols ,])"
60 execsql "INSERT INTO t2 VALUES([join $vals ,])"
69 do_execsql_test 2.3.$tn {
70 SELECT rowid FROM t2($q)
76 CREATE VIRTUAL TABLE x3 USING fts5(one);
77 INSERT INTO x3 VALUES('a b c');
78 INSERT INTO x3 VALUES('c b a');
79 INSERT INTO x3 VALUES('o t t');
80 SELECT * FROM x3('x OR y OR z');
83 #-------------------------------------------------------------------------
84 # Test that a crash occuring when the second or subsequent tokens in a
85 # phrase matched zero rows has been fixed.
88 CREATE VIRTUAL TABLE t1 USING fts5(x);
89 INSERT INTO t1 VALUES('ab');
90 INSERT INTO t1 VALUES('cd');
91 INSERT INTO t1 VALUES('ab cd');
92 INSERT INTO t1 VALUES('ab cdXXX');
93 INSERT INTO t1 VALUES('abXXX cd');
96 SELECT * FROM t1('"ab cd" OR "ab cd" *');
97 } {{ab cd} {ab cdXXX}}
99 SELECT * FROM t1('"xy zz" OR "ab cd" *');
100 } {{ab cd} {ab cdXXX}}
101 do_execsql_test 4.3 {
102 SELECT * FROM t1('"xy zz" OR "xy zz" *');
104 do_execsql_test 4.4 {
105 SELECT * FROM t1('"ab cd" OR "xy zz" *');
107 do_execsql_test 4.5 {
108 CREATE VIRTUAL TABLE t2 USING fts5(x);
109 INSERT INTO t2 VALUES('ab');
110 INSERT INTO t2 VALUES('cd');
111 INSERT INTO t2 VALUES('ef');
113 do_execsql_test 4.6 {
114 SELECT * FROM t2('ab + xyz');