Name

sqlite3_overload_function() — Create a stub function [EXP]

Definition

int sqlite3_overload_function( sqlite3* db, const char* name, int num_param );
db

A database connection.

name

A function name, in UTF-8.

num_param

The number of parameters in the stub function.

Returns

An SQLite result code.

Description

This function checks to see if the named SQL function (with the specified number of parameters) exists or not. If the function does exist, nothing is done. If the function does not already exist, a stub function is registered. This stub function will always return SQLITE_ERROR.

This function exists to support virtual table modules. Virtual tables have the ability to override functions that use virtual table columns as parameters. In order to do this, the function must already exist. The virtual table could register a stub function by itself, but this risks overriding an existing function. This function ensures there is a base SQL function that can be overridden without accidentally redefining an application-defined function.

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.