Name

sqlite3_create_module() — Register a virtual table implementation [EXP]

Definition

int sqlite3_create_module(    sqlite3* db, const char* name,
            const sqlite3_module* mod_struct, void* udp );
int sqlite3_create_module_v2( sqlite3* db, const char* name,
            const sqlite3_module* mod_struct, void* udp, dest_func );

void dest_func( void* udp );
db

A database connection.

name

The name of the module (the virtual table type), in UTF-8.

mod_struct

A module structure, which includes function pointers to all of the application-defined functions required to implement a virtual table module.

udp

An application-defined user-data pointer. This value is made available to some of the virtual table functions, as well as the destructor function.

dest_func

An optional function pointer to the module destroy function. This may be NULL.

Returns (sqlite3_create_module[_v2]())

An SQLite result code.

Description

These functions register a virtual table module. The only difference between the standard and _v2 version is the addition of the destroy function, which can be used to free any memory allocations associated with the user-data pointer.

For more information on writing a virtual table module, see Chapter 10.

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.