procedure TDataForm.TableFilterRecord(DataSet: TDataSet;
var Accept: Boolean);
var
i: integer;
f: TField;
s, pkName:
string;
pkValue: variant;
begin
Accept:=false;
with DataSet
do
begin
pkName := '
Nummer';
pkValue := FieldValues[pkName];
for i := 0
to Pred(FieldCount)
do
begin
f := Fields[i];
case f.DataType
of
ftMemo: s := GetMemo('
int', f.FieldName, pkName, pkValue);
ftGraphic: s := '
';
else s := f.AsString;
end;
if AnsiContainsText(s, SearchStr)
then
begin
Accept := true;
Break;
end;
end;
end;
end;
function GetMemo(tblName, fldName, keyName:
string; keyValue: variant):
string;
const
SELECT = '
SELECT %s FROM %s WHERE %s = :key';
var
strm: TStream;
q: TQuery;
begin
q := TQuery.Create(
nil);
with q
do
begin
DatabaseName := '
TEST';
SQL.Text := Format(SELECT, [fldName, tblName, keyName]);
Params.ParamValues['
key'] := keyValue;
Open;
strm := q.CreateBlobStream(Fields[0], bmRead);
SetLength(Result, strm.Size);
strm.ReadBuffer(Result[1], strm.Size);
strm.Free;
Close;
end;
end;