1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

If an error occurs in PagerSetPagesize(), set the output variable to the unmodified page-size before returning.

FossilOrigin-Name: 02def8f92588b8a45dff3976d1e7f9e3f0359b3b
This commit is contained in:
dan
2010-08-12 16:36:34 +00:00
parent 5653e4da36
commit 1879b088bd
5 changed files with 78 additions and 25 deletions

View File

@ -28,8 +28,6 @@ proc a_string {n} {
}
db func a_string a_string
if 1 {
#-------------------------------------------------------------------------
# Test fault-injection while rolling back a hot-journal file.
#
@ -1125,8 +1123,6 @@ do_faultsim_test pagerfault-24 -prep {
if {$ic != "ok"} { error "Integrity check: $ic" }
}
}
proc lockrows {n} {
if {$n==0} { return "" }
db eval { SELECT * FROM t1 WHERE oid = $n } {
@ -1134,6 +1130,7 @@ proc lockrows {n} {
}
}
do_test pagerfault-25-pre1 {
faultsim_delete_and_reopen
db func a_string a_string
@ -1150,7 +1147,7 @@ do_test pagerfault-25-pre1 {
}
faultsim_save_and_close
} {}
do_faultsim_test pagerfault-25 -faults full -prep {
do_faultsim_test pagerfault-25 -prep {
faultsim_restore_and_reopen
db func a_string a_string
set ::channel [db incrblob -readonly t1 a 1]
@ -1164,9 +1161,40 @@ do_faultsim_test pagerfault-25 -faults full -prep {
lockrows 30
} -test {
catch { lockrows 30 }
catch { db eval COMMIT }
close $::channel
faultsim_test_result {0 {}}
}
do_faultsim_test pagerfault-26 -prep {
faultsim_delete_and_reopen
execsql {
PRAGMA page_size = 1024;
PRAGMA journal_mode = truncate;
PRAGMA auto_vacuum = full;
PRAGMA locking_mode=exclusive;
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, 2);
PRAGMA page_size = 4096;
}
} -body {
execsql {
VACUUM;
}
} -test {
faultsim_test_result {0 {}}
set contents [db eval {SELECT * FROM t1}]
if {$contents != "1 2"} { error "Bad database contents ($contents)" }
set sz [file size test.db]
if {$testrc!=0 && $sz!=1024*3 && $sz!=4096*3} {
error "Expected file size to be 3072 or 12288 bytes - actual size $sz bytes"
}
if {$testrc==0 && $sz!=4096*3} {
error "Expected file size to be 12288 bytes - actual size $sz bytes"
}
}
finish_test