aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
-rw-r--r--src/pragma.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 77a790d46..962c857d6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1253,7 +1253,9 @@ void *sqlite3_wal_hook(
/*
-** Checkpoint database zDb. If zDb is NULL, the main database is checkpointed.
+** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points
+** to contains a zero-length string, all attached databases are
+** checkpointed.
*/
int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
#ifdef SQLITE_OMIT_WAL
@@ -1263,7 +1265,7 @@ int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
int iDb = SQLITE_MAX_ATTACHED; /* sqlite3.aDb[] index of db to checkpoint */
sqlite3_mutex_enter(db->mutex);
- if( zDb ){
+ if( zDb && zDb[0] ){
iDb = sqlite3FindDbName(db, zDb);
}
if( iDb<0 ){
diff --git a/src/pragma.c b/src/pragma.c
index 65a0550bc..c3aaaf9b3 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -1408,7 +1408,7 @@ void sqlite3Pragma(
*/
if( sqlite3StrICmp(zLeft, "wal_checkpoint")==0 ){
if( sqlite3ReadSchema(pParse) ) goto pragma_out;
- sqlite3VdbeAddOp3(v, OP_Checkpoint, iDb, 0, 0);
+ sqlite3VdbeAddOp3(v, OP_Checkpoint, pId2->z?iDb:SQLITE_MAX_ATTACHED, 0, 0);
}else
/*