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()。
如果第三個參數(指向 sqlite3_module 物件的指標)為 NULL,則不會建立新的模組,並且任何具有相同名稱的現有模組都會被移除。