Filter option gives false results

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
Antoine
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 08.02.2012, 21:35
Location: Netherlands
Contact:

Filter option gives false results

Post 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
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post 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
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Antoine
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 08.02.2012, 21:35
Location: Netherlands
Contact:

Post 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
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

Yep i know, i've tested your example with XE....
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Antoine
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 08.02.2012, 21:35
Location: Netherlands
Contact:

Post 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
Antoine
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 08.02.2012, 21:35
Location: Netherlands
Contact:

Post 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
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post 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.
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
Antoine
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: 08.02.2012, 21:35
Location: Netherlands
Contact:

Post by Antoine »

Danke schön, :lol:

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

xodo54yr@kpnmail.nl

Tnx Anton
Locked