summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/database/database.cpp4
-rw-r--r--src/database/engine.hpp1
-rw-r--r--src/database/statement.hpp1
3 files changed, 4 insertions, 2 deletions
diff --git a/src/database/database.cpp b/src/database/database.cpp
index b1a5ba5..f9a365d 100644
--- a/src/database/database.cpp
+++ b/src/database/database.cpp
@@ -37,7 +37,7 @@ void Database::open(const std::string& filename)
std::unique_ptr<DatabaseEngine> new_db;
static const auto psql_prefix = "postgresql://"s;
if (filename.substr(0, psql_prefix.size()) == psql_prefix)
- new_db = PostgresqlEngine::open("dbname="s + filename.substr(psql_prefix.size()));
+ new_db = PostgresqlEngine::open(filename);
else
new_db = Sqlite3Engine::open(filename);
if (!new_db)
@@ -242,7 +242,7 @@ std::vector<Database::RosterItem> Database::get_full_roster()
void Database::close()
{
- Database::db.release();
+ Database::db = nullptr;
}
std::string Database::gen_uuid()
diff --git a/src/database/engine.hpp b/src/database/engine.hpp
index 2dd4c21..41dccf5 100644
--- a/src/database/engine.hpp
+++ b/src/database/engine.hpp
@@ -20,6 +20,7 @@ class DatabaseEngine
public:
DatabaseEngine() = default;
+ virtual ~DatabaseEngine() = default;
DatabaseEngine(const DatabaseEngine&) = delete;
DatabaseEngine& operator=(const DatabaseEngine&) = delete;
diff --git a/src/database/statement.hpp b/src/database/statement.hpp
index db5f31b..4a61928 100644
--- a/src/database/statement.hpp
+++ b/src/database/statement.hpp
@@ -14,6 +14,7 @@ enum class StepResult
class Statement
{
public:
+ virtual ~Statement() = default;
virtual StepResult step() = 0;
virtual void bind(std::vector<std::string> params) = 0;