Constraint Conflict Resolution in SQLite
(conflict.html)
Constraint Conflict Resolution in SQLite
In most SQL databases, if you have a UNIQUE, NOT NULL, or
CHECK constraint on
a table and you try to do an UPDATE or INSERT that violates
the constraint, the database will abort the ...
|
C API: Determine The Collation For a Virtual Table Constraint
(c3ref/vtab_collation.html)
sqlite3_vtab_collation()
... This function returns a pointer to a string
that is the name of the appropriate collation sequence to use for text
comparisons on the constraint identified by its arguments.
The first argument must be the pointer to the sqlite3_index_info object ...
|
C API: Find all elements on the right-hand side of an IN constraint.
(c3ref/vtab_in_first.html)
sqlite3_vtab_in_first(), sqlite3_vtab_in_next()
... If the X parameter is not
an xFilter argument that was selected for all-at-once IN constraint
processing, then these routines return SQLITE_ERROR.
Use these routines to access all values on the right-hand side
of the IN constraint ...
|
C API: Virtual Table Constraint Operator Codes
(c3ref/c_index_constraint_eq.html)
SQLITE_INDEX_CONSTRAINT_EQ, SQLITE_INDEX_CONSTRAINT_GT, SQLITE_INDEX_CONSTRAINT_LE, SQLITE_INDEX_CONSTRAINT_LT, SQLITE_INDEX_CONSTRAINT_GE, SQLITE_INDEX_CONSTRAINT_MATCH ...
... For most real-world virtual
tables, the collating sequence of constraints does not matter (for example
because the constraints are numeric) and so the sqlite3_vtab_collation()
interface is not commonly needed.
See also lists of
Objects,
Constants, and
Functions.
|
C API: Constraint values in xBestIndex()
(c3ref/vtab_rhs_value.html)
sqlite3_vtab_rhs_value()
... Some constraints, such as SQLITE_INDEX_CONSTRAINT_ISNULL and
SQLITE_INDEX_CONSTRAINT_ISNOTNULL, have no right-hand operand. For such
constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.
The sqlite3_value object returned in *V is a protected sqlite3_value
and remains valid for the duration of the xBestIndex method call ...
|
C API: Identify and handle IN constraints in xBestIndex
(c3ref/vtab_in.html)
sqlite3_vtab_in()
... A constraint on a virtual table of the form
"column IN (...)" is
communicated to the xBestIndex method as a
SQLITE_INDEX_CONSTRAINT_EQ constraint. If xBestIndex wants to use
this constraint, it must set the corresponding
aConstraintUsage[].argvIndex to a positive integer. Then ...
|
C API: Result Codes
(c3ref/c_abort.html)
... SQLITE_SCHEMA, SQLITE_TOOBIG, SQLITE_CONSTRAINT, SQLITE_MISMATCH, SQLITE_MISUSE, SQLITE_NOLFS ...
Many SQLite functions return an integer result code from the set shown
here in order to indicate success or failure.
New error codes may be added in future versions of SQLite.
See also: extended result code definitions
See also lists ...
|
The ON CONFLICT Clause
(lang_conflict.html)
... The FAIL behavior only works for uniqueness, NOT NULL, and CHECK
constraints. A foreign key constraint violation causes an ABORT.
IGNORE
When an applicable constraint violation occurs,
the IGNORE resolution algorithm skips the one row that contains
the constraint violation ...
|
SQLite Foreign Key Support
(foreignkeys.html)
4.1. Composite Foreign Key Constraints
A composite foreign key constraint is one where the child and parent keys
are both composite keys. For example, consider
the following database schema:
CREATE TABLE album(
albumartist TEXT,
albumname TEXT,
albumcover BINARY,
PRIMARY KEY(albumartist, albumname)
);
CREATE TABLE song ...
|
CREATE TABLE
(lang_createtable.html)
... UNIQUE constraints
A UNIQUE constraint is similar to a PRIMARY KEY constraint, except
that a single table may have any number of UNIQUE constraints. For each
UNIQUE constraint on the table, each row must contain a unique combination
of values ...
|
Page generated by FTS5 in about 117.28 ms.