Debian Codegraph @

ext/rtree/rtreecirc.test

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