*** 119,151 **** int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); ---- *xClose* int (*xClose)(sqlite3_vtab_cursor*); ---- *xFilter* int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, int argc, sqlite3_value **argv); ---- *xNext* int (*xNext)(sqlite3_vtab_cursor*); ---- *xColumn* ! int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); ---- *xRowid int (*xRowid)(sqlite3_vtab_cursor*, sqlite_int64 *pRowid); ---- *xUpdate* ! int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite_int64 *); --- 119,226 ---- int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); + The method creates a new cursor used for reading information out + of a virtual table. The cursor is returned in *ppCursor. + + The cursor is not immediately usable. It must first be + positioned using xFilter. Then elements of a row of the + virtual table can be accessed using xColumn and xRowid. + + The xClose method is used to close the cursor. + ---- *xClose* int (*xClose)(sqlite3_vtab_cursor*); + This method closes a cursor previously opened by xOpen. + The SQLite core will always call xClose once for each + cursor opened using xOpen. + ---- *xFilter* int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, int argc, sqlite3_value **argv); + This method to begin a search of a virtual table. + The first argument is a cursor opened by xOpen. + The next two argument define a particular search + index previously choosen by + {link: wiki?p=VirtualTableBestIndexMethod xBestIndex} + The specific meanings of idxNum and idxStr are unimportant + as long as xFilter and xBestIndex agree on what that meaning + is. + + The xBestIndex function may have requested the values + of certain expressions. Those values are passed in + using the argc and argv parameters. + + After this method completes, the cursor should be left + pointing at a row of virtual table. The xColumn and + xRowid methods can be used to access that row. The + xNext method can be used to advance to the next row. + ---- *xNext* int (*xNext)(sqlite3_vtab_cursor*); + This method advances a virtual table cursor to the + next row of a result set initiated by xFilter. + If the cursor is already pointing at the last row + this routine returns 0 to indicate that no rows + remain. If the cursor was successfully advanced, + this routine returns 1. + ---- *xColumn* ! int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int N); ! ! The SQLite core invokes this method in order to find the ! value for the N-th column of the current row. ! N is zero-based so the first column is numbered 0. ! The xColumn method uses one of the sqlite3_result_AAAA() ! APIs to return the result. This method can invoke ! sqlite3_result_error() to raise an exception, if desired. ---- *xRowid int (*xRowid)(sqlite3_vtab_cursor*, sqlite_int64 *pRowid); + This method writes the 64-bit rowid of the current row + into *pRowid. + ---- *xUpdate* ! int (*xUpdate)( ! sqlite3_vtab *pCursor, ! int argc, ! sqlite3_value **argv, ! sqlite_int64 *pRowid ! ); ! ! All changes to a virtual table are made using the xUpdate ! method. This one method can be used to insert, delete, or ! update. ! ! The argv[0] parameter is the rowid of a row in the virtual ! table to be deleted. If argv[0] is NULL, then no deletion ! occurs. ! ! The argv[1] parameter is the rowid of a new row to be ! inserted into the virtual table. Subsequence argv[] ! entries contain values of the columns of the virtual table, ! in the order that the columns were declared. The number ! of columns will match the table declaration that the ! xConnect or xCreate method made using the ! sqlite3_declare_vtab() call. ! ! If argc==1, then no insert occurs. ! ! If argc>1 and argv[0]==argv[1] then the specified row ! is updated with new values contained in argv[2] and the ! following parameters.