Register A Virtual Table Implementation
int sqlite3_create_module(
sqlite3 *db, /* SQLite connection to register module with */
const char *zName, /* Name of the module */
const sqlite3_module *p, /* Methods for the module */
void *pClientData /* Client data for xCreate/xConnect */
);
int sqlite3_create_module_v2(
sqlite3 *db, /* SQLite connection to register module with */
const char *zName, /* Name of the module */
const sqlite3_module *p, /* Methods for the module */
void *pClientData, /* Client data for xCreate/xConnect */
void(*xDestroy)(void*) /* Module destructor function */
);
这些例程用于注册新的虚拟表模块名称。在使用模块创建新的虚拟表之前以及在为模块使用预先存在的虚拟表之前,必须注册模块名称。
模块名称在第一个参数指定的数据库连接上注册。模块的名称由第二个参数给出。第三个参数是一个指向虚拟表模块实现的指针。第四个参数是在创建或重新初始化新虚拟表时,传递到虚拟表模块的xCreate和xConnect方法的任意客户端数据指针。
sqlite3_create_module_v2()接口具有第五个参数,该参数是指向pClientData的析构函数的指针。当SQLite不再需要pClientData指针时,SQLite将调用析构函数(如果它不是NULL)。如果调用sqlite3_create_module_v2()失败,析构函数也会被调用。sqlite3_create_module()接口与具有NULL析构函数的sqlite3_create_module_v2()等效。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com