| 1 |
# 2017 August 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 |
# |
| 12 |
# The focus of this file is testing the r-tree extension. Specifically, |
| 13 |
# the impact of an SQLITE_SCHEMA error within the rtree module xConnect |
| 14 |
# callback. |
| 15 |
# |
| 16 |
|
| 17 |
|
| 18 |
if {![info exists testdir]} { |
| 19 |
set testdir [file join [file dirname [info script]] .. .. test] |
| 20 |
} |
| 21 |
source $testdir/tester.tcl |
| 22 |
set testprefix rtreeconnect |
| 23 |
|
| 24 |
ifcapable !rtree { |
| 25 |
finish_test |
| 26 |
return |
| 27 |
} |
| 28 |
|
| 29 |
do_execsql_test 1.0 { |
| 30 |
CREATE VIRTUAL TABLE r1 USING rtree(id, x1, x2, y1, y2); |
| 31 |
CREATE TABLE t1(id, x1, x2, y1, y2); |
| 32 |
CREATE TABLE log(l); |
| 33 |
|
| 34 |
CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN |
| 35 |
INSERT INTO r1 VALUES(new.id, new.x1, new.x2, new.y1, new.y2); |
| 36 |
INSERT INTO log VALUES('r1: ' || new.id); |
| 37 |
END; |
| 38 |
} |
| 39 |
|
| 40 |
db close |
| 41 |
sqlite3 db test.db |
| 42 |
sqlite3 db2 test.db |
| 43 |
|
| 44 |
do_test 1.1 { |
| 45 |
db eval { INSERT INTO log VALUES('startup'); } |
| 46 |
db2 eval { CREATE TABLE newtable(x,y); } |
| 47 |
} {} |
| 48 |
|
| 49 |
do_execsql_test 1.2 { |
| 50 |
INSERT INTO t1 VALUES(1, 2, 3, 4, 5); |
| 51 |
} |
| 52 |
|
| 53 |
db2 close |
| 54 |
db close |
| 55 |
|
| 56 |
finish_test |