aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2010-05-03 15:58:50 +0000
committerdan <dan@noemail.net>2010-05-03 15:58:50 +0000
commitaf0cfd366a3873256d96b8a6da5538e5342e8e2a (patch)
treea73008641dc9f8ee5880e18566e5617245dacdfe /src/main.c
parentb7e8ea201518d52b01ac7b5b40df7e05fe9dd6be (diff)
downloadsqlite-af0cfd366a3873256d96b8a6da5538e5342e8e2a.tar.gz
sqlite-af0cfd366a3873256d96b8a6da5538e5342e8e2a.zip
Have sqlite3_wal_checkpoint() handle a zero-length string in the same way as a NULL pointer. Fix "PRAGMA wal_checkpoint" so that it checkpoints all attached databases.
FossilOrigin-Name: 7fecd21f45b9ce773ffbcef6c84066474e8cd01c
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c6
1 files changed, 4 insertions, 2 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 ){