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

Merge in the blocking-checkpoint enhancement, including the new

sqlite3_wal_checkpoint_v2() interface and the
PRAGMA wal_checkpoint(full) statement.

FossilOrigin-Name: bac7342c368a7c4f5f2878e08d9581dcbf57dd58
This commit is contained in:
drh
2011-02-02 16:34:08 +00:00
23 changed files with 806 additions and 121 deletions

View File

@@ -5215,13 +5215,33 @@ case OP_AggFinal: {
}
#ifndef SQLITE_OMIT_WAL
/* Opcode: Checkpoint P1 * * * *
/* Opcode: Checkpoint P1 P2 P3 * *
**
** Checkpoint database P1. This is a no-op if P1 is not currently in
** WAL mode.
** WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL
** or RESTART.
*/
case OP_Checkpoint: {
rc = sqlite3Checkpoint(db, pOp->p1);
int nLog = -1; /* Number of pages in WAL log */
int nCkpt = -1; /* Number of checkpointed pages */
int bBusy = 0;
assert( pOp->p2==SQLITE_CHECKPOINT_PASSIVE
|| pOp->p2==SQLITE_CHECKPOINT_FULL
|| pOp->p2==SQLITE_CHECKPOINT_RESTART
);
rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &nLog, &nCkpt);
if( rc==SQLITE_BUSY ){
rc = SQLITE_OK;
bBusy = 1;
}
aMem[1].u.i = bBusy;
aMem[2].u.i = nLog;
aMem[3].u.i = nCkpt;
MemSetTypeFlag(&aMem[1], MEM_Int);
MemSetTypeFlag(&aMem[2], MEM_Int);
MemSetTypeFlag(&aMem[3], MEM_Int);
break;
};
#endif