1# 2008 Feb 19 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. 13# 14 15if {![info exists testdir]} { 16 set testdir [file join [file dirname [info script]] .. .. test] 17} 18source [file join [file dirname [info script]] rtree_util.tcl] 19source $testdir/tester.tcl 20set testprefix rtree1 21 22# Test plan: 23# 24# rtree-1.*: Creating/destroying r-tree tables. 25# rtree-2.*: Test the implicit constraints - unique rowid and 26# (coord[N]<=coord[N+1]) for even values of N. Also 27# automatic assigning of rowid values. 28# rtree-3.*: Linear scans of r-tree data. 29# rtree-4.*: Test INSERT 30# rtree-5.*: Test DELETE 31# rtree-6.*: Test UPDATE 32# rtree-7.*: Test renaming an r-tree table. 33# rtree-8.*: Test constrained scans of r-tree data. 34# 35# rtree-12.*: Test that on-conflict clauses are supported. 36# rtree-13.*: Test that bug [d2889096e7bdeac6d] has been fixed. 37# rtree-14.*: Test if a non-integer is inserted into the PK column of an 38# r-tree table, it is converted to an integer before being 39# inserted. Also that if a non-numeric is inserted into one 40# of the min/max dimension columns, it is converted to the 41# required type before being inserted. 42# rtree-15.*: Check that DROP TABLE works within a transaction that 43# writes to an r-tree table. 44# 45 46ifcapable !rtree { 47 finish_test 48 return 49} 50 51#---------------------------------------------------------------------------- 52# Test cases rtree-1.* test CREATE and DROP table statements. 53# 54 55# Test creating and dropping an rtree table. 56# 57do_test rtree-1.1.1 { 58 execsql { CREATE VIRTUAL TABLE t1 USING rtree(ii, x1, x2, y1, y2) } 59} {} 60do_test rtree-1.1.2 { 61 execsql { SELECT name FROM sqlite_master ORDER BY name } 62} {t1 t1_node t1_parent t1_rowid} 63do_test rtree-1.1.3 { 64 execsql { 65 DROP TABLE t1; 66 SELECT name FROM sqlite_master ORDER BY name; 67 } 68} {} 69 70# Test creating and dropping an rtree table with an odd name in 71# an attached database. 72# 73do_test rtree-1.2.1 { 74 file delete -force test2.db 75 execsql { 76 ATTACH 'test2.db' AS aux; 77 CREATE VIRTUAL TABLE aux.'a" "b' USING rtree(ii, x1, x2, y1, y2); 78 } 79} {} 80do_test rtree-1.2.2 { 81 execsql { SELECT name FROM sqlite_master ORDER BY name } 82} {} 83do_test rtree-1.2.3 { 84 execsql { SELECT name FROM aux.sqlite_master ORDER BY name } 85} {{a" "b} {a" "b_node} {a" "b_parent} {a" "b_rowid}} 86do_test rtree-1.2.4 { 87 execsql { 88 DROP TABLE aux.'a" "b'; 89 SELECT name FROM aux.sqlite_master ORDER BY name; 90 } 91} {} 92 93# Test that the logic for checking the number of columns specified 94# for an rtree table. Acceptable values are odd numbers between 3 and 95# 11, inclusive. 96# 97set cols [list i1 i2 i3 i4 i5 i6 i7 i8 i9 iA iB iC iD iE iF iG iH iI iJ iK] 98for {set nCol 1} {$nCol<[llength $cols]} {incr nCol} { 99 100 set columns [join [lrange $cols 0 [expr {$nCol-1}]] ,] 101 102 set X {0 {}} 103 if {$nCol%2 == 0} { set X {1 {Wrong number of columns for an rtree table}} } 104 if {$nCol < 3} { set X {1 {Too few columns for an rtree table}} } 105 if {$nCol > 11} { set X {1 {Too many columns for an rtree table}} } 106 107 do_test rtree-1.3.$nCol { 108 catchsql " 109 CREATE VIRTUAL TABLE t1 USING rtree($columns); 110 " 111 } $X 112 113 catchsql { DROP TABLE t1 } 114} 115 116# Like execsql except display output as integer where that can be 117# done without loss of information. 118# 119proc execsql_intout {sql} { 120 set out {} 121 foreach term [execsql $sql] { 122 regsub {\.0$} $term {} term 123 lappend out $term 124 } 125 return $out 126} 127 128# Test that it is possible to open an existing database that contains 129# r-tree tables. 130# 131do_execsql_test rtree-1.4.1a { 132 CREATE VIRTUAL TABLE t1 USING rtree(ii, x1, x2); 133 INSERT INTO t1 VALUES(1, 5.0, 10.0); 134 SELECT substr(hex(data),1,40) FROM t1_node; 135} {00000001000000000000000140A0000041200000} 136do_execsql_test rtree-1.4.1b { 137 INSERT INTO t1 VALUES(2, 15.0, 20.0); 138} {} 139do_test rtree-1.4.2 { 140 db close 141 sqlite3 db test.db 142 execsql_intout { SELECT * FROM t1 ORDER BY ii } 143} {1 5 10 2 15 20} 144do_test rtree-1.4.3 { 145 execsql { DROP TABLE t1 } 146} {} 147 148# Test that it is possible to create an r-tree table with ridiculous 149# column names. 150# 151do_test rtree-1.5.1 { 152 execsql_intout { 153 CREATE VIRTUAL TABLE t1 USING rtree("the key", "x dim.", "x2'dim"); 154 INSERT INTO t1 VALUES(1, 2, 3); 155 SELECT "the key", "x dim.", "x2'dim" FROM t1; 156 } 157} {1 2 3} 158do_test rtree-1.5.1 { 159 execsql { DROP TABLE t1 } 160} {} 161 162# Force the r-tree constructor to fail. 163# 164do_test rtree-1.6.1 { 165 execsql { CREATE TABLE t1_rowid(a); } 166 catchsql { 167 CREATE VIRTUAL TABLE t1 USING rtree("the key", "x dim.", "x2'dim"); 168 } 169} {1 {table "t1_rowid" already exists}} 170do_test rtree-1.6.1 { 171 execsql { DROP TABLE t1_rowid } 172} {} 173 174#---------------------------------------------------------------------------- 175# Test cases rtree-2.* 176# 177do_test rtree-2.1.1 { 178 execsql { 179 CREATE VIRTUAL TABLE t1 USING rtree(ii, x1, x2, y1, y2); 180 SELECT * FROM t1; 181 } 182} {} 183 184do_test rtree-2.1.2 { 185 execsql { INSERT INTO t1 VALUES(NULL, 1, 3, 2, 4) } 186 execsql_intout { SELECT * FROM t1 } 187} {1 1 3 2 4} 188do_test rtree-2.1.3 { 189 execsql { INSERT INTO t1 VALUES(NULL, 1, 3, 2, 4) } 190 execsql { SELECT rowid FROM t1 ORDER BY rowid } 191} {1 2} 192do_test rtree-2.1.3 { 193 execsql { INSERT INTO t1 VALUES(NULL, 1, 3, 2, 4) } 194 execsql { SELECT ii FROM t1 ORDER BY ii } 195} {1 2 3} 196 197do_test rtree-2.2.1 { 198 catchsql { INSERT INTO t1 VALUES(2, 1, 3, 2, 4) } 199} {1 {UNIQUE constraint failed: t1.ii}} 200do_test rtree-2.2.2 { 201 catchsql { INSERT INTO t1 VALUES(4, 1, 3, 4, 2) } 202} {1 {rtree constraint failed: t1.(y1<=y2)}} 203do_test rtree-2.2.3 { 204 catchsql { INSERT INTO t1 VALUES(4, 3, 1, 2, 4) } 205} {1 {rtree constraint failed: t1.(x1<=x2)}} 206do_test rtree-2.2.4 { 207 execsql { SELECT ii FROM t1 ORDER BY ii } 208} {1 2 3} 209 210do_test rtree-2.X { 211 execsql { DROP TABLE t1 } 212} {} 213 214#---------------------------------------------------------------------------- 215# Test cases rtree-3.* test linear scans of r-tree table data. To test 216# this we have to insert some data into an r-tree, but that is not the 217# focus of these tests. 218# 219do_test rtree-3.1.1 { 220 execsql { 221 CREATE VIRTUAL TABLE t1 USING rtree(ii, x1, x2, y1, y2); 222 SELECT * FROM t1; 223 } 224} {} 225do_test rtree-3.1.2 { 226 execsql_intout { 227 INSERT INTO t1 VALUES(5, 1, 3, 2, 4); 228 SELECT * FROM t1; 229 } 230} {5 1 3 2 4} 231do_test rtree-3.1.3 { 232 execsql_intout { 233 INSERT INTO t1 VALUES(6, 2, 6, 4, 8); 234 SELECT * FROM t1; 235 } 236} {5 1 3 2 4 6 2 6 4 8} 237 238# Test the constraint on the coordinates (c[i]<=c[i+1] where (i%2==0)): 239do_test rtree-3.2.1 { 240 catchsql { INSERT INTO t1 VALUES(7, 2, 6, 4, 3) } 241} {1 {rtree constraint failed: t1.(y1<=y2)}} 242do_test rtree-3.2.2 { 243 catchsql { INSERT INTO t1 VALUES(8, 2, 6, 3, 3) } 244} {0 {}} 245 246#---------------------------------------------------------------------------- 247# Test cases rtree-5.* test DELETE operations. 248# 249do_test rtree-5.1.1 { 250 execsql { CREATE VIRTUAL TABLE t2 USING rtree(ii, x1, x2) } 251} {} 252do_test rtree-5.1.2 { 253 execsql_intout { 254 INSERT INTO t2 VALUES(1, 10, 20); 255 INSERT INTO t2 VALUES(2, 30, 40); 256 INSERT INTO t2 VALUES(3, 50, 60); 257 SELECT * FROM t2 ORDER BY ii; 258 } 259} {1 10 20 2 30 40 3 50 60} 260do_test rtree-5.1.3 { 261 execsql_intout { 262 DELETE FROM t2 WHERE ii=2; 263 SELECT * FROM t2 ORDER BY ii; 264 } 265} {1 10 20 3 50 60} 266do_test rtree-5.1.4 { 267 execsql_intout { 268 DELETE FROM t2 WHERE ii=1; 269 SELECT * FROM t2 ORDER BY ii; 270 } 271} {3 50 60} 272do_test rtree-5.1.5 { 273 execsql { 274 DELETE FROM t2 WHERE ii=3; 275 SELECT * FROM t2 ORDER BY ii; 276 } 277} {} 278do_test rtree-5.1.6 { 279 execsql { SELECT * FROM t2_rowid } 280} {} 281 282#---------------------------------------------------------------------------- 283# Test cases rtree-5.* test UPDATE operations. 284# 285do_test rtree-6.1.1 { 286 execsql { CREATE VIRTUAL TABLE t3 USING rtree(ii, x1, x2, y1, y2) } 287} {} 288do_test rtree-6.1.2 { 289 execsql_intout { 290 INSERT INTO t3 VALUES(1, 2, 3, 4, 5); 291 UPDATE t3 SET x2=5; 292 SELECT * FROM t3; 293 } 294} {1 2 5 4 5} 295do_test rtree-6.1.3 { 296 execsql { UPDATE t3 SET ii = 2 } 297 execsql_intout { SELECT * FROM t3 } 298} {2 2 5 4 5} 299 300#---------------------------------------------------------------------------- 301# Test cases rtree-7.* test rename operations. 302# 303do_test rtree-7.1.1 { 304 execsql { 305 CREATE VIRTUAL TABLE t4 USING rtree(ii, x1, x2, y1, y2, z1, z2); 306 INSERT INTO t4 VALUES(1, 2, 3, 4, 5, 6, 7); 307 } 308} {} 309do_test rtree-7.1.2 { 310 execsql { ALTER TABLE t4 RENAME TO t5 } 311 execsql_intout { SELECT * FROM t5 } 312} {1 2 3 4 5 6 7} 313do_test rtree-7.1.3 { 314 db close 315 sqlite3 db test.db 316 execsql_intout { SELECT * FROM t5 } 317} {1 2 3 4 5 6 7} 318do_test rtree-7.1.4 { 319 execsql { ALTER TABLE t5 RENAME TO 'raisara "one"'''} 320 execsql_intout { SELECT * FROM "raisara ""one""'" } 321} {1 2 3 4 5 6 7} 322do_test rtree-7.1.5 { 323 execsql_intout { SELECT * FROM 'raisara "one"''' } 324} {1 2 3 4 5 6 7} 325do_test rtree-7.1.6 { 326 execsql { ALTER TABLE "raisara ""one""'" RENAME TO "abc 123" } 327 execsql_intout { SELECT * FROM "abc 123" } 328} {1 2 3 4 5 6 7} 329do_test rtree-7.1.7 { 330 db close 331 sqlite3 db test.db 332 execsql_intout { SELECT * FROM "abc 123" } 333} {1 2 3 4 5 6 7} 334 335# An error midway through a rename operation. 336do_test rtree-7.2.1 { 337 execsql { 338 CREATE TABLE t4_node(a); 339 } 340 catchsql { ALTER TABLE "abc 123" RENAME TO t4 } 341} {1 {SQL logic error}} 342do_test rtree-7.2.2 { 343 execsql_intout { SELECT * FROM "abc 123" } 344} {1 2 3 4 5 6 7} 345do_test rtree-7.2.3 { 346 execsql { 347 DROP TABLE t4_node; 348 CREATE TABLE t4_rowid(a); 349 } 350 catchsql { ALTER TABLE "abc 123" RENAME TO t4 } 351} {1 {SQL logic error}} 352do_test rtree-7.2.4 { 353 db close 354 sqlite3 db test.db 355 execsql_intout { SELECT * FROM "abc 123" } 356} {1 2 3 4 5 6 7} 357do_test rtree-7.2.5 { 358 execsql { DROP TABLE t4_rowid } 359 execsql { ALTER TABLE "abc 123" RENAME TO t4 } 360 execsql_intout { SELECT * FROM t4 } 361} {1 2 3 4 5 6 7} 362 363 364#---------------------------------------------------------------------------- 365# Test cases rtree-8.* 366# 367 368# Test that the function to determine if a leaf cell is part of the 369# result set works. 370do_test rtree-8.1.1 { 371 execsql { 372 CREATE VIRTUAL TABLE t6 USING rtree(ii, x1, x2); 373 INSERT INTO t6 VALUES(1, 3, 7); 374 INSERT INTO t6 VALUES(2, 4, 6); 375 } 376} {} 377do_test rtree-8.1.2 { execsql { SELECT ii FROM t6 WHERE x1>2 } } {1 2} 378do_test rtree-8.1.3 { execsql { SELECT ii FROM t6 WHERE x1>3 } } {2} 379do_test rtree-8.1.4 { execsql { SELECT ii FROM t6 WHERE x1>4 } } {} 380do_test rtree-8.1.5 { execsql { SELECT ii FROM t6 WHERE x1>5 } } {} 381do_test rtree-8.1.6 { execsql { SELECT ii FROM t6 WHERE x1<3 } } {} 382do_test rtree-8.1.7 { execsql { SELECT ii FROM t6 WHERE x1<4 } } {1} 383do_test rtree-8.1.8 { execsql { SELECT ii FROM t6 WHERE x1<5 } } {1 2} 384 385#---------------------------------------------------------------------------- 386# Test cases rtree-9.* 387# 388# Test that ticket #3549 is fixed. 389do_test rtree-9.1 { 390 execsql { 391 CREATE TABLE foo (id INTEGER PRIMARY KEY); 392 CREATE VIRTUAL TABLE bar USING rtree (id, minX, maxX, minY, maxY); 393 INSERT INTO foo VALUES (null); 394 INSERT INTO foo SELECT null FROM foo; 395 INSERT INTO foo SELECT null FROM foo; 396 INSERT INTO foo SELECT null FROM foo; 397 INSERT INTO foo SELECT null FROM foo; 398 INSERT INTO foo SELECT null FROM foo; 399 INSERT INTO foo SELECT null FROM foo; 400 DELETE FROM foo WHERE id > 40; 401 INSERT INTO bar SELECT NULL, 0, 0, 0, 0 FROM foo; 402 } 403} {} 404 405# This used to crash. 406do_test rtree-9.2 { 407 execsql { 408 SELECT count(*) FROM bar b1, bar b2, foo s1 WHERE s1.id = b1.id; 409 } 410} {1600} 411do_test rtree-9.3 { 412 execsql { 413 SELECT count(*) FROM bar b1, bar b2, foo s1 414 WHERE b1.minX <= b2.maxX AND s1.id = b1.id; 415 } 416} {1600} 417 418#------------------------------------------------------------------------- 419# Ticket #3970: Check that the error message is meaningful when a 420# keyword is used as a column name. 421# 422do_test rtree-10.1 { 423 catchsql { CREATE VIRTUAL TABLE t7 USING rtree(index, x1, y1, x2, y2) } 424} {1 {near "index": syntax error}} 425 426#------------------------------------------------------------------------- 427# Test last_insert_rowid(). 428# 429do_test rtree-11.1 { 430 execsql { 431 CREATE VIRTUAL TABLE t8 USING rtree(idx, x1, x2, y1, y2); 432 INSERT INTO t8 VALUES(1, 1.0, 1.0, 2.0, 2.0); 433 SELECT last_insert_rowid(); 434 } 435} {1} 436do_test rtree-11.2 { 437 execsql { 438 INSERT INTO t8 VALUES(NULL, 1.0, 1.0, 2.0, 2.0); 439 SELECT last_insert_rowid(); 440 } 441} {2} 442 443#------------------------------------------------------------------------- 444# Test on-conflict clause handling. 445# 446db_delete_and_reopen 447do_execsql_test 12.0.1 { 448 CREATE VIRTUAL TABLE t1 USING rtree_i32(idx, x1, x2, y1, y2); 449 INSERT INTO t1 VALUES(1, 1, 2, 3, 4); 450 SELECT substr(hex(data),1,56) FROM t1_node; 451} {00000001000000000000000100000001000000020000000300000004} 452do_execsql_test 12.0.2 { 453 INSERT INTO t1 VALUES(2, 2, 3, 4, 5); 454 INSERT INTO t1 VALUES(3, 3, 4, 5, 6); 455 456 CREATE TABLE source(idx, x1, x2, y1, y2); 457 INSERT INTO source VALUES(5, 8, 8, 8, 8); 458 INSERT INTO source VALUES(2, 7, 7, 7, 7); 459} 460db_save_and_close 461foreach {tn sql_template testdata} { 462 1 "INSERT %CONF% INTO t1 VALUES(2, 7, 7, 7, 7)" { 463 ROLLBACK 0 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6} 464 ABORT 0 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 465 IGNORE 0 0 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 466 FAIL 0 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 467 REPLACE 0 0 {1 1 2 3 4 2 7 7 7 7 3 3 4 5 6 4 4 5 6 7} 468 } 469 470 2 "INSERT %CONF% INTO t1 SELECT * FROM source" { 471 ROLLBACK 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6} 472 ABORT 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 473 IGNORE 1 0 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7 5 8 8 8 8} 474 FAIL 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7 5 8 8 8 8} 475 REPLACE 1 0 {1 1 2 3 4 2 7 7 7 7 3 3 4 5 6 4 4 5 6 7 5 8 8 8 8} 476 } 477 478 3 "UPDATE %CONF% t1 SET idx = 2 WHERE idx = 4" { 479 ROLLBACK 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6} 480 ABORT 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 481 IGNORE 1 0 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 482 FAIL 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 483 REPLACE 1 0 {1 1 2 3 4 2 4 5 6 7 3 3 4 5 6} 484 } 485 486 3 "UPDATE %CONF% t1 SET idx = ((idx+1)%5)+1 WHERE idx > 2" { 487 ROLLBACK 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6} 488 ABORT 1 1 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 489 IGNORE 1 0 {1 1 2 3 4 2 2 3 4 5 4 4 5 6 7 5 3 4 5 6} 490 FAIL 1 1 {1 1 2 3 4 2 2 3 4 5 4 4 5 6 7 5 3 4 5 6} 491 REPLACE 1 0 {1 4 5 6 7 2 2 3 4 5 5 3 4 5 6} 492 } 493 494 4 "INSERT %CONF% INTO t1 VALUES(2, 7, 6, 7, 7)" { 495 ROLLBACK 0 2 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6} 496 ABORT 0 2 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 497 IGNORE 0 0 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 498 FAIL 0 2 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 499 REPLACE 0 2 {1 1 2 3 4 2 2 3 4 5 3 3 4 5 6 4 4 5 6 7} 500 } 501 502} { 503 foreach {mode uses error data} $testdata { 504 db_restore_and_reopen 505 506 set sql [string map [list %CONF% "OR $mode"] $sql_template] 507 set testname "12.$tn.[string tolower $mode]" 508 509 execsql { 510 BEGIN; 511 INSERT INTO t1 VALUES(4, 4, 5, 6, 7); 512 } 513 514 set res(0) {0 {}} 515 set res(1) {1 {UNIQUE constraint failed: t1.idx}} 516 set res(2) {1 {rtree constraint failed: t1.(x1<=x2)}} 517 518 do_catchsql_test $testname.1 $sql $res($error) 519 do_test $testname.2 [list sql_uses_stmt db $sql] $uses 520 do_execsql_test $testname.3 { SELECT * FROM t1 ORDER BY idx } $data 521 522 do_test $testname.4 { rtree_check db t1 } 0 523 db close 524 } 525} 526 527#------------------------------------------------------------------------- 528# Test that bug [d2889096e7bdeac6d] has been fixed. 529# 530reset_db 531do_execsql_test 13.1 { 532 CREATE VIRTUAL TABLE t9 USING rtree(id, xmin, xmax); 533 INSERT INTO t9 VALUES(1,0,0); 534 INSERT INTO t9 VALUES(2,0,0); 535 SELECT * FROM t9 WHERE id IN (1, 2); 536} {1 0.0 0.0 2 0.0 0.0} 537 538do_execsql_test 13.2 { 539 WITH r(x) AS ( 540 SELECT 1 UNION ALL 541 SELECT 2 UNION ALL 542 SELECT 3 543 ) 544 SELECT * FROM r CROSS JOIN t9 WHERE id=x; 545} {1 1 0.0 0.0 2 2 0.0 0.0} 546 547#------------------------------------------------------------------------- 548# Test if a non-integer is inserted into the PK column of an r-tree 549# table, it is converted to an integer before being inserted. Also 550# that if a non-numeric is inserted into one of the min/max dimension 551# columns, it is converted to the required type before being inserted. 552# 553do_execsql_test 14.1 { 554 CREATE VIRTUAL TABLE t10 USING rtree(ii, x1, x2); 555} 556 557do_execsql_test 14.2 { 558 INSERT INTO t10 VALUES(NULL, 1, 2); 559 INSERT INTO t10 VALUES(NULL, 2, 3); 560 INSERT INTO t10 VALUES('4xxx', 3, 4); 561 INSERT INTO t10 VALUES(5.0, 4, 5); 562 INSERT INTO t10 VALUES(6.4, 5, 6); 563} 564do_execsql_test 14.3 { 565 SELECT * FROM t10; 566} { 567 1 1.0 2.0 2 2.0 3.0 4 3.0 4.0 5 4.0 5.0 6 5.0 6.0 568} 569 570do_execsql_test 14.4 { 571 DELETE FROM t10; 572 INSERT INTO t10 VALUES(1, 'one', 'two'); 573 INSERT INTO t10 VALUES(2, '52xyz', '81...'); 574} 575do_execsql_test 14.5 { 576 SELECT * FROM t10; 577} { 578 1 0.0 0.0 579 2 52.0 81.0 580} 581 582do_execsql_test 14.4 { 583 DROP TABLE t10; 584 CREATE VIRTUAL TABLE t10 USING rtree_i32(ii, x1, x2); 585 INSERT INTO t10 VALUES(1, 'one', 'two'); 586 INSERT INTO t10 VALUES(2, '52xyz', '81...'); 587 INSERT INTO t10 VALUES(3, 42.3, 49.9); 588} 589do_execsql_test 14.5 { 590 SELECT * FROM t10; 591} { 592 1 0 0 593 2 52 81 594 3 42 49 595} 596 597#------------------------------------------------------------------------- 598# 599do_execsql_test 15.0 { 600 CREATE VIRTUAL TABLE rt USING rtree(id, x1,x2, y1,y2); 601 CREATE TEMP TABLE t13(a, b, c); 602} 603do_execsql_test 15.1 { 604 BEGIN; 605 INSERT INTO rt VALUES(1,2,3,4,5); 606} 607do_execsql_test 15.2 { 608 DROP TABLE t13; 609 COMMIT; 610} 611 612finish_test 613