3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # Test that nothing goes wrong if an rtree table is created, then the
13 # database page-size is modified. At one point (3.6.22), this was causing
17 if {![info exists testdir]} {
18 set testdir [file join [file dirname [info script]] .. .. test]
20 source $testdir/tester.tcl
22 ifcapable !rtree||!vacuum {
27 # Like execsql except display output as integer where that can be
28 # done without loss of information.
30 proc execsql_intout {sql} {
32 foreach term [execsql $sql] {
33 regsub {\.0$} $term {} term
41 PRAGMA page_size = 1024;
42 CREATE VIRTUAL TABLE rt USING rtree(id, x1, x2, y1, y2);
43 INSERT INTO rt VALUES(1, 1, 2, 3, 4);
47 execsql_intout { SELECT * FROM rt }
51 PRAGMA page_size = 2048;
57 for {set i 2} {$i <= 51} {incr i} {
58 execsql { INSERT INTO rt VALUES($i, 1, 2, 3, 4) }
60 execsql_intout { SELECT sum(x1), sum(x2), sum(y1), sum(y2) FROM rt }
64 PRAGMA page_size = 512;
66 SELECT sum(x1), sum(x2), sum(y1), sum(y2) FROM rt