Skip to content

Commit b4df8fd

Browse files
committed
Implement SQLiteDatabase::Rewrite
Rewrite uses the VACUUM command which does exactly what we want. A specific advertised use case is to compact a database and ensure that any deleted data is actually deleted.
1 parent 010e365 commit b4df8fd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/wallet/sqlite.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ void SQLiteDatabase::Open()
181181

182182
bool SQLiteDatabase::Rewrite(const char* skip)
183183
{
184-
return false;
184+
// Rewrite the database using the VACUUM command: https://sqlite.org/lang_vacuum.html
185+
int ret = sqlite3_exec(m_db, "VACUUM", nullptr, nullptr, nullptr);
186+
return ret == SQLITE_OK;
185187
}
186188

187189
bool SQLiteDatabase::Backup(const std::string& dest) const

0 commit comments

Comments
 (0)