- @Query("SELECT * FROM accounts WHERE profile_id=:profileId ORDER BY name")
- public abstract LiveData<List<Account>> getAll(long profileId);
+ @Query("DELETE FROM accounts")
+ public abstract void deleteAllSync();
+
+ @Query("SELECT * FROM accounts WHERE profile_id=:profileId AND IIF(:includeZeroBalances=1, 1," +
+ " (EXISTS(SELECT 1 FROM account_values av WHERE av.account_id=accounts.id AND av.value" +
+ " <> 0) OR EXISTS(SELECT 1 FROM accounts a WHERE a.parent_name = accounts.name))) " +
+ "ORDER BY name")
+ public abstract LiveData<List<Account>> getAll(long profileId, boolean includeZeroBalances);