From 4c1b9abe7e230a39b119bdc45ebcd5e677fad488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 12 Jul 2016 00:31:57 +0200 Subject: Properly catch and handle database errors Do not use a singleton for the database. fix #3203 --- src/database/database.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/database/database.hpp') 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 static size_t count() { - return litesql::select(Database::get_db()).count(); + return litesql::select(*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; - - static db::BibouDB& get_db(); }; #endif /* USE_DATABASE */ -- cgit v1.2.3