FireDAC.Comp.Client.TFDCustomCommand.Fetch

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure Fetch(ATable: TFDDatSTable; AAll: Boolean = True; ABlocked: Boolean = False); overload;

C++

void __fastcall Fetch(Firedac::Dats::TFDDatSTable* ATable, bool AAll = true, bool ABlocked = false)/* overload */;

Properties

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

Description

Fetches rows from the current command cursor.

The Fetch method fetches rows from the current command cursor in the DatS table. To call Fetch, the command must be opened (in csActive state) by a call to Open, otherwise an exception is raised.

At each call up to FetchOptions.RowsetSize rows are fetched. If FetchOptions.AutoClose is True, FireDAC automatically calls the CloseAll method after fetching the last row.

If fiBlobs is in FetchOptions.Items, then the values of the BLOB field are fetched together with other field values. If fiDetails is in FetchOptions.Items, then the nested dataset is fetched together with other field values. While fetching, the field values are converted according to FormatOptions and stored into the DatS rows.

Example

var
  oTab: TADDatSTable;
...
  ADCommand1.CommandKind := skStoredProc;
  ADCommand1.CommandText.Text := 'SEL_CUST_PROC';
  oTab := ADCommand1.Define;
  try
    ADCommand1.Open;
    repeat
      oTab.Clear;
      ADCommand1.Fetch(oTab, False);
      // process next rowset
    until ADCommand1.RowsAffected = 0;
  finally
    oTab.Free;
  end;

See Also

Sample