SQLite and user functions
What values can an SQLite3 user function return?
A relevant example is adding a function for regexp
- w开发者_高级运维hat values would it return to indicate a match or a non-match? Or must it be void?
Results are reported from SQLite3 functions (at the C interface level) using the sqlite3_result_int
function (and its siblings, if returning other types).
void sqlite3_result_int(sqlite3_context*, int);
Report false by using a 0 for the second argument, and true by using a 1 (or other non-zero).
On this fossil repository (which pulls from SQLite fossil repository regularly) you have some example of SQLite3 extensions, including add-ons that overload the MATCH
function.
Example of a function which overloads the REGEXP operator
精彩评论