Index: third_party/sqlite/src/test/fts3query.test |
diff --git a/third_party/sqlite/src/test/fts3query.test b/third_party/sqlite/src/test/fts3query.test |
index 2d12351ae98053c1a16220dfa05d025ca9403da3..7d5ae991f70da1ae8f9d63834253ef6f42ae49a4 100644 |
--- a/third_party/sqlite/src/test/fts3query.test |
+++ b/third_party/sqlite/src/test/fts3query.test |
@@ -173,8 +173,8 @@ do_select_tests 5.4 -errorformat { |
4 "SELECT optimize(content) FROM t2 WHERE t2 MATCH 'history'" optimize |
} |
do_catchsql_test 5.5.1 { |
- SELECT matchinfo(t2, 'abc') FROM t2 WHERE t2 MATCH 'history' |
-} {1 {unrecognized matchinfo request: b}} |
+ SELECT matchinfo(t2, 'abcd') FROM t2 WHERE t2 MATCH 'history' |
+} {1 {unrecognized matchinfo request: d}} |
do_execsql_test 5.5 { DROP TABLE t2 } |
@@ -208,5 +208,81 @@ do_select_tests 6.2 { |
{{ZZZthe hand XXXgesturesYYY (called beatsZZZ}} |
} |
+# Test some range queries on the rowid field. |
+# |
+do_execsql_test 7.1 { |
+ CREATE VIRTUAL TABLE ft4 USING fts4(x); |
+ CREATE TABLE t4(x); |
+} |
+ |
+set SMALLINT -9223372036854775808 |
+set LARGEINT 9223372036854775807 |
+do_test 7.2 { |
+ db transaction { |
+ foreach {iFirst nEntry} [subst { |
+ 0 100 |
+ $SMALLINT 100 |
+ [expr $LARGEINT - 99] 100 |
+ }] { |
+ for {set i 0} {$i < $nEntry} {incr i} { |
+ set iRowid [expr $i + $iFirst] |
+ execsql { |
+ INSERT INTO ft4(rowid, x) VALUES($iRowid, 'x y z'); |
+ INSERT INTO t4(rowid, x) VALUES($iRowid, 'x y z'); |
+ } |
+ } |
+ } |
+ } |
+} {} |
+ |
+foreach {tn iFirst iLast} [subst { |
+ 1 5 10 |
+ 2 $SMALLINT [expr $SMALLINT+5] |
+ 3 $SMALLINT [expr $SMALLINT+50] |
+ 4 [expr $LARGEINT-5] $LARGEINT |
+ 5 $LARGEINT $LARGEINT |
+ 6 $SMALLINT $LARGEINT |
+ 7 $SMALLINT $SMALLINT |
+ 8 $LARGEINT $SMALLINT |
+}] { |
+ set res [db eval { |
+ SELECT rowid FROM t4 WHERE rowid BETWEEN $iFirst AND $iLast |
+ } ] |
+ |
+ do_execsql_test 7.2.$tn.1.[llength $res] { |
+ SELECT rowid FROM ft4 WHERE rowid BETWEEN $iFirst AND $iLast |
+ } $res |
+ set res [db eval { |
+ SELECT rowid FROM t4 WHERE rowid BETWEEN $iFirst AND $iLast |
+ ORDER BY +rowid DESC |
+ } ] |
+ do_execsql_test 7.2.$tn.2.[llength $res] { |
+ SELECT rowid FROM ft4 WHERE rowid BETWEEN $iFirst AND $iLast |
+ ORDER BY rowid DESC |
+ } $res |
+} |
+ |
+foreach ii [db eval {SELECT rowid FROM t4}] { |
+ set res1 [db eval {SELECT rowid FROM t4 WHERE rowid > $ii}] |
+ set res2 [db eval {SELECT rowid FROM t4 WHERE rowid < $ii}] |
+ set res1s [db eval {SELECT rowid FROM t4 WHERE rowid > $ii ORDER BY +rowid DESC}] |
+ set res2s [db eval {SELECT rowid FROM t4 WHERE rowid < $ii ORDER BY +rowid DESC}] |
+ |
+ do_execsql_test 7.3.$ii.1 { |
+ SELECT rowid FROM ft4 WHERE rowid > $ii |
+ } $res1 |
+ |
+ do_execsql_test 7.3.$ii.2 { |
+ SELECT rowid FROM ft4 WHERE rowid < $ii |
+ } $res2 |
+ |
+ do_execsql_test 7.3.$ii.3 { |
+ SELECT rowid FROM ft4 WHERE rowid > $ii ORDER BY rowid DESC |
+ } $res1s |
+ |
+ do_execsql_test 7.3.$ii.4 { |
+ SELECT rowid FROM ft4 WHERE rowid < $ii ORDER BY rowid DESC |
+ } $res2s |
+} |
finish_test |