summaryrefslogtreecommitdiff
path: root/src/database/database.hpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-07-12 00:31:57 +0200
committerlouiz’ <louiz@louiz.org>2016-07-12 00:31:57 +0200
commit4c1b9abe7e230a39b119bdc45ebcd5e677fad488 (patch)
tree52ef96df3fb94412787a3fac099d53199540b8f4 /src/database/database.hpp
parent03feb403f8fc702481f4e7a0ec0264aa2912ae51 (diff)
downloadbiboumi-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.hpp6
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 */