FireDAC.Stan.Option.TFDFetchOptions.RecordCountMode

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property RecordCountMode: TFDRecordCountMode read GetRecordcountMode  write SetRecordCountMode stored IsRCMS default cmVisible;

C++

__property TFDRecordCountMode RecordCountMode = {read=GetRecordcountMode, write=SetRecordCountMode, stored=IsRCMS, default=0};

Properties

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

Description

Controls how to count records in a result set.

Use the RecordCountMode property to control how the TFDDataSet counts the records in the result set.

Mode 

Description 

cmVisible

RecordCount returns the number of records currently accessible through the TDataSet navigation interface. For example, all these records are accessible to a user using associated TDBGrid.

  • RecordCountMode tracks records deleted/appended to the dataset.
  • Is not applicable to TFDTable in the LDV mode.
  • Has no overhead.
  • Gives a convenient value for the end-users.

 

cmFetched

RecordCount returns the number of fetched records at the current moment.

  • RecordCountMode tracks records deleted/appended to the dataset.
  • Is not applicable to TFDTable in the LDV mode.
  • Has no overhead.
  • Gives a current dataset "weight", rather than a convenient value for the end-users.

 

cmTotal 

RecordCount returns the number of records, which will be returned by the command. For this, FireDAC issues SELECT COUNT(*) FROM (<original SQL command text>).

  • RecordCountMode does not track records deleted / appended to the dataset. To refresh RecordCountMode, call the Refresh method.
  • Applicable to TFDTable in the LDV mode.
  • Has an overhead at dataset opening.
  • Gives nearly the exact number of records until the dataset records are deleted/inserted.

 

The default value is cmVisible

Note: MySQL may return the "Commands out of sync; you can't run this command now" error when RecordCountMode = cmTotal. In this case, either set Mode to fmFetchAll or do not use cmTotal.

See Also