All queries are now in a transaction

This commit is contained in:
Quentin Snow 2023-01-28 12:28:43 -06:00
parent 30290fc317
commit 8071bae4d9

View File

@ -43,6 +43,10 @@ int main(int argc, char *argv[]) {
if (rc != SQLITE_OK)
throw std::runtime_error("Error enabling foreign_keys. Database might be malformed.");
rc = sqlite3_exec(db, "BEGIN", nullptr, nullptr, nullptr);
if (rc != SQLITE_OK)
throw std::runtime_error("Couldn't begin transaction");
std::vector<char *> args(argv, argv + argc);
try {
OptHandlers::MainOptHandler moh(args, db);
@ -60,5 +64,9 @@ int main(int argc, char *argv[]) {
return 1;
}
rc = sqlite3_exec(db, "COMMIT", nullptr, nullptr, nullptr);
if (rc != SQLITE_OK)
throw std::runtime_error("Couldn't commit transaction");
return 0;
}