| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 47     CREATE INDEX i1 ON t1(b,c); | 47     CREATE INDEX i1 ON t1(b,c); | 
| 48     CREATE UNIQUE INDEX i2 ON t1(c,a); | 48     CREATE UNIQUE INDEX i2 ON t1(c,a); | 
| 49     CREATE TABLE t2 AS SELECT * FROM t1; | 49     CREATE TABLE t2 AS SELECT * FROM t1; | 
| 50     COMMIT; | 50     COMMIT; | 
| 51     DROP TABLE t2; | 51     DROP TABLE t2; | 
| 52   } | 52   } | 
| 53   set ::size1 [file size test.db] | 53   set ::size1 [file size test.db] | 
| 54   set ::cksum [cksum] | 54   set ::cksum [cksum] | 
| 55   expr {$::cksum!=""} | 55   expr {$::cksum!=""} | 
| 56 } {1} | 56 } {1} | 
|  | 57 | 
|  | 58 # Create bogus application-defined functions for functions used | 
|  | 59 # internally by VACUUM, to ensure that VACUUM falls back | 
|  | 60 # to the built-in functions. | 
|  | 61 # | 
|  | 62 proc failing_app_func {args} {error "bad function"} | 
|  | 63 do_test vacuum-1.1b { | 
|  | 64   db func substr failing_app_func | 
|  | 65   db func like failing_app_func | 
|  | 66   db func quote failing_app_func | 
|  | 67   catchsql {SELECT substr(name,1,3) FROM sqlite_master} | 
|  | 68 } {1 {bad function}} | 
|  | 69 | 
| 57 do_test vacuum-1.2 { | 70 do_test vacuum-1.2 { | 
| 58   execsql { | 71   execsql { | 
| 59     VACUUM; | 72     VACUUM; | 
| 60   } | 73   } | 
| 61   cksum | 74   cksum | 
| 62 } $cksum | 75 } $cksum | 
| 63 ifcapable vacuum { | 76 ifcapable vacuum { | 
| 64   do_test vacuum-1.3 { | 77   do_test vacuum-1.3 { | 
| 65     expr {[file size test.db]<$::size1} | 78     expr {[file size test.db]<$::size1} | 
| 66   } {1} | 79   } {1} | 
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 280 # [file delete] command covers us in case the library was compiled | 293 # [file delete] command covers us in case the library was compiled | 
| 281 # without in-memory database support. | 294 # without in-memory database support. | 
| 282 # | 295 # | 
| 283 file delete -force :memory: | 296 file delete -force :memory: | 
| 284 do_test vacuum-7.0 { | 297 do_test vacuum-7.0 { | 
| 285   sqlite3 db2 :memory: | 298   sqlite3 db2 :memory: | 
| 286   execsql { | 299   execsql { | 
| 287     CREATE TABLE t1(t); | 300     CREATE TABLE t1(t); | 
| 288     VACUUM; | 301     VACUUM; | 
| 289   } db2 | 302   } db2 | 
|  | 303 } {} | 
|  | 304 do_test vacuum-7.1 { | 
| 290   execsql { | 305   execsql { | 
| 291     CREATE TABLE t2(t); | 306     CREATE TABLE t2(t); | 
| 292     CREATE TABLE t3(t); | 307     CREATE TABLE t3(t); | 
| 293     DROP TABLE t2; | 308     DROP TABLE t2; | 
|  | 309     PRAGMA freelist_count; | 
|  | 310   } | 
|  | 311 } {1} | 
|  | 312 do_test vacuum-7.2 { | 
|  | 313   execsql { | 
| 294     VACUUM; | 314     VACUUM; | 
| 295     pragma integrity_check; | 315     pragma integrity_check; | 
| 296   } db2 | 316   } db2 | 
| 297 } {ok} | 317 } {ok} | 
|  | 318 do_test vacuum-7.3 { | 
|  | 319   execsql { PRAGMA freelist_count; } db2 | 
|  | 320 } {0} | 
|  | 321 ifcapable autovacuum { | 
|  | 322   do_test vacuum-7.4 { | 
|  | 323     execsql { PRAGMA auto_vacuum } db2 | 
|  | 324   } {0} | 
|  | 325   do_test vacuum-7.5 { | 
|  | 326     execsql { PRAGMA auto_vacuum = 1} db2 | 
|  | 327     execsql { PRAGMA auto_vacuum } db2 | 
|  | 328   } {0} | 
|  | 329   do_test vacuum-7.6 { | 
|  | 330     execsql { PRAGMA auto_vacuum = 1} db2 | 
|  | 331     execsql { VACUUM } db2 | 
|  | 332     execsql { PRAGMA auto_vacuum } db2 | 
|  | 333   } {1} | 
|  | 334 } | 
| 298 db2 close | 335 db2 close | 
| 299 | 336 | 
| 300 # Ticket #873.  VACUUM a database that has ' in its name. | 337 # Ticket #873.  VACUUM a database that has ' in its name. | 
| 301 # | 338 # | 
| 302 do_test vacuum-8.1 { | 339 do_test vacuum-8.1 { | 
| 303   file delete -force a'z.db | 340   file delete -force a'z.db | 
| 304   file delete -force a'z.db-journal | 341   file delete -force a'z.db-journal | 
| 305   sqlite3 db2 a'z.db | 342   sqlite3 db2 a'z.db | 
| 306   execsql { | 343   execsql { | 
| 307     CREATE TABLE t1(t); | 344     CREATE TABLE t1(t); | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 342     execsql { | 379     execsql { | 
| 343       VACUUM; | 380       VACUUM; | 
| 344     } | 381     } | 
| 345     cksum | 382     cksum | 
| 346   } $::cksum | 383   } $::cksum | 
| 347 } | 384 } | 
| 348 | 385 | 
| 349 file delete -force {a'z.db} | 386 file delete -force {a'z.db} | 
| 350 | 387 | 
| 351 finish_test | 388 finish_test | 
| OLD | NEW | 
|---|