#301 Re: mORMot 1 » FTS3 » 2010-08-19 10:16:36

I've been trying out the FTS3 by modifying the Sample 02 - Embedded SQLite ORM project

Adding the following before Application.run; works fine:

TSQLRestServerDB(Form1.Database).DB.GetTableNames(TableNamesAtCreation);
  if FindRawUTF8(TableNamesAtCreation, 'fts3index') = -1 then
    TSQLRestServerDB(Form1.Database).EngineExecuteAll(FormatUTF8(
    'CREATE VIRTUAL TABLE fts3index USING fts3(%, %);',['title', 'notes']));

The problem is if I change the add and find buttons onclick event as below I get an assertion failure at line1935 of SQLite3.pas when closing the app. Can you suggest what I'm doing wrong?

procedure TForm1.AddButtonClick(Sender: TObject);
var
  SQL: rawUTF8;
begin
  SQL := FormatUTF8('INSERT INTO fts3index(title, notes) VALUES(''%'', ''%'');',
      [StringToUTF8(NameEdit.Text), StringToUTF8(QuestionMemo.Text)]);
  TSQLRestServerDB(Database).EngineExecuteAll(SQL);
end;

procedure TForm1.FindButtonClick(Sender: TObject);
begin
  questionmemo.Text := TSQLRestServerDB(Database).DB.ExecuteJSON(
  'SELECT * FROM fts3index WHERE fts3index MATCH '''+NAMEEDIT.Text+''';');
end;

I would be great if a Free text searching option could be incorporated into your ORM framework.

Also seem to have found a problem with sample03 (pipes) - The server part can't find unit2.pas

Thanks

Board footer

Powered by FluxBB