fts5doclist.test 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. source [file join [file dirname [info script]] fts5_common.tcl]
  15. set testprefix fts5doclist
  16. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  17. ifcapable !fts5 {
  18. finish_test
  19. return
  20. }
  21. #-------------------------------------------------------------------------
  22. # Create a table with 1000 columns. Then add some large documents to it.
  23. # All text is in the right most column of the table.
  24. #
  25. do_test 1.0 {
  26. set cols [list]
  27. for {set i 0} {$i < 900} {incr i} { lappend cols "x$i" }
  28. execsql "CREATE VIRTUAL TABLE ccc USING fts5([join $cols ,])"
  29. } {}
  30. db func rnddoc fts5_rnddoc
  31. do_execsql_test 1.1 {
  32. WITH ii(i) AS (SELECT 1 UNION SELECT i+1 FROM ii WHERE i<100)
  33. INSERT INTO ccc(x899) SELECT rnddoc(500) FROM ii;
  34. }
  35. do_execsql_test 1.2 {
  36. INSERT INTO ccc(ccc) VALUES('integrity-check');
  37. }
  38. #-------------------------------------------------------------------------
  39. #
  40. reset_db
  41. do_execsql_test 2.1 {
  42. CREATE VIRTUAL TABLE tx USING fts5(x);
  43. }
  44. set doc [string repeat "abc " 5000]
  45. do_execsql_test 2.2 {
  46. BEGIN;
  47. INSERT INTO tx(rowid, x) VALUES(-9000000000000000000, $doc);
  48. INSERT INTO tx(rowid, x) VALUES(9000000000000000000, $doc);
  49. COMMIT;
  50. }
  51. do_execsql_test 2.3 {
  52. SELECT rowid FROM tx('abc');
  53. } {
  54. -9000000000000000000
  55. 9000000000000000000
  56. }
  57. finish_test