Hi all,
Where can I get an example of xFilter implementation? The issue I am having
here is that when I am trying to execute a "select * from tablex where value=1"
all I get is the last result from the file (336cc2282716::1).
int my_filter( sqlite3_vtab_cursor* pCursor, int idxNum, const char *idxStr,
int argc, sqlite3_value **argv )
{
csv_cursor * cur = (csv_cursor *) pCursor;
csv_vtab * tab = (csv_vtab *) cur->cursor.pVtab;
csvfile_rewind( tab->csv );
csvfile_read( tab->csv ); /* skip first row with column names */
cur->csvpos = csvfile_tell( tab->csv );
csvfile_read( tab->csv ); /* skip first row with column names */
return SQLITE_OK;
}
***first row in the file not important
ed527dc53686::1
336cc2282716::1
41f955b0::0
00225828815a::1
00271368ace9::0
f0def10e9046::0
70b1e68e9e67::0
ed527dc53686::1
336cc2282716::1
When I do "select * from tablex" I get all the results fine. It is only when I
use the where clause is that I get strange results.
Any hints will be greatly appreciated.
-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Jay A. Kreibich
Sent: Friday, February 25, 2011 11:00 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Virtual Table and the xBestIndex
On Fri, Feb 25, 2011 at 09:30:00PM -0500, Dariusz Matkowski scratched on the
wall:
> I am trying to implement a simple virtual table that reads in a file
> with two columns and "::" separator. My question is: is it necessary
> to implement xBestIndex to run a simple where clause queries?
You must implement a xBestIndex() function, but it does not need to
do anything other than return SQLITE_OK. This will result in a full
table scan for each query, but for something like a flat file (where
you cannot easily jump to specific records) that's usually not a
significant limitation.
-j
--
Jay A. Kreibich < J A Y @ K R E I B I.C H >
"Intelligence is like underwear: it is important that you have it,
but showing it to the wrong people has the tendency to make them
feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential
information, privileged material (including material protected by the
solicitor-client or other applicable privileges), or constitute non-public
information. Any use of this information by anyone other than the intended
recipient is prohibited. If you have received this transmission in error,
please immediately reply to the sender and delete this information from your
system. Use, dissemination, distribution, or reproduction of this transmission
by unintended recipients is not authorized and may be unlawful.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users