FireDAC.Stan.Option.TFDFetchOptions.Mode

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Mode: TFDFetchMode read GetMode write SetMode  stored IsMS default fmOnDemand;

C++

__property TFDFetchMode Mode = {read=GetMode, write=SetMode, stored=IsMS, default=1};

Properties

Type Visibility Source Unit Parent
property published
FireDAC.Stan.Option.pas
FireDAC.Stan.Option.hpp
FireDAC.Stan.Option TFDFetchOptions

Description

Controls how to fetch data.

Use the Mode property to control how the result set records must be fetched into the FireDAC internal data storage.

Mode 

Description 

fmManual

The records are not fetched automatically by FireDAC. A programmer must write the code to fetch records at appropriate moments, using the following methods:

  • FetchAll to fetch all records.
  • GetNextPacket to fetch the next record set (packet), containing RowsetSize records. 

fmOnDemand 

The records are fetched automatically by FireDAC, when they are demanded by the navigation or other dataset methods. At each demand, FireDAC fetches one or more record sets, containing RowsetSize records. This mode allows you to open big result sets without a significant delay, as it happens with the fmAll mode. But the total amount of time of fetching all the records will be higher than in the fmAll mode. For example, on the Microsoft SQL Server, the server side static cursor will be used . 

fmAll

All result set records are fetched automatically by FireDAC at the dataset Open call. On a big result set, it may take some time, but the navigation through a dataset will be fast, because all records will be stored in a FireDAC internal data storage. For certain DBMSs, such as Microsoft SQL Server, MySQL Server, or Sybase SQL Anywhere:

  • It releases a client result set buffer and allows you to execute the next command returning the result sets.
  • Gives maximum fetch performance. For example, on Microsoft SQL Server, the fast forward-only cursor will be used. 

fmExactRecsMax 

Similar to fmAll, but if the number of the fetched records (the value of the RecordCount property) differs from that specified in RecsMax, an exception is raised. 

This mode also affects the SQL commands executed by ExecSQL. If the number of the updated records (the value of the RowsAffected property) differs from that specified in RecsMax, an exception is raised. 

Use the fmExactRecsMax fetching mode in the following scenarios:

  • you need to ensure that your application fetches the only record with a specified key (set RecsMax to 1)
  • you need to ensure that your application updates or deletes the only record with a specified key (set RecsMax to 1).

The default value is fmOnDemand, for TFDCustomMemTable it is fmAll.

See Also