Sign in Join
FPDoc Onlineexperiment

TMemDataset.InternalOpen procedure

Member of TMemDatasetprotectedIn unit MemDs

Performs actions needed to open the in-memory dataset.

Declaration

pascal
procedure InternalOpen; override

Description

InternalOpen is an overridden procedure used to perform actions needed to open the in-memory dataset. InternalOpen implements the abstract virtual method defined in the ancestor class. InternalOpen is called from the Open method and when the value in the Active property is changed to True.

InternalOpen uses the value in the FileName property to determine if a file stream is needed to read the structure and optional record data for the dataset. When FileName contains a valid file name in the local file system, a TFileStream is created and stored in an internal member. The stream will later be passed to ReadFieldDefsFromStream, LoadDataFromStream, and CheckMarker to load and verify the content in the in-memory dataset. When FileName contains an empty string (''), no file stream is created and values in FieldDefs and record storage must be created at runtime.

InternalOpen calls InternalInitFieldDefs to initialize and load field definitions in the dataset. When DefaultFields is True, the CreateFields method is called to create fields for each of the definitions in FieldDefs. The BindFields method is called to enable calculated and lookup fields as well as compute the value in CalcFieldsSize.

InternalOpen calls CreateTable to allocate storage for records in the dataset, if record storage has not already been initialized. If FileName contains a valid file name, LoadDataFromStream is called to load record data from the file stream. CheckMarker is called to verify that record data was read and the internal file stream is positioned at the smEOF marker. Record data is not loaded when FileName contains an empty string ('') or does not contain a valid file name on the local file system.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.