1.Dd January 24, 2024 2.Dt SQLITE3_CREATE_MODULE 3 3.Os 4.Sh NAME 5.Nm sqlite3_create_module , 6.Nm sqlite3_create_module_v2 7.Nd register a virtual table implementation 8.Sh SYNOPSIS 9.In sqlite3.h 10.Ft int 11.Fo sqlite3_create_module 12.Fa "sqlite3 *db" 13.Fa "const char *zName" 14.Fa "const sqlite3_module *p" 15.Fa "void *pClientData" 16.Fc 17.Ft int 18.Fo sqlite3_create_module_v2 19.Fa "sqlite3 *db" 20.Fa "const char *zName" 21.Fa "const sqlite3_module *p" 22.Fa "void *pClientData" 23.Fa "void(*xDestroy)(void*)" 24.Fc 25.Sh DESCRIPTION 26These routines are used to register a new virtual table module 27name. 28Module names must be registered before creating a new virtual table 29using the module and before using a preexisting virtual table 30for the module. 31.Pp 32The module name is registered on the database connection 33specified by the first parameter. 34The name of the module is given by the second parameter. 35The third parameter is a pointer to the implementation of the virtual table module. 36The fourth parameter is an arbitrary client data pointer that is passed 37through into the xCreate and xConnect methods of the 38virtual table module when a new virtual table is be being created or 39reinitialized. 40.Pp 41The sqlite3_create_module_v2() interface has a fifth parameter which 42is a pointer to a destructor for the pClientData. 43SQLite will invoke the destructor function (if it is not NULL) when 44SQLite no longer needs the pClientData pointer. 45The destructor will also be invoked if the call to sqlite3_create_module_v2() 46fails. 47The sqlite3_create_module() interface is equivalent to sqlite3_create_module_v2() 48with a NULL destructor. 49.Pp 50If the third parameter (the pointer to the sqlite3_module object) is 51NULL then no new module is created and any existing modules with the 52same name are dropped. 53.Pp 54.Sh IMPLEMENTATION NOTES 55These declarations were extracted from the 56interface documentation at line 7530. 57.Bd -literal 58SQLITE_API int sqlite3_create_module( 59 sqlite3 *db, /* SQLite connection to register module with */ 60 const char *zName, /* Name of the module */ 61 const sqlite3_module *p, /* Methods for the module */ 62 void *pClientData /* Client data for xCreate/xConnect */ 63); 64SQLITE_API int sqlite3_create_module_v2( 65 sqlite3 *db, /* SQLite connection to register module with */ 66 const char *zName, /* Name of the module */ 67 const sqlite3_module *p, /* Methods for the module */ 68 void *pClientData, /* Client data for xCreate/xConnect */ 69 void(*xDestroy)(void*) /* Module destructor function */ 70); 71.Ed 72.Sh SEE ALSO 73.Xr sqlite3 3 , 74.Xr sqlite3_drop_modules 3 , 75.Xr sqlite3_module 3 76