Streaming AstaDataSets
TAstaDataSets are streamable so that they can be saved to disk or even stored in the blob field of a database. There are several methods available for streaming:
procedure SaveToFile(const FileName: string);
procedure LoadFromFile(const FileName: string);
procedure SaveToStream(Stream: TStream);
procedure LoadFromStream(Stream: TStream);
function SaveToString: string;
procedure LoadFromString(S: string);
When these methods are called both the defined fields and the data is streamed. Streaming memos and blobs is fully supported.
Since the field definitions are stored in the Form (.dfm) file, TAstaDataSets do NOT load their field definitions when LoadFromStream or LoadFromFile is called. This is done so as not to interfere with any persistent fields that you have defined. The fields are, however, always stored in the saved streams. To load a TAstaDataSet that has been saved from another TAstaDataSet, that has no fields defined, use the following calls.
procedure LoadFromStreamwithFields(Stream: TStream);
procedure LoadFromFileWithFields(const FileName: string);
This allows datasets of datasets to be saved if a blob field is defined in a TDataSet.