| OLD | NEW |
| 1 # 2010 June 16 | 1 # 2010 June 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 #*********************************************************************** |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 proc a_string {n} { | 27 proc a_string {n} { |
| 28 global a_string_counter | 28 global a_string_counter |
| 29 incr a_string_counter | 29 incr a_string_counter |
| 30 string range [string repeat "${a_string_counter}." $n] 1 $n | 30 string range [string repeat "${a_string_counter}." $n] 1 $n |
| 31 } | 31 } |
| 32 | 32 |
| 33 # Create a [testvfs] and install it as the default VFS. Set the device | 33 # Create a [testvfs] and install it as the default VFS. Set the device |
| 34 # characteristics flags to "SAFE_DELETE". | 34 # characteristics flags to "SAFE_DELETE". |
| 35 # | 35 # |
| 36 testvfs tvfs -default 1 | 36 testvfs tvfs -default 1 |
| 37 tvfs devchar undeletable_when_open | 37 tvfs devchar {undeletable_when_open powersafe_overwrite} |
| 38 | 38 |
| 39 # Set up a hook so that each time a journal file is opened, closed or | 39 # Set up a hook so that each time a journal file is opened, closed or |
| 40 # deleted, the method name ("xOpen", "xClose" or "xDelete") and the final | 40 # deleted, the method name ("xOpen", "xClose" or "xDelete") and the final |
| 41 # segment of the journal file-name (i.e. "test.db-journal") are appended to | 41 # segment of the journal file-name (i.e. "test.db-journal") are appended to |
| 42 # global list variable $::oplog. | 42 # global list variable $::oplog. |
| 43 # | 43 # |
| 44 tvfs filter {xOpen xClose xDelete} | 44 tvfs filter {xOpen xClose xDelete} |
| 45 tvfs script journal_op_catcher | 45 tvfs script journal_op_catcher |
| 46 proc journal_op_catcher {method filename args} { | 46 proc journal_op_catcher {method filename args} { |
| 47 | 47 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 INSERT INTO t2 SELECT randomblob(200), randomblob(300) FROM t2; -- 128 | 160 INSERT INTO t2 SELECT randomblob(200), randomblob(300) FROM t2; -- 128 |
| 161 } db2 | 161 } db2 |
| 162 } {} | 162 } {} |
| 163 do_test journal2-1.13 { | 163 do_test journal2-1.13 { |
| 164 tvfs filter {xOpen xClose xDelete xWrite xTruncate} | 164 tvfs filter {xOpen xClose xDelete xWrite xTruncate} |
| 165 set ::tvfs_error_on_write 1 | 165 set ::tvfs_error_on_write 1 |
| 166 catchsql { COMMIT } db2 | 166 catchsql { COMMIT } db2 |
| 167 } {1 {disk I/O error}} | 167 } {1 {disk I/O error}} |
| 168 db2 close | 168 db2 close |
| 169 unset ::tvfs_error_on_write | 169 unset ::tvfs_error_on_write |
| 170 file copy -force test.db testX.db | 170 forcecopy test.db testX.db |
| 171 | 171 |
| 172 do_test journal2-1.14 { file exists test.db-journal } 1 | 172 do_test journal2-1.14 { file exists test.db-journal } 1 |
| 173 do_test journal2-1.15 { | 173 do_test journal2-1.15 { |
| 174 execsql { | 174 execsql { |
| 175 SELECT count(*) FROM t2; | 175 SELECT count(*) FROM t2; |
| 176 PRAGMA integrity_check; | 176 PRAGMA integrity_check; |
| 177 } | 177 } |
| 178 } {64 ok} | 178 } {64 ok} |
| 179 | 179 |
| 180 # This block checks that in the test case above, connection [db2] really | 180 # This block checks that in the test case above, connection [db2] really |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 do_test journal2-2.4 { | 224 do_test journal2-2.4 { |
| 225 set ::oplog [list] | 225 set ::oplog [list] |
| 226 execsql { PRAGMA journal_mode = WAL } | 226 execsql { PRAGMA journal_mode = WAL } |
| 227 set ::oplog | 227 set ::oplog |
| 228 } {xClose test.db-journal xDelete test.db-journal} | 228 } {xClose test.db-journal xDelete test.db-journal} |
| 229 db close | 229 db close |
| 230 } | 230 } |
| 231 | 231 |
| 232 tvfs delete | 232 tvfs delete |
| 233 finish_test | 233 finish_test |
| 234 | |
| OLD | NEW |