IDASQLCommand

Overview

The IDASQLCommand interface is used to represents an individual command to be executed on the database. Commands 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

 

Dataset

Access to the standard VCL TDataSet.

property Dataset: TDataSet read write

DynamicWhere

Implementation of Dynamic Where.

property DynamicWhere: TDAWhereBuilder read write

Execute  safecall

Performs execution of SQL command.

function Execute: integer

Name

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

OnAfterExecute

Fires right after a command was executed.

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

OnBeforeExecute

Fires just before a command will be executed.

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

OnExecuteError

Fires if error was present during execution of command.

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

ParamByName  safecall

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

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

property Params: TDAParamCollection read write

Prepared

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

RefreshParams  safecall

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

SQL

Defines the SQL statement to be executed.

property SQL: string read write

SQLContainsDynamicWhere  safecall

Checks if SQL contains Dynamic Where macros.

function SQLContainsDynamicWhere: boolean

 

Dataset

Access to the standard VCL TDataSet.

property Dataset: TDataSet read write

DynamicWhere

Implementation of Dynamic Where.

property DynamicWhere: TDAWhereBuilder read write

Name

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

Params

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

property Params: TDAParamCollection read write

Prepared

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

SQL

Defines the SQL statement to be executed.

property SQL: string read write

 

Execute  safecall

Performs execution of SQL command.

function Execute: integer

ParamByName  safecall

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

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

Checks if SQL contains Dynamic Where macros.

function SQLContainsDynamicWhere: boolean

 

OnAfterExecute

Fires right after a command was executed.

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

OnBeforeExecute

Fires just before a command will be executed.

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

OnExecuteError

Fires if error was present during execution of command.

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

Descendants

See Also