TAstaCompress


 

Unit
AstaLzhCompress

 

Description
Used internally by ASTA to implement AstaCompresssion

 

Here is an example of how to use it to compress datasets to strings so they can be transported using ASTA Messaging:

 

procedure TForm1.BitBtn1Click(Sender: TObject);

var

  Ac: TAstaCompress;

begin

  FInputString := CloneDataSetToString(Table1);

  Memo1.Lines.Add('Table stored to string size: ' +

    IntToStr(Length(FInputString)));

  Ac := TAstaCompress.Create;

  try

    FOutputString : =Ac.CompressString(FInputString);

    Memo1.Lines.Add('String compressed to size: ' +

      InTtoStr(Length(FOutputString)));

  finally

    Ac.Free;

  end;

end;

 

procedure TForm1.BitBtn2Click(Sender: TObject);

var

  Ac: TAstaCompress;

  s: string;

begin

  Ac := TAstaCompress.Create;

  try

    s := Ac.DecompressString(FOutputString);

    Memo1.Lines.Add('String un-compressed to size: ' +

      InTtoStr(Length(s)));

    //free one if you've done this once

    DataSource2.DataSet.Free;

    DataSource2.DataSet := StringToDataSet(s);

  finally

    Ac.free;

  end;

end;

 

procedure TForm1.FormDestroy(Sender: TObject);

begin

  DataSource2.DataSet.Free; //free this one also!

end;

 

 



ASTA Overview TAstaClientSocket.SQLTransactionStart TAstaCompression