struct sqlite3_vtab { const sqlite3_module *pModule; /* The module for this virtual table */ int nRef; /* Number of open cursors */ char *zErrMsg; /* Error message from sqlite3_mprintf() */ /* Virtual table implementations will typically add additional fields */ };
每個虛擬表格模組實作都會使用此物件的子類別來描述虛擬表格的特定實體。每個子類別將根據模組實作的特定需求進行調整。這個父類別的目的是定義所有模組實作都通用的某些欄位。
虛擬表格方法可以透過將從 sqlite3_mprintf() 取得的字串賦值給 zErrMsg 來設定錯誤訊息。該方法應注意,在將新字串賦值給 zErrMsg 之前,應透過呼叫 sqlite3_free() 釋放任何先前的字串。在錯誤訊息傳遞到用戶端應用程式後,該字串將由 sqlite3_free() 自動釋放,並且 zErrMsg 欄位將被歸零。