Skip to content

TFieldDef

Class to describe one field in a record in a dataset.

Declaration

Source position: db.pas line 174

type

  TFieldDef = class(TNamedItem)
  public
    constructor Create(ACollection: TCollection);
    constructor Create(AOwner: TFieldDefs; const AName: string; 
                  ADataType: TFieldType; ASize: Integer; 
                  ARequired: Boolean; AFieldNo: LongInt; 
                  ACodePage: TSystemCodePage=CP_ACP); overload;
    destructor Destroy;
    function AddChild : TFieldDef;
    procedure Assign;
    function CreateField : TField;
    function HasChildDefs : Boolean;
    property FieldClass: TFieldClass; {r}
    property FieldNo: LongInt; {r}
    property CharSize: Word; {r}
    property InternalCalcField: Boolean; {rw}
    property ParentDef: TFieldDef; {r}
    property Required: Boolean; {rw}
    property Codepage: TSystemCodePage; {r}
  published
    property Attributes: TFieldAttributes; {rwd}
    property DataType: TFieldType; {rw}
    property ChildDefs: TFieldDefs; {rws}
    property Precision: LongInt; {rwd}
    property Size: Integer; {rwd}
  end;

Description

TFieldDef is used to describe the fields that are present in the data underlying the dataset. For each field in the underlying field, an TFieldDef instance is created when the dataset is opened. This class offers almost no methods, it is mainly a storage class, to store all relevant properties of fields in a record (name, data type, size, required or not, etc.)

Properties

Member Visibility Description
Attributes published Additional attributes of the field.
CharSize read only public Character size.
ChildDefs published
Codepage read only public System code page for the values in string and wide string field types.
DataType published Data type for the field.
FieldClass read only public TField class used for this fielddef.
FieldNo read only public Field number.
InternalCalcField public Is this a definition of an internally calculated field ?
ParentDef read only public
Precision published Precision used in BCD (Binary Coded Decimal) fields.
Required public Is the field required ?
Size published Size of the buffer needed to store the data of the field.
See all Properties

Methods

Member Visibility Description
AddChild public
Assign public Assign the contents of one TFieldDef instance to another.
Create public Constructor for TFieldDef.
CreateField public Create TField instance based on definitions in current TFieldDef instance.
Destroy public Free the TFieldDef instance.
HasChildDefs public
See all Methods

See also

Name Description
TDataset.FieldDefs Definitions of available fields in the underlying database.
TFieldDefs Collection of TFieldDef instances.