interface
sqlite.ApplyChangesetOptions
interface ApplyChangesetOptions
- filter?: (tableName: string) => boolean
for each table affected by at least one change in the changeset, the
filtercallback is invoked with the table name as the first argument. If the return value is falsy, then no attempt is made to apply any changes to the table. Otherwise, if the return value is truthy or nofiltercallback is provided, all changes related to the table are attempted. - onConflict?: (conflictType: number) => number
A function that determines how to handle conflicts. The function receives one argument, which can be one of the following values:
SQLITE_CHANGESET_DATA: ADELETEorUPDATEchange does not contain the expected "before" values.SQLITE_CHANGESET_NOTFOUND: A row matching the primary key of theDELETEorUPDATEchange does not exist.SQLITE_CHANGESET_CONFLICT: AnINSERTchange results in a duplicate primary key.SQLITE_CHANGESET_FOREIGN_KEY: Applying a change would result in a foreign key violation.SQLITE_CHANGESET_CONSTRAINT: Applying a change results in aUNIQUE,CHECK, orNOT NULLconstraint violation.
The function should return one of the following values:
SQLITE_CHANGESET_OMIT: Omit conflicting changes.SQLITE_CHANGESET_REPLACE: Replace existing values with conflicting changes (only valid withSQLITE_CHANGESET_DATAorSQLITE_CHANGESET_CONFLICTconflicts).SQLITE_CHANGESET_ABORT: Abort on conflict and roll back the database.
When an error is thrown in the conflict handler or when any other value is returned from the handler, applying the changeset is aborted and the database is rolled back.
Default: A function that returns
SQLITE_CHANGESET_ABORT.