Skip to content

Commit

Permalink
Implement SQLiteDatabase::Rewrite
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
achow101 committed Oct 14, 2020
1 parent 010e365 commit b4df8fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/wallet/sqlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ void SQLiteDatabase::Open()

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

bool SQLiteDatabase::Backup(const std::string& dest) const
Expand Down

0 comments on commit b4df8fd

Please sign in to comment.