首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Register A Virtual Table Implementation

代码语言:javascript
复制
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()等效。

扫码关注腾讯云开发者

领取腾讯云代金券