On 11/14/2015 12:33 AM, Johnny Wezel wrote:
> I think there is a flaw in information passing between the xBestIndex
> and xFilter methods in virtual tables.
>
> The information about the constraint operation in the aConstraint array
> can't reach xFilter. But how is xFilter to know how to set up the cursor
> when a statement like
>
> SELECT * FROM MyTable WHERE a > 10
>
> is given? I can pass the index covering a and I can make SQLite pass the
> constant 10 to xFilter, but not the > operation.
>
> IMHO xBestIndex should be called after xOpen as opposed to before and
> have a cursor parameter so I can set up the whole filtering information
> on my terms.
>
> Any thoughts on that?

The idea is that your xBestIndex method sets the 
sqlite3_index_info.idxNum and (optionally) the sqlite3_index_info.idxStr 
variables, the values of which are then passed to xFilter. So you have 
to invent some way for xBestIndex to encode the ">" that xFilter 
understands.

   https://www.sqlite.org/vtab.html#xbestindex
   https://www.sqlite.org/vtab.html#xfilter

See the rtree module for an example:

   http://www.sqlite.org/src/artifact/0f9b595bd0deb?ln=1635

I can see your point though. The simple cases would be easier if xFilter 
were passed something similar to the aConstraint[] array passed to 
xBestIndex.

Dan.

Reply via email to