Skip to content

Commit

Permalink
Implement SQLiteBatch::Close
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Oct 14, 2020
1 parent 9382535 commit 6636a26
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/wallet/sqlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ SQLiteBatch::SQLiteBatch(SQLiteDatabase& database)

void SQLiteBatch::Close()
{
// If m_db is in a transaction (i.e. not in autocommit mode), then abort the transaction in progress
if (m_database.m_db && sqlite3_get_autocommit(m_database.m_db) == 0) {
if (TxnAbort()) {
LogPrintf("SQLiteBatch: Batch closed unexpectedly without the transaction being explicitly committed or aborted\n");
} else {
LogPrintf("SQLiteBatch: Batch closed and failed to abort transaction\n");
}
}
}

bool SQLiteBatch::ReadKey(CDataStream&& key, CDataStream& value)
Expand Down

0 comments on commit 6636a26

Please sign in to comment.