interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / ext / rtree / rtreeconnect.test

56 lines · 1293 bytes Raw Blame History
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
18if {![info exists testdir]} {
19 set testdir [file join [file dirname [info script]] .. .. test]
20}
21source $testdir/tester.tcl
22set testprefix rtreeconnect
23
24ifcapable !rtree {
25 finish_test
26 return
27}
28
29do_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
40db close
41sqlite3 db test.db
42sqlite3 db2 test.db
43
44do_test 1.1 {
45 db eval { INSERT INTO log VALUES('startup'); }
46 db2 eval { CREATE TABLE newtable(x,y); }
47} {}
48
49do_execsql_test 1.2 {
50 INSERT INTO t1 VALUES(1, 2, 3, 4, 5);
51}
52
53db2 close
54db close
55
56finish_test