Reset unused cids, refactoring

This commit is contained in:
M66B
2019-01-06 10:15:06 +00:00
parent 53de71bccb
commit ae1a36b482
7 changed files with 88 additions and 81 deletions

View File

@@ -60,10 +60,20 @@ public interface DaoAttachment {
EntityAttachment getAttachment(long message, String cid);
@Query("UPDATE attachment" +
" SET progress = :progress" +
" SET progress = :progress, available = 0" +
" WHERE id = :id")
void setProgress(long id, Integer progress);
@Query("UPDATE attachment" +
" SET size = :size, progress = NULL, available = 1" +
" WHERE id = :id")
void setDownloaded(long id, Integer size);
@Query("UPDATE attachment" +
" SET cid = NULL" +
" WHERE id = :id")
void clearCid(long id);
@Insert
long insertAttachment(EntityAttachment attachment);