Query fixes

This commit is contained in:
M66B 2019-06-27 09:43:03 +02:00
parent 9e6d9903c0
commit 898e7bccf3
2 changed files with 14 additions and 14 deletions

View File

@ -62,7 +62,7 @@ public interface DaoAccount {
" FROM account" + " FROM account" +
" LEFT JOIN folder AS drafts ON drafts.account = account.id" + " LEFT JOIN folder AS drafts ON drafts.account = account.id" +
" WHERE :all OR account.synchronize" + " WHERE :all OR account.synchronize" +
" AND drafts.type = '" + EntityFolder.DRAFTS + "'" + " AND (drafts.type = '" + EntityFolder.DRAFTS + "' OR drafts.type IS NULL)" +
" GROUP BY account.id" + " GROUP BY account.id" +
" ORDER BY CASE WHEN :all THEN 0 ELSE account.`order` END" + " ORDER BY CASE WHEN :all THEN 0 ELSE account.`order` END" +
", CASE WHEN :all THEN 0 ELSE account.`primary` END DESC" + ", CASE WHEN :all THEN 0 ELSE account.`primary` END DESC" +

View File

@ -44,9 +44,9 @@ public interface DaoFolder {
" LEFT JOIN rule ON rule.folder = folder.id" + " LEFT JOIN rule ON rule.folder = folder.id" +
" LEFT JOIN operation ON operation.folder = folder.id" + " LEFT JOIN operation ON operation.folder = folder.id" +
" WHERE folder.account = :account AND account.synchronize" + " WHERE folder.account = :account AND account.synchronize" +
" AND message.ui_hide = 0" + " AND (message.ui_hide = 0 OR message.ui_hide IS NULL)" +
" AND rule.enabled" + " AND (rule.enabled OR rule.enabled IS NULL)" +
" AND operation.state = 'executing'" + " AND (operation.state = 'executing' OR operation.state IS NULL)" +
" GROUP BY folder.id") " GROUP BY folder.id")
List<TupleFolderEx> getFoldersEx(long account); List<TupleFolderEx> getFoldersEx(long account);
@ -85,9 +85,9 @@ public interface DaoFolder {
" THEN folder.unified AND account.synchronize" + " THEN folder.unified AND account.synchronize" +
" ELSE folder.account = :account AND account.synchronize" + " ELSE folder.account = :account AND account.synchronize" +
" END" + " END" +
" AND message.ui_hide = 0" + " AND (message.ui_hide = 0 OR message.ui_hide IS NULL)" +
" AND rule.enabled" + " AND (rule.enabled OR rule.enabled IS NULL)" +
" AND operation.state = 'executing'" + " AND (operation.state = 'executing' OR operation.state IS NULL)" +
" GROUP BY folder.id") " GROUP BY folder.id")
LiveData<List<TupleFolderEx>> liveFolders(Long account); LiveData<List<TupleFolderEx>> liveFolders(Long account);
@ -105,9 +105,9 @@ public interface DaoFolder {
" LEFT JOIN operation ON operation.folder = folder.id" + " LEFT JOIN operation ON operation.folder = folder.id" +
" WHERE account.`synchronize`" + " WHERE account.`synchronize`" +
" AND folder.unified" + " AND folder.unified" +
" AND message.ui_hide = 0" + " AND (message.ui_hide = 0 OR message.ui_hide IS NULL)" +
" AND rule.enabled" + " AND (rule.enabled OR rule.enabled IS NULL)" +
" AND operation.state = 'executing'" + " AND (operation.state = 'executing' OR operation.state IS NULL)" +
" GROUP BY folder.id") " GROUP BY folder.id")
LiveData<List<TupleFolderEx>> liveUnified(); LiveData<List<TupleFolderEx>> liveUnified();
@ -120,7 +120,7 @@ public interface DaoFolder {
" LEFT JOIN account ON account.id = folder.account" + " LEFT JOIN account ON account.id = folder.account" +
" LEFT JOIN message ON message.folder = folder.id" + " LEFT JOIN message ON message.folder = folder.id" +
" WHERE (account.id IS NULL OR (account.`synchronize` AND folder.navigation))" + " WHERE (account.id IS NULL OR (account.`synchronize` AND folder.navigation))" +
" AND message.ui_hide = 0" + " AND (message.ui_hide = 0 OR message.ui_hide IS NULL)" +
" GROUP BY folder.id") " GROUP BY folder.id")
LiveData<List<TupleFolderNav>> liveNavigation(); LiveData<List<TupleFolderNav>> liveNavigation();
@ -149,9 +149,9 @@ public interface DaoFolder {
" LEFT JOIN rule ON rule.folder = folder.id" + " LEFT JOIN rule ON rule.folder = folder.id" +
" LEFT JOIN operation ON operation.folder = folder.id" + " LEFT JOIN operation ON operation.folder = folder.id" +
" WHERE folder.id = :id" + " WHERE folder.id = :id" +
" AND message.ui_hide = 0" + " AND (message.ui_hide = 0 OR message.ui_hide IS NULL)" +
" AND rule.enabled" + " AND (rule.enabled OR rule.enabled IS NULL)" +
" AND operation.state = 'executing'" + " AND (operation.state = 'executing' OR operation.state IS NULL)" +
" GROUP BY folder.id") " GROUP BY folder.id")
LiveData<TupleFolderEx> liveFolderEx(long id); LiveData<TupleFolderEx> liveFolderEx(long id);