sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / ext / fts5 / test / fts5unindexed.test
| 1 | # 2015 Apr 24 |
| 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 | # The tests in this file focus on "unindexed" columns. |
| 13 | # |
| 14 | |
| 15 | source [file join [file dirname [info script]] fts5_common.tcl] |
| 16 | set testprefix fts5unindexed |
| 17 | |
| 18 | # If SQLITE_ENABLE_FTS5 is not defined, omit this file. |
| 19 | ifcapable !fts5 { |
| 20 | finish_test |
| 21 | return |
| 22 | } |
| 23 | |
| 24 | |
| 25 | do_execsql_test 1.1 { |
| 26 | CREATE VIRTUAL TABLE t1 USING fts5(a, b UNINDEXED); |
| 27 | INSERT INTO t1 VALUES('a b c', 'd e f'); |
| 28 | INSERT INTO t1 VALUES('g h i', 'j k l'); |
| 29 | } {} |
| 30 | |
| 31 | do_execsql_test 1.2 { SELECT rowid FROM t1 WHERE t1 MATCH 'b' } {1} |
| 32 | do_execsql_test 1.3 { SELECT rowid FROM t1 WHERE t1 MATCH 'e' } {} |
| 33 | |
| 34 | do_execsql_test 1.4 { INSERT INTO t1(t1) VALUES('integrity-check') } {} |
| 35 | do_execsql_test 1.5 { INSERT INTO t1(t1) VALUES('rebuild') } {} |
| 36 | do_execsql_test 1.6 { INSERT INTO t1(t1) VALUES('integrity-check') } {} |
| 37 | |
| 38 | do_execsql_test 1.7 { SELECT rowid FROM t1 WHERE t1 MATCH 'b' } {1} |
| 39 | do_execsql_test 1.8 { SELECT rowid FROM t1 WHERE t1 MATCH 'e' } {} |
| 40 | |
| 41 | do_execsql_test 1.9 { DELETE FROM t1 WHERE t1 MATCH 'b' } {} |
| 42 | |
| 43 | do_execsql_test 1.10 { INSERT INTO t1(t1) VALUES('integrity-check') } {} |
| 44 | do_execsql_test 1.11 { INSERT INTO t1(t1) VALUES('rebuild') } {} |
| 45 | do_execsql_test 1.12 { INSERT INTO t1(t1) VALUES('integrity-check') } {} |
| 46 | |
| 47 | do_execsql_test 1.13 { SELECT rowid FROM t1 WHERE t1 MATCH 'i' } {2} |
| 48 | do_execsql_test 1.14 { SELECT rowid FROM t1 WHERE t1 MATCH 'l' } {} |
| 49 | |
| 50 | do_execsql_test 2.1 { |
| 51 | CREATE VIRTUAL TABLE t2 USING fts5(a UNINDEXED, b UNINDEXED); |
| 52 | INSERT INTO t1 VALUES('a b c', 'd e f'); |
| 53 | INSERT INTO t1 VALUES('g h i', 'j k l'); |
| 54 | SELECT rowid FROM t2_data; |
| 55 | } {1 10} |
| 56 | do_execsql_test 2.2 { |
| 57 | INSERT INTO t2(t2) VALUES('rebuild'); |
| 58 | INSERT INTO t2(t2) VALUES('integrity-check'); |
| 59 | SELECT rowid FROM t2_data; |
| 60 | } {1 10} |
| 61 | |
| 62 | do_execsql_test 3.1 { |
| 63 | CREATE TABLE x4(i INTEGER PRIMARY KEY, a, b, c); |
| 64 | CREATE VIRTUAL TABLE t4 USING fts5(a, b UNINDEXED, c, content=x4); |
| 65 | INSERT INTO x4 VALUES(10, 'a b c', 'd e f', 'g h i'); |
| 66 | INSERT INTO x4 VALUES(20, 'j k l', 'm n o', 'p q r'); |
| 67 | INSERT INTO t4(t4) VALUES('rebuild'); |
| 68 | INSERT INTO t4(t4) VALUES('integrity-check'); |
| 69 | } {} |
| 70 | |
| 71 | do_execsql_test 3.2 { |
| 72 | INSERT INTO t4(t4, rowid, a, b, c) VALUES('delete', 20, 'j k l', '', 'p q r'); |
| 73 | DELETE FROM x4 WHERE rowid=20; |
| 74 | INSERT INTO t4(t4) VALUES('integrity-check'); |
| 75 | } {} |
| 76 | |
| 77 | |
| 78 | finish_test |