IDAServerDataset

Overview

The IDAServerDataset interface is used to represent a special type of command that fetches a record set from the database. The interface extends IDASQLCommand, which provides the basic settings for executing commands on the database, and extends it with functionality specific to commands returning record sets. Datasets are usually obtained via IDAConnection or TDASchema and will be implemented by different classes depending on the database driver you are using.

Location

Implemented in

 

Active

Specifies whether the dataset is currently active (open) or not. Setting this property to true will automatically open the dataset, while setting it to false will automatically close it.

property Active: boolean read write

Close  safecall

Closes the dataset

procedure Close

ControlsDisabled  safecall

Indicates whether data-aware controls update their display to reflect changes to the dataset.

function ControlsDisabled: Boolean

CurrentRecIdValue

Returns identificator of current record.

property CurrentRecIdValue: integer read write

Dataset    (declared in IDASQLCommand)

Access to the standard VCL TDataSet.

property Dataset: TDataSet read write

DisableConstraints  safecall

Disables dataset constraints

procedure DisableConstraints

DisableControls  safecall

Disables data display in data-aware controls associated with the dataset.

procedure DisableControls

DynamicWhere    (declared in IDASQLCommand)

Implementation of Dynamic Where.

property DynamicWhere: TDAWhereBuilder read write

EnableConstraints  safecall

Enables dataset constraints

procedure EnableConstraints

EnableControls  safecall

Enables data display in data-aware controls associated with the dataset.

procedure EnableControls

Eof

Indicates whether reading the dataset has reached the end of the recordset (EOF = End of File). EOF will only turn true if neither an empty dataset was opened or Next was called while the cursor was already on the last record (it will not turn to true when reaching the last record).

property Eof: boolean read write

Execute  safecall    (declared in IDASQLCommand)

Performs execution of SQL command.

function Execute: integer

FieldByName  safecall

Finds a field based on its name. If the specified field does not exist, FieldByName raises an exception.

function FieldByName(const aName: string): TDAField

Parameters:

  • aName: name of the searched field

FieldCount

Indicates the number of fields contained in the dataset.

property FieldCount: integer read write

Fields

Provides access to all the fields contained in the dataset.

property Fields: TDAFieldCollection read write

FieldValues

Provides convenient access to all the fields values of the current record without having to go though the Fields collection property.

property FieldValues[Index: integer]: Variant read write

FindField  safecall

Returns an item with the specified name.

function FindField(const aName: string): TDAField

Parameters:

  • aName: name of the searched field

IsEmpty

Indicates whether the dataset contains no records.

property IsEmpty: boolean read write

Locate  safecall

Locates and activates a record by key values.

function Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions): Boolean

Parameters:

  • KeyFields: The semicolon-separated list of fields.
  • KeyValues: Values specified by the Variant or Variant array.
  • Options: Indicates whether the search is case insensitive and whether partial matches are supported.

LogicalName

Defines the name of the data table.

property LogicalName: string read write

Lookup  safecall

Retrieves the field values from the record that matches the specified search values.

function Lookup(const KeyFields: string; const KeyValues: Variant; const ResultFields: string): Variant

Parameters:

  • KeyFields: the semicolon-separated list of fields
  • KeyValues: Values specified by the Variant or Variant array.
  • ResultFields: The semicolon-separated list of result fields.

Name    (declared in IDASQLCommand)

Returns a human-readable name for the command. For commands obtained through a TDASchema component, this will be the name that the command (or data table) was defined under in Schema Modeler. When obtaining a command from an IDAConnection, the name can be specified in the call to NewCommand or NewDataset.

property Name: string read write

Names

Returns data table's field name specified by Index

property Names[Index: integer]: string read write

Next  safecall

Advances the cursor to the next available record in the dataset. If the current record is the last record available, calling Next will set EOF to indicate the end of the dataset has been reached.

procedure Next

OnAfterExecute    (declared in IDASQLCommand)

Fires right after a command was executed.

property OnAfterExecute: TDAAfterExecuteCommandEvent read write
delegate: procedure OnAfterExecute(const Sender: IDASQLCommand; ActualSQL: string; ElapsedMilliseconds: Cardinal)

OnAfterOpen

Fires after dataset was opened

property OnAfterOpen: TDAAfterOpenDatasetEvent read write
delegate: procedure OnAfterOpen(const Sender: IDADataset; ActualSQL: string; ElapsedMilliseconds: Cardinal)

OnBeforeExecute    (declared in IDASQLCommand)

Fires just before a command will be executed.

property OnBeforeExecute: TDABeforeExecuteCommandEvent read write
delegate: procedure OnBeforeExecute(const Sender: IDASQLCommand)

OnBeforeOpen

Fires before dataset was opened

property OnBeforeOpen: TDABeforeOpenDatasetEvent read write
delegate: procedure OnBeforeOpen(const Sender: IDADataset)

OnExecuteError    (declared in IDASQLCommand)

Fires if error was present during execution of command.

property OnExecuteError: TDAExecuteCommandErrorEvent read write
delegate: procedure OnExecuteError(const Sender: IDASQLCommand; ActualSQL: string; Error: Exception)

OnOpenError

Fired if error was occured duting opening of dataset

property OnOpenError: TDAOpenDatasetErrorEvent read write
delegate: procedure OnOpenError(const Sender: IDADataset; ActualSQL: string; Error: Exception)

Open  safecall

Opens the dataset and prepares it for fetching records from the database.

procedure Open

OrderBy

Represents the collection of OrderBy statements.

property OrderBy: TDAOrderByCollection read write

ParamByName  safecall    (declared in IDASQLCommand)

Locates a specific parameter, based on its name. If no matching parameter is defined, an exception will be raised.

function ParamByName(const aName: string): TDAParam

Parameters:

  • aName: name of the parameter

Params    (declared in IDASQLCommand)

Provides access to the list of parameters defined for the command.

property Params: TDAParamCollection read write

Prepared    (declared in IDASQLCommand)

Specifies whether the SQL statement has been prepared for execution on the database (true) or not (false). Setting this property to true will automatically prepare the statement. Preparing statements on the database server allows for faster execution, especially if the statement will be executed multiple times, as the server will not need to re-parse the SQL text for every execution. Please refer to your database system's documentation for more information on preparing statements.

Note that changing the SQL or Where properties will automatically un-prepare the statement.

property Prepared: boolean read write

RecordCount

Returns the counf of records

property RecordCount: integer read write

RefreshParams  safecall    (declared in IDASQLCommand)

Refreshes the list of parameters defined for the command based on the actual parameter names found in the SQL statement and Where clause.

procedure RefreshParams

RowRecIdValue

Returns record ID

property RowRecIdValue: integer read write

SQL    (declared in IDASQLCommand)

Defines the SQL statement to be executed.

property SQL: string read write

SQLContainsDynamicWhere  safecall    (declared in IDASQLCommand)

Checks if SQL contains Dynamic Where macros.

function SQLContainsDynamicWhere: boolean

 

Active

Specifies whether the dataset is currently active (open) or not. Setting this property to true will automatically open the dataset, while setting it to false will automatically close it.

property Active: boolean read write

CurrentRecIdValue

Returns identificator of current record.

property CurrentRecIdValue: integer read write

Dataset    (declared in IDASQLCommand)

Access to the standard VCL TDataSet.

property Dataset: TDataSet read write

DynamicWhere    (declared in IDASQLCommand)

Implementation of Dynamic Where.

property DynamicWhere: TDAWhereBuilder read write

Eof

Indicates whether reading the dataset has reached the end of the recordset (EOF = End of File). EOF will only turn true if neither an empty dataset was opened or Next was called while the cursor was already on the last record (it will not turn to true when reaching the last record).

property Eof: boolean read write

FieldCount

Indicates the number of fields contained in the dataset.

property FieldCount: integer read write

Fields

Provides access to all the fields contained in the dataset.

property Fields: TDAFieldCollection read write

FieldValues

Provides convenient access to all the fields values of the current record without having to go though the Fields collection property.

property FieldValues[Index: integer]: Variant read write

IsEmpty

Indicates whether the dataset contains no records.

property IsEmpty: boolean read write

LogicalName

Defines the name of the data table.

property LogicalName: string read write

Name    (declared in IDASQLCommand)

Returns a human-readable name for the command. For commands obtained through a TDASchema component, this will be the name that the command (or data table) was defined under in Schema Modeler. When obtaining a command from an IDAConnection, the name can be specified in the call to NewCommand or NewDataset.

property Name: string read write

Names

Returns data table's field name specified by Index

property Names[Index: integer]: string read write

OrderBy

Represents the collection of OrderBy statements.

property OrderBy: TDAOrderByCollection read write

Params    (declared in IDASQLCommand)

Provides access to the list of parameters defined for the command.

property Params: TDAParamCollection read write

Prepared    (declared in IDASQLCommand)

Specifies whether the SQL statement has been prepared for execution on the database (true) or not (false). Setting this property to true will automatically prepare the statement. Preparing statements on the database server allows for faster execution, especially if the statement will be executed multiple times, as the server will not need to re-parse the SQL text for every execution. Please refer to your database system's documentation for more information on preparing statements.

Note that changing the SQL or Where properties will automatically un-prepare the statement.

property Prepared: boolean read write

RecordCount

Returns the counf of records

property RecordCount: integer read write

RowRecIdValue

Returns record ID

property RowRecIdValue: integer read write

SQL    (declared in IDASQLCommand)

Defines the SQL statement to be executed.

property SQL: string read write

 

Close  safecall

Closes the dataset

procedure Close

ControlsDisabled  safecall

Indicates whether data-aware controls update their display to reflect changes to the dataset.

function ControlsDisabled: Boolean

DisableConstraints  safecall

Disables dataset constraints

procedure DisableConstraints

DisableControls  safecall

Disables data display in data-aware controls associated with the dataset.

procedure DisableControls

EnableConstraints  safecall

Enables dataset constraints

procedure EnableConstraints

EnableControls  safecall

Enables data display in data-aware controls associated with the dataset.

procedure EnableControls

Execute  safecall    (declared in IDASQLCommand)

Performs execution of SQL command.

function Execute: integer

FieldByName  safecall

Finds a field based on its name. If the specified field does not exist, FieldByName raises an exception.

function FieldByName(const aName: string): TDAField

Parameters:

  • aName: name of the searched field

FindField  safecall

Returns an item with the specified name.

function FindField(const aName: string): TDAField

Parameters:

  • aName: name of the searched field

Locate  safecall

Locates and activates a record by key values.

function Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions): Boolean

Parameters:

  • KeyFields: The semicolon-separated list of fields.
  • KeyValues: Values specified by the Variant or Variant array.
  • Options: Indicates whether the search is case insensitive and whether partial matches are supported.

Lookup  safecall

Retrieves the field values from the record that matches the specified search values.

function Lookup(const KeyFields: string; const KeyValues: Variant; const ResultFields: string): Variant

Parameters:

  • KeyFields: the semicolon-separated list of fields
  • KeyValues: Values specified by the Variant or Variant array.
  • ResultFields: The semicolon-separated list of result fields.

Next  safecall

Advances the cursor to the next available record in the dataset. If the current record is the last record available, calling Next will set EOF to indicate the end of the dataset has been reached.

procedure Next

Open  safecall

Opens the dataset and prepares it for fetching records from the database.

procedure Open

ParamByName  safecall    (declared in IDASQLCommand)

Locates a specific parameter, based on its name. If no matching parameter is defined, an exception will be raised.

function ParamByName(const aName: string): TDAParam

Parameters:

  • aName: name of the parameter

RefreshParams  safecall    (declared in IDASQLCommand)

Refreshes the list of parameters defined for the command based on the actual parameter names found in the SQL statement and Where clause.

procedure RefreshParams

SQLContainsDynamicWhere  safecall    (declared in IDASQLCommand)

Checks if SQL contains Dynamic Where macros.

function SQLContainsDynamicWhere: boolean

 

OnAfterExecute    (declared in IDASQLCommand)

Fires right after a command was executed.

property OnAfterExecute: TDAAfterExecuteCommandEvent read write
delegate: procedure OnAfterExecute(const Sender: IDASQLCommand; ActualSQL: string; ElapsedMilliseconds: Cardinal)

OnAfterOpen

Fires after dataset was opened

property OnAfterOpen: TDAAfterOpenDatasetEvent read write
delegate: procedure OnAfterOpen(const Sender: IDADataset; ActualSQL: string; ElapsedMilliseconds: Cardinal)

OnBeforeExecute    (declared in IDASQLCommand)

Fires just before a command will be executed.

property OnBeforeExecute: TDABeforeExecuteCommandEvent read write
delegate: procedure OnBeforeExecute(const Sender: IDASQLCommand)

OnBeforeOpen

Fires before dataset was opened

property OnBeforeOpen: TDABeforeOpenDatasetEvent read write
delegate: procedure OnBeforeOpen(const Sender: IDADataset)

OnExecuteError    (declared in IDASQLCommand)

Fires if error was present during execution of command.

property OnExecuteError: TDAExecuteCommandErrorEvent read write
delegate: procedure OnExecuteError(const Sender: IDASQLCommand; ActualSQL: string; Error: Exception)

OnOpenError

Fired if error was occured duting opening of dataset

property OnOpenError: TDAOpenDatasetErrorEvent read write
delegate: procedure OnOpenError(const Sender: IDADataset; ActualSQL: string; Error: Exception)

See Also