[EMAIL PROTECTED] wrote:
The virtual table will be claim to support an index on
the PATTERN column. So when something of the form
PATTERN = <constant expression>
appears in the WHERE clause, the query optimizer will
open an index cursor on the virtual table, rather than
a table cursor, and preposition the index cursor to the
entry where the PATTERN column was equal to the query
expression. The virtual table implementation will
perform a full-text search in response to any such
actions. Subsequent calls to the xNext() method in
the vtab structure will return successive rows in the
result set of the full-text search.
Ok, I think I'm starting to follow this now. SQLite will scan the index
definitions in the sqlite3_vtab, and find the index on the PATTERN
column. Then it will call the xOpenCursor function to get the index
cursor returned through the second argument. Then it will call the
xSeek function, passing back this cursor and the search string as the
third argument (but I'm still not sure what the second and third
arguments do).
The xSeek implementation will parse the search string and do the actual
lookup in the real full text index. It will then update the cursor to
"point" to the first record.
Then Sqlite will repeated call xNext to get a pointer to the next
matching record.
You say the sqlite3_vtab_cursor structure is opaque, but it seems to me
that the virrtual table implementation functions will need no know about
its internals to update it.
For each record that is located SQLite will call the xColumn function
one or more times to get the data for the selected columns (so that it
can be returned from the SQL query). I don't see a general
sqlite3_value* argument to this function for the returned value, but I'm
not sure what the sqlite3_context argument is for.
Any other use of the PATTERN column will return NULL.
Attempts to modify the PATTERN column will throw a
constraint error. This makes the PATTERN column rather
"special" which has raised a few eyebrows. I am open
to alternative proposals, but this is the best interface
I have seen so far.
Conceptually I don't have a problem with the PATTERN column, it actually
seems rather ingenious. I'm just having a little difficulty see how it
is going to be implemented using the proposed virtual table API.
Thanks for the clarification.
Dennis Cote