Anybody using FTS with Unidac SQLite??

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ravink
Posts: 30
Joined: Tue 02 Sep 2008 05:11

Anybody using FTS with Unidac SQLite??

Post by ravink » Fri 05 Aug 2011 17:25

Hi

I could only find only a single post on FTS in these forums. It is possible that nobody is using FTS here.

I have searched these forums as well as requested for help using FTS with Unidac but nothing is available. There are no examples available. As my skills are limited I would need an example to get started.

I hope someone can point me to how I can get started with Sqlite FTS.

Regards

Ravi K.
________
HotRachel
Last edited by ravink on Fri 12 Aug 2011 02:29, edited 1 time in total.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 09 Aug 2011 14:12

Hello,

The code specified below shows how to work with FTS through UniDAC:

Code: Select all

var
UniConnection: TUniConnection;
UniQuery: TUniQuery;
begin
UniConnection := TUniConnection.Create(nil);
UniQuery := TUniQuery.Create(nil);
try
UniConnection.ProviderName := 'SQLite';
UniConnection.Database := ' ';
UniConnection.Connect;
UniConnection.ExecSQL('CREATE VIRTUAL TABLE mail USING fts3(subject, body)',[]);
UniConnection.ExecSQL('INSERT INTO mail(docid, subject, body) VALUES(1, ''software feedback'', ''found it too slow'')',[]);
UniConnection.ExecSQL('INSERT INTO mail(docid, subject, body) VALUES(2, ''software feedback'', ''no feedback'')',[]);
UniConnection.ExecSQL('INSERT INTO mail(docid, subject, body) VALUES(3, ''slow lunch order'', ''was a software problem'')',[]);

UniQuery.Connection := UniConnection;
UniQuery.SQL.Text := 'SELECT * FROM mail WHERE subject MATCH ''software''';
{SELECT * FROM mail WHERE body MATCH 'feedback';
SELECT * FROM mail WHERE mail MATCH 'software';
SELECT * FROM mail WHERE mail MATCH 'slow';}
UniQuery.Open;
while not UniQuery.Eof do
begin
ShowMessage(UniQuery.FieldByName('subject').AsString);
UniQuery.Next;
end;
UniConnection.ExecSQL('DROP TABLE mail',[]);
finally
UniQuery.Free;
UniConnection.Free;
end; 

ravink
Posts: 30
Joined: Tue 02 Sep 2008 05:11

Post by ravink » Fri 12 Aug 2011 17:07

Hi

Unfortunately I cannot use your code as there is no solution on how to compile the sqlite library to make it work with Unidac. And since the sqlite library is in C I will need a compiler as well as knowledge of C to use it.

It really will be much easier if Devart is willing to provide the compiled dlls and necessary directives. Other delphi vendors seem to have done it. I don't see why devart cannot do it also.

Regards

Ravi K.
AlexP wrote:Hello,

The code specified below shows how to work with FTS through UniDAC:

Code: Select all

var
UniConnection: TUniConnection;
UniQuery: TUniQuery;
begin
UniConnection := TUniConnection.Create(nil);
UniQuery := TUniQuery.Create(nil);
try
UniConnection.ProviderName := 'SQLite';
UniConnection.Database := ' ';
UniConnection.Connect;
UniConnection.ExecSQL('CREATE VIRTUAL TABLE mail USING fts3(subject, body)',[]);
UniConnection.ExecSQL('INSERT INTO mail(docid, subject, body) VALUES(1, ''software feedback'', ''found it too slow'')',[]);
UniConnection.ExecSQL('INSERT INTO mail(docid, subject, body) VALUES(2, ''software feedback'', ''no feedback'')',[]);
UniConnection.ExecSQL('INSERT INTO mail(docid, subject, body) VALUES(3, ''slow lunch order'', ''was a software problem'')',[]);

UniQuery.Connection := UniConnection;
UniQuery.SQL.Text := 'SELECT * FROM mail WHERE subject MATCH ''software''';
{SELECT * FROM mail WHERE body MATCH 'feedback';
SELECT * FROM mail WHERE mail MATCH 'software';
SELECT * FROM mail WHERE mail MATCH 'slow';}
UniQuery.Open;
while not UniQuery.Eof do
begin
ShowMessage(UniQuery.FieldByName('subject').AsString);
UniQuery.Next;
end;
UniConnection.ExecSQL('DROP TABLE mail',[]);
finally
UniQuery.Free;
UniConnection.Free;
end; 

ravink
Posts: 30
Joined: Tue 02 Sep 2008 05:11

Post by ravink » Fri 12 Aug 2011 17:08

Hi

Unfortunately I cannot use your code as there is no solution on how to compile the sqlite library to make it work with Unidac. And since the sqlite library is in C I will need a compiler as well as knowledge of C to use it.

It really will be much easier if Devart is willing to provide the compiled dlls and necessary directives. Other delphi vendors seem to have done it. I don't see why devart cannot do it also.

Regards

Ravi K.
AlexP wrote:Hello,

The code specified below shows how to work with FTS through UniDAC:

Code: Select all

var
UniConnection: TUniConnection;
UniQuery: TUniQuery;
begin
UniConnection := TUniConnection.Create(nil);
UniQuery := TUniQuery.Create(nil);
try
UniConnection.ProviderName := 'SQLite';
UniConnection.Database := ' ';
UniConnection.Connect;
UniConnection.ExecSQL('CREATE VIRTUAL TABLE mail USING fts3(subject, body)',[]);
UniConnection.ExecSQL('INSERT INTO mail(docid, subject, body) VALUES(1, ''software feedback'', ''found it too slow'')',[]);
UniConnection.ExecSQL('INSERT INTO mail(docid, subject, body) VALUES(2, ''software feedback'', ''no feedback'')',[]);
UniConnection.ExecSQL('INSERT INTO mail(docid, subject, body) VALUES(3, ''slow lunch order'', ''was a software problem'')',[]);

UniQuery.Connection := UniConnection;
UniQuery.SQL.Text := 'SELECT * FROM mail WHERE subject MATCH ''software''';
{SELECT * FROM mail WHERE body MATCH 'feedback';
SELECT * FROM mail WHERE mail MATCH 'software';
SELECT * FROM mail WHERE mail MATCH 'slow';}
UniQuery.Open;
while not UniQuery.Eof do
begin
ShowMessage(UniQuery.FieldByName('subject').AsString);
UniQuery.Next;
end;
UniConnection.ExecSQL('DROP TABLE mail',[]);
finally
UniQuery.Free;
UniConnection.Free;
end; 

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 15 Aug 2011 12:47

Hello,

We plan to add SQLite library to UniDAC in one of its future versions.

ravink
Posts: 30
Joined: Tue 02 Sep 2008 05:11

Post by ravink » Tue 16 Aug 2011 06:19

Hi

As I understand here, you are saying that FTS3/FTS4 cannot be used with sqlite without access to a C compiler.

From what I understand based on your answers here as well as direct mails, all that is needed is the sqlite3.dll compiled with different parameters. What I don't understand is since sqlite is Open Source, why devart cannot compile a version with the required settings for unidac users to download. And add an example as well.

If not I will have to wait or look for other sources.

Regards

Ravi K.

Post Reply