From: dan Date: Mon, 5 Jul 2010 19:13:26 +0000 (+0000) Subject: Simplify the previous commit by removing the pagerCheckForOrDeleteWAL() wrapper. X-Git-Tag: version-3.7.2~191 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=db10f082820714a4fc807f78e00c93fad96fbb1b;p=thirdparty%2Fsqlite.git Simplify the previous commit by removing the pagerCheckForOrDeleteWAL() wrapper. FossilOrigin-Name: a1324d125e2dd7004eaf8680f5f832ef17285087 --- diff --git a/manifest b/manifest index 09e5cf6d6a..8824485946 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Allocate\sa\sbuffer\scontaining\sthe\sfull\spath-name\sto\sthe\sassociated\sWAL\sfile\swhen\sa\spager\sis\screated.\sThis\ssaves\shaving\sto\sconstruct\sa\snew\sbuffer\seach\stime\sa\snew\sread-transaction\sis\sopened\sand\sSQLite\schecks\sfor\sthe\sexistance\sof\sa\sWAL\sfile. -D 2010-07-05T19:03:36 +C Simplify\sthe\sprevious\scommit\sby\sremoving\sthe\spagerCheckForOrDeleteWAL()\swrapper. +D 2010-07-05T19:13:26 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -156,7 +156,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19 F src/os_unix.c c6112f0ae34f23ae5ca0189a685e084befbdcf26 F src/os_win.c 883caa09d8cf7c4dfdef6eba6930466cb8a8275c -F src/pager.c d6454d37992882904ac0cdc1fd12887d1eecf434 +F src/pager.c 311571e62fe6a039d2a8dddea830981a6052239a F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e F src/pcache.c 1e9aa2dbc0845b52e1b51cc39753b6d1e041cb07 @@ -830,7 +830,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P c0d124da88e84e68679c2f3f4b2b35c03aecc916 -R cd5e60ea3770ef2152f9ff5f3bc6b29a +P 3053a4ad15343a56efa430503797b77bb6d1e770 +R 1ec303291d035dc0b39644c087426f86 U dan -Z 3d489137870470f4068fe7324b7dadaf +Z 86c196ef09ff127a40f174a4579ff6fc diff --git a/manifest.uuid b/manifest.uuid index 7c5571c81f..c8faa485f6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3053a4ad15343a56efa430503797b77bb6d1e770 \ No newline at end of file +a1324d125e2dd7004eaf8680f5f832ef17285087 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index 0f634dd382..a080d6950d 100644 --- a/src/pager.c +++ b/src/pager.c @@ -2438,32 +2438,6 @@ static int pagerBeginReadTransaction(Pager *pPager){ return rc; } -/* -** Check for the existence of or delete the *-wal file that corresponds to -** the database opened by pPager. -** -** When pExists!=NULL, set *pExists to 1 if the *-wal file exists, or 0 -** if the *-wal file does not exist. -** -** When pExists==NULL, delete the *-wal file if it exists, or the do -** nothing if the *-wal file does not exist. -** -** Return SQLITE_OK on success. If on an IO or OOM error occurs, return -** an SQLite error code. -*/ -static int pagerCheckForOrDeleteWAL(Pager *pPager, int *pExists){ - int rc; /* Return code */ - char *zWal = pPager->zWal; /* Name of the WAL file */ - - assert( !pPager->tempFile ); - if( pExists ){ - rc = sqlite3OsAccess(pPager->pVfs, zWal, SQLITE_ACCESS_EXISTS, pExists); - }else{ - rc = sqlite3OsDelete(pPager->pVfs, zWal, 0); - } - return rc; -} - /* ** 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 @@ -2493,10 +2467,12 @@ static int pagerOpenWalIfPresent(Pager *pPager){ rc = sqlite3PagerPagecount(pPager, &nPage); if( rc ) return rc; if( nPage==0 ){ - rc = pagerCheckForOrDeleteWAL(pPager, 0); + rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0); isWal = 0; }else{ - rc = pagerCheckForOrDeleteWAL(pPager, &isWal); + rc = sqlite3OsAccess( + pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal + ); } if( rc==SQLITE_OK ){ if( isWal ){ @@ -6084,8 +6060,7 @@ int sqlite3PagerOpenWal( ** (e.g. due to malloc() failure), unlock the database file and ** return an error code. */ - rc = sqlite3WalOpen(pPager->pVfs, pPager->fd, - pPager->zWal, &pPager->pWal); + rc = sqlite3WalOpen(pPager->pVfs, pPager->fd, pPager->zWal, &pPager->pWal); if( rc==SQLITE_OK ){ pPager->journalMode = PAGER_JOURNALMODE_WAL; } @@ -6118,7 +6093,9 @@ int sqlite3PagerCloseWal(Pager *pPager){ int logexists = 0; rc = sqlite3OsLock(pPager->fd, SQLITE_LOCK_SHARED); if( rc==SQLITE_OK ){ - rc = pagerCheckForOrDeleteWAL(pPager, &logexists); + rc = sqlite3OsAccess( + pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &logexists + ); } if( rc==SQLITE_OK && logexists ){ rc = sqlite3WalOpen(pPager->pVfs, pPager->fd,