Chromium Code Reviews

Side by Side Diff: third_party/sqlite/src/test/vtab_shared.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « third_party/sqlite/src/test/vtabF.test ('k') | third_party/sqlite/src/test/wal.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2007 April 16 1 # 2007 April 16
2 # 2 #
3 # The author disclaims copyright to this source code. In place of 3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing: 4 # a legal notice, here is a blessing:
5 # 5 #
6 # May you do good and not evil. 6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others. 7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give. 8 # May you share freely, never taking more than you give.
9 # 9 #
10 #*********************************************************************** 10 #***********************************************************************
11 # This file tests interactions between the virtual table and 11 # This file tests interactions between the virtual table and
12 # shared-schema functionality. 12 # shared-schema functionality.
13 # 13 #
14 # $Id: vtab_shared.test,v 1.3 2009/07/24 17:58:53 danielk1977 Exp $ 14 # $Id: vtab_shared.test,v 1.3 2009/07/24 17:58:53 danielk1977 Exp $
15 15
16 set testdir [file dirname $argv0] 16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl 17 source $testdir/tester.tcl
18 set testprefix vtab_shared
18 19
19 ifcapable !vtab||!shared_cache { 20 ifcapable !vtab||!shared_cache {
20 finish_test 21 finish_test
21 return 22 return
22 } 23 }
23 24
24 db close 25 db close
25 sqlite3_enable_shared_cache 1 26 sqlite3_enable_shared_cache 1
26 sqlite3 db test.db 27 sqlite3 db test.db
27 sqlite3 db2 test.db 28 sqlite3 db2 test.db
(...skipping 81 matching lines...)
109 # 110 #
110 do_test vtab_shared-1.10 { 111 do_test vtab_shared-1.10 {
111 db eval { SELECT * FROM t1 } { 112 db eval { SELECT * FROM t1 } {
112 set error [catchsql { DROP TABLE t1 } db2] 113 set error [catchsql { DROP TABLE t1 } db2]
113 break 114 break
114 } 115 }
115 set error 116 set error
116 } {1 {database table is locked: sqlite_master}} 117 } {1 {database table is locked: sqlite_master}}
117 118
118 do_test vtab_shared-1.11 { 119 do_test vtab_shared-1.11 {
119 breakpoint
120 execsql { 120 execsql {
121 CREATE VIRTUAL TABLE t2 USING echo(t0); 121 CREATE VIRTUAL TABLE t2 USING echo(t0);
122 CREATE VIRTUAL TABLE t3 USING echo(t0); 122 CREATE VIRTUAL TABLE t3 USING echo(t0);
123 } 123 }
124 execsql { SELECT * FROM t3 } db2 124 execsql { SELECT * FROM t3 } db2
125 } {1 2 3 4 5 6} 125 } {1 2 3 4 5 6}
126 126
127 do_test vtab_shared-1.12.1 { 127 ifcapable compound {
128 db close 128 do_test vtab_shared-1.12.1 {
129 execsql { 129 db close
130 SELECT * FROM t1 UNION ALL 130 execsql {
131 SELECT * FROM t2 UNION ALL 131 SELECT * FROM t1 UNION ALL
132 SELECT * FROM t3 132 SELECT * FROM t2 UNION ALL
133 } db2 133 SELECT * FROM t3
134 } {1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6} 134 } db2
135 do_test vtab_shared-1.12.2 { 135 } {1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6}
136 sqlite3 db test.db 136 do_test vtab_shared-1.12.2 {
137 register_echo_module [sqlite3_connection_pointer db] 137 sqlite3 db test.db
138 execsql { 138 register_echo_module [sqlite3_connection_pointer db]
139 SELECT * FROM t1 UNION ALL 139 execsql {
140 SELECT * FROM t2 UNION ALL 140 SELECT * FROM t1 UNION ALL
141 SELECT * FROM t3 141 SELECT * FROM t2 UNION ALL
142 } db 142 SELECT * FROM t3
143 } {1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6} 143 } db
144 } {1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6}
145 }
144 146
145 # Try a rename or two. 147 # Try a rename or two.
146 # 148 #
147 ifcapable altertable { 149 ifcapable altertable {
148 do_test vtab_shared-1.13.1 { 150 do_test vtab_shared-1.13.1 {
149 execsql { ALTER TABLE t1 RENAME TO t4 } 151 execsql { ALTER TABLE t1 RENAME TO t4 }
150 execsql { SELECT * FROM t4 } db 152 execsql { SELECT * FROM t4 } db
151 } {1 2 3 4 5 6} 153 } {1 2 3 4 5 6}
152 do_test vtab_shared-1.13.2 { 154 do_test vtab_shared-1.13.2 {
153 execsql { SELECT * FROM t4 } db2 155 execsql { SELECT * FROM t4 } db2
(...skipping 66 matching lines...)
220 sqlite3 db2 test.db 222 sqlite3 db2 test.db
221 register_echo_module [sqlite3_connection_pointer db2] 223 register_echo_module [sqlite3_connection_pointer db2]
222 execsql { 224 execsql {
223 INSERT INTO t3 VALUES(4, 5, 6); 225 INSERT INTO t3 VALUES(4, 5, 6);
224 SELECT * FROM t3; 226 SELECT * FROM t3;
225 } 227 }
226 } {1 2 3 4 5 6} 228 } {1 2 3 4 5 6}
227 229
228 db close 230 db close
229 db2 close 231 db2 close
232
233 #---------------------------------------------------------------
234 # Test calling sqlite3_close() with vtabs on the disconnect list.
235 #
236 ifcapable rtree {
237 reset_db
238 do_test 2.1.1 {
239 sqlite3 db test.db
240 sqlite3 db2 test.db
241
242 # Create a virtual table using [db].
243 execsql {
244 CREATE VIRTUAL TABLE rt USING rtree(id, x1, x2);
245 INSERT INTO rt VALUES(1, 2 ,3);
246 SELECT * FROM rt;
247 }
248
249 # Drop the virtual table using [db2]. The sqlite3_vtab object belonging
250 # to [db] is moved to the sqlite3.pDisconnect list.
251 execsql { DROP TABLE rt } db2
252
253 # Immediately close [db]. At one point this would fail due to the
254 # unfinalized statements held by the un-xDisconnect()ed sqlite3_vtab.
255 db close
256 } {}
257 db2 close
258 }
259
260 ifcapable fts3 {
261 # Same test as above, except using fts3 instead of rtree.
262 reset_db
263 do_test 2.2.1 {
264 sqlite3 db test.db
265 sqlite3 db2 test.db
266 execsql {
267 CREATE VIRTUAL TABLE ft USING fts3;
268 INSERT INTO ft VALUES('hello world');
269 SELECT * FROM ft;
270 }
271 execsql { DROP TABLE ft } db2
272 db close
273 } {}
274 db2 close
275 }
276
230 sqlite3_enable_shared_cache 0 277 sqlite3_enable_shared_cache 0
231 finish_test 278 finish_test
279
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/vtabF.test ('k') | third_party/sqlite/src/test/wal.test » ('j') | no next file with comments »

Powered by Google App Engine