From 61de6b1dac4ef29627f3bdb9ce11b6c0d06f4a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Tue, 24 Apr 2018 19:19:06 +0200 Subject: Revert "Use a different Date data type" This reverts commit 857c7d3972a03cbeebf730d99b924d3710dee6a0. --- src/database/database.hpp | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'src/database/database.hpp') diff --git a/src/database/database.hpp b/src/database/database.hpp index 75ff8f3..d986ecc 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -10,7 +10,6 @@ #include #include -#include #include #include @@ -18,9 +17,11 @@ #include #include + class Database { public: + using time_point = std::chrono::system_clock::time_point; struct RecordNotFound: public std::exception {}; enum class Paging { first, last }; @@ -36,8 +37,7 @@ class Database struct Server: Column { static constexpr auto name = "server_"; }; - struct OldDate: Column { static constexpr auto name = "date_"; }; - struct Date: Column { static constexpr auto name = "date_"; }; + struct Date: Column { static constexpr auto name = "date_"; }; struct Body: Column { static constexpr auto name = "body_"; }; @@ -88,8 +88,6 @@ class Database using MucLogLineTable = Table; using MucLogLine = MucLogLineTable::RowType; - using OldMucLogLineTable = Table; - using OldMucLogLine = OldMucLogLineTable::RowType; using GlobalOptionsTable = Table; using GlobalOptions = GlobalOptionsTable::RowType; @@ -143,7 +141,7 @@ class Database */ static MucLogLine get_muc_log(const std::string& owner, const std::string& chan_name, const std::string& server, const std::string& uuid, const std::string& start="", const std::string& end=""); static std::string store_muc_message(const std::string& owner, const std::string& chan_name, const std::string& server_name, - DateTime::time_point date, const std::string& body, const std::string& nick); + time_point date, const std::string& body, const std::string& nick); static void add_roster_item(const std::string& local, const std::string& remote); static bool has_roster_item(const std::string& local, const std::string& remote); @@ -170,13 +168,6 @@ class Database static std::unique_ptr db; - static DatabaseEngine::EngineType engine_type() - { - if (Database::db) - return Database::db->engine_type(); - return DatabaseEngine::EngineType::None; - } - /** * Some caches, to avoid doing very frequent query requests for a few options. */ @@ -225,20 +216,7 @@ class Transaction public: Transaction(); ~Transaction(); - void rollback(); bool success{false}; }; -template -void convert_date_format(DatabaseEngine& db, Table table) -{ - const auto existing_columns = db.get_all_columns_from_table(table.get_name()); - const auto date_pair = existing_columns.find(Database::Date::name); - if (date_pair != existing_columns.end() && date_pair->second == "integer") - { - log_info("Converting Date_ format to the new one."); - db.convert_date_format(db); - } -} - #endif /* USE_DATABASE */ -- cgit v1.2.3