here is a sample:
function TSWSrv.FetchData(const SQL: WideString; var Params: OleVariant;
Compress: Shortint): OleVariant;
var
buff:Array of byte;
v:TParams;
begin
setsql(DataSet,Sql);
v:=TParams.Create;
try
v.ParseSQL(Sql,true);
UnpackParams(params,v);
setparams(DataSet,V);
if Compress=0 then
result:=Prov.Data
else
begin
buff:=Prov.Data;
GetParams(DataSet,v);
params:=PackageParams(v);
mem.Clear;
zip:=TCompressionStream.Create(cldefault,mem);
try
zip.Write(buff[0],high(Buff)+1);
finally
freeandnil(zip);
end;
setlength(buff,mem.size);
mem.Position:=0;
mem.Read(buff[0],mem.Size);
result:=buff;
end;
finally
V.Free;
DataSet.Close;
end;
end;