In unit ffSQLDef.pas, the rewritten function
TffSqlLikePattern.Find, throws a exception when the
argument is empty :
---------------------------------------------------------------------
function TffSqlLikePattern.Find(const TextToSearch:
Variant): Boolean;
{Rewritten !!.13}
{Search the TextToSearch. Return true if the search
pattern was found}
....
begin
Result := False;
try
if TVarData(TextToSearch).VType and VarTypeMask =
varByte then begin
TextLen := VarArrayHighBound(TextToSearch, 1);
if TextLen = 0 then
Exit;
VStr := '';
VPtr := VarArrayLock(TextToSearch);
end
else begin
TextLen := Length(TextToSearch);
if TextLen = 0 then
Exit;
VStr := VarToStr(TextToSearch);
VPtr := PAnsiChar(VStr);
end;
....
finally
if VStr = '' then
VarArrayUnlock(TextToSearch);
end;
end;
---------------------------------------------------------------
If TextLen=0, VStr is undefined and must not be used to
check the call to VarArrayUnloc in the finally block.
I think that the most simple solution is to move the
'try' command out of the first block of code :
function TffSqlLikePattern.Find(const TextToSearch:
Variant): Boolean;
{Rewritten !!.13}
{Search the TextToSearch. Return true if the search
pattern was found}
....
begin
Result := False;
//**** removed try
if TVarData(TextToSearch).VType and VarTypeMask =
varByte then begin
TextLen := VarArrayHighBound(TextToSearch, 1);
if TextLen = 0 then
Exit;
VStr := '';
VPtr := VarArrayLock(TextToSearch);
end
else begin
TextLen := Length(TextToSearch);
if TextLen = 0 then
Exit;
VStr := VarToStr(TextToSearch);
VPtr := PAnsiChar(VStr);
end;
try //*** New try position
....
finally
if VStr = '' then
VarArrayUnlock(TextToSearch);
end;
end;