Stay organized with collections Save and categorize content based on your preferences.

OnConflictStrategy.Companion

object OnConflictStrategy.Companion


Summary

Constants

const Int
ABORT = 3

OnConflict strategy constant to abort the transaction.

const Int
FAIL = 4

This property is deprecated. Use ABORT instead.

const Int
IGNORE = 5

OnConflict strategy constant to ignore the conflict.

const Int
NONE = 0

OnConflict strategy constant used by default when no other strategy is set.

const Int

OnConflict strategy constant to replace the old data and continue the transaction.

const Int

This property is deprecated. Use ABORT instead.

Constants

ABORT

const val ABORT = 3: Int

OnConflict strategy constant to abort the transaction. The transaction is rolled back.

FAIL

const val FAIL = 4: Int

OnConflict strategy constant to fail the transaction.

IGNORE

const val IGNORE = 5: Int

OnConflict strategy constant to ignore the conflict.

An Insert DAO method that returns the inserted rows ids will return -1 for rows that are not inserted since this strategy will ignore the row if there is a conflict.

NONE

const val NONE = 0: Int

OnConflict strategy constant used by default when no other strategy is set. Using it prevents Room from generating ON CONFLICT clause. It may be useful when there is a need to use ON CONFLICT clause within a trigger. The runtime behavior is the same as when ABORT strategy is applied. The transaction is rolled back.

REPLACE

const val REPLACE = 1: Int

OnConflict strategy constant to replace the old data and continue the transaction.

An Insert DAO method that returns the inserted rows ids will never return -1 since this strategy will always insert a row even if there is a conflict.

ROLLBACK

const val ROLLBACK = 2: Int

OnConflict strategy constant to rollback the transaction.