Page 1 of 1

Filter option gives false results

Posted: 08.02.2012, 22:14
by Antoine
When there are columns in the source table that only contain numbers (in VARCHAR columns) that are included in the filter, the results seem to be totally random and non-relevant.

For example, the code below works flawless:

Code: Select all

procedure TForm1.SearchEditChange(Sender: TObject);
var
  filterQuery : String;
begin
  if Length(SearchEdit.Text) >= 3 then
   begin
    TestTable.FilterOptions:= [foCaseInsensitive];

    filterQuery := 'Name   LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
               ' OR Street LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
               //' OR Nr     LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
               ' OR Town   LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
               ' OR Phone  LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
               '';
    TestTable.Filter := filterQuery;
    TestTable.Filtered := true;
   end
    else
   begin
    TestTable.Filtered:= False;
   end
end;
But when the commented out line is active, it does not work at all.
In this image the problem is clearly visible:

Image

Here is a download link to the Delphi 2010 test project including the database:
http://dl.dropbox.com/u/32493275/ZEOSTEST/ZEOSTEST.zip

Posted: 09.02.2012, 14:43
by EgonHugeist
Antoine,

which SVN-revision do you use? I tested your test project and it works fine...

Maybe i've different sources. I'm working on Full-unicode support for D2009+. So if the last testing revision from Sourceforge.net fails, try my revision from on Sourceforge.net in folder testing-egonhugeist...

best regards

Posted: 09.02.2012, 14:50
by Antoine
Hi, we are working with Delphi 2010. Now i have this evening an meeting with my collegue, I will waite to this evening.

Regards

Posted: 09.02.2012, 15:09
by EgonHugeist
Yep i know, i've tested your example with XE....

Posted: 10.02.2012, 11:49
by Antoine
This code work's perfect:

Code: Select all

procedure TForm1.SearchEditChange(Sender: TObject);
var
  filterQuery : String;
begin
  TestTable.Filtered := False;
  if Length(SearchEdit.Text) >= 2 then
   begin
    filterQuery := 'Name   LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
               ' OR Street LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
               ' OR Nr     =    '                 + SearchEdit.Text +
               ' OR Town   LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
               ' OR Phone  LIKE ' + QuotedStr('*' + SearchEdit.Text + '*') +
               '';
    TestTable.Filter := filterQuery;
    TestTable.Filtered := true;
   end
end;
Thanks all

Regards

Posted: 11.02.2012, 15:47
by Antoine
Hi all,

it's wrong to use one character in the database with ZEOS.

You must have use more then 2 characters in the table. In any table... Is that an bug in ZEOS or is it a programm fail?

I have test it in SQLite Administrator program. But there I can use one character...

I don't know what it is for problem....

Greetz Antoine

Posted: 26.02.2012, 00:06
by EgonHugeist
Nope i think this isn't a bug. The Filter option you use are not Select-Statments like in tha SQLAdmin. They where done on the cached-resultsets. So they are much faster than Database-requests... I'll check this 1Char-Option for you.

Posted: 29.02.2012, 12:57
by Antoine
Danke schön, :lol:

If you have an answer you can mail me for faster results:

xodo54yr@kpnmail.nl

Tnx Anton