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 #***********************************************************************
12 source [file join [file dirname [info script]] fts5_common.tcl]
13 set testprefix fts5first
22 CREATE VIRTUAL TABLE x1 USING fts5(a, b);
25 foreach {tn expr ok} {
36 set res(0) {/1 {fts5: syntax error near .*}/}
39 do_catchsql_test 1.$tn { SELECT * FROM x1($expr) } $res($ok)
42 #-------------------------------------------------------------------------
45 INSERT INTO x1 VALUES('a b c', 'b c a');
48 foreach {tn expr match} {
60 do_execsql_test 2.$tn { SELECT EXISTS (SELECT rowid FROM x1($expr)) } $match
63 #-------------------------------------------------------------------------
67 INSERT INTO x1 VALUES('b a', 'c a');
68 INSERT INTO x1 VALUES('a a', 'c c');
69 INSERT INTO x1 VALUES('a b', 'a a');
71 fts5_aux_test_functions db
73 foreach {tn expr expect} {
75 2 {^c AND ^b} {{0 2} {1 0}}
77 do_execsql_test 3.$tn {
78 SELECT fts5_test_queryphrase(x1) FROM x1($expr) LIMIT 1
82 #-------------------------------------------------------------------------
85 CREATE VIRTUAL TABLE x2 USING fts5(a, b, c, detail=column);
88 do_catchsql_test 3.2 {
89 SELECT * FROM x2('a + b');
90 } {1 {fts5: phrase queries are not supported (detail!=full)}}
92 do_catchsql_test 3.3 {
93 SELECT * FROM x2('^a');
94 } {1 {fts5: phrase queries are not supported (detail!=full)}}