Changes to support building with SQLITE_OMIT_WAL.

FossilOrigin-Name: d1ed743b6ed07ad0ee7d466932c5a83caa9489ee
This commit is contained in:
shaneh 2010-08-24 18:35:12 +00:00
parent 357b5f97be
commit 9091f775a8
6 changed files with 101 additions and 92 deletions

View File

@ -1,8 +1,5 @@
-----BEGIN PGP SIGNED MESSAGE----- C Changes\sto\ssupport\sbuilding\swith\sSQLITE_OMIT_WAL.
Hash: SHA1 D 2010-08-24T18:35:12
C Change\ssqlite3_open_v2()\sto\sreturn\sSQLITE_MISUSE\sif\sthe\scombination\sof\sbits\nin\sthe\sflags\sparameter\sis\sinvalid.\s\sThe\sdocumentation\ssays\sthe\sbehavior\sin\s\nthis\ssituation\sis\sundefined\s-\sthe\sdocumentation\sis\sunaltered\sby\sthis\scode\s\nchange.
D 2010-08-24T18:07:58
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 543f91f24cd7fee774ecc0a61c19704c0c3e78fd F Makefile.in 543f91f24cd7fee774ecc0a61c19704c0c3e78fd
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -159,7 +156,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e
F src/os_unix.c 11194cbcf6a57456e58022dc537ab8c3497d9bb9 F src/os_unix.c 11194cbcf6a57456e58022dc537ab8c3497d9bb9
F src/os_win.c 51cb62f76262d961ea4249489383d714501315a7 F src/os_win.c 51cb62f76262d961ea4249489383d714501315a7
F src/pager.c a5f5d9787b11dfb0b6082e6f5846d00b459a8e19 F src/pager.c 48556db031d16064ffbde48053da8ec5032df7e8
F src/pager.h ef8c8f71ab022cc2fff768a1175dd32355be9dcd F src/pager.h ef8c8f71ab022cc2fff768a1175dd32355be9dcd
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07 F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07
@ -543,7 +540,7 @@ F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a
F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347 F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
F test/null.test a8b09b8ed87852742343b33441a9240022108993 F test/null.test a8b09b8ed87852742343b33441a9240022108993
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
F test/pager1.test 6922029d71a8090169c71a67a141b6b94ad17d50 F test/pager1.test 12ad20280db1ba25f1f0d7ddebf0971a305d8f80
F test/pager2.test 0fbb6b6dc40ce1fecfe758c555a748ad2e9beaa3 F test/pager2.test 0fbb6b6dc40ce1fecfe758c555a748ad2e9beaa3
F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
F test/pagerfault.test 84c6a4fcfe1a9e450fc1cec86f5baebfb017e53e F test/pagerfault.test 84c6a4fcfe1a9e450fc1cec86f5baebfb017e53e
@ -613,7 +610,7 @@ F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
F test/sqllimits1.test e90a0ed94452076f6a10209d378e06b5f75ef0a0 F test/sqllimits1.test e90a0ed94452076f6a10209d378e06b5f75ef0a0
F test/stat.test 70fe540ffb285947aead5533dfd0c8c12f17f14e F test/stat.test 3c18f0698e1a56c67e75b55c398332a3ffba579a
F test/stmt.test 7915bd3e8380b956c095f40f41a775a30716e649 F test/stmt.test 7915bd3e8380b956c095f40f41a775a30716e649
F test/subquery.test b524f57c9574b2c0347045b4510ef795d4686796 F test/subquery.test b524f57c9574b2c0347045b4510ef795d4686796
F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4 F test/subselect.test d24fd8757daf97dafd2e889c73ea4c4272dcf4e4
@ -800,7 +797,7 @@ F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142
F test/walfault.test 05c470688d742688e455dd56816bd6bcffa298f8 F test/walfault.test 05c470688d742688e455dd56816bd6bcffa298f8
F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483 F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
F test/walmode.test 4ecd37284f245247f7935896ab66f6943f0432a0 F test/walmode.test 4ecd37284f245247f7935896ab66f6943f0432a0
F test/walshared.test 985b4a3406b2b2dace1d52a42d26a11dd6900981 F test/walshared.test 6dda2293880c300baf5d791c307f653094585761
F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933 F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933
F test/walthread.test a25a393c068a2b42b44333fa3fdaae9072f1617c F test/walthread.test a25a393c068a2b42b44333fa3fdaae9072f1617c
F test/where.test de337a3fe0a459ec7c93db16a519657a90552330 F test/where.test de337a3fe0a459ec7c93db16a519657a90552330
@ -849,14 +846,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P c2dc39c0c4673a39f5fe6e643acb3bcf4ca22265 P 5e8101c5122336844ea920e6fbdace23e35b931f
R e846dae6bf0f685d3d72ee1ee9be47aa R a696c1133501b0d7ad2be0304e78dcd5
U drh U shaneh
Z 126048b893ad61b8f7402ec300895fff Z 80d9d8f470083fca9ed888138d87f8b3
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFMdAqCoxKgR168RlERAtdlAJwIyEYLa9m+PygLDf3RUTuQe/66TACffSUE
yfKyQ4iSKXTFtQzDhfDQ3S8=
=PFf6
-----END PGP SIGNATURE-----

View File

@ -1 +1 @@
5e8101c5122336844ea920e6fbdace23e35b931f d1ed743b6ed07ad0ee7d466932c5a83caa9489ee

View File

@ -2977,6 +2977,7 @@ static int pagerBeginReadTransaction(Pager *pPager){
return rc; return rc;
} }
#endif
/* /*
** This function is called as part of the transition from PAGER_OPEN ** This function is called as part of the transition from PAGER_OPEN
@ -2998,7 +2999,11 @@ static int pagerPagecount(Pager *pPager, Pgno *pnPage){
*/ */
assert( pPager->eState==PAGER_OPEN ); assert( pPager->eState==PAGER_OPEN );
assert( pPager->eLock>=SHARED_LOCK || pPager->noReadlock ); assert( pPager->eLock>=SHARED_LOCK || pPager->noReadlock );
#ifndef SQLITE_OMIT_WAL
nPage = sqlite3WalDbsize(pPager->pWal); nPage = sqlite3WalDbsize(pPager->pWal);
#else
nPage = 0;
#endif
/* If the database size was not available from the WAL sub-system, /* If the database size was not available from the WAL sub-system,
** determine it based on the size of the database file. If the size ** determine it based on the size of the database file. If the size
@ -3033,7 +3038,7 @@ static int pagerPagecount(Pager *pPager, Pgno *pnPage){
return SQLITE_OK; return SQLITE_OK;
} }
#ifndef SQLITE_OMIT_WAL
/* /*
** Check if the *-wal file that corresponds to the database opened by pPager ** Check if the *-wal file that corresponds to the database opened by pPager
** exists if the database is not empy, or verify that the *-wal file does ** exists if the database is not empy, or verify that the *-wal file does
@ -4778,7 +4783,9 @@ int sqlite3PagerSharedLock(Pager *pPager){
** mode. Otherwise, the following function call is a no-op. ** mode. Otherwise, the following function call is a no-op.
*/ */
rc = pagerOpenWalIfPresent(pPager); rc = pagerOpenWalIfPresent(pPager);
#ifndef SQLITE_OMIT_WAL
assert( pPager->pWal==0 || rc==SQLITE_OK ); assert( pPager->pWal==0 || rc==SQLITE_OK );
#endif
} }
if( pagerUseWal(pPager) ){ if( pagerUseWal(pPager) ){

View File

@ -1919,32 +1919,34 @@ do_test pager1-20.2.2 {
} }
} {} } {}
do_test pager1-20.3.1 { ifcapable wal {
faultsim_delete_and_reopen do_test pager1-20.3.1 {
db func a_string a_string faultsim_delete_and_reopen
execsql { db func a_string a_string
PRAGMA cache_size = 10; execsql {
PRAGMA journal_mode = wal; PRAGMA cache_size = 10;
BEGIN; PRAGMA journal_mode = wal;
CREATE TABLE t1(x); BEGIN;
CREATE TABLE t2(y); CREATE TABLE t1(x);
INSERT INTO t1 VALUES(a_string(800)); CREATE TABLE t2(y);
INSERT INTO t1 SELECT a_string(800) FROM t1; /* 2 */ INSERT INTO t1 VALUES(a_string(800));
INSERT INTO t1 SELECT a_string(800) FROM t1; /* 4 */ INSERT INTO t1 SELECT a_string(800) FROM t1; /* 2 */
INSERT INTO t1 SELECT a_string(800) FROM t1; /* 8 */ INSERT INTO t1 SELECT a_string(800) FROM t1; /* 4 */
INSERT INTO t1 SELECT a_string(800) FROM t1; /* 16 */ INSERT INTO t1 SELECT a_string(800) FROM t1; /* 8 */
INSERT INTO t1 SELECT a_string(800) FROM t1; /* 32 */ INSERT INTO t1 SELECT a_string(800) FROM t1; /* 16 */
COMMIT; INSERT INTO t1 SELECT a_string(800) FROM t1; /* 32 */
} COMMIT;
} {wal} }
do_test pager1-20.3.2 { } {wal}
execsql { do_test pager1-20.3.2 {
BEGIN; execsql {
INSERT INTO t2 VALUES('xxxx'); BEGIN;
} INSERT INTO t2 VALUES('xxxx');
recursive_select 32 t1 }
execsql COMMIT recursive_select 32 t1
} {} execsql COMMIT
} {}
}
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Test that a WAL database may not be opened if: # Test that a WAL database may not be opened if:
@ -1952,28 +1954,30 @@ do_test pager1-20.3.2 {
# pager1-21.1.*: The VFS has an iVersion less than 2, or # pager1-21.1.*: The VFS has an iVersion less than 2, or
# pager1-21.2.*: The VFS does not provide xShmXXX() methods. # pager1-21.2.*: The VFS does not provide xShmXXX() methods.
# #
do_test pager1-21.0 { ifcapable wal {
faultsim_delete_and_reopen do_test pager1-21.0 {
execsql { faultsim_delete_and_reopen
PRAGMA journal_mode = WAL; execsql {
CREATE TABLE ko(c DEFAULT 'abc', b DEFAULT 'def'); PRAGMA journal_mode = WAL;
INSERT INTO ko DEFAULT VALUES; CREATE TABLE ko(c DEFAULT 'abc', b DEFAULT 'def');
} INSERT INTO ko DEFAULT VALUES;
} {wal} }
do_test pager1-21.1 { } {wal}
testvfs tv -noshm 1 do_test pager1-21.1 {
sqlite3 db2 test.db -vfs tv testvfs tv -noshm 1
catchsql { SELECT * FROM ko } db2 sqlite3 db2 test.db -vfs tv
} {1 {unable to open database file}} catchsql { SELECT * FROM ko } db2
db2 close } {1 {unable to open database file}}
tv delete db2 close
do_test pager1-21.2 { tv delete
testvfs tv -iversion 1 do_test pager1-21.2 {
sqlite3 db2 test.db -vfs tv testvfs tv -iversion 1
catchsql { SELECT * FROM ko } db2 sqlite3 db2 test.db -vfs tv
} {1 {unable to open database file}} catchsql { SELECT * FROM ko } db2
db2 close } {1 {unable to open database file}}
tv delete db2 close
tv delete
}
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# Test that a "PRAGMA wal_checkpoint": # Test that a "PRAGMA wal_checkpoint":
@ -2254,24 +2258,26 @@ do_test pager1.27.1 {
# the same database. # the same database.
# #
catch { db close } catch { db close }
do_multiclient_test tn { ifcapable wal {
do_test pager1-28.$tn.1 { do_multiclient_test tn {
sql1 { do_test pager1-28.$tn.1 {
PRAGMA journal_mode = WAL; sql1 {
CREATE TABLE t1(a, b); PRAGMA journal_mode = WAL;
INSERT INTO t1 VALUES('a', 'b'); CREATE TABLE t1(a, b);
} INSERT INTO t1 VALUES('a', 'b');
} {wal} }
do_test pager1-28.$tn.2 { sql2 { SELECT * FROM t1 } } {a b} } {wal}
do_test pager1-28.$tn.2 { sql2 { SELECT * FROM t1 } } {a b}
do_test pager1-28.$tn.3 { sql1 { PRAGMA locking_mode=exclusive } } {exclusive} do_test pager1-28.$tn.3 { sql1 { PRAGMA locking_mode=exclusive } } {exclusive}
do_test pager1-28.$tn.4 { do_test pager1-28.$tn.4 {
csql1 { BEGIN; INSERT INTO t1 VALUES('c', 'd'); } csql1 { BEGIN; INSERT INTO t1 VALUES('c', 'd'); }
} {1 {database is locked}} } {1 {database is locked}}
code2 { db2 close ; sqlite3 db2 test.db } code2 { db2 close ; sqlite3 db2 test.db }
do_test pager1-28.$tn.4 { do_test pager1-28.$tn.4 {
sql1 { INSERT INTO t1 VALUES('c', 'd'); COMMIT } sql1 { INSERT INTO t1 VALUES('c', 'd'); COMMIT }
} {} } {}
}
} }
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -30,11 +30,14 @@ do_execsql_test stat-0.0 {
CREATE VIRTUAL TABLE temp.stat USING dbstat; CREATE VIRTUAL TABLE temp.stat USING dbstat;
SELECT * FROM stat; SELECT * FROM stat;
} {} } {}
do_execsql_test stat-0.1 {
PRAGMA journal_mode = WAL; ifcapable wal {
PRAGMA journal_mode = delete; do_execsql_test stat-0.1 {
SELECT * FROM stat; PRAGMA journal_mode = WAL;
} {wal delete sqlite_master / 1 leaf 0 0 916 0} PRAGMA journal_mode = delete;
SELECT * FROM stat;
} {wal delete sqlite_master / 1 leaf 0 0 916 0}
}
do_test stat-1.0 { do_test stat-1.0 {
execsql { execsql {

View File

@ -15,6 +15,9 @@
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
ifcapable !wal {finish_test ; return }
db close db close
set ::enable_shared_cache [sqlite3_enable_shared_cache 1] set ::enable_shared_cache [sqlite3_enable_shared_cache 1]