diff options
author | louiz’ <louiz@louiz.org> | 2016-07-12 00:31:57 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2016-07-12 00:31:57 +0200 |
commit | 4c1b9abe7e230a39b119bdc45ebcd5e677fad488 (patch) | |
tree | 52ef96df3fb94412787a3fac099d53199540b8f4 /src/database/database.hpp | |
parent | 03feb403f8fc702481f4e7a0ec0264aa2912ae51 (diff) | |
download | biboumi-4c1b9abe7e230a39b119bdc45ebcd5e677fad488.tar.gz biboumi-4c1b9abe7e230a39b119bdc45ebcd5e677fad488.tar.bz2 biboumi-4c1b9abe7e230a39b119bdc45ebcd5e677fad488.tar.xz biboumi-4c1b9abe7e230a39b119bdc45ebcd5e677fad488.zip |
Properly catch and handle database errors
Do not use a singleton for the database.
fix #3203
Diffstat (limited to 'src/database/database.hpp')
-rw-r--r-- | src/database/database.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database/database.hpp b/src/database/database.hpp index 0131669..7173bcd 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -26,7 +26,7 @@ public: template<typename PersistentType> static size_t count() { - return litesql::select<PersistentType>(Database::get_db()).count(); + return litesql::select<PersistentType>(*Database::db).count(); } /** * Return the object from the db. Create it beforehand (with all default @@ -42,11 +42,11 @@ public: const std::string& channel); static void close(); + static void open(const std::string& filename, const std::string& db_type="sqlite3"); + private: static std::unique_ptr<db::BibouDB> db; - - static db::BibouDB& get_db(); }; #endif /* USE_DATABASE */ |