summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-11-29 21:40:46 +0100
committerlouiz’ <louiz@louiz.org>2017-12-02 20:08:50 +0100
commit923cf31ba62ebfd2369a9594a60020477730b649 (patch)
treea743e9e92579809c8e95395edf1304eefc09e796 /src
parent0168b96b79db2627fdba77a8712956408aa081d1 (diff)
parente1c7a6518a1aeaac1786c321aee35bd5e20acf6f (diff)
downloadbiboumi-923cf31ba62ebfd2369a9594a60020477730b649.tar.gz
biboumi-923cf31ba62ebfd2369a9594a60020477730b649.tar.bz2
biboumi-923cf31ba62ebfd2369a9594a60020477730b649.tar.xz
biboumi-923cf31ba62ebfd2369a9594a60020477730b649.zip
Merge branch 'postgresql' into 'postgresql'
Some fixes for the postgresql branch See merge request louiz/biboumi!19
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;