| OLD | NEW |
| 1 # 2004 August 30 | 1 # 2004 August 30 |
| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 DELETE FROM t1 WHERE a = 1; | 339 DELETE FROM t1 WHERE a = 1; |
| 340 } -corrupt { | 340 } -corrupt { |
| 341 set nPage [expr [file size corrupt.db] / 1024] | 341 set nPage [expr [file size corrupt.db] / 1024] |
| 342 hexio_write corrupt.db [expr 1024 + ($nPage-3)*5] 010000000 | 342 hexio_write corrupt.db [expr 1024 + ($nPage-3)*5] 010000000 |
| 343 } -test { | 343 } -test { |
| 344 do_test corrupt2-6.3 { | 344 do_test corrupt2-6.3 { |
| 345 catchsql " $::presql pragma incremental_vacuum = 1 " | 345 catchsql " $::presql pragma incremental_vacuum = 1 " |
| 346 } {1 {database disk image is malformed}} | 346 } {1 {database disk image is malformed}} |
| 347 } | 347 } |
| 348 | 348 |
| 349 corruption_test -sqlprep { | 349 if {![nonzero_reserved_bytes]} { |
| 350 PRAGMA auto_vacuum = 1; | 350 corruption_test -sqlprep { |
| 351 PRAGMA page_size = 1024; | 351 PRAGMA auto_vacuum = 1; |
| 352 CREATE TABLE t1(a INTEGER PRIMARY KEY, b); | 352 PRAGMA page_size = 1024; |
| 353 INSERT INTO t1 VALUES(1, randomblob(2500)); | 353 CREATE TABLE t1(a INTEGER PRIMARY KEY, b); |
| 354 DELETE FROM t1 WHERE a = 1; | 354 INSERT INTO t1 VALUES(1, randomblob(2500)); |
| 355 } -corrupt { | 355 DELETE FROM t1 WHERE a = 1; |
| 356 set nAppend [expr 1024*207 - [file size corrupt.db]] | 356 } -corrupt { |
| 357 set fd [open corrupt.db r+] | 357 set nAppend [expr 1024*207 - [file size corrupt.db]] |
| 358 seek $fd 0 end | 358 set fd [open corrupt.db r+] |
| 359 puts -nonewline $fd [string repeat x $nAppend] | 359 seek $fd 0 end |
| 360 close $fd | 360 puts -nonewline $fd [string repeat x $nAppend] |
| 361 hexio_write corrupt.db 28 00000000 | 361 close $fd |
| 362 } -test { | 362 hexio_write corrupt.db 28 00000000 |
| 363 do_test corrupt2-6.4 { | 363 } -test { |
| 364 catchsql " | 364 do_test corrupt2-6.4 { |
| 365 $::presql | 365 catchsql " |
| 366 BEGIN EXCLUSIVE; | 366 $::presql |
| 367 COMMIT; | 367 BEGIN EXCLUSIVE; |
| 368 " | 368 COMMIT; |
| 369 } {1 {database disk image is malformed}} | 369 " |
| 370 } {1 {database disk image is malformed}} |
| 371 } |
| 370 } | 372 } |
| 371 } | 373 } |
| 372 | 374 |
| 373 | 375 |
| 374 set sqlprep { | 376 set sqlprep { |
| 375 PRAGMA auto_vacuum = 0; | 377 PRAGMA auto_vacuum = 0; |
| 376 PRAGMA page_size = 1024; | 378 PRAGMA page_size = 1024; |
| 377 CREATE TABLE t1(a INTEGER PRIMARY KEY, b); | 379 CREATE TABLE t1(a INTEGER PRIMARY KEY, b); |
| 378 CREATE INDEX i1 ON t1(b); | 380 CREATE INDEX i1 ON t1(b); |
| 379 INSERT INTO t1 VALUES(1, randomblob(50)); | 381 INSERT INTO t1 VALUES(1, randomblob(50)); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 | 602 |
| 601 do_execsql_test 14.5 { | 603 do_execsql_test 14.5 { |
| 602 PRAGMA integrity_check; | 604 PRAGMA integrity_check; |
| 603 } {{*** in database main *** | 605 } {{*** in database main *** |
| 604 Page 3 is never used}} | 606 Page 3 is never used}} |
| 605 | 607 |
| 606 | 608 |
| 607 finish_test | 609 finish_test |
| 608 | 610 |
| 609 finish_test | 611 finish_test |
| OLD | NEW |