ObjectAn object containing commonly used constants for SQLite operations.
The following constants are exported by the sqlite.constants object.
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 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. |
SQLITE_CHANGESET_FOREIGN_KEY |
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. |
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.
| Constant | Description |
|---|---|
SQLITE_CHANGESET_OMIT |
Conflicting changes are omitted. |
SQLITE_CHANGESET_REPLACE |
Conflicting changes replace existing values. Note that this value can only be returned when the type of conflict is either SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. |
SQLITE_CHANGESET_ABORT |
Abort when a change encounters a conflict and roll back database. |
The following constants are used with the database.setAuthorizer() method.
One of the following constants must be returned from the authorizer callback
function passed to database.setAuthorizer().
| Constant | Description |
|---|---|
SQLITE_OK |
Allow the operation to proceed normally. |
SQLITE_DENY |
Deny the operation and cause an error to be returned. |
SQLITE_IGNORE |
Ignore the operation and continue as if it had never been requested. |
The following constants are passed as the first argument to the authorizer callback function to indicate what type of operation is being authorized.
| Constant | Description |
|---|---|
SQLITE_CREATE_INDEX |
Create an index |
SQLITE_CREATE_TABLE |
Create a table |
SQLITE_CREATE_TEMP_INDEX |
Create a temporary index |
SQLITE_CREATE_TEMP_TABLE |
Create a temporary table |
SQLITE_CREATE_TEMP_TRIGGER |
Create a temporary trigger |
SQLITE_CREATE_TEMP_VIEW |
Create a temporary view |
SQLITE_CREATE_TRIGGER |
Create a trigger |
SQLITE_CREATE_VIEW |
Create a view |
SQLITE_DELETE |
Delete from a table |
SQLITE_DROP_INDEX |
Drop an index |
SQLITE_DROP_TABLE |
Drop a table |
SQLITE_DROP_TEMP_INDEX |
Drop a temporary index |
SQLITE_DROP_TEMP_TABLE |
Drop a temporary table |
SQLITE_DROP_TEMP_TRIGGER |
Drop a temporary trigger |
SQLITE_DROP_TEMP_VIEW |
Drop a temporary view |
SQLITE_DROP_TRIGGER |
Drop a trigger |
SQLITE_DROP_VIEW |
Drop a view |
SQLITE_INSERT |
Insert into a table |
SQLITE_PRAGMA |
Execute a PRAGMA statement |
SQLITE_READ |
Read from a table |
SQLITE_SELECT |
Execute a SELECT statement |
SQLITE_TRANSACTION |
Begin, commit, or rollback a transaction |
SQLITE_UPDATE |
Update a table |
SQLITE_ATTACH |
Attach a database |
SQLITE_DETACH |
Detach a database |
SQLITE_ALTER_TABLE |
Alter a table |
SQLITE_REINDEX |
Reindex |
SQLITE_ANALYZE |
Analyze the database |
SQLITE_CREATE_VTABLE |
Create a virtual table |
SQLITE_DROP_VTABLE |
Drop a virtual table |
SQLITE_FUNCTION |
Use a function |
SQLITE_SAVEPOINT |
Create, release, or rollback a savepoint |
SQLITE_COPY |
Copy data (legacy) |
SQLITE_RECURSIVE |
Recursive query |