1
0
Fork 1

Need to join with monocles when getting messages

This commit is contained in:
Arne 2024-10-23 11:08:41 +02:00
parent 807fcb948c
commit 19bc30e0c0

View file

@ -1322,7 +1322,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
final Conversation conversation, final String messageId) {
final var db = this.getReadableDatabase();
final String sql =
"select * from messages where conversationUuid=? and serverMsgId=? LIMIT 1";
"select * from messages LEFT JOIN monocles.messages USING (uuid) where conversationUuid=? and serverMsgId=? LIMIT 1";
final String[] args = {conversation.getUuid(), messageId};
final Cursor cursor = db.rawQuery(sql, args);
if (cursor == null) {
@ -1342,7 +1342,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
final Conversation conversation, final String messageId) {
final var db = this.getReadableDatabase();
final String sql =
"select * from messages where conversationUuid=? and (uuid=? OR remoteMsgId=?) LIMIT 1";
"select * from messages LEFT JOIN monocles.messages USING (uuid) where conversationUuid=? and (uuid=? OR remoteMsgId=?) LIMIT 1";
final String[] args = {conversation.getUuid(), messageId, messageId};
final Cursor cursor = db.rawQuery(sql, args);
if (cursor == null) {