Skip to content

TFieldDefs

Collection of TFieldDef instances.

Declaration

Source position: db.pas line 224

type

  TFieldDefs = class(TDefCollection)
  public
    constructor Create;
    function Add(const AName: string; ADataType: TFieldType; 
            ASize: Integer; APrecision: Integer; ARequired: Boolean; 
            AReadOnly: Boolean; AFieldNo: Integer; 
            ACodePage: TSystemCodePage) : TFieldDef; overload;
    function Add(const AName: string; ADataType: TFieldType; ASize: Word; 
            ARequired: Boolean; AFieldNo: Integer) : TFieldDef; overload;
    procedure Add(const AName: string; ADataType: TFieldType; ASize: Word; 
             ARequired: Boolean); overload;
    procedure Add(const AName: string; ADataType: TFieldType; ASize: Word); overload;
    procedure Add(const AName: string; ADataType: TFieldType); overload;
    function AddFieldDef : TFieldDef;
    procedure Assign; overload;
    function Find : TFieldDef;
    procedure Update; overload;
    function MakeNameUnique : string;
    property HiddenFields: Boolean; {rw}
    property Items[Index : LongInt]: TFieldDef; {rw}
    property ParentDef: TFieldDef; {r}
  end;

Description

TFieldDefs is used by each TDataset instance to keep a description of the data that it manages; for each field in a record that makes up the underlying data, the TFieldDefs instance keeps an instance of TFieldDef that describes the field's contents. For any internally calculated fields of the dataset, a TFieldDef instance is kept as well. This collection is filled by descendent classes of TDataset as soon as the dataset is opened; it is cleared when the dataset closes. After the collection was populated, the dataset creates TField instances based on all the definitions in the collections. If persistent fields were used, the contents of the fielddefs collection is compared to the field components that are present in the dataset. If the collection contains more field definitions than Field components, these extra fields will not be available in the dataset.

Properties

Member Visibility Description
HiddenFields public Should field instances be created for hidden fields.
Items public Indexed access to the fielddef instances.
ParentDef read only public
See all Properties

Methods

Member Visibility Description
Add public Add a new field definition to the collection.
AddFieldDef public Add new TFieldDef.
Assign public Copy all items from one dataset to another.
Create public Create a new instance of TFieldDefs.
Find public Find item by name.
MakeNameUnique public Create a unique field name starting from a base name.
Update public Force update of definitions.
See all Methods

See also

Name Description
TFieldDef Class to describe one field in a record in a dataset.
TDataset Base class for records-based data-access.