Page 1 of 1
Filtering issue
Posted: 20.03.2008, 12:09
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
Posted: 20.03.2008, 14:42
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
Posted: 20.03.2008, 16:07
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
Posted: 21.03.2008, 12:08
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