Simplified grouping of found messages

pull/215/head
M66B 6 months ago
parent c7b8774f00
commit 1b770c89eb

@ -42,7 +42,6 @@ public interface DaoMessage {
String is_drafts = "folder.type = '" + EntityFolder.DRAFTS + "'"; String is_drafts = "folder.type = '" + EntityFolder.DRAFTS + "'";
String is_outbox = "folder.type = '" + EntityFolder.OUTBOX + "'"; String is_outbox = "folder.type = '" + EntityFolder.OUTBOX + "'";
String is_sent = "folder.type = '" + EntityFolder.SENT + "'"; String is_sent = "folder.type = '" + EntityFolder.SENT + "'";
String is_outgoing = is_drafts + " OR " + is_outbox + " OR " + is_sent;
@Transaction @Transaction
@SuppressWarnings(RoomWarnings.CURSOR_MISMATCH) @SuppressWarnings(RoomWarnings.CURSOR_MISMATCH)
@ -71,7 +70,7 @@ public interface DaoMessage {
", message.priority AS ui_priority" + ", message.priority AS ui_priority" +
", message.importance AS ui_importance" + ", message.importance AS ui_importance" +
", MAX(CASE WHEN" + ", MAX(CASE WHEN" +
" (:found AND folder.type <> '" + EntityFolder.ARCHIVE + "' AND NOT (" + is_outgoing + "))" + " (:found AND folder.type <> '" + EntityFolder.ARCHIVE + "')" +
" OR (NOT :found AND :type IS NULL AND folder.unified)" + " OR (NOT :found AND :type IS NULL AND folder.unified)" +
" OR (NOT :found AND folder.type = :type)" + " OR (NOT :found AND folder.type = :type)" +
" THEN message.received ELSE 0 END) AS dummy" + " THEN message.received ELSE 0 END) AS dummy" +
@ -149,7 +148,7 @@ public interface DaoMessage {
", message.priority AS ui_priority" + ", message.priority AS ui_priority" +
", message.importance AS ui_importance" + ", message.importance AS ui_importance" +
", MAX(CASE WHEN" + ", MAX(CASE WHEN" +
" (:found AND folder.type <> '" + EntityFolder.ARCHIVE + "' AND NOT (" + is_outgoing + "))" + " (:found AND folder.type <> '" + EntityFolder.ARCHIVE + "')" +
" OR (NOT :found AND folder.id = :folder)" + " OR (NOT :found AND folder.id = :folder)" +
" THEN message.received ELSE 0 END) AS dummy" + " THEN message.received ELSE 0 END) AS dummy" +
" FROM message" + " FROM message" +
@ -1096,7 +1095,7 @@ public interface DaoMessage {
", message.priority AS ui_priority" + ", message.priority AS ui_priority" +
", message.importance AS ui_importance" + ", message.importance AS ui_importance" +
", MAX(CASE WHEN" + ", MAX(CASE WHEN" +
" (:found AND folder.type <> '" + EntityFolder.ARCHIVE + "' AND NOT (" + is_outgoing + "))" + " (:found AND folder.type <> '" + EntityFolder.ARCHIVE + "')" +
" OR (NOT :found AND :type IS NULL AND folder.unified)" + " OR (NOT :found AND :type IS NULL AND folder.unified)" +
" OR (NOT :found AND folder.type = :type)" + " OR (NOT :found AND folder.type = :type)" +
" THEN message.received ELSE 0 END) AS dummy" + " THEN message.received ELSE 0 END) AS dummy" +
@ -1182,7 +1181,7 @@ public interface DaoMessage {
", message.priority AS ui_priority" + ", message.priority AS ui_priority" +
", message.importance AS ui_importance" + ", message.importance AS ui_importance" +
", MAX(CASE WHEN" + ", MAX(CASE WHEN" +
" (:found AND folder.type <> '" + EntityFolder.ARCHIVE + "' AND NOT (" + is_outgoing + "))" + " (:found AND folder.type <> '" + EntityFolder.ARCHIVE + "')" +
" OR (NOT :found AND folder.id = :folder)" + " OR (NOT :found AND folder.id = :folder)" +
" THEN message.received ELSE 0 END) AS dummy" + " THEN message.received ELSE 0 END) AS dummy" +
" FROM (SELECT * FROM message" + " FROM (SELECT * FROM message" +

Loading…
Cancel
Save