1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Remove the requirement to open the wal file before sqlite3_snapshot_recover()

is called. Also add some comments to new functions.

FossilOrigin-Name: 28393c413cc4505b94411730e728583c5d4baaae
This commit is contained in:
dan
2016-11-19 18:31:37 +00:00
parent 4d4757fcc8
commit 93f5113290
6 changed files with 86 additions and 61 deletions

View File

@@ -4064,7 +4064,11 @@ int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb){
if( iDb==0 || iDb>1 ){
Btree *pBt = db->aDb[iDb].pBt;
if( 0==sqlite3BtreeIsInReadTrans(pBt) ){
rc = sqlite3PagerSnapshotRecover(sqlite3BtreePager(pBt));
rc = sqlite3BtreeBeginTrans(pBt, 0);
if( rc==SQLITE_OK ){
rc = sqlite3PagerSnapshotRecover(sqlite3BtreePager(pBt));
sqlite3BtreeCommit(pBt);
}
}
}
sqlite3_mutex_leave(db->mutex);