1.Dd December 19, 2018 2.Dt SQLITE_VTAB_CONSTRAINT_SUPPORT 3 3.Os 4.Sh NAME 5.Nm SQLITE_VTAB_CONSTRAINT_SUPPORT 6.Nd Virtual Table Configuration Options 7.Sh SYNOPSIS 8.Fd #define SQLITE_VTAB_CONSTRAINT_SUPPORT 9.Sh DESCRIPTION 10These macros define the various options to the sqlite3_vtab_config() 11interface that virtual table implementations can use to 12customize and optimize their behavior. 13.Bl -tag -width Ds 14.It SQLITE_VTAB_CONSTRAINT_SUPPORT Calls of the form sqlite3_vtab_config(db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) 15are supported, where X is an integer. 16If X is zero, then the virtual table whose xCreate 17or xConnect method invoked sqlite3_vtab_config() 18does not support constraints. 19In this configuration (which is the default) if a call to the xUpdate 20method returns SQLITE_CONSTRAINT, then the entire 21statement is rolled back as if OR ABORT had been specified 22as part of the users SQL statement, regardless of the actual ON CONFLICT 23mode specified. 24.Pp 25If X is non-zero, then the virtual table implementation guarantees 26that if xUpdate returns SQLITE_CONSTRAINT, 27it will do so before any modifications to internal or persistent data 28structures have been made. 29If the ON CONFLICT mode is ABORT, FAIL, IGNORE or ROLLBACK, 30SQLite is able to roll back a statement or database transaction, and 31abandon or continue processing the current SQL statement as appropriate. 32If the ON CONFLICT mode is REPLACE and the xUpdate method returns 33SQLITE_CONSTRAINT, SQLite handles this as if the ON 34CONFLICT mode had been ABORT. 35.Pp 36Virtual table implementations that are required to handle OR REPLACE 37must do so within the xUpdate method. 38If a call to the sqlite3_vtab_on_conflict() 39function indicates that the current ON CONFLICT policy is REPLACE, 40the virtual table implementation should silently replace the appropriate 41rows within the xUpdate callback and return SQLITE_OK. 42Or, if this is not possible, it may return SQLITE_CONSTRAINT, in which 43case SQLite falls back to OR ABORT constraint handling. 44.El 45.Pp 46.Sh SEE ALSO 47.Xr sqlite3_vtab_config 3 , 48.Xr sqlite3_vtab_on_conflict 3 , 49.Xr SQLITE_OK 3 50