FireDAC.Comp.Client.TFDCustomCommand.Define

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Define(ASchema: TFDDatSManager; ATable: TFDDatSTable = nil;  AMetaInfoMergeMode: TFDPhysMetaInfoMergeMode = mmReset): TFDDatSTable; overload;
function Define(ATable: TFDDatSTable = nil;  AMetaInfoMergeMode: TFDPhysMetaInfoMergeMode = mmReset): TFDDatSTable; overload;

C++

Firedac::Dats::TFDDatSTable* __fastcall Define(Firedac::Dats::TFDDatSManager* ASchema, Firedac::Dats::TFDDatSTable* ATable = (Firedac::Dats::TFDDatSTable*)(0x0), Firedac::Phys::Intf::TFDPhysMetaInfoMergeMode AMetaInfoMergeMode = (Firedac::Phys::Intf::TFDPhysMetaInfoMergeMode)(0x0))/* overload */;
Firedac::Dats::TFDDatSTable* __fastcall Define(Firedac::Dats::TFDDatSTable* ATable = (Firedac::Dats::TFDDatSTable*)(0x0), Firedac::Phys::Intf::TFDPhysMetaInfoMergeMode AMetaInfoMergeMode = (Firedac::Phys::Intf::TFDPhysMetaInfoMergeMode)(0x0))/* overload */;

Properties

Type Visibility Source Unit Parent
function public
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
FireDAC.Comp.Client TFDCustomCommand

Description

Defines the structure of the DatS table.

The Define method defines the structure of the DatS table for the command's current cursor if the command is open, or for the first cursor if it is closed.

The method creates a new DatS table, if the value of the ATable parameter is nil.

If the SQL command is SELECT and fiMeta is in FetchOptions.Items, then Define asks the primary key fields for the table in the FROM clause. Finally, the method fills the column list of the DatS table.

This method is overloaded:

  • The first overloaded method defines the DatS manager for the command's multiple result sets.
  • The second overloaded method defines the structure of the DatS table for the command's current cursor.

Example

var
  oTab: TFDDatSTable;
....
  ADCommand1.Prepare('select * from MyTab');
  oTab := ADCommand1.Define;
  ADCommand1.Open;
  ADCommand1.Fetch(oTab);
  ADCommand1.Close;

  // Some time later, after the structure of DB table MyTab have changed.
  // For example, field was removed.

  ADCommand1.Prepare('select * from MyTab');
  oTab := ADCommand1.Define(oTab, mmOverride);
  ADCommand1.Open;
  ADCommand1.Fetch(oTab);
  ADCommand1.Close;

See Also