--- a/src/SqlHandler.h Tue Oct 29 00:23:56 2019 +0100
+++ b/src/SqlHandler.h Tue Oct 29 19:46:08 2019 +0100
@@ -137,6 +137,18 @@
else throw SqlException(L"Unable to prepare SQLite statement.");
}
+ void transactionBegin() {
+ sqlite3_exec(db, "BEGIN", nullptr, nullptr, nullptr);
+ }
+
+ void transactionCommit() {
+ sqlite3_exec(db, "COMMIT", nullptr, nullptr, nullptr);
+ }
+
+ void transactionRollback() {
+ sqlite3_exec(db, "ROLLBACK", nullptr, nullptr, nullptr);
+ }
+
};
class SqlHandler : public RelationalReaderValueHandler {
@@ -248,6 +260,7 @@
}
connection.reset(new Connection(file.c_str()));
+ connection->transactionBegin();
}
virtual ~SqlHandler() {
@@ -335,6 +348,8 @@
// pass-through some relations:
for (const CopyRelations& copy : configuration.copyRelations) copyRelations(copy);
+
+ connection->transactionCommit();
// delete or keep the file:
if (configuration.file.size()) {