TDAEBaseStoredProcedure

Overview

The TDAEBaseStoredProcedure base class implements tools for manipulation with the stored procedures of the Direct Access Component.

Location

Implements

 

constructor Create  virtual    (declared in TDAESQLCommand)

Creates a new instance.

constructor Create(aConnection: IDAConnection; aDataset: TDataset; const aName: string)

Parameters:

  • aConnection: Connection
  • aDataset: Dataset
  • aName: Name

CachedParams  protected    (declared in TDAESQLCommand)

property CachedParams: TStringList read write

CanFreeNativeFieldData  protected safecall    (declared in TDAESQLCommand)

Specifies that given field can destroy pointer returned in GetNativeFieldData method

function CanFreeNativeFieldData: Boolean

CanUseNativeFieldData  protected safecall    (declared in TDAESQLCommand)

Specifies that given field can return data in GetNativeFieldData method

function CanUseNativeFieldData(Index: Integer): Boolean

Parameters:

  • Index: Required field index

ClearParams  protected virtual    (declared in TDAESQLCommand)

Clears parameter values.

procedure ClearParams

Connection  protected    (declared in TDAESQLCommand)

Presents the IDAConnection to access information about available databases, tables, columns, etc.

property Connection: IDAConnection read write

CreateNativeDatabaseAccess  protected virtual    (declared in TDAESQLCommand)

Creates an IDANativeDatabaseAccess implementor.

function CreateNativeDatabaseAccess: IDANativeDatabaseAccess

Dataset    (declared in TDAESQLCommand)

Access to the standard VCL TDataSet.

property Dataset: TDataset read write

DoCreateNativeObject  protected virtual abstract    (declared in TDAESQLCommand)

Creates a object specific to the given connection.

function DoCreateNativeObject: TObject

DoExecute  protected virtual safecall abstract

Executes stored procedure

function DoExecute: integer

DoPrepare  protected virtual safecall

Empty method. Stored procedures do not need to be prepared by default.

procedure DoPrepare(Value: boolean)

Parameters:

  • Value: not used

DynamicWhere  protected    (declared in TDAESQLCommand)

Implementation of Dynamic Where.

property DynamicWhere: TDAWhereBuilder read write

Execute  protected override safecall

Executes stored procedure

function Execute: integer

FindCachedParameter  protected    (declared in TDAESQLCommand)

function FindCachedParameter(const AParams: TParams; const AParamName: string): TParam

Parameters:

  • AParams:
  • AParamName:

FindParameter  protected    (declared in TDAESQLCommand)

Finds the AParamName parameter in the |TParams collection.

function FindParameter(const AParams: TParams; const AParamName: string): TParam

Parameters:

  • AParams:
  • AParamName:

GetDataset  protected safecall    (declared in TDAESQLCommand)

Implements IDASQLCommand by returning the result of CreateDataset.

function GetDataset: TDataset

GetName  protected safecall    (declared in TDAESQLCommand)

Implements IDASQLCommand by returning a value set in the constructor.

function GetName: string

GetNativeFieldData  protected virtual safecall    (declared in TDAESQLCommand)

Sets the DataSize to the according field size value, allocates the Data memory and copies the content of the field.

function GetNativeFieldData(Index: Integer; var Data: pointer; var DataSize: cardinal): Boolean

Parameters:

  • Index: Required field index
  • Data: Pointer allocated with GetMem, which points to a copy of the field data.
  • DataSize: Data size

GetNativeFieldDataType  protected safecall    (declared in TDAESQLCommand)

Returns the field type of the Index field

function GetNativeFieldDataType(Index: Integer): TFieldType

Parameters:

  • Index: field index

GetParams  protected safecall    (declared in TDAESQLCommand)

Implements IDASQLCommand by returning the current parameters.

function GetParams: TDAParamCollection

GetParamValues  protected virtual safecall abstract    (declared in TDAESQLCommand)

Retrieves the values of the given parameters.

procedure GetParamValues(Params: TDAParamCollection)

Parameters:

  • Params: Parameters

GetParamValuesStd  protected    (declared in TDAESQLCommand)

Retrieves the values from Params2 for the daptOutput, daptInputOutput and daptResult parameters of Params1.

procedure GetParamValuesStd(Params1: TDAParamCollection; Params2: TParams)

Parameters:

  • Params1: Parameters guide
  • Params2: Values source

intVCLTypeToDAType  protected virtual    (declared in TDAESQLCommand)

Gets mapping |TFieldType to TDADataType.

function intVCLTypeToDAType(aFieldType: TFieldType; ASize: integer; ADecimalPrecision: integer; aDecimalScale: integer): TDADataType

Parameters:

  • aFieldType:
  • ASize:
  • ADecimalPrecision:
  • aDecimalScale:

IsTDatasetCompatible  protected safecall    (declared in TDAESQLCommand)

Returns true if data access object is TDataset descendant.

function IsTDatasetCompatible: Boolean

Name  protected    (declared in TDAESQLCommand)

Returns a human-readable name for the command.

property Name: string read write

NativeDatabaseAccess  protected    (declared in TDAESQLCommand)

property NativeDatabaseAccess: IDANativeDatabaseAccess read write

NativeFieldCount  protected safecall    (declared in TDAESQLCommand)

Implements IDASQLCommandNativeObject by delegating the call to the FNativeDatabaseAccess member.

function NativeFieldCount: Integer

NativeFields  protected    (declared in TDAESQLCommand)

property NativeFields[Index: Integer]: IDANativeField read write

NativeFindField  protected safecall    (declared in TDAESQLCommand)

Implements IDASQLCommandNativeObject by delegating the call to the FNativeDatabaseAccess member.

function NativeFindField(const FieldName: string): IDANativeField

Parameters:

  • FieldName: name of the searched field

NativeObject  protected    (declared in TDAESQLCommand)

Access to the standard VCL |TObject which implements the data access.

property NativeObject: TObject read write

OnAfterExecute    (declared in TDAESQLCommand)

Fires right after a command was executed.

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

OnBeforeExecute    (declared in TDAESQLCommand)

Fires before command execution

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

OnExecuteError    (declared in TDAESQLCommand)

Fires when exception is detected during command execution

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

ParamByName  protected safecall    (declared in TDAESQLCommand)

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  protected    (declared in TDAESQLCommand)

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

property Params: TDAParamCollection read write

Prepared  protected    (declared in TDAESQLCommand)

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

PrepareSQLStatement  protected override

Abstract class. RefreshParams must be implemented in the descendants.

procedure PrepareSQLStatement

RecreateCachedParams  protected    (declared in TDAESQLCommand)

procedure RecreateCachedParams(aParams: TParams)

Parameters:

  • aParams:

RefreshParams  protected virtual safecall    (declared in TDAESQLCommand)

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

RefreshParamsStd  protected

Refreshes the parameters. Descendants may use it for RefreshParams.

procedure RefreshParamsStd(AParams: TParams)

Parameters:

  • AParams: Input parameters

SetParamValues  protected virtual safecall abstract    (declared in TDAESQLCommand)

Converts values from Data Abstract TDAParam values.

procedure SetParamValues(Params: TDAParamCollection)

Parameters:

  • Params: parameters

SetParamValuesStd  protected    (declared in TDAESQLCommand)

Utility method to set the values of Params2 (|TParams) for the daptOutput, daptInputOutput and daptResult parameters of Params1 (TDAParamCollection).

procedure SetParamValuesStd(Params1: TDAParamCollection; Params2: TParams)

Parameters:

  • Params1: Parameters guide
  • Params2: Values holder

SQL  protected    (declared in TDAESQLCommand)

Defines the SQL statement to be executed.

property SQL: string read write

SQLContainsDynamicWhere  protected virtual safecall    (declared in TDAESQLCommand)

Checks if SQL contains Dynamic Where macros.

function SQLContainsDynamicWhere: boolean

StoredProcedureName  protected

Stored procedure name

property StoredProcedureName: string read write

 

CachedParams  protected    (declared in TDAESQLCommand)

property CachedParams: TStringList read write

Connection  protected    (declared in TDAESQLCommand)

Presents the IDAConnection to access information about available databases, tables, columns, etc.

property Connection: IDAConnection read write

Dataset    (declared in TDAESQLCommand)

Access to the standard VCL TDataSet.

property Dataset: TDataset read write

DynamicWhere  protected    (declared in TDAESQLCommand)

Implementation of Dynamic Where.

property DynamicWhere: TDAWhereBuilder read write

Name  protected    (declared in TDAESQLCommand)

Returns a human-readable name for the command.

property Name: string read write

NativeDatabaseAccess  protected    (declared in TDAESQLCommand)

property NativeDatabaseAccess: IDANativeDatabaseAccess read write

NativeFields  protected    (declared in TDAESQLCommand)

property NativeFields[Index: Integer]: IDANativeField read write

NativeObject  protected    (declared in TDAESQLCommand)

Access to the standard VCL |TObject which implements the data access.

property NativeObject: TObject read write

Params  protected    (declared in TDAESQLCommand)

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

property Params: TDAParamCollection read write

Prepared  protected    (declared in TDAESQLCommand)

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  protected    (declared in TDAESQLCommand)

Defines the SQL statement to be executed.

property SQL: string read write

StoredProcedureName  protected

Stored procedure name

property StoredProcedureName: string read write

 

constructor Create  virtual    (declared in TDAESQLCommand)

Creates a new instance.

constructor Create(aConnection: IDAConnection; aDataset: TDataset; const aName: string)

Parameters:

  • aConnection: Connection
  • aDataset: Dataset
  • aName: Name

CanFreeNativeFieldData  protected safecall    (declared in TDAESQLCommand)

Specifies that given field can destroy pointer returned in GetNativeFieldData method

function CanFreeNativeFieldData: Boolean

CanUseNativeFieldData  protected safecall    (declared in TDAESQLCommand)

Specifies that given field can return data in GetNativeFieldData method

function CanUseNativeFieldData(Index: Integer): Boolean

Parameters:

  • Index: Required field index

ClearParams  protected virtual    (declared in TDAESQLCommand)

Clears parameter values.

procedure ClearParams

CreateNativeDatabaseAccess  protected virtual    (declared in TDAESQLCommand)

Creates an IDANativeDatabaseAccess implementor.

function CreateNativeDatabaseAccess: IDANativeDatabaseAccess

DoCreateNativeObject  protected virtual abstract    (declared in TDAESQLCommand)

Creates a object specific to the given connection.

function DoCreateNativeObject: TObject

DoExecute  protected virtual safecall abstract

Executes stored procedure

function DoExecute: integer

DoPrepare  protected virtual safecall

Empty method. Stored procedures do not need to be prepared by default.

procedure DoPrepare(Value: boolean)

Parameters:

  • Value: not used

Execute  protected override safecall

Executes stored procedure

function Execute: integer

FindCachedParameter  protected    (declared in TDAESQLCommand)

function FindCachedParameter(const AParams: TParams; const AParamName: string): TParam

Parameters:

  • AParams:
  • AParamName:

FindParameter  protected    (declared in TDAESQLCommand)

Finds the AParamName parameter in the |TParams collection.

function FindParameter(const AParams: TParams; const AParamName: string): TParam

Parameters:

  • AParams:
  • AParamName:

GetDataset  protected safecall    (declared in TDAESQLCommand)

Implements IDASQLCommand by returning the result of CreateDataset.

function GetDataset: TDataset

GetName  protected safecall    (declared in TDAESQLCommand)

Implements IDASQLCommand by returning a value set in the constructor.

function GetName: string

GetNativeFieldData  protected virtual safecall    (declared in TDAESQLCommand)

Sets the DataSize to the according field size value, allocates the Data memory and copies the content of the field.

function GetNativeFieldData(Index: Integer; var Data: pointer; var DataSize: cardinal): Boolean

Parameters:

  • Index: Required field index
  • Data: Pointer allocated with GetMem, which points to a copy of the field data.
  • DataSize: Data size

GetNativeFieldDataType  protected safecall    (declared in TDAESQLCommand)

Returns the field type of the Index field

function GetNativeFieldDataType(Index: Integer): TFieldType

Parameters:

  • Index: field index

GetParams  protected safecall    (declared in TDAESQLCommand)

Implements IDASQLCommand by returning the current parameters.

function GetParams: TDAParamCollection

GetParamValues  protected virtual safecall abstract    (declared in TDAESQLCommand)

Retrieves the values of the given parameters.

procedure GetParamValues(Params: TDAParamCollection)

Parameters:

  • Params: Parameters

GetParamValuesStd  protected    (declared in TDAESQLCommand)

Retrieves the values from Params2 for the daptOutput, daptInputOutput and daptResult parameters of Params1.

procedure GetParamValuesStd(Params1: TDAParamCollection; Params2: TParams)

Parameters:

  • Params1: Parameters guide
  • Params2: Values source

intVCLTypeToDAType  protected virtual    (declared in TDAESQLCommand)

Gets mapping |TFieldType to TDADataType.

function intVCLTypeToDAType(aFieldType: TFieldType; ASize: integer; ADecimalPrecision: integer; aDecimalScale: integer): TDADataType

Parameters:

  • aFieldType:
  • ASize:
  • ADecimalPrecision:
  • aDecimalScale:

IsTDatasetCompatible  protected safecall    (declared in TDAESQLCommand)

Returns true if data access object is TDataset descendant.

function IsTDatasetCompatible: Boolean

NativeFieldCount  protected safecall    (declared in TDAESQLCommand)

Implements IDASQLCommandNativeObject by delegating the call to the FNativeDatabaseAccess member.

function NativeFieldCount: Integer

NativeFindField  protected safecall    (declared in TDAESQLCommand)

Implements IDASQLCommandNativeObject by delegating the call to the FNativeDatabaseAccess member.

function NativeFindField(const FieldName: string): IDANativeField

Parameters:

  • FieldName: name of the searched field

ParamByName  protected safecall    (declared in TDAESQLCommand)

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

PrepareSQLStatement  protected override

Abstract class. RefreshParams must be implemented in the descendants.

procedure PrepareSQLStatement

RecreateCachedParams  protected    (declared in TDAESQLCommand)

procedure RecreateCachedParams(aParams: TParams)

Parameters:

  • aParams:

RefreshParams  protected virtual safecall    (declared in TDAESQLCommand)

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

RefreshParamsStd  protected

Refreshes the parameters. Descendants may use it for RefreshParams.

procedure RefreshParamsStd(AParams: TParams)

Parameters:

  • AParams: Input parameters

SetParamValues  protected virtual safecall abstract    (declared in TDAESQLCommand)

Converts values from Data Abstract TDAParam values.

procedure SetParamValues(Params: TDAParamCollection)

Parameters:

  • Params: parameters

SetParamValuesStd  protected    (declared in TDAESQLCommand)

Utility method to set the values of Params2 (|TParams) for the daptOutput, daptInputOutput and daptResult parameters of Params1 (TDAParamCollection).

procedure SetParamValuesStd(Params1: TDAParamCollection; Params2: TParams)

Parameters:

  • Params1: Parameters guide
  • Params2: Values holder

SQLContainsDynamicWhere  protected virtual safecall    (declared in TDAESQLCommand)

Checks if SQL contains Dynamic Where macros.

function SQLContainsDynamicWhere: boolean

 

OnAfterExecute    (declared in TDAESQLCommand)

Fires right after a command was executed.

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

OnBeforeExecute    (declared in TDAESQLCommand)

Fires before command execution

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

OnExecuteError    (declared in TDAESQLCommand)

Fires when exception is detected during command execution

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

Descendants

See Also