From 7a6c664014d044b85e3501fc508e2c59c680c270 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Mon, 9 Jul 2018 13:03:03 +0200 Subject: [PATCH] Code beautifying --- src/core/database.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/core/database.cpp b/src/core/database.cpp index b017565..1ad5f43 100644 --- a/src/core/database.cpp +++ b/src/core/database.cpp @@ -5,20 +5,17 @@ Database::Database(const std::string& dbname) : db(nullptr) { const int errCode = sqlite3_open(dbname.c_str(), &db); - if(errCode) { + if (errCode) { throw std::runtime_error("Could not open database file."); } } -Database::~Database() -{ - sqlite3_close(db); -} +Database::~Database() { sqlite3_close(db); } void Database::exec(const std::string& sql) { const int errCode = sqlite3_exec(db, sql.c_str(), nullptr, nullptr, nullptr); - if(errCode) { + if (errCode) { throw std::runtime_error("Error in SQL execution."); } } \ No newline at end of file