From 5ef7ba08028065b03d51d1dc70bb35aeb41ae19d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Sat, 14 Apr 2018 19:48:45 +0200 Subject: Use the Date to find a next page in RSM, not the id This way, it works, whatever the order of insertion in the database was. fix #3343 --- src/database/database.cpp | 9 +++++---- src/database/database.hpp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/database') diff --git a/src/database/database.cpp b/src/database/database.cpp index c935139..fb24ad3 100644 --- a/src/database/database.cpp +++ b/src/database/database.cpp @@ -192,7 +192,7 @@ std::string Database::store_muc_message(const std::string& owner, const std::str } std::vector Database::get_muc_logs(const std::string& owner, const std::string& chan_name, const std::string& server, - int limit, const std::string& start, const std::string& end, const Id::real_type reference_record_id, Database::Paging paging) + int limit, const std::string& start, const std::string& end, const std::string& reference_uuid, Database::Paging paging) { if (limit == 0) return {}; @@ -222,14 +222,15 @@ std::vector Database::get_muc_logs(const std::string& owne request << " and " << Database::Date{} << "<=" << writer; } } - if (reference_record_id != Id::unset_value) + if (!reference_uuid.empty()) { - request << " and " << Id{}; + request << " and " << Database::Date{}; if (paging == Database::Paging::first) request << ">"; else request << "<"; - request << reference_record_id; + request << "(SELECT " << Database::Date{} << " FROM " << Database::muc_log_lines.get_name().data() + << " WHERE " << Database::Uuid{} << " = " << reference_uuid << ")"; } if (paging == Database::Paging::first) diff --git a/src/database/database.hpp b/src/database/database.hpp index 75ff8f3..b4c4fa0 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -135,7 +135,7 @@ class Database */ static std::vector get_muc_logs(const std::string& owner, const std::string& chan_name, const std::string& server, int limit=-1, const std::string& start="", const std::string& end="", - const Id::real_type reference_record_id=Id::unset_value, Paging=Paging::first); + const std::string& reference_record_id={}, Paging=Paging::first); /** * Get just one single record matching the given uuid, between (optional) end and start. -- cgit v1.2.3