Fixed identity selection changing, refactoring

This commit is contained in:
M66B
2019-01-25 15:41:00 +00:00
parent ad9c675fa4
commit 8306b0eb50
5 changed files with 39 additions and 22 deletions

View File

@@ -30,18 +30,14 @@ import androidx.room.Update;
@Dao
public interface DaoIdentity {
@Query("SELECT identity.*, account.name AS accountName FROM identity" +
" JOIN account ON account.id = identity.account")
LiveData<List<TupleIdentityEx>> liveIdentities();
@Query("SELECT identity.* FROM identity" +
" JOIN account ON account.id = identity.account" +
" WHERE (:account IS NULL OR account.id = :account)" +
" AND account.synchronize = :synchronize" +
" AND identity.synchronize = :synchronize")
LiveData<List<EntityIdentity>> liveIdentities(Long account, boolean synchronize);
" WHERE NOT :synchronize OR account.synchronize")
LiveData<List<TupleIdentityEx>> liveIdentities(boolean synchronize);
@Query("SELECT * FROM identity")
List<EntityIdentity> getIdentities();
@Query("SELECT identity.*, account.name AS accountName FROM identity" +
" JOIN account ON account.id = identity.account" +
" WHERE NOT :synchronize OR account.synchronize")
List<TupleIdentityEx> getIdentities(boolean synchronize);
@Query("SELECT * FROM identity WHERE account = :account")
List<EntityIdentity> getIdentities(long account);