From caa35b36acbb6105834af761d17b063b3706f633 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Mon, 9 Jul 2018 21:03:59 +0200 Subject: [PATCH] more on database --- src/core/database.cpp | 10 ++++++++++ src/core/database.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/core/database.cpp b/src/core/database.cpp index 1ad5f43..0b3207a 100644 --- a/src/core/database.cpp +++ b/src/core/database.cpp @@ -18,4 +18,14 @@ void Database::exec(const std::string& sql) if (errCode) { throw std::runtime_error("Error in SQL execution."); } +} + +void Database::beginTransaction() +{ + exec("BEGIN TRANSACTION"); +} + +void Database::endTransaction() +{ + exec("END TRANSACTION"); } \ No newline at end of file diff --git a/src/core/database.h b/src/core/database.h index dcb2858..5fcf027 100644 --- a/src/core/database.h +++ b/src/core/database.h @@ -15,6 +15,8 @@ public: void exec(const std::string& sql); private: sqlite3 *db; + void beginTransaction(); + void endTransaction(); }; #endif // DATABASE_H \ No newline at end of file