3 # May you do good and not evil.
4 # May you find forgiveness for yourself and forgive others.
5 # May you share freely, never taking more than you give.
7 #***********************************************************************
9 # The tests in this file test edge cases surrounding DROP TABLE on
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
16 ifcapable !vtab { finish_test ; return }
17 source $testdir/fts3_common.tcl
18 source $testdir/malloc_common.tcl
20 set testprefix vtabdrop
22 #-------------------------------------------------------------------------
23 # Test that if a DROP TABLE is executed against an rtree table, but the
24 # xDestroy() call fails, the rtree table is not dropped, the sqlite_master
25 # table is not modified and the internal schema remains intact.
29 CREATE VIRTUAL TABLE rt USING rtree(id, x1, x2);
30 CREATE TABLE t1(x, y);
31 INSERT INTO t1 VALUES(1, 2);
37 INSERT INTO t1 VALUES(3, 4);
39 db eval { SELECT * FROM t1 } {
40 catchsql { DROP TABLE rt }
46 SELECT name FROM sqlite_master ORDER BY 1;
49 } {rt rt_node rt_parent rt_rowid t1 1 2 3 4}
55 SELECT name FROM sqlite_master ORDER BY 1;
56 } {rt rt_node rt_parent rt_rowid t1}
59 #-------------------------------------------------------------------------
60 # Same as tests 1.*, except with fts5 instead of rtree.
65 CREATE VIRTUAL TABLE ft USING fts5(x);
66 CREATE TABLE t1(x, y);
67 INSERT INTO t1 VALUES(1, 2);
73 INSERT INTO t1 VALUES(3, 4);
75 db eval { SELECT * FROM t1 } {
76 catchsql { DROP TABLE ft }
82 SELECT name FROM sqlite_master ORDER BY 1;
83 } {ft ft_config ft_content ft_data ft_docsize ft_idx t1}
89 SELECT name FROM sqlite_master ORDER BY 1;
90 } {ft ft_config ft_content ft_data ft_docsize ft_idx t1}
93 #-------------------------------------------------------------------------
94 # Same as tests 1.*, except with fts3 instead of rtree.
99 CREATE VIRTUAL TABLE ft USING fts3(x);
100 CREATE TABLE t1(x, y);
101 INSERT INTO t1 VALUES(1, 2);
107 INSERT INTO t1 VALUES(3, 4);
109 db eval { SELECT * FROM t1 } {
110 catchsql { DROP TABLE ft }
115 do_execsql_test 2.2 {
116 SELECT name FROM sqlite_master ORDER BY 1;
117 } {ft ft_content ft_segdir ft_segments sqlite_autoindex_ft_segdir_1 t1}
122 do_execsql_test 2.3 {
123 SELECT name FROM sqlite_master ORDER BY 1;
124 } {ft ft_content ft_segdir ft_segments sqlite_autoindex_ft_segdir_1 t1}