Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void Database::Deleter::operator()(sqlite3* apSQLite)
SQLITECPP_ASSERT(SQLITE_OK == ret, "database is locked"); // See SQLITECPP_ENABLE_ASSERT_HANDLER
}

//Set a busy handler that sleeps for a specified amount of time when a table is locked.
// Set a busy handler that sleeps for a specified amount of time when a table is locked.
void Database::setBusyTimeout(const int aBusyTimeoutMs)
{
const int ret = sqlite3_busy_timeout(getHandle(), aBusyTimeoutMs);
Expand Down
6 changes: 3 additions & 3 deletions src/Savepoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Savepoint::~Savepoint() {
if (!mbReleased) {
try {
rollback();
release();
} catch (SQLite::Exception&) {
// Never throw an exception in a destructor: error if already rolled
// back or released, but no harm is caused by this.
Expand All @@ -49,17 +50,16 @@ void Savepoint::release() {
mDatabase.exec(std::string("RELEASE SAVEPOINT ") + msName);
mbReleased = true;
} else {
throw SQLite::Exception("Savepoint already released or rolled back.");
throw SQLite::Exception("Savepoint already released.");
}
}

// Rollback the savepoint
void Savepoint::rollback() {
if (!mbReleased) {
mDatabase.exec(std::string("ROLLBACK TO SAVEPOINT ") + msName);
mbReleased = true;
} else {
throw SQLite::Exception("Savepoint already released or rolled back.");
throw SQLite::Exception("Savepoint already released.");
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Savepoint_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TEST(Savepoint, commitRollback) {
db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)"));
EXPECT_EQ(SQLite::OK, db.getErrorCode());

// Insert a first valu
// Insert a first value
EXPECT_EQ(1, db.exec("INSERT INTO test VALUES (NULL, 'first')"));
EXPECT_EQ(1, db.getLastInsertRowid());

Expand Down