rtreecirc.test 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # 2018 Dec 22
  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. if {![info exists testdir]} {
  15. set testdir [file join [file dirname [info script]] .. .. test]
  16. }
  17. source [file join [file dirname [info script]] rtree_util.tcl]
  18. source $testdir/tester.tcl
  19. set testprefix rtreecirc
  20. ifcapable !rtree {
  21. finish_test
  22. return
  23. }
  24. do_execsql_test 1.0 {
  25. CREATE VIRTUAL TABLE rt USING rtree(id, x1, x2, y1, y2);
  26. SELECT name FROM sqlite_master ORDER BY 1;
  27. } {
  28. rt rt_node rt_parent rt_rowid
  29. }
  30. db_save_and_close
  31. foreach {tn schema sql} {
  32. 1 {
  33. CREATE TRIGGER tr1 AFTER INSERT ON rt_node BEGIN
  34. SELECT * FROM rt;
  35. END;
  36. } {
  37. INSERT INTO rt VALUES(1, 2, 3, 4, 5);
  38. }
  39. 2 {
  40. CREATE TRIGGER tr1 AFTER INSERT ON rt_parent BEGIN
  41. SELECT * FROM rt;
  42. END;
  43. } {
  44. INSERT INTO rt VALUES(1, 2, 3, 4, 5);
  45. }
  46. 3 {
  47. CREATE TRIGGER tr1 AFTER INSERT ON rt_rowid BEGIN
  48. SELECT * FROM rt;
  49. END;
  50. } {
  51. INSERT INTO rt VALUES(1, 2, 3, 4, 5);
  52. }
  53. } {
  54. db_restore_and_reopen
  55. do_execsql_test 1.1.$tn.1 $schema
  56. do_catchsql_test 1.1.$tn.2 $sql {1 {no such table: main.rt}}
  57. db close
  58. }
  59. finish_test