fts5unindexed.test 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. source [file join [file dirname [info script]] fts5_common.tcl]
  15. set testprefix fts5unindexed
  16. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  17. ifcapable !fts5 {
  18. finish_test
  19. return
  20. }
  21. do_execsql_test 1.1 {
  22. CREATE VIRTUAL TABLE t1 USING fts5(a, b UNINDEXED);
  23. INSERT INTO t1 VALUES('a b c', 'd e f');
  24. INSERT INTO t1 VALUES('g h i', 'j k l');
  25. } {}
  26. do_execsql_test 1.2 { SELECT rowid FROM t1 WHERE t1 MATCH 'b' } {1}
  27. do_execsql_test 1.3 { SELECT rowid FROM t1 WHERE t1 MATCH 'e' } {}
  28. do_execsql_test 1.4 { INSERT INTO t1(t1) VALUES('integrity-check') } {}
  29. do_execsql_test 1.5 { INSERT INTO t1(t1) VALUES('rebuild') } {}
  30. do_execsql_test 1.6 { INSERT INTO t1(t1) VALUES('integrity-check') } {}
  31. do_execsql_test 1.7 { SELECT rowid FROM t1 WHERE t1 MATCH 'b' } {1}
  32. do_execsql_test 1.8 { SELECT rowid FROM t1 WHERE t1 MATCH 'e' } {}
  33. do_execsql_test 1.9 { DELETE FROM t1 WHERE t1 MATCH 'b' } {}
  34. do_execsql_test 1.10 { INSERT INTO t1(t1) VALUES('integrity-check') } {}
  35. do_execsql_test 1.11 { INSERT INTO t1(t1) VALUES('rebuild') } {}
  36. do_execsql_test 1.12 { INSERT INTO t1(t1) VALUES('integrity-check') } {}
  37. do_execsql_test 1.13 { SELECT rowid FROM t1 WHERE t1 MATCH 'i' } {2}
  38. do_execsql_test 1.14 { SELECT rowid FROM t1 WHERE t1 MATCH 'l' } {}
  39. do_execsql_test 2.1 {
  40. CREATE VIRTUAL TABLE t2 USING fts5(a UNINDEXED, b UNINDEXED);
  41. INSERT INTO t1 VALUES('a b c', 'd e f');
  42. INSERT INTO t1 VALUES('g h i', 'j k l');
  43. SELECT rowid FROM t2_data;
  44. } {1 10}
  45. do_execsql_test 2.2 {
  46. INSERT INTO t2(t2) VALUES('rebuild');
  47. INSERT INTO t2(t2) VALUES('integrity-check');
  48. SELECT rowid FROM t2_data;
  49. } {1 10}
  50. do_execsql_test 3.1 {
  51. CREATE TABLE x4(i INTEGER PRIMARY KEY, a, b, c);
  52. CREATE VIRTUAL TABLE t4 USING fts5(a, b UNINDEXED, c, content=x4);
  53. INSERT INTO x4 VALUES(10, 'a b c', 'd e f', 'g h i');
  54. INSERT INTO x4 VALUES(20, 'j k l', 'm n o', 'p q r');
  55. INSERT INTO t4(t4) VALUES('rebuild');
  56. INSERT INTO t4(t4) VALUES('integrity-check');
  57. } {}
  58. do_execsql_test 3.2 {
  59. INSERT INTO t4(t4, rowid, a, b, c) VALUES('delete', 20, 'j k l', '', 'p q r');
  60. DELETE FROM x4 WHERE rowid=20;
  61. INSERT INTO t4(t4) VALUES('integrity-check');
  62. } {}
  63. finish_test