50 lines
2.0 KiB
Groff
50 lines
2.0 KiB
Groff
.Dd March 11, 2017
|
|
.Dt SQLITE_VTAB_CONSTRAINT_SUPPORT 3
|
|
.Os
|
|
.Sh NAME
|
|
.Nm SQLITE_VTAB_CONSTRAINT_SUPPORT
|
|
.Nd Virtual Table Configuration Options
|
|
.Sh SYNOPSIS
|
|
.Fd #define SQLITE_VTAB_CONSTRAINT_SUPPORT
|
|
.Sh DESCRIPTION
|
|
These macros define the various options to the sqlite3_vtab_config()
|
|
interface that virtual table implementations can use to
|
|
customize and optimize their behavior.
|
|
.Bl -tag -width Ds
|
|
.It SQLITE_VTAB_CONSTRAINT_SUPPORT Calls of the form sqlite3_vtab_config(db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X)
|
|
are supported, where X is an integer.
|
|
If X is zero, then the virtual table whose xCreate
|
|
or xConnect method invoked sqlite3_vtab_config()
|
|
does not support constraints.
|
|
In this configuration (which is the default) if a call to the xUpdate
|
|
method returns SQLITE_CONSTRAINT, then the entire
|
|
statement is rolled back as if OR ABORT had been specified
|
|
as part of the users SQL statement, regardless of the actual ON CONFLICT
|
|
mode specified.
|
|
.Pp
|
|
If X is non-zero, then the virtual table implementation guarantees
|
|
that if xUpdate returns SQLITE_CONSTRAINT,
|
|
it will do so before any modifications to internal or persistent data
|
|
structures have been made.
|
|
If the ON CONFLICT mode is ABORT, FAIL, IGNORE or ROLLBACK,
|
|
SQLite is able to roll back a statement or database transaction, and
|
|
abandon or continue processing the current SQL statement as appropriate.
|
|
If the ON CONFLICT mode is REPLACE and the xUpdate method returns
|
|
SQLITE_CONSTRAINT, SQLite handles this as if the ON
|
|
CONFLICT mode had been ABORT.
|
|
.Pp
|
|
Virtual table implementations that are required to handle OR REPLACE
|
|
must do so within the xUpdate method.
|
|
If a call to the sqlite3_vtab_on_conflict()
|
|
function indicates that the current ON CONFLICT policy is REPLACE,
|
|
the virtual table implementation should silently replace the appropriate
|
|
rows within the xUpdate callback and return SQLITE_OK.
|
|
Or, if this is not possible, it may return SQLITE_CONSTRAINT, in which
|
|
case SQLite falls back to OR ABORT constraint handling.
|
|
.El
|
|
.Pp
|
|
.Sh SEE ALSO
|
|
.Xr sqlite3_vtab_config 3 ,
|
|
.Xr sqlite3_vtab_on_conflict 3 ,
|
|
.Xr SQLITE_OK 3
|