Send improvements

This commit is contained in:
M66B
2018-12-08 19:03:24 +01:00
parent 1800a43bbf
commit 4fb6d0c739
3 changed files with 19 additions and 12 deletions

View File

@@ -28,13 +28,15 @@ import androidx.room.Query;
@Dao
public interface DaoOperation {
@Query("SELECT * FROM operation WHERE message = :message ORDER BY id")
LiveData<List<EntityOperation>> getOperationsByMessage(long message);
@Query("SELECT * FROM operation" +
" WHERE folder = :folder" +
" ORDER BY CASE WHEN name = '" + EntityOperation.SYNC + "' THEN 1 ELSE 0 END, id")
List<EntityOperation> getOperationsByFolder(long folder);
" ORDER BY" +
" CASE WHEN name = '" + EntityOperation.SYNC + "' THEN" +
" CASE WHEN :outbox THEN -1 ELSE 1 END" +
" ELSE 0" +
" END" +
", id")
List<EntityOperation> getOperationsByFolder(long folder, boolean outbox);
@Query("SELECT * FROM operation ORDER BY id")
LiveData<List<EntityOperation>> liveOperations();