冲突解决常量
【Conflict resolution constants】
以下常量之一可以作为传递给 database.applyChangeset() 的 onConflict 冲突解决处理程序的参数。另请参阅 SQLite 文档中的 传递给冲突处理程序的常量。
【One of the following constants is available as an argument to the onConflict
conflict resolution handler passed to database.applyChangeset(). See also
Constants Passed To The Conflict Handler in the SQLite documentation.】
| Constant | Description |
|---|---|
SQLITE_CHANGESET_DATA |
The conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is present in the database, but one or more other (non primary-key) fields modified by the update do not contain the expected "before" values. |
SQLITE_CHANGESET_NOTFOUND |
The conflict handler is invoked with this constant when processing a DELETE or UPDATE change if a row with the required PRIMARY KEY fields is not present in the database. |
SQLITE_CHANGESET_CONFLICT |
This constant is passed to the conflict handler while processing an INSERT change if the operation would result in duplicate primary key values. |
SQLITE_CHANGESET_CONSTRAINT |
If foreign key handling is enabled, and applying a changeset leaves the database in a state containing foreign key violations, the conflict handler is invoked with this constant exactly once before the changeset is committed. If the conflict handler returns SQLITE_CHANGESET_OMIT, the changes, including those that caused the foreign key constraint violation, are committed. Or, if it returns SQLITE_CHANGESET_ABORT, the changeset is rolled back. |
SQLITE_CHANGESET_FOREIGN_KEY |
If any other constraint violation occurs while applying a change (i.e. a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is invoked with this constant. |
必须从传递给 database.applyChangeset() 的 onConflict 冲突解决处理程序中返回以下常量之一。另请参见 SQLite 文档中的 来自冲突处理程序的常量。
【One of the following constants must be returned from the onConflict conflict
resolution handler passed to database.applyChangeset(). See also
Constants Returned From The Conflict Handler in the SQLite documentation.】
| 常量 | 描述 |
|---|---|
SQLITE_CHANGESET_OMIT |
冲突的更改将被忽略。 |
SQLITE_CHANGESET_REPLACE |
冲突的更改将替换现有值。请注意,当冲突类型为 SQLITE_CHANGESET_DATA 或 SQLITE_CHANGESET_CONFLICT 时才可以返回此值。 |
SQLITE_CHANGESET_ABORT |
在更改遇到冲突时中止,并回滚数据库。 |