fts5ai.test 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # 2014 June 17
  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. # This file implements regression tests for SQLite library. The
  12. # focus of this script is testing the FTS5 module.
  13. #
  14. # Specifically, it tests transactions and savepoints
  15. #
  16. source [file join [file dirname [info script]] fts5_common.tcl]
  17. set testprefix fts5ai
  18. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  19. ifcapable !fts5 {
  20. finish_test
  21. return
  22. }
  23. foreach_detail_mode $testprefix {
  24. do_execsql_test 1.0 {
  25. CREATE VIRTUAL TABLE t1 USING fts5(a, detail=%DETAIL%);
  26. } {}
  27. do_execsql_test 1.1 {
  28. BEGIN;
  29. INSERT INTO t1 VALUES('a b c');
  30. INSERT INTO t1 VALUES('d e f');
  31. SAVEPOINT one;
  32. INSERT INTO t1 VALUES('g h i');
  33. SAVEPOINT two;
  34. INSERT INTO t1 VALUES('j k l');
  35. ROLLBACK TO one;
  36. INSERT INTO t1 VALUES('m n o');
  37. SAVEPOINT two;
  38. INSERT INTO t1 VALUES('p q r');
  39. RELEASE one;
  40. SAVEPOINT one;
  41. INSERT INTO t1 VALUES('s t u');
  42. ROLLBACK TO one;
  43. COMMIT;
  44. }
  45. do_execsql_test 1.2 {
  46. INSERT INTO t1(t1) VALUES('integrity-check');
  47. }
  48. do_execsql_test 1.3 {
  49. SAVEPOINT one;
  50. INSERT INTO t1 VALUES('v w x');
  51. ROLLBACK TO one;
  52. }
  53. }
  54. finish_test