FireDAC.Comp.DataSet.TFDDataSet.SaveToStream
Delphi
procedure SaveToStream(AStream: TStream; AFormat: TFDStorageFormat = sfAuto);
C++
void __fastcall SaveToStream(System::Classes::TStream* AStream, Firedac::Stan::Intf::TFDStorageFormat AFormat = (Firedac::Stan::Intf::TFDStorageFormat)(0x0));
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | FireDAC.Comp.DataSet.pas FireDAC.Comp.DataSet.hpp |
FireDAC.Comp.DataSet | TFDDataSet |
Description
Saves a dataset's data to a stream.
Call SaveToStream to save the dataset data to an external file.
AStream
is the reference to the stream to which to write data. The dataset starts to write its data at the current stream position.
AFormat
is the file format:
sfXML
– a stream contains a well formed stand-alone XML data.sfBinary
– a stream contains a binary data with custom FireDAC format.sfAuto
– a format is determined by ResourceOptions.sfJSON
– a stream contains a stand-alone JSON data.
DefaultStoreExt if it is specified, otherwise by ResourceOptions.DefaultStoreFormat.
SaveToStream stores into the stream the items specified by ResourceOptions.StoreItems.
Example
var
oStr: TStream;
....
FDQuery1.Edit;
oStr := FDQuery1.CreateBlobStream(FDQuery1.FieldByName('data'), bmWrite);
try
FDMemTable1.SaveToStream(oStr, sfBinary);
finally
oStr.Free;
FDQuery1.Post;
end;