OLD | NEW |
1 # 2001 September 15 | 1 # 2001 September 15 |
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 #*********************************************************************** |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 integrity_check vacuum-2.11 | 201 integrity_check vacuum-2.11 |
202 db3 close | 202 db3 close |
203 | 203 |
204 | 204 |
205 # Ticket #427. Make sure VACUUM works when the EMPTY_RESULT_CALLBACKS | 205 # Ticket #427. Make sure VACUUM works when the EMPTY_RESULT_CALLBACKS |
206 # pragma is turned on. | 206 # pragma is turned on. |
207 # | 207 # |
208 do_test vacuum-3.1 { | 208 do_test vacuum-3.1 { |
209 db close | 209 db close |
210 db2 close | 210 db2 close |
211 file delete test.db | 211 delete_file test.db |
212 sqlite3 db test.db | 212 sqlite3 db test.db |
213 execsql { | 213 execsql { |
214 PRAGMA empty_result_callbacks=on; | 214 PRAGMA empty_result_callbacks=on; |
215 VACUUM; | 215 VACUUM; |
216 } | 216 } |
217 } {} | 217 } {} |
218 | 218 |
219 # Ticket #464. Make sure VACUUM works with the sqlite3_prepare() API. | 219 # Ticket #464. Make sure VACUUM works with the sqlite3_prepare() API. |
220 # | 220 # |
221 do_test vacuum-4.1 { | 221 do_test vacuum-4.1 { |
222 db close | 222 db close |
223 sqlite3 db test.db; set DB [sqlite3_connection_pointer db] | 223 sqlite3 db test.db; set DB [sqlite3_connection_pointer db] |
224 set VM [sqlite3_prepare $DB {VACUUM} -1 TAIL] | 224 set VM [sqlite3_prepare $DB {VACUUM} -1 TAIL] |
225 sqlite3_step $VM | 225 sqlite3_step $VM |
226 } {SQLITE_DONE} | 226 } {SQLITE_DONE} |
227 do_test vacuum-4.2 { | 227 do_test vacuum-4.2 { |
228 sqlite3_finalize $VM | 228 sqlite3_finalize $VM |
229 } SQLITE_OK | 229 } SQLITE_OK |
230 | 230 |
231 # Ticket #515. VACUUM after deleting and recreating the table that | 231 # Ticket #515. VACUUM after deleting and recreating the table that |
232 # a view refers to. Omit this test if the library is not view-enabled. | 232 # a view refers to. Omit this test if the library is not view-enabled. |
233 # | 233 # |
234 ifcapable view { | 234 ifcapable view { |
235 do_test vacuum-5.1 { | 235 do_test vacuum-5.1 { |
236 db close | 236 db close |
237 file delete -force test.db | 237 forcedelete test.db |
238 sqlite3 db test.db | 238 sqlite3 db test.db |
239 catchsql { | 239 catchsql { |
240 CREATE TABLE Test (TestID int primary key); | 240 CREATE TABLE Test (TestID int primary key); |
241 INSERT INTO Test VALUES (NULL); | 241 INSERT INTO Test VALUES (NULL); |
242 CREATE VIEW viewTest AS SELECT * FROM Test; | 242 CREATE VIEW viewTest AS SELECT * FROM Test; |
243 | 243 |
244 BEGIN; | 244 BEGIN; |
245 CREATE TABLE tempTest (TestID int primary key, Test2 int NULL); | 245 CREATE TABLE tempTest (TestID int primary key, Test2 int NULL); |
246 INSERT INTO tempTest SELECT TestID, 1 FROM Test; | 246 INSERT INTO tempTest SELECT TestID, 1 FROM Test; |
247 DROP TABLE Test; | 247 DROP TABLE Test; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } | 283 } |
284 } {} | 284 } {} |
285 do_test vacuum-6.4 { | 285 do_test vacuum-6.4 { |
286 execsql { | 286 execsql { |
287 select count(*) from "abc abc" WHERE a = X'00112233'; | 287 select count(*) from "abc abc" WHERE a = X'00112233'; |
288 } | 288 } |
289 } {1} | 289 } {1} |
290 } | 290 } |
291 | 291 |
292 # Check what happens when an in-memory database is vacuumed. The | 292 # Check what happens when an in-memory database is vacuumed. The |
293 # [file delete] command covers us in case the library was compiled | 293 # [delete_file] command covers us in case the library was compiled |
294 # without in-memory database support. | 294 # without in-memory database support. |
295 # | 295 # |
296 file delete -force :memory: | 296 forcedelete :memory: |
297 do_test vacuum-7.0 { | 297 do_test vacuum-7.0 { |
298 sqlite3 db2 :memory: | 298 sqlite3 db2 :memory: |
299 execsql { | 299 execsql { |
300 CREATE TABLE t1(t); | 300 CREATE TABLE t1(t); |
301 VACUUM; | 301 VACUUM; |
302 } db2 | 302 } db2 |
303 } {} | 303 } {} |
304 do_test vacuum-7.1 { | 304 do_test vacuum-7.1 { |
305 execsql { | 305 execsql { |
306 CREATE TABLE t2(t); | 306 CREATE TABLE t2(t); |
(...skipping 23 matching lines...) Expand all Loading... |
330 execsql { PRAGMA auto_vacuum = 1} db2 | 330 execsql { PRAGMA auto_vacuum = 1} db2 |
331 execsql { VACUUM } db2 | 331 execsql { VACUUM } db2 |
332 execsql { PRAGMA auto_vacuum } db2 | 332 execsql { PRAGMA auto_vacuum } db2 |
333 } {1} | 333 } {1} |
334 } | 334 } |
335 db2 close | 335 db2 close |
336 | 336 |
337 # Ticket #873. VACUUM a database that has ' in its name. | 337 # Ticket #873. VACUUM a database that has ' in its name. |
338 # | 338 # |
339 do_test vacuum-8.1 { | 339 do_test vacuum-8.1 { |
340 file delete -force a'z.db | 340 forcedelete a'z.db |
341 file delete -force a'z.db-journal | 341 forcedelete a'z.db-journal |
342 sqlite3 db2 a'z.db | 342 sqlite3 db2 a'z.db |
343 execsql { | 343 execsql { |
344 CREATE TABLE t1(t); | 344 CREATE TABLE t1(t); |
345 VACUUM; | 345 VACUUM; |
346 } db2 | 346 } db2 |
347 } {} | 347 } {} |
348 db2 close | 348 db2 close |
349 | 349 |
350 # Ticket #1095: Vacuum a table that uses AUTOINCREMENT | 350 # Ticket #1095: Vacuum a table that uses AUTOINCREMENT |
351 # | 351 # |
(...skipping 24 matching lines...) Expand all Loading... |
376 expr {$::cksum!=""} | 376 expr {$::cksum!=""} |
377 } {1} | 377 } {1} |
378 do_test vacuum-9.4 { | 378 do_test vacuum-9.4 { |
379 execsql { | 379 execsql { |
380 VACUUM; | 380 VACUUM; |
381 } | 381 } |
382 cksum | 382 cksum |
383 } $::cksum | 383 } $::cksum |
384 } | 384 } |
385 | 385 |
386 file delete -force {a'z.db} | 386 forcedelete {a'z.db} |
| 387 |
| 388 # Test that "PRAGMA count_changes" does not interfere with VACUUM or cause |
| 389 # it to return any rows to the user. |
| 390 # |
| 391 do_test vacuum-10.1 { |
| 392 db close |
| 393 forcedelete test.db |
| 394 sqlite3 db test.db |
| 395 execsql { |
| 396 CREATE TABLE t8(a, b); |
| 397 INSERT INTO t8 VALUES('a', 'b'); |
| 398 INSERT INTO t8 VALUES('c', 'd'); |
| 399 PRAGMA count_changes = 1; |
| 400 } |
| 401 } {} |
| 402 do_test vacuum-10.2 { execsql VACUUM } {} |
387 | 403 |
388 finish_test | 404 finish_test |
OLD | NEW |