| OLD | NEW |
| 1 # 2007 May 04 | 1 # 2007 May 04 |
| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 execsql { | 63 execsql { |
| 64 PRAGMA incremental_vacuum(1000); | 64 PRAGMA incremental_vacuum(1000); |
| 65 } | 65 } |
| 66 file size test.db | 66 file size test.db |
| 67 } {3072} | 67 } {3072} |
| 68 | 68 |
| 69 # Make sure incremental vacuum works on attached databases. | 69 # Make sure incremental vacuum works on attached databases. |
| 70 # | 70 # |
| 71 ifcapable attach { | 71 ifcapable attach { |
| 72 do_test incrvacuum2-2.1 { | 72 do_test incrvacuum2-2.1 { |
| 73 file delete -force test2.db test2.db-journal | 73 forcedelete test2.db test2.db-journal |
| 74 execsql { | 74 execsql { |
| 75 ATTACH DATABASE 'test2.db' AS aux; | 75 ATTACH DATABASE 'test2.db' AS aux; |
| 76 PRAGMA aux.auto_vacuum=incremental; | 76 PRAGMA aux.auto_vacuum=incremental; |
| 77 CREATE TABLE aux.t2(x); | 77 CREATE TABLE aux.t2(x); |
| 78 INSERT INTO t2 VALUES(zeroblob(30000)); | 78 INSERT INTO t2 VALUES(zeroblob(30000)); |
| 79 INSERT INTO t1 SELECT * FROM t2; | 79 INSERT INTO t1 SELECT * FROM t2; |
| 80 DELETE FROM t2; | 80 DELETE FROM t2; |
| 81 DELETE FROM t1; | 81 DELETE FROM t1; |
| 82 } | 82 } |
| 83 list [file size test.db] [file size test2.db] | 83 list [file size test.db] [file size test2.db] |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 DELETE FROM t1; | 184 DELETE FROM t1; |
| 185 } | 185 } |
| 186 | 186 |
| 187 do_test 4.2 { | 187 do_test 4.2 { |
| 188 execsql { | 188 execsql { |
| 189 PRAGMA journal_mode = WAL; | 189 PRAGMA journal_mode = WAL; |
| 190 PRAGMA incremental_vacuum(1); | 190 PRAGMA incremental_vacuum(1); |
| 191 PRAGMA wal_checkpoint; | 191 PRAGMA wal_checkpoint; |
| 192 } | 192 } |
| 193 file size test.db-wal | 193 file size test.db-wal |
| 194 } {1640} | 194 } [expr {32+2*(512+24)}] |
| 195 | 195 |
| 196 do_test 4.3 { | 196 do_test 4.3 { |
| 197 db close | 197 db close |
| 198 sqlite3 db test.db | 198 sqlite3 db test.db |
| 199 set maxsz 0 | 199 set maxsz 0 |
| 200 while {[file size test.db] > [expr 512*3]} { | 200 while {[file size test.db] > [expr 512*3]} { |
| 201 execsql { PRAGMA journal_mode = WAL } | 201 execsql { PRAGMA journal_mode = WAL } |
| 202 execsql { PRAGMA wal_checkpoint } | 202 execsql { PRAGMA wal_checkpoint } |
| 203 execsql { PRAGMA incremental_vacuum(1) } | 203 execsql { PRAGMA incremental_vacuum(1) } |
| 204 set newsz [file size test.db-wal] | 204 set newsz [file size test.db-wal] |
| 205 if {$newsz>$maxsz} {set maxsz $newsz} | 205 if {$newsz>$maxsz} {set maxsz $newsz} |
| 206 } | 206 } |
| 207 set maxsz | 207 set maxsz |
| 208 } {2176} | 208 } [expr {32+3*(512+24)}] |
| 209 } | 209 } |
| 210 | 210 |
| 211 finish_test | 211 finish_test |
| OLD | NEW |