| 1 |
# 2015 April 21 |
| 2 |
# |
| 3 |
# The author disclaims copyright to this source code. In place of |
| 4 |
# a legal notice, here is a blessing: |
| 5 |
# |
| 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. |
| 9 |
# |
| 10 |
#*********************************************************************** |
| 11 |
# |
| 12 |
# This test is focused on edge cases in the doclist format. |
| 13 |
# |
| 14 |
|
| 15 |
source [file join [file dirname [info script]] fts5_common.tcl] |
| 16 |
set testprefix fts5doclist |
| 17 |
|
| 18 |
# If SQLITE_ENABLE_FTS5 is not defined, omit this file. |
| 19 |
ifcapable !fts5 { |
| 20 |
finish_test |
| 21 |
return |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
#------------------------------------------------------------------------- |
| 26 |
# Create a table with 1000 columns. Then add some large documents to it. |
| 27 |
# All text is in the right most column of the table. |
| 28 |
# |
| 29 |
do_test 1.0 { |
| 30 |
set cols [list] |
| 31 |
for {set i 0} {$i < 900} {incr i} { lappend cols "x$i" } |
| 32 |
execsql "CREATE VIRTUAL TABLE ccc USING fts5([join $cols ,])" |
| 33 |
} {} |
| 34 |
|
| 35 |
db func rnddoc fts5_rnddoc |
| 36 |
do_execsql_test 1.1 { |
| 37 |
WITH ii(i) AS (SELECT 1 UNION SELECT i+1 FROM ii WHERE i<100) |
| 38 |
INSERT INTO ccc(x899) SELECT rnddoc(500) FROM ii; |
| 39 |
} |
| 40 |
|
| 41 |
do_execsql_test 1.2 { |
| 42 |
INSERT INTO ccc(ccc) VALUES('integrity-check'); |
| 43 |
} |
| 44 |
|
| 45 |
#------------------------------------------------------------------------- |
| 46 |
# |
| 47 |
reset_db |
| 48 |
do_execsql_test 2.1 { |
| 49 |
CREATE VIRTUAL TABLE tx USING fts5(x); |
| 50 |
} |
| 51 |
|
| 52 |
set doc [string repeat "abc " 5000] |
| 53 |
do_execsql_test 2.2 { |
| 54 |
BEGIN; |
| 55 |
INSERT INTO tx(rowid, x) VALUES(-9000000000000000000, $doc); |
| 56 |
INSERT INTO tx(rowid, x) VALUES(9000000000000000000, $doc); |
| 57 |
COMMIT; |
| 58 |
} |
| 59 |
|
| 60 |
do_execsql_test 2.3 { |
| 61 |
SELECT rowid FROM tx('abc'); |
| 62 |
} { |
| 63 |
-9000000000000000000 |
| 64 |
9000000000000000000 |
| 65 |
} |
| 66 |
|
| 67 |
finish_test |