aboutsummaryrefslogtreecommitdiff
path: root/3rdparty/sqlitecpp/source/SQLiteCpp/Savepoint.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/Savepoint.cpp
parentfad6a88a13ab1f888ab25ad0aae19c1d63aa0623 (diff)
Start from a clean slate
Diffstat (limited to '3rdparty/sqlitecpp/source/SQLiteCpp/Savepoint.cpp')
-rw-r--r--3rdparty/sqlitecpp/source/SQLiteCpp/Savepoint.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/3rdparty/sqlitecpp/source/SQLiteCpp/Savepoint.cpp b/3rdparty/sqlitecpp/source/SQLiteCpp/Savepoint.cpp
deleted file mode 100644
index b3d13a2..0000000
--- a/3rdparty/sqlitecpp/source/SQLiteCpp/Savepoint.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * @file Savepoint.cpp
- * @ingroup SQLiteCpp
- * @brief A Savepoint is a way to group multiple SQL statements into an atomic
- * secured operation. Similar to a transaction while allowing child savepoints.
- *
- * Copyright (c) 2020 Kelvin Hammond ([email protected])
- *
- * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt or
- * copy at http://opensource.org/licenses/MIT)
- */
-
-#include <SQLiteCpp/Assertion.h>
-#include <SQLiteCpp/Database.h>
-#include <SQLiteCpp/Savepoint.h>
-#include <SQLiteCpp/Statement.h>
-
-namespace SQLite {
-
-// Begins the SQLite savepoint
-Savepoint::Savepoint(Database& aDatabase, std::string aName)
- : mDatabase(aDatabase), msName(aName), mbReleased(false) {
- // workaround because you cannot bind to SAVEPOINT
- // escape name for use in query
- Statement stmt(mDatabase, "SELECT quote(?)");
- stmt.bind(1, msName);
- stmt.executeStep();
- msName = stmt.getColumn(0).getText();
-
- mDatabase.exec(std::string("SAVEPOINT ") + msName);
-}
-
-// Safely rollback the savepoint if it has not been committed.
-Savepoint::~Savepoint() {
- if (!mbReleased) {
- try {
- rollback();
- } catch (SQLite::Exception&) {
- // Never throw an exception in a destructor: error if already rolled
- // back or released, but no harm is caused by this.
- }
- }
-}
-
-// Release the savepoint and commit
-void Savepoint::release() {
- if (!mbReleased) {
- mDatabase.exec(std::string("RELEASE SAVEPOINT ") + msName);
- mbReleased = true;
- } else {
- throw SQLite::Exception("Savepoint already released or rolled back.");
- }
-}
-
-// 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.");
- }
-}
-
-} // namespace SQLite