aboutsummaryrefslogtreecommitdiff
path: root/lib/database.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/database.cpp')
-rw-r--r--lib/database.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/lib/database.cpp b/lib/database.cpp
index 4eb82cf5..2b472648 100644
--- a/lib/database.cpp
+++ b/lib/database.cpp
@@ -323,23 +323,21 @@ void Database::saveCurrentOutboundMegolmSession(
const QOlmOutboundGroupSession& session)
{
const auto pickle = session.pickle(picklingMode);
- if (pickle) {
- auto deleteQuery = prepareQuery(QStringLiteral("DELETE FROM outbound_megolm_sessions WHERE roomId=:roomId AND sessionId=:sessionId;"));
- deleteQuery.bindValue(":roomId", roomId);
- deleteQuery.bindValue(":sessionId", session.sessionId());
-
- auto insertQuery = prepareQuery(QStringLiteral("INSERT INTO outbound_megolm_sessions(roomId, sessionId, pickle, creationTime, messageCount) VALUES(:roomId, :sessionId, :pickle, :creationTime, :messageCount);"));
- insertQuery.bindValue(":roomId", roomId);
- insertQuery.bindValue(":sessionId", session.sessionId());
- insertQuery.bindValue(":pickle", pickle.value());
- insertQuery.bindValue(":creationTime", session.creationTime());
- insertQuery.bindValue(":messageCount", session.messageCount());
-
- transaction();
- execute(deleteQuery);
- execute(insertQuery);
- commit();
- }
+ auto deleteQuery = prepareQuery(QStringLiteral("DELETE FROM outbound_megolm_sessions WHERE roomId=:roomId AND sessionId=:sessionId;"));
+ deleteQuery.bindValue(":roomId", roomId);
+ deleteQuery.bindValue(":sessionId", session.sessionId());
+
+ auto insertQuery = prepareQuery(QStringLiteral("INSERT INTO outbound_megolm_sessions(roomId, sessionId, pickle, creationTime, messageCount) VALUES(:roomId, :sessionId, :pickle, :creationTime, :messageCount);"));
+ insertQuery.bindValue(":roomId", roomId);
+ insertQuery.bindValue(":sessionId", session.sessionId());
+ insertQuery.bindValue(":pickle", pickle);
+ insertQuery.bindValue(":creationTime", session.creationTime());
+ insertQuery.bindValue(":messageCount", session.messageCount());
+
+ transaction();
+ execute(deleteQuery);
+ execute(insertQuery);
+ commit();
}
QOlmOutboundGroupSessionPtr Database::loadCurrentOutboundMegolmSession(const QString& roomId, const PicklingMode& picklingMode)