Index: third_party/sqlite/src/test/vtab_shared.test |
diff --git a/third_party/sqlite/src/test/vtab_shared.test b/third_party/sqlite/src/test/vtab_shared.test |
index ce2e432fcfa23d858f8e81e0c95473bd566cbdd2..34739929001eeeabe5bf236763b6c05aa0c1d2d2 100644 |
--- a/third_party/sqlite/src/test/vtab_shared.test |
+++ b/third_party/sqlite/src/test/vtab_shared.test |
@@ -15,6 +15,7 @@ |
set testdir [file dirname $argv0] |
source $testdir/tester.tcl |
+set testprefix vtab_shared |
ifcapable !vtab||!shared_cache { |
finish_test |
@@ -116,7 +117,6 @@ do_test vtab_shared-1.10 { |
} {1 {database table is locked: sqlite_master}} |
do_test vtab_shared-1.11 { |
-breakpoint |
execsql { |
CREATE VIRTUAL TABLE t2 USING echo(t0); |
CREATE VIRTUAL TABLE t3 USING echo(t0); |
@@ -124,23 +124,25 @@ breakpoint |
execsql { SELECT * FROM t3 } db2 |
} {1 2 3 4 5 6} |
-do_test vtab_shared-1.12.1 { |
- db close |
- execsql { |
- SELECT * FROM t1 UNION ALL |
- SELECT * FROM t2 UNION ALL |
- SELECT * FROM t3 |
- } db2 |
-} {1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6} |
-do_test vtab_shared-1.12.2 { |
- sqlite3 db test.db |
- register_echo_module [sqlite3_connection_pointer db] |
- execsql { |
- SELECT * FROM t1 UNION ALL |
- SELECT * FROM t2 UNION ALL |
- SELECT * FROM t3 |
- } db |
-} {1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6} |
+ifcapable compound { |
+ do_test vtab_shared-1.12.1 { |
+ db close |
+ execsql { |
+ SELECT * FROM t1 UNION ALL |
+ SELECT * FROM t2 UNION ALL |
+ SELECT * FROM t3 |
+ } db2 |
+ } {1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6} |
+ do_test vtab_shared-1.12.2 { |
+ sqlite3 db test.db |
+ register_echo_module [sqlite3_connection_pointer db] |
+ execsql { |
+ SELECT * FROM t1 UNION ALL |
+ SELECT * FROM t2 UNION ALL |
+ SELECT * FROM t3 |
+ } db |
+ } {1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6} |
+} |
# Try a rename or two. |
# |
@@ -227,5 +229,51 @@ do_test vtab_shared_1.15.3 { |
db close |
db2 close |
+ |
+#--------------------------------------------------------------- |
+# Test calling sqlite3_close() with vtabs on the disconnect list. |
+# |
+ifcapable rtree { |
+ reset_db |
+ do_test 2.1.1 { |
+ sqlite3 db test.db |
+ sqlite3 db2 test.db |
+ |
+ # Create a virtual table using [db]. |
+ execsql { |
+ CREATE VIRTUAL TABLE rt USING rtree(id, x1, x2); |
+ INSERT INTO rt VALUES(1, 2 ,3); |
+ SELECT * FROM rt; |
+ } |
+ |
+ # Drop the virtual table using [db2]. The sqlite3_vtab object belonging |
+ # to [db] is moved to the sqlite3.pDisconnect list. |
+ execsql { DROP TABLE rt } db2 |
+ |
+ # Immediately close [db]. At one point this would fail due to the |
+ # unfinalized statements held by the un-xDisconnect()ed sqlite3_vtab. |
+ db close |
+ } {} |
+ db2 close |
+} |
+ |
+ifcapable fts3 { |
+ # Same test as above, except using fts3 instead of rtree. |
+ reset_db |
+ do_test 2.2.1 { |
+ sqlite3 db test.db |
+ sqlite3 db2 test.db |
+ execsql { |
+ CREATE VIRTUAL TABLE ft USING fts3; |
+ INSERT INTO ft VALUES('hello world'); |
+ SELECT * FROM ft; |
+ } |
+ execsql { DROP TABLE ft } db2 |
+ db close |
+ } {} |
+ db2 close |
+} |
+ |
sqlite3_enable_shared_cache 0 |
finish_test |
+ |