dda70fe38e
lines at the end of scripts. (CVS 6721) FossilOrigin-Name: 1fef16ec2b89981770cf44f606a420fbe031a7a4
100 lines
1.9 KiB
Plaintext
100 lines
1.9 KiB
Plaintext
# 2009 March 24
|
|
#
|
|
# 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.
|
|
#
|
|
#***********************************************************************
|
|
#
|
|
# $Id: jrnlmode2.test,v 1.6 2009/06/05 17:09:12 drh Exp $
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
ifcapable {!pager_pragmas} {
|
|
finish_test
|
|
return
|
|
}
|
|
|
|
#-------------------------------------------------------------------------
|
|
# Test overview:
|
|
#
|
|
# jrnlmode2-1.*: Demonstrate bug #3745
|
|
# jrnlmode2-2.*: Demonstrate bug #3751
|
|
#
|
|
|
|
do_test jrnlmode2-1.1 {
|
|
execsql {
|
|
PRAGMA journal_mode = persist;
|
|
CREATE TABLE t1(a, b);
|
|
INSERT INTO t1 VALUES(1, 2);
|
|
}
|
|
} {persist}
|
|
|
|
do_test jrnlmode2-1.2 {
|
|
file exists test.db-journal
|
|
} {1}
|
|
|
|
do_test jrnlmode2-1.3 {
|
|
sqlite3 db2 test.db
|
|
execsql { SELECT * FROM t1 } db2
|
|
} {1 2}
|
|
|
|
do_test jrnlmode2-1.4 {
|
|
execsql {
|
|
INSERT INTO t1 VALUES(3, 4);
|
|
BEGIN;
|
|
SELECT * FROM t1;
|
|
}
|
|
execsql { PRAGMA lock_status }
|
|
} {main shared temp closed}
|
|
|
|
do_test jrnlmode2-1.5 {
|
|
file exists test.db-journal
|
|
} {1}
|
|
|
|
do_test jrnlmode2-1.6 {
|
|
catchsql { SELECT * FROM t1 } db2
|
|
} {0 {1 2 3 4}}
|
|
|
|
do_test jrnlmode2-1.7 {
|
|
execsql { COMMIT }
|
|
catchsql { SELECT * FROM t1 } db2
|
|
} {0 {1 2 3 4}}
|
|
|
|
|
|
|
|
do_test jrnlmode2-2.1 {
|
|
db2 close
|
|
execsql { PRAGMA journal_mode = truncate }
|
|
execsql { INSERT INTO t1 VALUES(5, 6) }
|
|
} {}
|
|
|
|
do_test jrnlmode2-2.2 {
|
|
file exists test.db-journal
|
|
} {1}
|
|
|
|
do_test jrnlmode2-2.3 {
|
|
file size test.db-journal
|
|
} {0}
|
|
|
|
do_test jrnlmode2-2.4 {
|
|
sqlite3 db2 test.db -readonly 1
|
|
catchsql { SELECT * FROM t1 } db2
|
|
} {0 {1 2 3 4 5 6}}
|
|
|
|
do_test jrnlmode2-2.5 {
|
|
file delete test.db-journal
|
|
} {}
|
|
|
|
do_test jrnlmode2-2.6 {
|
|
sqlite3 db2 test.db -readonly 1
|
|
catchsql { SELECT * FROM t1 } db2
|
|
} {0 {1 2 3 4 5 6}}
|
|
|
|
catch { db2 close }
|
|
finish_test
|