Code beautifying
This commit is contained in:
parent
0b0e754b49
commit
7a6c664014
1 changed files with 3 additions and 6 deletions
|
@ -5,20 +5,17 @@
|
||||||
Database::Database(const std::string& dbname) : db(nullptr)
|
Database::Database(const std::string& dbname) : db(nullptr)
|
||||||
{
|
{
|
||||||
const int errCode = sqlite3_open(dbname.c_str(), &db);
|
const int errCode = sqlite3_open(dbname.c_str(), &db);
|
||||||
if(errCode) {
|
if (errCode) {
|
||||||
throw std::runtime_error("Could not open database file.");
|
throw std::runtime_error("Could not open database file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Database::~Database()
|
Database::~Database() { sqlite3_close(db); }
|
||||||
{
|
|
||||||
sqlite3_close(db);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Database::exec(const std::string& sql)
|
void Database::exec(const std::string& sql)
|
||||||
{
|
{
|
||||||
const int errCode = sqlite3_exec(db, sql.c_str(), nullptr, nullptr, nullptr);
|
const int errCode = sqlite3_exec(db, sql.c_str(), nullptr, nullptr, nullptr);
|
||||||
if(errCode) {
|
if (errCode) {
|
||||||
throw std::runtime_error("Error in SQL execution.");
|
throw std::runtime_error("Error in SQL execution.");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue