diff --git a/app/src/main/java/eu/faircode/email/DaoFolder.java b/app/src/main/java/eu/faircode/email/DaoFolder.java index 37474c3d37..c5806b32ef 100644 --- a/app/src/main/java/eu/faircode/email/DaoFolder.java +++ b/app/src/main/java/eu/faircode/email/DaoFolder.java @@ -218,52 +218,52 @@ public interface DaoFolder { @Insert long insertFolder(EntityFolder folder); - @Query("UPDATE folder SET unified = :unified WHERE id = :id") + @Query("UPDATE folder SET unified = :unified WHERE id = :id AND unified <> :unified") int setFolderUnified(long id, boolean unified); - @Query("UPDATE folder SET navigation = :navigation WHERE id = :id") + @Query("UPDATE folder SET navigation = :navigation WHERE id = :id AND navigation <> :navigation") int setFolderNavigation(long id, boolean navigation); - @Query("UPDATE folder SET notify = :notify WHERE id = :id") + @Query("UPDATE folder SET notify = :notify WHERE id = :id AND notify <> :notify") int setFolderNotify(long id, boolean notify); - @Query("UPDATE folder SET synchronize = :synchronize WHERE id = :id") + @Query("UPDATE folder SET synchronize = :synchronize WHERE id = :id AND synchronize <> :synchronize") int setFolderSynchronize(long id, boolean synchronize); - @Query("UPDATE folder SET state = :state WHERE id = :id") + @Query("UPDATE folder SET state = :state WHERE id = :id AND state <> :state") int setFolderState(long id, String state); - @Query("UPDATE folder SET state = :state WHERE account = :account") + @Query("UPDATE folder SET state = :state WHERE account = :account AND state <> :state") int setFolderStates(long account, String state); - @Query("UPDATE folder SET sync_state = :state WHERE id = :id") + @Query("UPDATE folder SET sync_state = :state WHERE id = :id AND sync_state <> :state") int setFolderSyncState(long id, String state); - @Query("UPDATE folder SET total = :total WHERE id = :id") + @Query("UPDATE folder SET total = :total WHERE id = :id AND total <> :total") int setFolderTotal(long id, Integer total); - @Query("UPDATE folder SET error = :error WHERE id = :id") + @Query("UPDATE folder SET error = :error WHERE id = :id AND error <> :error") int setFolderError(long id, String error); - @Query("UPDATE folder SET subscribed = :subscribed WHERE id = :id") + @Query("UPDATE folder SET subscribed = :subscribed WHERE id = :id AND subscribed <> :subscribed") int setFolderSubscribed(long id, Boolean subscribed); - @Query("UPDATE folder SET selectable = :selectable WHERE id = :id") + @Query("UPDATE folder SET selectable = :selectable WHERE id = :id AND selectable <> :selectable") int setFolderSelectable(long id, Boolean selectable); - @Query("UPDATE folder SET inferiors = :inferiors WHERE id = :id") + @Query("UPDATE folder SET inferiors = :inferiors WHERE id = :id AND inferiors <> :inferiors") int setFolderInferiors(long id, Boolean inferiors); - @Query("UPDATE folder SET type = :type WHERE id = :id") + @Query("UPDATE folder SET type = :type WHERE id = :id AND type <> :type") int setFolderType(long id, String type); - @Query("UPDATE folder SET `order` = :order WHERE id = :id") + @Query("UPDATE folder SET `order` = :order WHERE id = :id AND `order` <> :order") int setFolderOrder(long id, Integer order); - @Query("UPDATE folder SET parent = :parent WHERE id = :id") + @Query("UPDATE folder SET parent = :parent WHERE id = :id AND parent <> :parent") int setFolderParent(long id, Long parent); - @Query("UPDATE folder SET collapsed = :collapsed WHERE id = :id") + @Query("UPDATE folder SET collapsed = :collapsed WHERE id = :id AND collapsed <> :collapsed") int setFolderCollapsed(long id, boolean collapsed); @Query("UPDATE folder" + @@ -301,25 +301,25 @@ public interface DaoFolder { " AND type = '" + EntityFolder.USER + "'") int setFolderProperties(long account, int sync_days, int keep_days); - @Query("UPDATE folder SET keywords = :keywords WHERE id = :id") + @Query("UPDATE folder SET keywords = :keywords WHERE id = :id AND keywords <> :keywords") int setFolderKeywords(long id, String keywords); @Query("UPDATE folder SET name = :name WHERE account = :account AND name = :old") int renameFolder(long account, String old, String name); - @Query("UPDATE folder SET initialize = :days WHERE id = :id") + @Query("UPDATE folder SET initialize = :days WHERE id = :id AND initialize <> :days") int setFolderInitialize(long id, int days); - @Query("UPDATE folder SET keep_days = :days WHERE id = :id") + @Query("UPDATE folder SET keep_days = :days WHERE id = :id AND keep_days <> :days") int setFolderKeep(long id, int days); - @Query("UPDATE folder SET uidv = :uidv WHERE id = :id") + @Query("UPDATE folder SET uidv = :uidv WHERE id = :id AND uidv <> :uidv") int setFolderUidValidity(long id, Long uidv); - @Query("UPDATE folder SET last_sync = :last_sync WHERE id = :id") + @Query("UPDATE folder SET last_sync = :last_sync WHERE id = :id AND last_sync <> :last_sync") int setFolderLastSync(long id, long last_sync); - @Query("UPDATE folder SET read_only = :read_only WHERE id = :id") + @Query("UPDATE folder SET read_only = :read_only WHERE id = :id AND read_only <> :read_only") int setFolderReadOnly(long id, boolean read_only); @Query("UPDATE folder SET tbc = NULL WHERE id = :id") @@ -331,10 +331,13 @@ public interface DaoFolder { @Query("UPDATE folder SET tbd = 1 WHERE id = :id") int setFolderTbd(long id); - @Query("UPDATE folder SET poll = :poll, poll_count = 1 WHERE id = :id") + @Query("UPDATE folder" + + " SET poll = :poll, poll_count = 1" + + " WHERE id = :id" + + " AND (poll <> :poll OR poll_count <> 1)") int setFolderPoll(long id, boolean poll); - @Query("UPDATE folder SET poll_count = :count WHERE id = :id") + @Query("UPDATE folder SET poll_count = :count WHERE id = :id AND poll_count <> :count") int setFolderPollCount(long id, int count); @Query("DELETE FROM folder WHERE id = :id")