jo jo
jo jo

Reputation: 1838

Get Result From Room Update Query

How can I get a result of when my data has been updated successfully in my Room database.

My Query Sample:

@Query("UPDATE Cohort SET isSelectedCTypeCoh = 'false'")
fun clearAllSelectedHoldingTypeDB()

Upvotes: 1

Views: 765

Answers (1)

Ravi Kumar
Ravi Kumar

Reputation: 4508

You can modify your update function to return an int indicating the number of rows updated in the database.

Kotlin:

@Update
fun updateUser(user: User):Int

Java:

@Update
public int updateUser(User user);

Upvotes: 2

Related Questions