MV
12/02/2023, 11:18 PM@Query("UPDATE account set current = 0 where current = 1")
suspend fun removeCurrent()
@Query("UPDATE account set current = 1 where id = :accountId")
suspend fun setCurrent(accountId: Int)
@Query("SELECT * FROM account where current = 1 limit 1")
fun getCurrent(): LiveData<Account?>
I have some function observing the current account (getCurrent).
The problem is when I swap between account I do, removeCurrent(), setCurrent(acc)
.
But between the calls of those two queries my livedata updates and subsequentially updates the consumers.
I would like to avoid that
(What I get from getCurrent: oldAcc, null, newAcc; What I want oldAcc, newAcc)MV
12/02/2023, 11:28 PMupdateCurrent
which is transaction of those two queries