mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Modify the interface to the blocking wal-checkpoint functionality.
FossilOrigin-Name: 72787c010c8944e8fcf9c98aa4482f129142d8e9
This commit is contained in:
26
src/pragma.c
26
src/pragma.c
@@ -1393,19 +1393,29 @@ void sqlite3Pragma(
|
||||
|
||||
#ifndef SQLITE_OMIT_WAL
|
||||
/*
|
||||
** PRAGMA [database.]wal_checkpoint
|
||||
** PRAGMA [database.]wal_blocking_checkpoint
|
||||
** PRAGMA [database.]wal_checkpoint = passive|full|restart
|
||||
**
|
||||
** Checkpoint the database.
|
||||
*/
|
||||
if( sqlite3StrICmp(zLeft, "wal_checkpoint")==0
|
||||
|| sqlite3StrICmp(zLeft, "wal_blocking_checkpoint")==0
|
||||
){
|
||||
int bBlock = (zLeft[14]!=0);
|
||||
if( sqlite3StrICmp(zLeft, "wal_checkpoint")==0 ){
|
||||
int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED);
|
||||
assert( bBlock==(sqlite3StrICmp(zLeft, "wal_checkpoint")!=0) );
|
||||
int eMode = SQLITE_CHECKPOINT_PASSIVE;
|
||||
if( zRight ){
|
||||
if( sqlite3StrICmp(zRight, "full")==0 ){
|
||||
eMode = SQLITE_CHECKPOINT_FULL;
|
||||
}else if( sqlite3StrICmp(zRight, "restart")==0 ){
|
||||
eMode = SQLITE_CHECKPOINT_RESTART;
|
||||
}
|
||||
}
|
||||
if( sqlite3ReadSchema(pParse) ) goto pragma_out;
|
||||
sqlite3VdbeAddOp2(v, OP_Checkpoint, iBt, bBlock);
|
||||
sqlite3VdbeSetNumCols(v, 3);
|
||||
pParse->nMem = 3;
|
||||
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "busy", SQLITE_STATIC);
|
||||
sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "log", SQLITE_STATIC);
|
||||
sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "checkpointed", SQLITE_STATIC);
|
||||
|
||||
sqlite3VdbeAddOp2(v, OP_Checkpoint, iBt, eMode);
|
||||
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);
|
||||
}else
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user