Ok so lets assume your xConnect function declares something similar to

Create table textfiles( result_path text, result_name text, contents blob, 
search_path text hidden, name_pattern text hidden, is_recursive hidden);

So that you can

SELECT contents from textfiles( 'mypath', NULL, 0);
SELECT contents from textfiles where search_path = 'mypath' and is_recursive = 
1;
SLEECT contents from textfiles where search_path = 'mypath' and name_pattern IN 
('*.txt','*.csv');

With xBestIndex returning costs 1, 2, and 2/3 (with IN and without IN) 
respectively.

And you want to know how to make SQLite always call xFilter with 
('mypath','*.txt') and ('mypath','*.csv') instead of just once with only 
('mypath') and attempting to retrieve the undefined/empty name_pattern. Is this 
correct?

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:[email protected]] Im 
Auftrag von Max Vlasov
Gesendet: Mittwoch, 17. April 2019 13:03
An: SQLite mailing list <[email protected]>
Betreff: Re: [sqlite] [EXTERNAL] "Optional" incoming parameters for virtual 
tables

On Wed, 17 Apr 2019 at 12:52, Hick Gunter <[email protected]> wrote:

> Your xBestIndex function should be returning a cost that is
> proportional to the "effort required to fulfill the query". My own VT
> implementations have been returning the total number of records for
> queries with no constraints and assuming a constant fan-out factor for
> each key field provided as a constraint (eg. 25 for a full table scan,
> 5 if only the first of two key fields is provided and 1 if both are provided).
>

I suspect that you talk more about tables that possess and outputs data 
regardless of "incoming" parameters involved. I understand that in this case it 
is mostly about performance-wise issues when the worst-case scenario is a time 
penalty but still valid results. I'm here more about table-valued tables when 
for some of them not providing incoming parameters means not valid data at all. 
One of my examples is a virtual table outputting text files from a folder. 
Folder is a required parameter, but there's also a binary flag regarding 
whether the scan processes subfolders.
If the flag is provided, the implementation wants it to be used in the 
constraint chosen. Otherwise the intention from the query will not be 
transferred and the scan will be folder-recursive despite the fact that the 
flag disabling it appeared in the query.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to