SQLite: fix handling of SQLITE_DEFAULT_SYNCHRONOUS macros.

This commit is contained in:
levlam 2022-10-06 01:47:45 +03:00
parent 4af5c4f5dd
commit 6176272d60

View File

@ -60743,17 +60743,24 @@ act_like_temp_file:
pPager->memDb = (u8)memDb; pPager->memDb = (u8)memDb;
pPager->readOnly = (u8)readOnly; pPager->readOnly = (u8)readOnly;
assert( useJournal || pPager->tempFile ); assert( useJournal || pPager->tempFile );
pPager->noSync = pPager->tempFile; int level = SQLITE_DEFAULT_SYNCHRONOUS + 1;
pPager->noSync = pPager->tempFile || level==PAGER_SYNCHRONOUS_OFF;
if( pPager->noSync ){ if( pPager->noSync ){
assert( pPager->fullSync==0 ); assert( pPager->fullSync==0 );
assert( pPager->extraSync==0 ); assert( pPager->extraSync==0 );
assert( pPager->syncFlags==0 ); assert( pPager->syncFlags==0 );
assert( pPager->walSyncFlags==0 ); assert( pPager->walSyncFlags==0 );
}else{ }else{
pPager->fullSync = 1; pPager->fullSync = level>=PAGER_SYNCHRONOUS_FULL ?1:0;
pPager->extraSync = 0; pPager->extraSync = level==PAGER_SYNCHRONOUS_EXTRA ?1:0;
pPager->syncFlags = SQLITE_SYNC_NORMAL; pPager->syncFlags = SQLITE_SYNC_NORMAL;
pPager->walSyncFlags = SQLITE_SYNC_NORMAL | (SQLITE_SYNC_NORMAL<<2); pPager->walSyncFlags = (pPager->syncFlags<<2);
if( pPager->fullSync ){
pPager->walSyncFlags |= pPager->syncFlags;
}
#if SQLITE_DEFAULT_CKPTFULLFSYNC
pPager->walSyncFlags |= (SQLITE_SYNC_FULL<<2);
#endif
} }
/* pPager->pFirst = 0; */ /* pPager->pFirst = 0; */
/* pPager->pFirstSynced = 0; */ /* pPager->pFirstSynced = 0; */