32f2964390
(thus creating a new empty database file) the *-wal file is automatically deleted. FossilOrigin-Name: 95c69dfbddaf4367cd699dfe8fcf8e06030c1f53
53 lines
1.3 KiB
Plaintext
53 lines
1.3 KiB
Plaintext
# 2010 July 1
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
# Verify that an empty database and a non-empty WAL file do not
|
|
# result in database corruption
|
|
#
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
source $testdir/malloc_common.tcl
|
|
ifcapable !wal {finish_test ; return }
|
|
|
|
do_test wal4-1.1 {
|
|
db close
|
|
file delete -force wal4.db wal4.db-journal wal4.db-wal wal4.db-shm
|
|
file delete -force test.db test.db-journal test.db-wal test.db-shm
|
|
sqlite3 db2 wal4.db
|
|
db2 eval {
|
|
PRAGMA journal_mode=WAL;
|
|
CREATE TABLE t1(x);
|
|
INSERT INTO t1 VALUES(1);
|
|
INSERT INTO t1 VALUES(2);
|
|
SELECT x FROM t1 ORDER BY x;
|
|
}
|
|
} {wal 1 2}
|
|
do_test wal4-1.2 {
|
|
file delete -force test.db test.db-journal test.db-wal
|
|
file copy wal4.db-wal test.db-wal
|
|
sqlite3 db test.db
|
|
catchsql {
|
|
SELECT * FROM t1;
|
|
}
|
|
} {1 {no such table: t1}}
|
|
|
|
do_malloc_test wal4-2.0 -tclprep {
|
|
db close
|
|
file delete -force test.db test.db-journal test.db-wal
|
|
file copy wal4.db-wal test.db-wal
|
|
sqlite3 db test.db
|
|
} -sqlbody {
|
|
SELECT name FROM sqlite_master
|
|
}
|
|
|
|
|
|
finish_test
|