Filtering issue

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Filtering issue

Post by btrewern »

When using a filter like:

Code: Select all

ZQuery1.Filter := 'Field1 Like ''*any_text*''';
ZQuery1.Filtered := True;
The returned recordset includes all the correct records and all records which contain just one character in Field1.

Anyone seen this before? Any fix?

Regards,

Ben
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

After some investigation it looks like this is a problem in the ZMatchPattern.pas unit.

See

Code: Select all

function MatchAfterStar(Pattern, Text: string): Integer;
var
  P, T, PLen, TLen: Integer;
begin
  Result := 0;
  P := 1;
  T := 1;
  PLen := Length(Pattern);
  TLen := Length(Text);
  if TLen = 1 then
  begin
    Result := MATCH_VALID;
    Exit;
  end;
..
..
There seems to be some problem with the logic here but I can't see what they are actually trying to do.

Anyone got any idea?

Regards,

Ben
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

With a quick web search I've found the original code by Kevin Boylan which Sergey Seroukhov used as the base for the ZMatchPattern Unit. See attached file.

I've used this to replace the code in ZMatchPattern and the filtering seems to work correctly.

Anyone have any comments?

Ben
You do not have the required permissions to view the files attached to this post.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Ben,

Can you add it as a diff to the corresponding Zeoslib file or add you changed files? That makes it easier for me to test, comment and eventually integrate. I know, that sounds lazy, but given the limited amount of time a human has...

Mark
Image
Post Reply