aboutsummaryrefslogtreecommitdiff
path: root/3rdparty/sqlitecpp/source/SQLiteCpp/Transaction.cpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-06-27 18:27:13 -0700
committerrtk0c <[email protected]>2022-06-27 18:27:13 -0700
commit8f0dda5eab181b0f14f2652b4e984aaaae3f258c (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /3rdparty/sqlitecpp/source/SQLiteCpp/Transaction.cpp
parentfad6a88a13ab1f888ab25ad0aae19c1d63aa0623 (diff)
Start from a clean slate
Diffstat (limited to '3rdparty/sqlitecpp/source/SQLiteCpp/Transaction.cpp')
-rw-r--r--3rdparty/sqlitecpp/source/SQLiteCpp/Transaction.cpp83
1 files changed, 0 insertions, 83 deletions
diff --git a/3rdparty/sqlitecpp/source/SQLiteCpp/Transaction.cpp b/3rdparty/sqlitecpp/source/SQLiteCpp/Transaction.cpp
deleted file mode 100644
index 2a8857a..0000000
--- a/3rdparty/sqlitecpp/source/SQLiteCpp/Transaction.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * @file Transaction.cpp
- * @ingroup SQLiteCpp
- * @brief A Transaction is way to group multiple SQL statements into an atomic secured operation.
- *
- * Copyright (c) 2012-2019 Sebastien Rombauts ([email protected])
- *
- * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
- * or copy at http://opensource.org/licenses/MIT)
- */
-#include <SQLiteCpp/Transaction.h>
-
-#include <SQLiteCpp/Database.h>
-#include <SQLiteCpp/Assertion.h>
-
-#include <sqlite3.h>
-
-namespace SQLite
-{
-
-
-// Begins the SQLite transaction
-Transaction::Transaction(Database& aDatabase, TransactionBehavior behavior) :
- mDatabase(aDatabase),
- mbCommited(false)
-{
- const char *stmt;
- switch (behavior) {
- case TransactionBehavior::DEFERRED:
- stmt = "BEGIN DEFERRED";
- break;
- case TransactionBehavior::IMMEDIATE:
- stmt = "BEGIN IMMEDIATE";
- break;
- case TransactionBehavior::EXCLUSIVE:
- stmt = "BEGIN EXCLUSIVE";
- break;
- default:
- throw SQLite::Exception("invalid/unknown transaction behavior", SQLITE_ERROR);
- }
- mDatabase.exec(stmt);
-}
-
-// Begins the SQLite transaction
-Transaction::Transaction(Database &aDatabase) :
- mDatabase(aDatabase),
- mbCommited(false)
-{
- mDatabase.exec("BEGIN");
-}
-
-// Safely rollback the transaction if it has not been committed.
-Transaction::~Transaction()
-{
- if (false == mbCommited)
- {
- try
- {
- mDatabase.exec("ROLLBACK");
- }
- catch (SQLite::Exception&)
- {
- // Never throw an exception in a destructor: error if already rollbacked, but no harm is caused by this.
- }
- }
-}
-
-// Commit the transaction.
-void Transaction::commit()
-{
- if (false == mbCommited)
- {
- mDatabase.exec("COMMIT");
- mbCommited = true;
- }
- else
- {
- throw SQLite::Exception("Transaction already committed.");
- }
-}
-
-
-} // namespace SQLite