1.Dd January 24, 2024 2.Dt SQLITE_VTAB_CONSTRAINT_SUPPORT 3 3.Os 4.Sh NAME 5.Nm SQLITE_VTAB_CONSTRAINT_SUPPORT , 6.Nm SQLITE_VTAB_INNOCUOUS , 7.Nm SQLITE_VTAB_DIRECTONLY , 8.Nm SQLITE_VTAB_USES_ALL_SCHEMAS 9.Nd virtual table configuration options 10.Sh SYNOPSIS 11.In sqlite3.h 12.Fd #define SQLITE_VTAB_CONSTRAINT_SUPPORT 13.Fd #define SQLITE_VTAB_INNOCUOUS 14.Fd #define SQLITE_VTAB_DIRECTONLY 15.Fd #define SQLITE_VTAB_USES_ALL_SCHEMAS 16.Sh DESCRIPTION 17These macros define the various options to the 18.Fn sqlite3_vtab_config 19interface that virtual table implementations can use to 20customize and optimize their behavior. 21.Bl -tag -width Ds 22.It SQLITE_VTAB_CONSTRAINT_SUPPORT 23Calls of the form sqlite3_vtab_config(db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) 24are supported, where X is an integer. 25If X is zero, then the virtual table whose xCreate 26or xConnect method invoked 27.Fn sqlite3_vtab_config 28does not support constraints. 29In this configuration (which is the default) if a call to the xUpdate 30method returns SQLITE_CONSTRAINT, then the entire 31statement is rolled back as if OR ABORT had been specified 32as part of the users SQL statement, regardless of the actual ON CONFLICT 33mode specified. 34.Pp 35If X is non-zero, then the virtual table implementation guarantees 36that if xUpdate returns SQLITE_CONSTRAINT, 37it will do so before any modifications to internal or persistent data 38structures have been made. 39If the ON CONFLICT mode is ABORT, FAIL, IGNORE or ROLLBACK, 40SQLite is able to roll back a statement or database transaction, and 41abandon or continue processing the current SQL statement as appropriate. 42If the ON CONFLICT mode is REPLACE and the xUpdate method returns 43SQLITE_CONSTRAINT, SQLite handles this as if the ON 44CONFLICT mode had been ABORT. 45.Pp 46Virtual table implementations that are required to handle OR REPLACE 47must do so within the xUpdate method. 48If a call to the 49.Fn sqlite3_vtab_on_conflict 50function indicates that the current ON CONFLICT policy is REPLACE, 51the virtual table implementation should silently replace the appropriate 52rows within the xUpdate callback and return SQLITE_OK. 53Or, if this is not possible, it may return SQLITE_CONSTRAINT, in which 54case SQLite falls back to OR ABORT constraint handling. 55.It SQLITE_VTAB_DIRECTONLY 56Calls of the form sqlite3_vtab_config(db,SQLITE_VTAB_DIRECTONLY) 57from within the the xConnect or xCreate methods of a 58virtual table implementation prohibits that virtual table 59from being used from within triggers and views. 60.It SQLITE_VTAB_INNOCUOUS 61Calls of the form sqlite3_vtab_config(db,SQLITE_VTAB_INNOCUOUS) 62from within the the xConnect or xCreate methods of a 63virtual table implementation identify that virtual table 64as being safe to use from within triggers and views. 65Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the virtual 66table can do no serious harm even if it is controlled by a malicious 67hacker. 68Developers should avoid setting the SQLITE_VTAB_INNOCUOUS flag unless 69absolutely necessary. 70.It SQLITE_VTAB_USES_ALL_SCHEMAS 71Calls of the form sqlite3_vtab_config(db,SQLITE_VTAB_USES_ALL_SCHEMA) 72from within the the xConnect or xCreate methods of a 73virtual table implementation instruct the query planner 74to begin at least a read transaction on all schemas ("main", "temp", 75and any ATTACH-ed databases) whenever the virtual table is used. 76.El 77.Pp 78.Sh IMPLEMENTATION NOTES 79These declarations were extracted from the 80interface documentation at line 9740. 81.Bd -literal 82#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1 83#define SQLITE_VTAB_INNOCUOUS 2 84#define SQLITE_VTAB_DIRECTONLY 3 85#define SQLITE_VTAB_USES_ALL_SCHEMAS 4 86.Ed 87.Sh SEE ALSO 88.Xr sqlite3_vtab_config 3 , 89.Xr sqlite3_vtab_on_conflict 3 , 90.Xr SQLITE_OK 3 91