Name
sqlite3_set_auxdata() — Set auxiliary data on a function parameter
Definition
void sqlite3_set_auxdata( sqlite3_context* ctx, int pidx, void* data, mem_callback ); void mem_callback( void* ptr );
-
ctx
An SQL function context, provided by the SQLite library.
-
pidx
The parameter index.
-
data
The auxiliary data value.
-
mem_callback
A function pointer to a memory deallocation function. This function frees the memory buffer used to hold the value. If the buffer was allocated with
sqlite3_malloc()
, a reference tosqlite3_free()
can be passed directly.The flags
SQLITE_STATIC
andSQLITE_TRANSIENT
(which are used bysqlite3_bind_xxx()
andsqlite3_
result_
xxx()
) are not available in this context.
Description
This function allows an SQL function implementation to attach auxiliary data to specific SQL function parameters. In situations where an SQL statement calls the same function repeatedly with the same parameter values, the auxiliary data will be preserved across calls. This allows a function implementation to cache high-cost value, such as a compiled regular expression.
For more details on how to use auxiliary data, see http://www.sqlite.org/c3ref/get_auxdata.html.
Get Using SQLite now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.