1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

The noReadlock property on a pager object implies the readOnly property.

Use this fact to simplify the logic in sqlite3PagerSharedLock(). (CVS 6944)

FossilOrigin-Name: 886e665f6cf780464b280c286b03c9fb5c1a6b2a
This commit is contained in:
drh
2009-07-25 22:13:34 +00:00
parent f31506b7b7
commit a53c704fec
3 changed files with 12 additions and 11 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.626 2009/07/25 19:31:32 drh Exp $
** @(#) $Id: pager.c,v 1.627 2009/07/25 22:13:35 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -3567,14 +3567,15 @@ int sqlite3PagerSharedLock(Pager *pPager){
int isHotJournal = 0;
assert( !MEMDB );
assert( sqlite3PcacheRefCount(pPager->pPCache)==0 );
if( !pPager->noReadlock ){
if( pPager->noReadlock ){
assert( pPager->readOnly );
pPager->state = PAGER_SHARED;
}else{
rc = pager_wait_on_lock(pPager, SHARED_LOCK);
if( rc!=SQLITE_OK ){
assert( pPager->state==PAGER_UNLOCK );
return pager_error(pPager, rc);
}
}else if( pPager->state==PAGER_UNLOCK ){
pPager->state = PAGER_SHARED;
}
assert( pPager->state>=SHARED_LOCK );