*** 109,119 **** --- 109,145 ---- struct sqlite3_vtab { const sqlite3_module *pModule; + int nRef; + char *zErrMsg; }; Virtual table implementations will normally subclass this structure to add additional private and implementation-specific fields. + The nRef field is used internally by the SQLite core + and should not be altered by the virtual table implementation. + The virtual table implementation can pass error message text + to the core by putting an error message string obtained from + sqlite3_mprintf() in zErrMsg. Prior to assigning a new value + to zErrMsg, the virtual table implementation should + free any prior content of zErrMsg using sqlite3_free(). + Failure to do this might result in a memory leak. + The SQLite core will + free and zero the content of zErrMsg when it delivers + the error message text to the client application or when it + destroys the virtual table. + The virtual table implementation only needs to worry about + freeing the zErrMsg content when it overwrites the content + with a new, different error message. + + *Compatibility Notice:* The sqlite3_vtab structure has been + modified for SQLite version 3.3.8. Virtual table implementations + that are built as loadable extensions for SQLite version 3.3.7 + and earlier will need to be recompiled in order to work with + SQLite versions 3.3.8 and later. Because the the virtual + table mechanism is still considered an experimental API as + of version 3.3.8, such changes are allowed without breaking SQLite's + policy of not making changes that break legacy code. The sqlite3_vtab_cursor structure represents a pointer into a virtual table.