| 1 |
# 2014 March 11 |
| 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 |
# Miscellaneous tests for errors in the rtree constructor. |
| 13 |
# |
| 14 |
|
| 15 |
|
| 16 |
if {![info exists testdir]} { |
| 17 |
set testdir [file join [file dirname [info script]] .. .. test] |
| 18 |
} |
| 19 |
source [file join [file dirname [info script]] rtree_util.tcl] |
| 20 |
source $testdir/tester.tcl |
| 21 |
source $testdir/lock_common.tcl |
| 22 |
ifcapable !rtree||!builtin_test { |
| 23 |
finish_test |
| 24 |
return |
| 25 |
} |
| 26 |
set testprefix rtreeD |
| 27 |
|
| 28 |
#------------------------------------------------------------------------- |
| 29 |
# Test that if an SQLITE_BUSY is encountered within the vtable |
| 30 |
# constructor, a relevant error message is returned. |
| 31 |
# |
| 32 |
do_multiclient_test tn { |
| 33 |
do_test 1.$tn.1 { |
| 34 |
sql1 { |
| 35 |
CREATE TABLE t1(a, b); |
| 36 |
INSERT INTO t1 VALUES(1,2); |
| 37 |
CREATE VIRTUAL TABLE rt USING rtree(id, minx, maxx, miny, maxy); |
| 38 |
INSERT INTO rt VALUES(1,2,3,4,5); |
| 39 |
} |
| 40 |
} {} |
| 41 |
|
| 42 |
do_test 1.$tn.2 { |
| 43 |
sql2 { SELECT * FROM t1; } |
| 44 |
} {1 2} |
| 45 |
|
| 46 |
do_test 1.$tn.3 { |
| 47 |
sql1 { BEGIN EXCLUSIVE; INSERT INTO t1 VALUES(3, 4); } |
| 48 |
} {} |
| 49 |
|
| 50 |
do_test 1.$tn.4 { |
| 51 |
list [catch { sql2 { SELECT * FROM rt } } msg] $msg |
| 52 |
} {1 {database is locked}} |
| 53 |
} |
| 54 |
|
| 55 |
finish_test |