pull/190/head
M66B 4 years ago
parent 0ec97b7544
commit 44ba8d186e

@ -124,79 +124,79 @@ public interface DaoAccount {
@Update @Update
void updateAccount(EntityAccount account); void updateAccount(EntityAccount account);
@Query("UPDATE account SET separator = :separator WHERE id = :id AND separator <> :separator") @Query("UPDATE account SET separator = :separator WHERE id = :id AND NOT (separator IS :separator)")
int setFolderSeparator(long id, Character separator); int setFolderSeparator(long id, Character separator);
@Query("UPDATE account SET synchronize = :synchronize WHERE id = :id AND synchronize <> :synchronize") @Query("UPDATE account SET synchronize = :synchronize WHERE id = :id AND NOT (synchronize IS :synchronize)")
int setAccountSynchronize(long id, boolean synchronize); int setAccountSynchronize(long id, boolean synchronize);
@Query("UPDATE account SET `primary` = :primary WHERE id = :id AND `primary` <> :primary") @Query("UPDATE account SET `primary` = :primary WHERE id = :id AND NOT (`primary` IS :primary)")
int setAccountPrimary(long id, boolean primary); int setAccountPrimary(long id, boolean primary);
@Query("UPDATE account SET thread = :thread WHERE id = :id AND thread <> :thread") @Query("UPDATE account SET thread = :thread WHERE id = :id AND NOT (thread IS :thread)")
int setAccountThread(long id, Long thread); int setAccountThread(long id, Long thread);
@Query("SELECT thread FROM account WHERE id = :id") @Query("SELECT thread FROM account WHERE id = :id")
Long getAccountThread(long id); Long getAccountThread(long id);
@Query("UPDATE account SET state = :state WHERE id = :id AND state <> :state") @Query("UPDATE account SET state = :state WHERE id = :id AND NOT (state IS :state)")
int setAccountState(long id, String state); int setAccountState(long id, String state);
@Query("UPDATE account SET password = :password WHERE id = :id AND password <> :password") @Query("UPDATE account SET password = :password WHERE id = :id AND NOT (password IS :password)")
int setAccountPassword(long id, String password); int setAccountPassword(long id, String password);
@Query("UPDATE account SET last_connected = :last_connected WHERE id = :id AND last_connected <> :last_connected") @Query("UPDATE account SET last_connected = :last_connected WHERE id = :id AND NOT (last_connected IS :last_connected)")
int setAccountConnected(long id, long last_connected); int setAccountConnected(long id, long last_connected);
@Query("UPDATE account SET backoff_until = :backoff_until WHERE id = :id AND backoff_until <> :backoff_until") @Query("UPDATE account SET backoff_until = :backoff_until WHERE id = :id AND NOT (backoff_until IS :backoff_until)")
int setAccountBackoff(long id, Long backoff_until); int setAccountBackoff(long id, Long backoff_until);
@Query("UPDATE account" + @Query("UPDATE account" +
" SET quota_usage = :used, quota_limit = :limit" + " SET quota_usage = :used, quota_limit = :limit" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (quota_usage <> :used OR quota_limit <> :limit)") " AND (NOT (quota_usage IS :used) OR NOT (quota_limit IS :limit))")
int setAccountQuota(long id, Long used, Long limit); int setAccountQuota(long id, Long used, Long limit);
@Query("UPDATE account SET poll_interval = :value WHERE id = :id AND poll_interval <> :value") @Query("UPDATE account SET poll_interval = :value WHERE id = :id AND NOT (poll_interval IS :value)")
int setAccountKeepAliveInterval(long id, int value); int setAccountKeepAliveInterval(long id, int value);
@Query("UPDATE account SET keep_alive_ok = :ok WHERE id = :id AND keep_alive_ok <> :ok") @Query("UPDATE account SET keep_alive_ok = :ok WHERE id = :id AND NOT (keep_alive_ok IS :ok)")
int setAccountKeepAliveOk(long id, boolean ok); int setAccountKeepAliveOk(long id, boolean ok);
@Query("UPDATE account" + @Query("UPDATE account" +
" SET keep_alive_failed = :failed, keep_alive_succeeded = :succeeded" + " SET keep_alive_failed = :failed, keep_alive_succeeded = :succeeded" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (keep_alive_failed <> :failed OR keep_alive_succeeded <> :succeeded)") " AND (NOT (keep_alive_failed IS :failed) OR NOT (keep_alive_succeeded IS :succeeded))")
int setAccountKeepAliveValues(long id, int failed, int succeeded); int setAccountKeepAliveValues(long id, int failed, int succeeded);
@Query("UPDATE account SET poll_exempted = :value WHERE id = :id AND poll_exempted <> :value") @Query("UPDATE account SET poll_exempted = :value WHERE id = :id AND NOT (poll_exempted IS :value)")
int setAccountPollExempted(long id, boolean value); int setAccountPollExempted(long id, boolean value);
@Query("UPDATE account SET `order` = :order WHERE id = :id AND `order` <> :order") @Query("UPDATE account SET `order` = :order WHERE id = :id AND NOT (`order` IS :order)")
int setAccountOrder(long id, Integer order); int setAccountOrder(long id, Integer order);
@Query("UPDATE account SET partial_fetch = :partial_fetch WHERE id = :id AND partial_fetch <> :partial_fetch") @Query("UPDATE account SET partial_fetch = :partial_fetch WHERE id = :id AND NOT (partial_fetch IS :partial_fetch)")
int setAccountPartialFetch(long id, boolean partial_fetch); int setAccountPartialFetch(long id, boolean partial_fetch);
@Query("UPDATE account SET max_size = :max_size WHERE id = :id AND max_size <> :max_size") @Query("UPDATE account SET max_size = :max_size WHERE id = :id AND NOT (max_size IS :max_size)")
int setAccountMaxSize(long id, Long max_size); int setAccountMaxSize(long id, Long max_size);
@Query("UPDATE account SET warning = :warning WHERE id = :id AND warning <> :warning") @Query("UPDATE account SET warning = :warning WHERE id = :id AND NOT (warning IS :warning)")
int setAccountWarning(long id, String warning); int setAccountWarning(long id, String warning);
@Query("UPDATE account SET error = :error WHERE id = :id AND error <> :error") @Query("UPDATE account SET error = :error WHERE id = :id AND NOT (error IS :error)")
int setAccountError(long id, String error); int setAccountError(long id, String error);
@Query("UPDATE account" + @Query("UPDATE account" +
" SET swipe_left = :left, swipe_right = :right" + " SET swipe_left = :left, swipe_right = :right" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (swipe_left <> :left OR swipe_right <> :right)") " AND (NOT (swipe_left IS :left) OR NOT (swipe_right IS :right))")
int setAccountSwipes(long id, Long left, Long right); int setAccountSwipes(long id, Long left, Long right);
@Query("UPDATE account SET `primary` = 0") @Query("UPDATE account SET `primary` = 0 WHERE NOT (`primary` IS 0)")
void resetPrimary(); void resetPrimary();
@Query("UPDATE account SET tbd = 1 WHERE id = :id") @Query("UPDATE account SET tbd = 1 WHERE id = :id AND NOT (tbd IS 1)")
int setAccountTbd(long id); int setAccountTbd(long id);
@Query("DELETE FROM account WHERE id = :id") @Query("DELETE FROM account WHERE id = :id")

@ -61,10 +61,10 @@ public interface DaoAnswer {
@Update @Update
int updateAnswer(EntityAnswer answer); int updateAnswer(EntityAnswer answer);
@Query("UPDATE answer SET hide = :hide WHERE id = :id AND hide <> :hide") @Query("UPDATE answer SET hide = :hide WHERE id = :id AND NOT (hide IS :hide)")
int setAnswerHidden(long id, boolean hide); int setAnswerHidden(long id, boolean hide);
@Query("UPDATE answer SET standard = 0 WHERE standard <> 0") @Query("UPDATE answer SET standard = 0 WHERE NOT (standard IS 0)")
void resetStandard(); void resetStandard();
@Query("DELETE FROM answer WHERE id = :id") @Query("DELETE FROM answer WHERE id = :id")

@ -65,54 +65,54 @@ public interface DaoAttachment {
@Query("UPDATE attachment" + @Query("UPDATE attachment" +
" SET message = :message" + " SET message = :message" +
" WHERE id = :id" + " WHERE id = :id" +
" AND message <> :message") " AND NOT (message IS :message)")
void setMessage(long id, long message); void setMessage(long id, long message);
@Query("UPDATE attachment" + @Query("UPDATE attachment" +
" SET error = NULL, progress = :progress, available = 0" + " SET error = NULL, progress = :progress, available = 0" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (error IS NOT NULL OR progress <> :progress OR available <> 0)") " AND (error IS NOT NULL OR NOT (progress IS :progress) OR NOT (available IS 0))")
void setProgress(long id, Integer progress); void setProgress(long id, Integer progress);
@Query("UPDATE attachment" + @Query("UPDATE attachment" +
" SET size = :size, error = NULL, progress = NULL, available = 1" + " SET size = :size, error = NULL, progress = NULL, available = 1" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (size <> :size OR error IS NOT NULL OR progress IS NOT NULL OR available <> 1)") " AND (NOT (size IS :size) OR error IS NOT NULL OR progress IS NOT NULL OR NOT (available IS 1))")
void setDownloaded(long id, Long size); void setDownloaded(long id, Long size);
@Query("UPDATE attachment" + @Query("UPDATE attachment" +
" SET size = NULL, progress = NULL, available = :available" + " SET size = NULL, progress = NULL, available = :available" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (size IS NOT NULL OR progress IS NOT NULL OR available <> :available)") " AND (size IS NOT NULL OR progress IS NOT NULL OR NOT (available IS :available))")
void setAvailable(long id, boolean available); void setAvailable(long id, boolean available);
@Query("UPDATE attachment" + @Query("UPDATE attachment" +
" SET size = NULL, progress = NULL, available = 0" + " SET size = NULL, progress = NULL, available = 0" +
" WHERE message = :message" + " WHERE message = :message" +
" AND (size IS NOT NULL OR progress IS NOT NULL OR available <> 0)") " AND (size IS NOT NULL OR progress IS NOT NULL OR NOT (available IS 0))")
void resetAvailable(long message); void resetAvailable(long message);
@Query("UPDATE attachment" + @Query("UPDATE attachment" +
" SET error = :error, progress = NULL, available = 0" + " SET error = :error, progress = NULL, available = 0" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (error <> :error OR progress IS NOT NULL OR available <> 0)") " AND (NOT (error IS :error) OR progress IS NOT NULL OR NOT (available IS 0))")
void setError(long id, String error); void setError(long id, String error);
@Query("UPDATE attachment" + @Query("UPDATE attachment" +
" SET disposition = :disposition" + " SET disposition = :disposition" +
" WHERE id = :id" + " WHERE id = :id" +
" AND disposition <> :disposition") " AND NOT (disposition IS :disposition)")
void setDisposition(long id, String disposition); void setDisposition(long id, String disposition);
@Query("UPDATE attachment" + @Query("UPDATE attachment" +
" SET cid = :cid" + " SET cid = :cid" +
" WHERE id = :id" + " WHERE id = :id" +
" AND cid <> :cid") " AND NOT (cid IS :cid)")
void setCid(long id, String cid); void setCid(long id, String cid);
@Query("UPDATE attachment" + @Query("UPDATE attachment" +
" SET available = 0" + " SET available = 0" +
" WHERE available <> 0" + " WHERE NOT (available IS 0)" +
" AND EXISTS" + " AND EXISTS" +
" (SELECT * FROM attachment a" + " (SELECT * FROM attachment a" +
" JOIN message ON message.id = a.message" + " JOIN message ON message.id = a.message" +

@ -81,10 +81,10 @@ public interface DaoContact {
" AND email = :email") " AND email = :email")
int deleteContact(long account, int type, String email); int deleteContact(long account, int type, String email);
@Query("UPDATE contact SET name = :name WHERE id = :id AND name <> :name") @Query("UPDATE contact SET name = :name WHERE id = :id AND NOT (name IS :name)")
int setContactName(long id, String name); int setContactName(long id, String name);
@Query("UPDATE contact SET state = :state WHERE id = :id AND state <> :state") @Query("UPDATE contact SET state = :state WHERE id = :id AND NOT (state IS :state)")
int setContactState(long id, int state); int setContactState(long id, int state);
@Query("DELETE FROM contact" + @Query("DELETE FROM contact" +

@ -218,59 +218,60 @@ public interface DaoFolder {
@Insert @Insert
long insertFolder(EntityFolder folder); long insertFolder(EntityFolder folder);
@Query("UPDATE folder SET unified = :unified WHERE id = :id AND unified <> :unified") @Query("UPDATE folder SET unified = :unified WHERE id = :id AND NOT (unified IS :unified)")
int setFolderUnified(long id, boolean unified); int setFolderUnified(long id, boolean unified);
@Query("UPDATE folder SET navigation = :navigation WHERE id = :id AND navigation <> :navigation") @Query("UPDATE folder SET navigation = :navigation WHERE id = :id AND NOT (navigation IS :navigation)")
int setFolderNavigation(long id, boolean navigation); int setFolderNavigation(long id, boolean navigation);
@Query("UPDATE folder SET notify = :notify WHERE id = :id AND notify <> :notify") @Query("UPDATE folder SET notify = :notify WHERE id = :id AND NOT (notify IS :notify)")
int setFolderNotify(long id, boolean notify); int setFolderNotify(long id, boolean notify);
@Query("UPDATE folder SET synchronize = :synchronize WHERE id = :id AND synchronize <> :synchronize") @Query("UPDATE folder SET synchronize = :synchronize WHERE id = :id AND NOT (synchronize IS :synchronize)")
int setFolderSynchronize(long id, boolean synchronize); int setFolderSynchronize(long id, boolean synchronize);
@Query("UPDATE folder SET state = :state WHERE id = :id AND state <> :state") @Query("UPDATE folder SET state = :state WHERE id = :id AND NOT (state IS :state)")
int setFolderState(long id, String state); int setFolderState(long id, String state);
@Query("UPDATE folder SET state = :state WHERE account = :account AND state <> :state") @Query("UPDATE folder SET state = :state WHERE account = :account AND NOT (state IS :state)")
int setFolderStates(long account, String state); int setFolderStates(long account, String state);
@Query("UPDATE folder SET sync_state = :state WHERE id = :id AND sync_state <> :state") @Query("UPDATE folder SET sync_state = :state WHERE id = :id AND NOT (sync_state IS :state)")
int setFolderSyncState(long id, String state); int setFolderSyncState(long id, String state);
@Query("UPDATE folder SET total = :total WHERE id = :id AND total <> :total") @Query("UPDATE folder SET total = :total WHERE id = :id AND NOT (total IS :total)")
int setFolderTotal(long id, Integer total); int setFolderTotal(long id, Integer total);
@Query("UPDATE folder SET error = :error WHERE id = :id AND error <> :error") @Query("UPDATE folder SET error = :error WHERE id = :id AND NOT (error IS :error)")
int setFolderError(long id, String error); int setFolderError(long id, String error);
@Query("UPDATE folder SET subscribed = :subscribed WHERE id = :id AND subscribed <> :subscribed") @Query("UPDATE folder SET subscribed = :subscribed WHERE id = :id AND NOT (subscribed IS :subscribed)")
int setFolderSubscribed(long id, Boolean subscribed); int setFolderSubscribed(long id, Boolean subscribed);
@Query("UPDATE folder SET selectable = :selectable WHERE id = :id AND selectable <> :selectable") @Query("UPDATE folder SET selectable = :selectable WHERE id = :id AND NOT (selectable IS :selectable)")
int setFolderSelectable(long id, Boolean selectable); int setFolderSelectable(long id, Boolean selectable);
@Query("UPDATE folder SET inferiors = :inferiors WHERE id = :id AND inferiors <> :inferiors") @Query("UPDATE folder SET inferiors = :inferiors WHERE id = :id AND NOT (inferiors IS :inferiors)")
int setFolderInferiors(long id, Boolean inferiors); int setFolderInferiors(long id, Boolean inferiors);
@Query("UPDATE folder SET type = :type WHERE id = :id AND type <> :type") @Query("UPDATE folder SET type = :type WHERE id = :id AND NOT (type IS :type)")
int setFolderType(long id, String type); int setFolderType(long id, String type);
@Query("UPDATE folder SET `order` = :order WHERE id = :id AND `order` <> :order") @Query("UPDATE folder SET `order` = :order WHERE id = :id AND NOT (`order` IS :order)")
int setFolderOrder(long id, Integer order); int setFolderOrder(long id, Integer order);
@Query("UPDATE folder SET parent = :parent WHERE id = :id AND parent <> :parent") @Query("UPDATE folder SET parent = :parent WHERE id = :id AND NOT (parent IS :parent)")
int setFolderParent(long id, Long parent); int setFolderParent(long id, Long parent);
@Query("UPDATE folder SET collapsed = :collapsed WHERE id = :id AND collapsed <> :collapsed") @Query("UPDATE folder SET collapsed = :collapsed WHERE id = :id AND NOT (collapsed IS :collapsed)")
int setFolderCollapsed(long id, boolean collapsed); int setFolderCollapsed(long id, boolean collapsed);
@Query("UPDATE folder" + @Query("UPDATE folder" +
" SET type = '" + EntityFolder.USER + "'" + " SET type = '" + EntityFolder.USER + "'" +
" WHERE account = :account" + " WHERE account = :account" +
" AND type <> '" + EntityFolder.INBOX + "'" + " AND type <> '" + EntityFolder.INBOX + "'" +
" AND type <> '" + EntityFolder.SYSTEM + "'") " AND type <> '" + EntityFolder.SYSTEM + "'" +
" AND type <> '" + EntityFolder.USER + "'")
int setFoldersUser(long account); int setFoldersUser(long account);
@Query("UPDATE folder" + @Query("UPDATE folder" +
@ -298,46 +299,47 @@ public interface DaoFolder {
@Query("UPDATE folder" + @Query("UPDATE folder" +
" SET sync_days = :sync_days, keep_days = :keep_days" + " SET sync_days = :sync_days, keep_days = :keep_days" +
" WHERE account = :account" + " WHERE account = :account" +
" AND type = '" + EntityFolder.USER + "'") " AND type = '" + EntityFolder.USER + "'" +
" AND (NOT (sync_days IS :sync_days) OR NOT (keep_days IS :keep_days))")
int setFolderProperties(long account, int sync_days, int keep_days); int setFolderProperties(long account, int sync_days, int keep_days);
@Query("UPDATE folder SET keywords = :keywords WHERE id = :id AND keywords <> :keywords") @Query("UPDATE folder SET keywords = :keywords WHERE id = :id AND NOT (keywords IS :keywords)")
int setFolderKeywords(long id, String keywords); int setFolderKeywords(long id, String keywords);
@Query("UPDATE folder SET name = :name WHERE account = :account AND name = :old") @Query("UPDATE folder SET name = :name WHERE account = :account AND name = :old AND NOT (:old IS :name)")
int renameFolder(long account, String old, String name); int renameFolder(long account, String old, String name);
@Query("UPDATE folder SET initialize = :days WHERE id = :id AND initialize <> :days") @Query("UPDATE folder SET initialize = :days WHERE id = :id AND NOT (initialize IS :days)")
int setFolderInitialize(long id, int days); int setFolderInitialize(long id, int days);
@Query("UPDATE folder SET keep_days = :days WHERE id = :id AND keep_days <> :days") @Query("UPDATE folder SET keep_days = :days WHERE id = :id AND NOT (keep_days IS :days)")
int setFolderKeep(long id, int days); int setFolderKeep(long id, int days);
@Query("UPDATE folder SET uidv = :uidv WHERE id = :id AND uidv <> :uidv") @Query("UPDATE folder SET uidv = :uidv WHERE id = :id AND NOT (uidv IS :uidv)")
int setFolderUidValidity(long id, Long uidv); int setFolderUidValidity(long id, Long uidv);
@Query("UPDATE folder SET last_sync = :last_sync WHERE id = :id AND last_sync <> :last_sync") @Query("UPDATE folder SET last_sync = :last_sync WHERE id = :id AND NOT (last_sync IS :last_sync)")
int setFolderLastSync(long id, long last_sync); int setFolderLastSync(long id, long last_sync);
@Query("UPDATE folder SET read_only = :read_only WHERE id = :id AND read_only <> :read_only") @Query("UPDATE folder SET read_only = :read_only WHERE id = :id AND NOT (read_only IS :read_only)")
int setFolderReadOnly(long id, boolean read_only); int setFolderReadOnly(long id, boolean read_only);
@Query("UPDATE folder SET tbc = NULL WHERE id = :id") @Query("UPDATE folder SET tbc = NULL WHERE id = :id AND tbc IS NOT NULL")
int resetFolderTbc(long id); int resetFolderTbc(long id);
@Query("UPDATE folder SET `rename` = NULL WHERE id = :id") @Query("UPDATE folder SET `rename` = NULL WHERE id = :id AND `rename` IS NOT NULL")
int resetFolderRename(long id); int resetFolderRename(long id);
@Query("UPDATE folder SET tbd = 1 WHERE id = :id") @Query("UPDATE folder SET tbd = 1 WHERE id = :id AND NOT (tbd IS 1)")
int setFolderTbd(long id); int setFolderTbd(long id);
@Query("UPDATE folder" + @Query("UPDATE folder" +
" SET poll = :poll, poll_count = 1" + " SET poll = :poll, poll_count = 1" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (poll <> :poll OR poll_count <> 1)") " AND (NOT (poll IS :poll) OR NOT (poll_count IS 1))")
int setFolderPoll(long id, boolean poll); int setFolderPoll(long id, boolean poll);
@Query("UPDATE folder SET poll_count = :count WHERE id = :id AND poll_count <> :count") @Query("UPDATE folder SET poll_count = :count WHERE id = :id AND NOT (poll_count IS :count)")
int setFolderPollCount(long id, int count); int setFolderPollCount(long id, int count);
@Query("DELETE FROM folder WHERE id = :id") @Query("DELETE FROM folder WHERE id = :id")

@ -86,51 +86,51 @@ public interface DaoIdentity {
@Update @Update
void updateIdentity(EntityIdentity identity); void updateIdentity(EntityIdentity identity);
@Query("UPDATE identity SET synchronize = :synchronize WHERE id = :id AND synchronize <> :synchronize") @Query("UPDATE identity SET synchronize = :synchronize WHERE id = :id AND NOT (synchronize IS :synchronize)")
int setIdentitySynchronize(long id, boolean synchronize); int setIdentitySynchronize(long id, boolean synchronize);
@Query("UPDATE identity SET `primary` = :primary WHERE id = :id AND `primary` <> :primary") @Query("UPDATE identity SET `primary` = :primary WHERE id = :id AND NOT (`primary` IS :primary)")
int setIdentityPrimary(long id, boolean primary); int setIdentityPrimary(long id, boolean primary);
@Query("UPDATE identity SET state = :state WHERE id = :id AND state <> :state") @Query("UPDATE identity SET state = :state WHERE id = :id AND NOT (state IS :state)")
int setIdentityState(long id, String state); int setIdentityState(long id, String state);
@Query("UPDATE identity SET password = :password WHERE id = :id AND password <> :password") @Query("UPDATE identity SET password = :password WHERE id = :id AND NOT (password IS :password)")
int setIdentityPassword(long id, String password); int setIdentityPassword(long id, String password);
@Query("UPDATE identity SET password = :password" + @Query("UPDATE identity SET password = :password" +
" WHERE account = :account" + " WHERE account = :account" +
" AND user = :user" + " AND user = :user" +
" AND password <> :password" + " AND NOT (password IS :password)" +
" AND host LIKE :domain") " AND host LIKE :domain")
int setIdentityPassword(long account, String user, String password, String domain); int setIdentityPassword(long account, String user, String password, String domain);
@Query("UPDATE identity SET password = :password" + @Query("UPDATE identity SET password = :password" +
" WHERE account = :account" + " WHERE account = :account" +
" AND user = :user" + " AND user = :user" +
" AND password <> :password" + " AND NOT (password IS :password)" +
" AND auth_type = :auth_type") " AND auth_type = :auth_type")
int setIdentityPassword(long account, String user, String password, int auth_type); int setIdentityPassword(long account, String user, String password, int auth_type);
@Query("UPDATE identity SET last_connected = :last_connected WHERE id = :id AND last_connected <> :last_connected") @Query("UPDATE identity SET last_connected = :last_connected WHERE id = :id AND NOT (last_connected IS :last_connected)")
int setIdentityConnected(long id, long last_connected); int setIdentityConnected(long id, long last_connected);
@Query("UPDATE identity SET encrypt = :encrypt WHERE id = :id AND encrypt <> :encrypt") @Query("UPDATE identity SET encrypt = :encrypt WHERE id = :id AND NOT (encrypt IS :encrypt)")
int setIdentityEncrypt(long id, int encrypt); int setIdentityEncrypt(long id, int encrypt);
@Query("UPDATE identity SET sign_key = :sign_key WHERE id = :id AND sign_key <> :sign_key") @Query("UPDATE identity SET sign_key = :sign_key WHERE id = :id AND NOT (sign_key IS :sign_key)")
int setIdentitySignKey(long id, Long sign_key); int setIdentitySignKey(long id, Long sign_key);
@Query("UPDATE identity SET sign_key_alias = :alias WHERE id = :id AND sign_key_alias <> :alias") @Query("UPDATE identity SET sign_key_alias = :alias WHERE id = :id AND NOT (sign_key_alias IS :alias)")
int setIdentitySignKeyAlias(long id, String alias); int setIdentitySignKeyAlias(long id, String alias);
@Query("UPDATE identity SET max_size = :max_size WHERE id = :id AND max_size <> :max_size") @Query("UPDATE identity SET max_size = :max_size WHERE id = :id AND NOT (max_size IS :max_size)")
int setIdentityMaxSize(long id, Long max_size); int setIdentityMaxSize(long id, Long max_size);
@Query("UPDATE identity SET error = :error WHERE id = :id AND error <> :error") @Query("UPDATE identity SET error = :error WHERE id = :id AND NOT (error IS :error)")
int setIdentityError(long id, String error); int setIdentityError(long id, String error);
@Query("UPDATE identity SET `primary` = 0 WHERE account = :account AND `primary` <> 0") @Query("UPDATE identity SET `primary` = 0 WHERE account = :account AND NOT (`primary` IS 0)")
void resetPrimary(long account); void resetPrimary(long account);
@Query("DELETE FROM identity WHERE id = :id") @Query("DELETE FROM identity WHERE id = :id")

@ -587,97 +587,101 @@ public interface DaoMessage {
int updateMessage(EntityMessage message); int updateMessage(EntityMessage message);
@Query("UPDATE message SET thread = :thread" + @Query("UPDATE message SET thread = :thread" +
" WHERE account = :account AND thread = :old AND thread <> :thread") " WHERE account = :account AND thread = :old AND NOT (thread IS :thread)")
int updateMessageThread(long account, String old, String thread); int updateMessageThread(long account, String old, String thread);
@Query("UPDATE message SET uid = :uid WHERE id = :id AND uid <> :uid") @Query("UPDATE message SET uid = :uid WHERE id = :id AND NOT (uid IS :uid)")
int setMessageUid(long id, Long uid); int setMessageUid(long id, Long uid);
@Query("UPDATE message SET msgid = :msgid WHERE id = :id AND msgid <> :msgid") @Query("UPDATE message SET msgid = :msgid WHERE id = :id AND NOT (msgid IS :msgid)")
int setMessageMsgId(long id, String msgid); int setMessageMsgId(long id, String msgid);
@Query("UPDATE message SET hash = :hash WHERE id = :id AND hash <> :hash") @Query("UPDATE message SET hash = :hash WHERE id = :id AND NOT (hash IS :hash)")
int setMessageHash(long id, String hash); int setMessageHash(long id, String hash);
@Query("UPDATE message SET priority = :priority WHERE id = :id AND priority <> :priority") @Query("UPDATE message SET priority = :priority WHERE id = :id AND NOT (priority IS :priority)")
int setMessagePriority(long id, Integer priority); int setMessagePriority(long id, Integer priority);
@Query("UPDATE message SET importance = :importance WHERE id = :id AND importance <> :importance") @Query("UPDATE message SET importance = :importance WHERE id = :id AND NOT (importance IS :importance)")
int setMessageImportance(long id, Integer importance); int setMessageImportance(long id, Integer importance);
@Query("UPDATE message SET receipt_request = :receipt_request WHERE id = :id AND receipt_request <> :receipt_request") @Query("UPDATE message SET receipt_request = :receipt_request WHERE id = :id AND NOT (receipt_request IS :receipt_request)")
int setMessageReceiptRequest(long id, Boolean receipt_request); int setMessageReceiptRequest(long id, Boolean receipt_request);
@Query("UPDATE message SET notifying = :notifying WHERE id = :id AND notifying <> :notifying") @Query("UPDATE message SET notifying = :notifying WHERE id = :id AND NOT (notifying IS :notifying)")
int setMessageNotifying(long id, int notifying); int setMessageNotifying(long id, int notifying);
@Query("UPDATE message SET fts = :fts WHERE id = :id AND fts <> :fts") @Query("UPDATE message SET fts = :fts WHERE id = :id AND NOT (fts IS :fts)")
int setMessageFts(long id, boolean fts); int setMessageFts(long id, boolean fts);
@Query("UPDATE message SET received = :received WHERE id = :id AND received <> :received") @Query("UPDATE message SET received = :received WHERE id = :id AND NOT (received IS :received)")
int setMessageReceived(long id, long received); int setMessageReceived(long id, long received);
@Query("UPDATE message SET subject = :subject WHERE id = :id AND subject <> :subject") @Query("UPDATE message SET subject = :subject WHERE id = :id AND NOT (subject IS :subject)")
int setMessageSubject(long id, String subject); int setMessageSubject(long id, String subject);
@Query("UPDATE message SET seen = :seen WHERE id = :id AND seen <> :seen") @Query("UPDATE message SET seen = :seen WHERE id = :id AND NOT (seen IS :seen)")
int setMessageSeen(long id, boolean seen); int setMessageSeen(long id, boolean seen);
@Query("UPDATE message SET flagged = :flagged WHERE id = :id AND flagged <> :flagged") @Query("UPDATE message SET flagged = :flagged WHERE id = :id AND NOT (flagged IS :flagged)")
int setMessageFlagged(long id, boolean flagged); int setMessageFlagged(long id, boolean flagged);
@Query("UPDATE message SET answered = :answered WHERE id = :id AND answered <> :answered") @Query("UPDATE message SET answered = :answered WHERE id = :id AND NOT (answered IS :answered)")
int setMessageAnswered(long id, boolean answered); int setMessageAnswered(long id, boolean answered);
@Query("UPDATE message SET keywords = :keywords WHERE id = :id AND keywords <> :keywords") @Query("UPDATE message SET keywords = :keywords WHERE id = :id AND NOT (keywords IS :keywords)")
int setMessageKeywords(long id, String keywords); int setMessageKeywords(long id, String keywords);
@Query("UPDATE message SET labels = :labels WHERE id = :id AND labels <> :labels") @Query("UPDATE message SET labels = :labels WHERE id = :id AND NOT (labels IS :labels)")
int setMessageLabels(long id, String labels); int setMessageLabels(long id, String labels);
@Query("UPDATE message SET ui_seen = :ui_seen WHERE id = :id AND ui_seen <> :ui_seen") @Query("UPDATE message SET ui_seen = :ui_seen WHERE id = :id AND NOT (ui_seen IS :ui_seen)")
int setMessageUiSeen(long id, boolean ui_seen); int setMessageUiSeen(long id, boolean ui_seen);
@Query("UPDATE message" + @Query("UPDATE message" +
" SET ui_flagged = :ui_flagged, color = :color" + " SET ui_flagged = :ui_flagged, color = :color" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (ui_flagged <> :ui_flagged OR color <> :color)") " AND (NOT (ui_flagged IS :ui_flagged) OR NOT (color IS :color))")
int setMessageUiFlagged(long id, boolean ui_flagged, Integer color); int setMessageUiFlagged(long id, boolean ui_flagged, Integer color);
@Query("UPDATE message SET ui_answered = :ui_answered WHERE id = :id AND ui_answered <> :ui_answered") @Query("UPDATE message SET ui_answered = :ui_answered WHERE id = :id AND NOT (ui_answered IS :ui_answered)")
int setMessageUiAnswered(long id, boolean ui_answered); int setMessageUiAnswered(long id, boolean ui_answered);
@Query("UPDATE message SET ui_hide = :ui_hide WHERE id = :id AND ui_hide <> :ui_hide") @Query("UPDATE message SET ui_hide = :ui_hide WHERE id = :id AND NOT (ui_hide IS :ui_hide)")
int setMessageUiHide(long id, Boolean ui_hide); int setMessageUiHide(long id, Boolean ui_hide);
@Query("UPDATE message SET ui_ignored = :ui_ignored WHERE id = :id AND ui_ignored <> :ui_ignored") @Query("UPDATE message SET ui_ignored = :ui_ignored WHERE id = :id AND NOT (ui_ignored IS :ui_ignored)")
int setMessageUiIgnored(long id, boolean ui_ignored); int setMessageUiIgnored(long id, boolean ui_ignored);
@Query("UPDATE message SET ui_busy = :busy WHERE id = :id AND ui_busy <> :busy") @Query("UPDATE message SET ui_busy = :busy WHERE id = :id AND NOT (ui_busy IS :busy)")
int setMessageUiBusy(long id, Long busy); int setMessageUiBusy(long id, Long busy);
@Query("UPDATE message" + @Query("UPDATE message" +
" SET received = :sent, sent = :sent" + " SET received = :sent, sent = :sent" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (received <> :sent OR sent <> :sent)") " AND (NOT (received IS :sent) OR NOT (sent IS :sent))")
int setMessageSent(long id, Long sent); int setMessageSent(long id, Long sent);
@Query("UPDATE message SET error = :error WHERE id = :id AND error <> :error") @Query("UPDATE message SET error = :error WHERE id = :id AND NOT (error IS :error)")
int setMessageError(long id, String error); int setMessageError(long id, String error);
@Query("UPDATE message SET identity = :identity WHERE id = :id AND identity <> :identity") @Query("UPDATE message SET identity = :identity WHERE id = :id AND NOT (identity IS :identity)")
int setMessageIdentity(long id, Long identity); int setMessageIdentity(long id, Long identity);
@Query("UPDATE message SET revision = :revision WHERE id = :id AND revision <> :revision") @Query("UPDATE message SET revision = :revision WHERE id = :id AND NOT (revision IS :revision)")
int setMessageRevision(long id, Integer revision); int setMessageRevision(long id, Integer revision);
@Query("UPDATE message SET revisions = :revisions WHERE id = :id AND revisions <> :revisions") @Query("UPDATE message SET revisions = :revisions WHERE id = :id AND NOT (revisions IS :revisions)")
int setMessageRevisions(long id, Integer revisions); int setMessageRevisions(long id, Integer revisions);
@Query("UPDATE message" + @Query("UPDATE message" +
" SET content = 0, fts = 0, language = NULL, plain_only = NULL, preview = NULL" + " SET content = 0, fts = 0, language = NULL, plain_only = NULL, preview = NULL" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (content <> 0 OR fts <> 0 OR language IS NOT NULL OR plain_only IS NOT NULL OR preview IS NOT NULL)") " AND (NOT (content IS 0)" +
" OR NOT (fts IS 0)" +
" OR language IS NOT NULL" +
" OR plain_only IS NOT NULL" +
" OR preview IS NOT NULL)")
int resetMessageContent(long id); int resetMessageContent(long id);
@Query("UPDATE message" + @Query("UPDATE message" +
@ -688,42 +692,42 @@ public interface DaoMessage {
", preview = :preview" + ", preview = :preview" +
", warning = :warning" + ", warning = :warning" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (content <> :content" + " AND (NOT (content IS :content)" +
" OR fts <> 0" + " OR NOT (fts IS 0)" +
" OR language <> :language" + " OR NOT (language IS :language)" +
" OR plain_only <> :plain_only" + " OR NOT (plain_only IS :plain_only)" +
" OR preview <> :preview" + " OR NOT (preview IS :preview)" +
" OR warning <> :warning)") " OR NOT (warning IS :warning))")
int setMessageContent(long id, boolean content, String language, Boolean plain_only, String preview, String warning); int setMessageContent(long id, boolean content, String language, Boolean plain_only, String preview, String warning);
@Query("UPDATE message" + @Query("UPDATE message" +
" SET size = :size, total = :total" + " SET size = :size, total = :total" +
" WHERE id = :id" + " WHERE id = :id" +
" AND (size <> :size OR total <> :total)") " AND (NOT (size IS :size) OR NOT (total IS :total))")
int setMessageSize(long id, Long size, Long total); int setMessageSize(long id, Long size, Long total);
@Query("UPDATE message SET headers = :headers WHERE id = :id AND headers <> :headers") @Query("UPDATE message SET headers = :headers WHERE id = :id AND NOT (headers IS :headers)")
int setMessageHeaders(long id, String headers); int setMessageHeaders(long id, String headers);
@Query("UPDATE message SET raw = :raw WHERE id = :id AND raw <> :raw") @Query("UPDATE message SET raw = :raw WHERE id = :id AND NOT (raw IS :raw)")
int setMessageRaw(long id, Boolean raw); int setMessageRaw(long id, Boolean raw);
@Query("UPDATE message SET stored = :stored WHERE id = :id AND stored <> :stored") @Query("UPDATE message SET stored = :stored WHERE id = :id AND NOT (stored IS :stored)")
int setMessageStored(long id, long stored); int setMessageStored(long id, long stored);
@Query("UPDATE message SET plain_only = :plain_only WHERE id = :id AND plain_only <> :plain_only") @Query("UPDATE message SET plain_only = :plain_only WHERE id = :id AND NOT (plain_only IS :plain_only)")
int setMessagePlainOnly(long id, boolean plain_only); int setMessagePlainOnly(long id, boolean plain_only);
@Query("UPDATE message SET encrypt = :encrypt WHERE id = :id AND encrypt <> :encrypt") @Query("UPDATE message SET encrypt = :encrypt WHERE id = :id AND NOT (encrypt IS :encrypt)")
int setMessageEncrypt(long id, Integer encrypt); int setMessageEncrypt(long id, Integer encrypt);
@Query("UPDATE message SET ui_encrypt = :ui_encrypt WHERE id = :id AND ui_encrypt <> :ui_encrypt") @Query("UPDATE message SET ui_encrypt = :ui_encrypt WHERE id = :id AND NOT (ui_encrypt IS :ui_encrypt)")
int setMessageUiEncrypt(long id, Integer ui_encrypt); int setMessageUiEncrypt(long id, Integer ui_encrypt);
@Query("UPDATE message SET verified = :verified WHERE id = :id AND verified <> :verified") @Query("UPDATE message SET verified = :verified WHERE id = :id AND NOT (verified IS :verified)")
int setMessageVerified(long id, boolean verified); int setMessageVerified(long id, boolean verified);
@Query("UPDATE message SET last_attempt = :last_attempt WHERE id = :id AND last_attempt <> :last_attempt") @Query("UPDATE message SET last_attempt = :last_attempt WHERE id = :id AND NOT (last_attempt IS :last_attempt)")
int setMessageLastAttempt(long id, long last_attempt); int setMessageLastAttempt(long id, long last_attempt);
@Query("UPDATE message SET ui_ignored = 1" + @Query("UPDATE message SET ui_ignored = 1" +
@ -734,22 +738,22 @@ public interface DaoMessage {
" WHERE (:folder IS NULL AND folder.unified) OR id = :folder)") " WHERE (:folder IS NULL AND folder.unified) OR id = :folder)")
int ignoreAll(Long account, Long folder); int ignoreAll(Long account, Long folder);
@Query("UPDATE message SET ui_found = 1 WHERE id = :id AND ui_found <> 1") @Query("UPDATE message SET ui_found = 1 WHERE id = :id AND NOT (ui_found IS 1)")
int setMessageFound(long id); int setMessageFound(long id);
@Query("UPDATE message SET ui_found = 0 WHERE ui_found <> 0") @Query("UPDATE message SET ui_found = 0 WHERE NOT (ui_found IS 0)")
int resetSearch(); int resetSearch();
@Query("UPDATE message SET ui_snoozed = :wakeup WHERE id = :id AND ui_snoozed <> :wakeup") @Query("UPDATE message SET ui_snoozed = :wakeup WHERE id = :id AND NOT (ui_snoozed IS :wakeup)")
int setMessageSnoozed(long id, Long wakeup); int setMessageSnoozed(long id, Long wakeup);
@Query("UPDATE message SET ui_unsnoozed = :unsnoozed WHERE id = :id AND ui_unsnoozed <> :unsnoozed") @Query("UPDATE message SET ui_unsnoozed = :unsnoozed WHERE id = :id AND NOT (ui_unsnoozed IS :unsnoozed)")
int setMessageUnsnoozed(long id, boolean unsnoozed); int setMessageUnsnoozed(long id, boolean unsnoozed);
@Query("UPDATE message SET uidl = :uidl WHERE id = :id AND uidl <> :uidl") @Query("UPDATE message SET uidl = :uidl WHERE id = :id AND NOT (uidl IS :uidl)")
int setMessageUidl(long id, String uidl); int setMessageUidl(long id, String uidl);
@Query("UPDATE message SET notifying = 0 WHERE notifying <> 0") @Query("UPDATE message SET notifying = 0 WHERE NOT (notifying IS 0)")
int clearNotifyingMessages(); int clearNotifyingMessages();
@Query("UPDATE message SET headers = NULL" + @Query("UPDATE message SET headers = NULL" +
@ -757,7 +761,7 @@ public interface DaoMessage {
" AND account IN (SELECT id FROM account WHERE pop = " + EntityAccount.TYPE_IMAP + ")") " AND account IN (SELECT id FROM account WHERE pop = " + EntityAccount.TYPE_IMAP + ")")
int clearMessageHeaders(); int clearMessageHeaders();
@Query("UPDATE message SET fts = 0 WHERE fts <> 0") @Query("UPDATE message SET fts = 0 WHERE NOT (fts IS 0)")
int resetFts(); int resetFts();
@Query("DELETE FROM message WHERE id = :id") @Query("DELETE FROM message WHERE id = :id")

@ -126,16 +126,16 @@ public interface DaoOperation {
" AND name = :name") " AND name = :name")
int getOperationCount(long folder, long message, String name); int getOperationCount(long folder, long message, String name);
@Query("UPDATE operation SET tries = :tries WHERE id = :id AND tries <> :tries") @Query("UPDATE operation SET tries = :tries WHERE id = :id AND NOT (tries IS :tries)")
int setOperationTries(long id, int tries); int setOperationTries(long id, int tries);
@Query("UPDATE operation SET state = :state WHERE id = :id AND state <> :state") @Query("UPDATE operation SET state = :state WHERE id = :id AND NOT (state IS :state)")
int setOperationState(long id, String state); int setOperationState(long id, String state);
@Query("UPDATE operation SET state = NULL WHERE state IS NOT NULL") @Query("UPDATE operation SET state = NULL WHERE state IS NOT NULL")
int resetOperationStates(); int resetOperationStates();
@Query("UPDATE operation SET error = :error WHERE id = :id AND error <> :error") @Query("UPDATE operation SET error = :error WHERE id = :id AND NOT (error IS :error)")
int setOperationError(long id, String error); int setOperationError(long id, String error);
@Insert @Insert

@ -59,16 +59,16 @@ public interface DaoRule {
@Update @Update
int updateRule(EntityRule rule); int updateRule(EntityRule rule);
@Query("UPDATE rule SET folder = :folder WHERE id = :id AND folder <> :folder") @Query("UPDATE rule SET folder = :folder WHERE id = :id AND NOT (folder IS :folder)")
int setRuleFolder(long id, long folder); int setRuleFolder(long id, long folder);
@Query("UPDATE rule SET enabled = :enabled WHERE id = :id AND enabled <> :enabled") @Query("UPDATE rule SET enabled = :enabled WHERE id = :id AND NOT (enabled IS :enabled)")
int setRuleEnabled(long id, boolean enabled); int setRuleEnabled(long id, boolean enabled);
@Query("UPDATE rule SET applied = applied + 1 WHERE id = :id") @Query("UPDATE rule SET applied = applied + 1 WHERE id = :id")
int applyRule(long id); int applyRule(long id);
@Query("UPDATE rule SET applied = 0 WHERE id = :id AND applied <> 0") @Query("UPDATE rule SET applied = 0 WHERE id = :id AND NOT (applied IS 0)")
int resetRule(long id); int resetRule(long id);
@Query("DELETE FROM rule WHERE id = :id") @Query("DELETE FROM rule WHERE id = :id")

Loading…
Cancel
Save