TDABusinessProcessor
Overview
Business Processors provide the core logic for processing changes from client applications and applying them to the back-end database.
Business Processor functionality tightly integrates with the default data service implementations provided by Data Abstract (TDataAbstractService for new v4.0 style servers), allowing the majority of middle-tier server applications to function without any manual processing code.
Furthermore, the data service classes provide the ability to automatically and internally instantiate business processors as needed, requiring you to drop and manually configure TDABusinessProcessor components only if you want to override the default behavior.
Location
- Unit: uDABusinessProcessor.pas
- Ancestry: TComponent | TROComponent | TScriptableComponent | TDABusinessProcessor
constructor Create override
Standard component constructor
constructor Create(aOwner: TComponent)
Parameters:
- aOwner: Owner
Assign override
Copies the contents of another, similar object.
procedure Assign(Source: TPersistent)
Parameters:
- Source: Instance whose properties will be copied
BusinessRulesID
Used for associating current strongly typed business processor to a business helper class . It should correspond to a value used in RegisterBusinessProcessorRules
method, called in initialization section of the business helper class unit.
property BusinessRulesID: string read write
CheckProperties
Validates the business processor properties.
procedure CheckProperties
CreateMappings protected
Creates mapping for specific command
procedure CreateMappings(const aDelta: IDADelta; out MappingArray: TDAParamMappingArray; const aCommand: IDASQLCommand; lAdditionalMapping: TDAColumnMappingCollection; AValidateCommand: Boolean)
Parameters:
- aDelta: Delta
- MappingArray: Mapping array
- aCommand: Command
- lAdditionalMapping: Additional mapping
- AValidateCommand: Validate command
CurrentChange
This is an individual changed record currently being processed.
property CurrentChange: TDADeltaChange read
CurrentDelta
CurrentDelta is the set of changes currently to be transmitted between client and server.
property CurrentDelta: TDADelta read
DeleteCommandName
This command will be used to apply DELETE changes for the data table back to the server. This property only needs to be assigned if your schema provides a special command for processing DELETE changes (which could be an SQL DELETE statement or a stored procedure). To make the Business Processor use this command, remove poAutoGenerateDelete in the ProcessorOptions; if poAutoGenerateDelete is specified, the Business Processor will automatically generate the necessary SQL code to perform the DELETE on the database.
property DeleteCommandName: string read write
DoAfterExecuteCommandEvent protected
Fires AfterExecuteCommand event.
procedure DoAfterExecuteCommandEvent(const ACommand: IDASQLCommand; CommandName: string; ElapsedMilliseconds: Cardinal)
Parameters:
- ACommand: command
- CommandName: command name
- ElapsedMilliseconds: time of execution of command
DoAfterProcessChangeEvent protected
Fires AfterProcessChange event.
procedure DoAfterProcessChangeEvent(aChange: TDADeltaChange; Processed: Boolean; var CanRemoveFromDelta: Boolean)
Parameters:
- aChange: Change
- Processed: Status of change
- CanRemoveFromDelta: Remove change from delta or not.
DoAfterProcessDeltaEvent protected
Fires OnAfterProcessDelta
procedure DoAfterProcessDeltaEvent(const aDelta: IDADelta)
Parameters:
- aDelta: Delta
DoBeforeExecuteCommandEvent protected
Fires BeforeExecuteCommand event.
procedure DoBeforeExecuteCommandEvent(const ACommand: IDASQLCommand; CommandName: string)
Parameters:
- ACommand: Command
- CommandName: Command name
DoBeforeProcessChangeEvent protected
Fires OnBeforeProcessChange
procedure DoBeforeProcessChangeEvent(aChange: TDADeltaChange; var ProcessChange: Boolean; var CanRemoveFromDelta: Boolean)
Parameters:
- aChange: Change
- ProcessChange: Process change
- CanRemoveFromDelta: Remove change from delta
DoGenerateSQLEvent protected
Fires OnGenerateSQL event.
procedure DoGenerateSQLEvent(aChangeType: TDAChangeType; const ReferencedStatement: TDAStatement; const aDelta: IDADelta; var SQL: string)
Parameters:
- aChangeType: Change type
- ReferencedStatement: Referenced statement
- aDelta: Delta
- SQL: SQL statement
DoProcessChangeEvent protected
Fires OnProcessChange
procedure DoProcessChangeEvent(aChangeType: TDAChangeType; aChange: TDADeltaChange; const aCommand: IDASQLCommand)
Parameters:
- aChangeType: Change type
- aChange: Change
- aCommand: Command
DoProcessErrorEvent protected
Fires OnProcessError
procedure DoProcessErrorEvent(aChange: TDADeltaChange; const aCommand: IDASQLCommand; var CanRemoveFromDelta: Boolean; Error: Exception)
Parameters:
- aChange: Change
- aCommand: command
- CanRemoveFromDelta: Allows removes change from delta or not
- Error: Exception raised by the data change attempt
DoRefreshDeltaChangeEvent protected
Fires OnRefreshDeltaChange event.
procedure DoRefreshDeltaChangeEvent(aChangeType: TDAChangeType; aChange: TDADeltaChange; const aRefreshDataSet: IDAServerDataset)
Parameters:
- aChangeType: Change type
- aChange: Change
- aRefreshDataSet: Refresh dataset
GenerateRefreshDataset (TDADataset, IDAConnection, string, TDAColumnMappingCollection, TDAColumnMappingCollection): IDAServerDataset protected overload
Creates an IDADataset that can be used for refreshing data.
function GenerateRefreshDataset(aDataset: TDADataset; aConnection: IDAConnection; const aTargetTable: string; aColumnMappings: TDAColumnMappingCollection; AUnionMapping: TDAColumnMappingCollection): IDAServerDataset
Parameters:
- aDataset: Dataset
- aConnection: Connection
- aTargetTable: Target table
- aColumnMappings: Column mapping
- AUnionMapping: Union mapping
GenerateRefreshDataset (TDADataset, IDADelta, TDAStatement, IDAConnection): IDADataset protected overload
Creates an IDADataset that can be used for refreshing data.
function GenerateRefreshDataset(aDataset: TDADataset; const aDelta: IDADelta; aDatasetStatement: TDAStatement; aConnection: IDAConnection): IDADataset
Parameters:
- aDataset: Dataset
- aDelta: Delta
- aDatasetStatement: Dataset statement
- aConnection: Connection
GenerateSQL protected dynamic
Generates SQL for insert, update or delete according to aChangeType.
function GenerateSQL(aChangeType: TDAChangeType; aChange: TDADeltaChange; aDataset: TDADataset; const aDelta: IDADelta; aDatasetStatement: TDAStatement; aConnection: IDAConnection): string
Parameters:
- aChangeType: Change type
- aChange: Change
- aDataset: Dataset
- aDelta: Delta
- aDatasetStatement: Dataset statement
- aConnection: Connection
GenerateSQL2 protected
Generates SQL for insert, update or delete according to aChangeType.
function GenerateSQL2(aChangeType: TDAChangeType; aChange: TDADeltaChange; aDataset: TDADataset; const aDelta: IDADelta; aDatasetStatement: TDAStatement; aConnection: IDAConnection; aUseAutoIncUpdate: Boolean): string
Parameters:
- aChangeType: Change type
- aChange: Change
- aDataset: Dataset
- aDelta: Delta
- aDatasetStatement: Dataset statement
- aConnection: Connection
- aUseAutoIncUpdate: Use Autoinc update
GetConnectionForObject protected
Returns connection for specified object
function GetConnectionForObject(const aConnection: IDAConnection; const aName: string): IDAConnection
Parameters:
- aConnection: Default connection
- aName: name of object
HasReducedDelta
Checks if reduced delta is used
property HasReducedDelta: Boolean read
InsertCommandName
This command will be used to apply INSERT changes for the data table back to the server. This property only needs to be assigned if your schema provides a special command for processing INSERT changes (which could be an SQL INSERT statement or a stored procedure). To make the Business Processor use this command, remove poAutoGenerateInsert in the ProcessorOptions; if poAutoGenerateInsert is specified, the Business Processor will automatically generate the necessary SQL code to perform the INSERT on the database.
property InsertCommandName: string read write
Notification protected override
Forwards notification messages to all owned components.
procedure Notification(AComponent: TComponent; Operation: TOperation)
Parameters:
- AComponent: component
- Operation: operation
OnAfterExecuteCommand
Fires right after a command was executed.
property OnAfterExecuteCommand: TDAAfterExecuteCommandEvent read write
delegate: procedure OnAfterExecuteCommand(const Sender: IDASQLCommand; ActualSQL: string; ElapsedMilliseconds: Cardinal)
OnAfterProcessChange
Fires just after the Business Processor finishes processing an individual change received from the client.
property OnAfterProcessChange: TDAAfterProcessChangeEvent read write
delegate: procedure OnAfterProcessChange(Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean; var CanRemoveFromDelta: Boolean)
OnAfterProcessDelta
Fires right after the business processor is finished processing a delta received from the client. You can use this event to inspect (or modify) any resulting delta that was generated and will be sent back to the client.
property OnAfterProcessDelta: TDAProcessDeltaEvent read write
delegate: procedure OnAfterProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta)
OnBeforeExecuteCommand
Fires just before a command will be executed.
property OnBeforeExecuteCommand: TDABeforeExecuteCommandEvent read write
delegate: procedure OnBeforeExecuteCommand(const Sender: IDASQLCommand)
OnBeforeProcessChange
Fires just before the Business Processor starts processing an individual change received from the client. Use this event to inspect or make modifications to the change before it will be applied, or to prevent the change from being applied at all by setting the ProcessChange parameter to false.
property OnBeforeProcessChange: TDABeforeProcessChangeEvent read write
delegate: procedure OnBeforeProcessChange(Sender: TDABusinessProcessor; aChangeType: TDAChangeType; aChange: TDADeltaChange; var ProcessChange: Boolean)
OnBeforeProcessDelta
Fires just before the business processor starts processing a delta received from the client.
property OnBeforeProcessDelta: TDAProcessDeltaEvent read write
delegate: procedure OnBeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta)
OnGenerateSQL
Fires after the Business Processor has generated code for applying an update. You can use the SQL parameter passed to this event to inspect, log or even modify the SQL before it will be applied. Note that this event will not fire for every individual change that is being processed; for each round of updates, the Business Processor will only generate each type of SQL statement (INSERT, UPDATE, DELETE and refresh SELECT) once. Therefore, you should not use this event to make change-specific modifications to the SQL code.
property OnGenerateSQL: TDAGenerateSQLEvent read write
delegate: procedure OnGenerateSQL(Sender: TDABusinessProcessor; ChangeType: TDAChangeType; const ReferencedStatement: TDAStatement; const aDelta: IDADelta; var SQL: string)
OnProcessChange
Fires as the Business Processor processes an individual change. Use this event to inspect or log the change being processed, including the actual command and it's parameters that will be run on the dataset. You can also use this event to make last adjustments to the command or its parameters, if needed, but modifications to the change itself will have no effect, as the command has already been fully initialized.
property OnProcessChange: TDAProcessChangeEvent read write
delegate: procedure OnProcessChange(Sender: TDABusinessProcessor; aChangeType: TDAChangeType; aChange: TDADeltaChange; const aCommand: IDASQLCommand)
OnProcessError
Fires if an error occurred while applying an individual change to the back-end database.
property OnProcessError: TDAProcessErrorEvent read write
delegate: procedure OnProcessError(Sender: TDABusinessProcessor; aChangeType: TDAChangeType; aChange: TDADeltaChange; const aCommand: IDASQLCommand; var CanRemoveFromDelta: Boolean; Error: Exception)
OnRefreshDeltaChange
Fires as the business processor executes the data refresh for an individual change. Use this event to inspect or log the refresh, including the actual SQL and dataset parameters . You can also use this event to make last adjustments to the dataset SQL or its parameters.
property OnRefreshDeltaChange: TDARefreshDeltaChangeEvent read write
delegate: procedure OnRefreshDeltaChange(Sender: TDABusinessProcessor; aChangeType: TDAChangeType; aChange: TDADeltaChange; const aRefreshDataSet: IDADataset)
ProcessDelta (IDAConnection, IDADelta, TDAChangeTypes, TDADeltaStruct) overload virtual
Performs the processing of the passed delta and applies the changes to the database.
procedure ProcessDelta(const aConnection: IDAConnection; const aDelta: IDADelta; ChangeTypes: TDAChangeTypes; ADeltaStruct: TDADeltaStruct)
Parameters:
- aConnection: Connection
- aDelta: Delta
- ChangeTypes: Change types
- ADeltaStruct: Delta struct
ProcessDeltaForUnion virtual
Performs the processing of the passed delta and applies the changes to the database.
procedure ProcessDeltaForUnion(const aConnection: IDAConnection; const aDelta: IDADelta; ChangeTypes: TDAChangeTypes; ADeltaStruct: TDADeltaStruct)
Parameters:
- aConnection: Connection
- aDelta: Delta
- ChangeTypes: Change types
- ADeltaStruct: Delta struct
ProcessorOptions
Configures various options for the behavior of the business processor. Available options include:
- Generate automatic INSERT statements instead of using the InsertCommandName.
- Generate automatic UPDATE statements instead of using the UpdateCommandName.
- Generate automatic DELETE statements instead of using the DeleteCommandName.
- Generate automatic SELECT statements instead of using the RefreshDatasetName.
- Prepare commands against the back-end database for faster execution. See IDASQLCommand.Prepared for details.
- Disable the "no rows were affected by this update" error message.
property ProcessorOptions: TDAProcessorOptions read write
QueryInterface protected override
Returns a reference to a specified interface if the object supports that interface. This is one of the methods introduced by the IUnknown interface.
function QueryInterface(const IID: TGUID; out Obj: ): HResult
Parameters:
- IID: Identifier of the interface to return
- Obj: Variable to store the returned interface reference to
RaiseExceptionAtError
Manages how TDABusinessProcessor behaves when an error is encountered.
property RaiseExceptionAtError: Boolean read write
ReferencedDataset
The dataset (data table) to which this Business Processor refers. Every Business Processor is configured to handle deltas for one specific data table, and this property will be used to determine which table is handled by this processor.
property ReferencedDataset: string read write
RefreshDatasetName
Sets the name of the datatset (data table) that will be used to fetch refresh data from the server. This property only needs to be assigned if your schema provides a special dataset for refreshing data from the server (which could be an SQL SELECT statement or a stored procedure). To make the Business Processor use this dataset, remove poAutoGenerateRefreshDataset in the ProcessorOptions; if poAutoGenerateRefreshDataset is specified, the Business Processor will automatically generate the necessary SQL code to perform the SELECT on the database.
property RefreshDatasetName: string read write
ROFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure ROFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
RORemoveFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure RORemoveFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
Schema
References the TDASchema that the Business Processor will be working on. Most commonly, this is the ServiceSchema of the data service. All the data tables and commands referenced from InsertCommandName, UpdateCommandName, DeleteCommandName, RefreshDatasetName and ReferencedDataset must be defined in this schema.
property Schema: TDASchema read write
ScriptingProvider (declared in TScriptableComponent)
Component which performs the execution of the script.
property ScriptingProvider: TDABaseScriptingProvider read write
SendRemoveNotification protected (declared in TROComponent)
Forwards notification messages to all owned components.
procedure SendRemoveNotification(aComponent: TComponent)
Parameters:
- aComponent: component
Service
Reference to own service.
property Service: TRORemoteDataModule read write
SetupCommands (IDAConnection, TDADeltaChange, IDASQLCommand, string, Boolean) protected overload dynamic
Creates delta commands
procedure SetupCommands(const aConnection: IDAConnection; const aChange: TDADeltaChange; out anCmd: IDASQLCommand; out aTargetTable: string; aUseAutoIncUpdate: Boolean)
Parameters:
- aConnection: Connection
- aChange: Change
- anCmd: Command
- aTargetTable: Target table
- aUseAutoIncUpdate: Use Autoinc update
SetupCommands (IDAConnection, IDADelta, TDADeltaProcessorItemCollection) protected overload dynamic
Creates delta commands
procedure SetupCommands(const aConnection: IDAConnection; const aDelta: IDADelta; out aCommandsList: TDADeltaProcessorItemCollection)
Parameters:
- aConnection: Connection
- aDelta: Delta
- aCommandsList: List of commands
SetupCommands (IDAConnection, IDADelta, IDASQLCommand, IDASQLCommand, IDASQLCommand, IDASQLCommand, IDAServerDataset, string) protected overload dynamic
Creates delta commands
procedure SetupCommands(const aConnection: IDAConnection; const aDelta: IDADelta; out anInsertCmd: IDASQLCommand; out anUpdateCmd: IDASQLCommand; out anUpdateCMD_AutoInc: IDASQLCommand; out aDeleteCmd: IDASQLCommand; out aRefreshDs: IDAServerDataset; out aTargetTable: string)
Parameters:
- aConnection: Connection
- aDelta: Delta
- anInsertCmd: Insert command
- anUpdateCmd: Update command
- anUpdateCMD_AutoInc: Insert command for autoinc
- aDeleteCmd: Delete command
- aRefreshDs: Refresh dataset
- aTargetTable: Target table
SetupCommandsWithMapping protected
Creates delta command
procedure SetupCommandsWithMapping(const aConnection: IDAConnection; const aChange: TDADeltaChange; const aChangeType: TDAChangeType; out anCmd: IDASQLCommand; out aParamMapping: TDAParamMappingArray; out aRefreshDs: IDAServerDataset; out aTargetTable: string; aUseAutoIncUpdate: Boolean)
Parameters:
- aConnection: Connection
- aChange: Change
- aChangeType: Change type
- anCmd: Command
- aParamMapping: Param mapping
- aRefreshDs: Refresh dataset
- aTargetTable: Target table
- aUseAutoIncUpdate: Use Autoinc update
SetupDeltaCommands
Setups delta commands
procedure SetupDeltaCommands(ADatasetName: string; AOverride: Boolean)
Parameters:
- ADatasetName: Dataset name
- AOverride: Allows to use delta commands as they are declared in schema
SynchronizeAutoIncs
Synchonizes auto increment values between master and detail deltas
procedure SynchronizeAutoIncs(const aMasterDelta: IDADelta; const aDetailDelta: IDADelta; const aRelationship: TDADatasetRelationship)
Parameters:
- aMasterDelta: master delta
- aDetailDelta: detail delta
- aRelationship: relationship
UpdateCommandName
This command will be used to apply UPDATE changes for the data table back to the server. This property only needs to be assigned if your schema provides a special command for processing UPDATE changes (which could be an SQL UPDATE statement or a stored procedure). To make the Business Processor use this command, remove poAutoGenerateUpdate in the ProcessorOptions; if poAutoGenerateUpdate is specified, the Business Processor will automatically generate the necessary SQL code to perform the UPDATE on the database.
property UpdateCommandName: string read write
UpdateMode
Defines how rows for UPDATEs and DELETEs will be located. Available options are:
- Only the fields from the primary key (PK) of the data table will be used to locate records for UPDATEs and DELETEs.
- All fields defined for the data table will be used to locate records for UPDATEs and DELETEs.
- The fields from the primary key (PK) of the data table plus those listed in the business processor's UserUpdateFields property will be used to locate records for UPDATEs and DELETEs.
- Only the fields listed in the business processor's UserUpdateFields property will be used to locate records for UPDATEs and DELETEs.
property UpdateMode: TDAUpdateMode read write
UpdateSQLForOracle protected
Updates SQL that was received with GenerateSQL with Oracle specific syntax.
procedure UpdateSQLForOracle(aChangeType: TDAChangeType; aDataset: TDADataset; const aDelta: IDADelta; aDatasetStatement: TDAStatement; aConnection: IOracleConnection; var OriginalSQL: string)
Parameters:
- aChangeType: Change type
- aDataset: Dataset
- aDelta: Delta
- aDatasetStatement: Dataset statement
- aConnection: Connection
- OriginalSQL: Original SQL
UserUpdateFields
Contains the list of fields to be used to locate rows for updating and deleting, if the UpdateMode is set to updWhereKeyAndUserDefined or updWhereUserDefined.
property UserUpdateFields: TStrings read write
BusinessRulesID
Used for associating current strongly typed business processor to a business helper class . It should correspond to a value used in RegisterBusinessProcessorRules
method, called in initialization section of the business helper class unit.
property BusinessRulesID: string read write
CurrentChange
This is an individual changed record currently being processed.
property CurrentChange: TDADeltaChange read
CurrentDelta
CurrentDelta is the set of changes currently to be transmitted between client and server.
property CurrentDelta: TDADelta read
DeleteCommandName
This command will be used to apply DELETE changes for the data table back to the server. This property only needs to be assigned if your schema provides a special command for processing DELETE changes (which could be an SQL DELETE statement or a stored procedure). To make the Business Processor use this command, remove poAutoGenerateDelete in the ProcessorOptions; if poAutoGenerateDelete is specified, the Business Processor will automatically generate the necessary SQL code to perform the DELETE on the database.
property DeleteCommandName: string read write
HasReducedDelta
Checks if reduced delta is used
property HasReducedDelta: Boolean read
InsertCommandName
This command will be used to apply INSERT changes for the data table back to the server. This property only needs to be assigned if your schema provides a special command for processing INSERT changes (which could be an SQL INSERT statement or a stored procedure). To make the Business Processor use this command, remove poAutoGenerateInsert in the ProcessorOptions; if poAutoGenerateInsert is specified, the Business Processor will automatically generate the necessary SQL code to perform the INSERT on the database.
property InsertCommandName: string read write
ProcessorOptions
Configures various options for the behavior of the business processor. Available options include:
- Generate automatic INSERT statements instead of using the InsertCommandName.
- Generate automatic UPDATE statements instead of using the UpdateCommandName.
- Generate automatic DELETE statements instead of using the DeleteCommandName.
- Generate automatic SELECT statements instead of using the RefreshDatasetName.
- Prepare commands against the back-end database for faster execution. See IDASQLCommand.Prepared for details.
- Disable the "no rows were affected by this update" error message.
property ProcessorOptions: TDAProcessorOptions read write
RaiseExceptionAtError
Manages how TDABusinessProcessor behaves when an error is encountered.
property RaiseExceptionAtError: Boolean read write
ReferencedDataset
The dataset (data table) to which this Business Processor refers. Every Business Processor is configured to handle deltas for one specific data table, and this property will be used to determine which table is handled by this processor.
property ReferencedDataset: string read write
RefreshDatasetName
Sets the name of the datatset (data table) that will be used to fetch refresh data from the server. This property only needs to be assigned if your schema provides a special dataset for refreshing data from the server (which could be an SQL SELECT statement or a stored procedure). To make the Business Processor use this dataset, remove poAutoGenerateRefreshDataset in the ProcessorOptions; if poAutoGenerateRefreshDataset is specified, the Business Processor will automatically generate the necessary SQL code to perform the SELECT on the database.
property RefreshDatasetName: string read write
Schema
References the TDASchema that the Business Processor will be working on. Most commonly, this is the ServiceSchema of the data service. All the data tables and commands referenced from InsertCommandName, UpdateCommandName, DeleteCommandName, RefreshDatasetName and ReferencedDataset must be defined in this schema.
property Schema: TDASchema read write
ScriptingProvider (declared in TScriptableComponent)
Component which performs the execution of the script.
property ScriptingProvider: TDABaseScriptingProvider read write
Service
Reference to own service.
property Service: TRORemoteDataModule read write
UpdateCommandName
This command will be used to apply UPDATE changes for the data table back to the server. This property only needs to be assigned if your schema provides a special command for processing UPDATE changes (which could be an SQL UPDATE statement or a stored procedure). To make the Business Processor use this command, remove poAutoGenerateUpdate in the ProcessorOptions; if poAutoGenerateUpdate is specified, the Business Processor will automatically generate the necessary SQL code to perform the UPDATE on the database.
property UpdateCommandName: string read write
UpdateMode
Defines how rows for UPDATEs and DELETEs will be located. Available options are:
- Only the fields from the primary key (PK) of the data table will be used to locate records for UPDATEs and DELETEs.
- All fields defined for the data table will be used to locate records for UPDATEs and DELETEs.
- The fields from the primary key (PK) of the data table plus those listed in the business processor's UserUpdateFields property will be used to locate records for UPDATEs and DELETEs.
- Only the fields listed in the business processor's UserUpdateFields property will be used to locate records for UPDATEs and DELETEs.
property UpdateMode: TDAUpdateMode read write
UserUpdateFields
Contains the list of fields to be used to locate rows for updating and deleting, if the UpdateMode is set to updWhereKeyAndUserDefined or updWhereUserDefined.
property UserUpdateFields: TStrings read write
constructor Create override
Standard component constructor
constructor Create(aOwner: TComponent)
Parameters:
- aOwner: Owner
Assign override
Copies the contents of another, similar object.
procedure Assign(Source: TPersistent)
Parameters:
- Source: Instance whose properties will be copied
CheckProperties
Validates the business processor properties.
procedure CheckProperties
CreateMappings protected
Creates mapping for specific command
procedure CreateMappings(const aDelta: IDADelta; out MappingArray: TDAParamMappingArray; const aCommand: IDASQLCommand; lAdditionalMapping: TDAColumnMappingCollection; AValidateCommand: Boolean)
Parameters:
- aDelta: Delta
- MappingArray: Mapping array
- aCommand: Command
- lAdditionalMapping: Additional mapping
- AValidateCommand: Validate command
DoAfterExecuteCommandEvent protected
Fires AfterExecuteCommand event.
procedure DoAfterExecuteCommandEvent(const ACommand: IDASQLCommand; CommandName: string; ElapsedMilliseconds: Cardinal)
Parameters:
- ACommand: command
- CommandName: command name
- ElapsedMilliseconds: time of execution of command
DoAfterProcessChangeEvent protected
Fires AfterProcessChange event.
procedure DoAfterProcessChangeEvent(aChange: TDADeltaChange; Processed: Boolean; var CanRemoveFromDelta: Boolean)
Parameters:
- aChange: Change
- Processed: Status of change
- CanRemoveFromDelta: Remove change from delta or not.
DoAfterProcessDeltaEvent protected
Fires OnAfterProcessDelta
procedure DoAfterProcessDeltaEvent(const aDelta: IDADelta)
Parameters:
- aDelta: Delta
DoBeforeExecuteCommandEvent protected
Fires BeforeExecuteCommand event.
procedure DoBeforeExecuteCommandEvent(const ACommand: IDASQLCommand; CommandName: string)
Parameters:
- ACommand: Command
- CommandName: Command name
DoBeforeProcessChangeEvent protected
Fires OnBeforeProcessChange
procedure DoBeforeProcessChangeEvent(aChange: TDADeltaChange; var ProcessChange: Boolean; var CanRemoveFromDelta: Boolean)
Parameters:
- aChange: Change
- ProcessChange: Process change
- CanRemoveFromDelta: Remove change from delta
DoGenerateSQLEvent protected
Fires OnGenerateSQL event.
procedure DoGenerateSQLEvent(aChangeType: TDAChangeType; const ReferencedStatement: TDAStatement; const aDelta: IDADelta; var SQL: string)
Parameters:
- aChangeType: Change type
- ReferencedStatement: Referenced statement
- aDelta: Delta
- SQL: SQL statement
DoProcessChangeEvent protected
Fires OnProcessChange
procedure DoProcessChangeEvent(aChangeType: TDAChangeType; aChange: TDADeltaChange; const aCommand: IDASQLCommand)
Parameters:
- aChangeType: Change type
- aChange: Change
- aCommand: Command
DoProcessErrorEvent protected
Fires OnProcessError
procedure DoProcessErrorEvent(aChange: TDADeltaChange; const aCommand: IDASQLCommand; var CanRemoveFromDelta: Boolean; Error: Exception)
Parameters:
- aChange: Change
- aCommand: command
- CanRemoveFromDelta: Allows removes change from delta or not
- Error: Exception raised by the data change attempt
DoRefreshDeltaChangeEvent protected
Fires OnRefreshDeltaChange event.
procedure DoRefreshDeltaChangeEvent(aChangeType: TDAChangeType; aChange: TDADeltaChange; const aRefreshDataSet: IDAServerDataset)
Parameters:
- aChangeType: Change type
- aChange: Change
- aRefreshDataSet: Refresh dataset
GenerateRefreshDataset (TDADataset, IDAConnection, string, TDAColumnMappingCollection, TDAColumnMappingCollection): IDAServerDataset protected overload
Creates an IDADataset that can be used for refreshing data.
function GenerateRefreshDataset(aDataset: TDADataset; aConnection: IDAConnection; const aTargetTable: string; aColumnMappings: TDAColumnMappingCollection; AUnionMapping: TDAColumnMappingCollection): IDAServerDataset
Parameters:
- aDataset: Dataset
- aConnection: Connection
- aTargetTable: Target table
- aColumnMappings: Column mapping
- AUnionMapping: Union mapping
GenerateRefreshDataset (TDADataset, IDADelta, TDAStatement, IDAConnection): IDADataset protected overload
Creates an IDADataset that can be used for refreshing data.
function GenerateRefreshDataset(aDataset: TDADataset; const aDelta: IDADelta; aDatasetStatement: TDAStatement; aConnection: IDAConnection): IDADataset
Parameters:
- aDataset: Dataset
- aDelta: Delta
- aDatasetStatement: Dataset statement
- aConnection: Connection
GenerateSQL protected dynamic
Generates SQL for insert, update or delete according to aChangeType.
function GenerateSQL(aChangeType: TDAChangeType; aChange: TDADeltaChange; aDataset: TDADataset; const aDelta: IDADelta; aDatasetStatement: TDAStatement; aConnection: IDAConnection): string
Parameters:
- aChangeType: Change type
- aChange: Change
- aDataset: Dataset
- aDelta: Delta
- aDatasetStatement: Dataset statement
- aConnection: Connection
GenerateSQL2 protected
Generates SQL for insert, update or delete according to aChangeType.
function GenerateSQL2(aChangeType: TDAChangeType; aChange: TDADeltaChange; aDataset: TDADataset; const aDelta: IDADelta; aDatasetStatement: TDAStatement; aConnection: IDAConnection; aUseAutoIncUpdate: Boolean): string
Parameters:
- aChangeType: Change type
- aChange: Change
- aDataset: Dataset
- aDelta: Delta
- aDatasetStatement: Dataset statement
- aConnection: Connection
- aUseAutoIncUpdate: Use Autoinc update
GetConnectionForObject protected
Returns connection for specified object
function GetConnectionForObject(const aConnection: IDAConnection; const aName: string): IDAConnection
Parameters:
- aConnection: Default connection
- aName: name of object
Notification protected override
Forwards notification messages to all owned components.
procedure Notification(AComponent: TComponent; Operation: TOperation)
Parameters:
- AComponent: component
- Operation: operation
ProcessDelta (IDAConnection, IDADelta, TDAChangeTypes, TDADeltaStruct) overload virtual
Performs the processing of the passed delta and applies the changes to the database.
procedure ProcessDelta(const aConnection: IDAConnection; const aDelta: IDADelta; ChangeTypes: TDAChangeTypes; ADeltaStruct: TDADeltaStruct)
Parameters:
- aConnection: Connection
- aDelta: Delta
- ChangeTypes: Change types
- ADeltaStruct: Delta struct
ProcessDeltaForUnion virtual
Performs the processing of the passed delta and applies the changes to the database.
procedure ProcessDeltaForUnion(const aConnection: IDAConnection; const aDelta: IDADelta; ChangeTypes: TDAChangeTypes; ADeltaStruct: TDADeltaStruct)
Parameters:
- aConnection: Connection
- aDelta: Delta
- ChangeTypes: Change types
- ADeltaStruct: Delta struct
QueryInterface protected override
Returns a reference to a specified interface if the object supports that interface. This is one of the methods introduced by the IUnknown interface.
function QueryInterface(const IID: TGUID; out Obj: ): HResult
Parameters:
- IID: Identifier of the interface to return
- Obj: Variable to store the returned interface reference to
ROFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure ROFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
RORemoveFreeNotification (declared in TROComponent)
Forwards notification messages to all owned components.
procedure RORemoveFreeNotification(aComponent: TComponent)
Parameters:
- aComponent: component
SendRemoveNotification protected (declared in TROComponent)
Forwards notification messages to all owned components.
procedure SendRemoveNotification(aComponent: TComponent)
Parameters:
- aComponent: component
SetupCommands (IDAConnection, TDADeltaChange, IDASQLCommand, string, Boolean) protected overload dynamic
Creates delta commands
procedure SetupCommands(const aConnection: IDAConnection; const aChange: TDADeltaChange; out anCmd: IDASQLCommand; out aTargetTable: string; aUseAutoIncUpdate: Boolean)
Parameters:
- aConnection: Connection
- aChange: Change
- anCmd: Command
- aTargetTable: Target table
- aUseAutoIncUpdate: Use Autoinc update
SetupCommands (IDAConnection, IDADelta, TDADeltaProcessorItemCollection) protected overload dynamic
Creates delta commands
procedure SetupCommands(const aConnection: IDAConnection; const aDelta: IDADelta; out aCommandsList: TDADeltaProcessorItemCollection)
Parameters:
- aConnection: Connection
- aDelta: Delta
- aCommandsList: List of commands
SetupCommands (IDAConnection, IDADelta, IDASQLCommand, IDASQLCommand, IDASQLCommand, IDASQLCommand, IDAServerDataset, string) protected overload dynamic
Creates delta commands
procedure SetupCommands(const aConnection: IDAConnection; const aDelta: IDADelta; out anInsertCmd: IDASQLCommand; out anUpdateCmd: IDASQLCommand; out anUpdateCMD_AutoInc: IDASQLCommand; out aDeleteCmd: IDASQLCommand; out aRefreshDs: IDAServerDataset; out aTargetTable: string)
Parameters:
- aConnection: Connection
- aDelta: Delta
- anInsertCmd: Insert command
- anUpdateCmd: Update command
- anUpdateCMD_AutoInc: Insert command for autoinc
- aDeleteCmd: Delete command
- aRefreshDs: Refresh dataset
- aTargetTable: Target table
SetupCommandsWithMapping protected
Creates delta command
procedure SetupCommandsWithMapping(const aConnection: IDAConnection; const aChange: TDADeltaChange; const aChangeType: TDAChangeType; out anCmd: IDASQLCommand; out aParamMapping: TDAParamMappingArray; out aRefreshDs: IDAServerDataset; out aTargetTable: string; aUseAutoIncUpdate: Boolean)
Parameters:
- aConnection: Connection
- aChange: Change
- aChangeType: Change type
- anCmd: Command
- aParamMapping: Param mapping
- aRefreshDs: Refresh dataset
- aTargetTable: Target table
- aUseAutoIncUpdate: Use Autoinc update
SetupDeltaCommands
Setups delta commands
procedure SetupDeltaCommands(ADatasetName: string; AOverride: Boolean)
Parameters:
- ADatasetName: Dataset name
- AOverride: Allows to use delta commands as they are declared in schema
SynchronizeAutoIncs
Synchonizes auto increment values between master and detail deltas
procedure SynchronizeAutoIncs(const aMasterDelta: IDADelta; const aDetailDelta: IDADelta; const aRelationship: TDADatasetRelationship)
Parameters:
- aMasterDelta: master delta
- aDetailDelta: detail delta
- aRelationship: relationship
UpdateSQLForOracle protected
Updates SQL that was received with GenerateSQL with Oracle specific syntax.
procedure UpdateSQLForOracle(aChangeType: TDAChangeType; aDataset: TDADataset; const aDelta: IDADelta; aDatasetStatement: TDAStatement; aConnection: IOracleConnection; var OriginalSQL: string)
Parameters:
- aChangeType: Change type
- aDataset: Dataset
- aDelta: Delta
- aDatasetStatement: Dataset statement
- aConnection: Connection
- OriginalSQL: Original SQL
OnAfterExecuteCommand
Fires right after a command was executed.
property OnAfterExecuteCommand: TDAAfterExecuteCommandEvent read write
delegate: procedure OnAfterExecuteCommand(const Sender: IDASQLCommand; ActualSQL: string; ElapsedMilliseconds: Cardinal)
OnAfterProcessChange
Fires just after the Business Processor finishes processing an individual change received from the client.
property OnAfterProcessChange: TDAAfterProcessChangeEvent read write
delegate: procedure OnAfterProcessChange(Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean; var CanRemoveFromDelta: Boolean)
OnAfterProcessDelta
Fires right after the business processor is finished processing a delta received from the client. You can use this event to inspect (or modify) any resulting delta that was generated and will be sent back to the client.
property OnAfterProcessDelta: TDAProcessDeltaEvent read write
delegate: procedure OnAfterProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta)
OnBeforeExecuteCommand
Fires just before a command will be executed.
property OnBeforeExecuteCommand: TDABeforeExecuteCommandEvent read write
delegate: procedure OnBeforeExecuteCommand(const Sender: IDASQLCommand)
OnBeforeProcessChange
Fires just before the Business Processor starts processing an individual change received from the client. Use this event to inspect or make modifications to the change before it will be applied, or to prevent the change from being applied at all by setting the ProcessChange parameter to false.
property OnBeforeProcessChange: TDABeforeProcessChangeEvent read write
delegate: procedure OnBeforeProcessChange(Sender: TDABusinessProcessor; aChangeType: TDAChangeType; aChange: TDADeltaChange; var ProcessChange: Boolean)
OnBeforeProcessDelta
Fires just before the business processor starts processing a delta received from the client.
property OnBeforeProcessDelta: TDAProcessDeltaEvent read write
delegate: procedure OnBeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta)
OnGenerateSQL
Fires after the Business Processor has generated code for applying an update. You can use the SQL parameter passed to this event to inspect, log or even modify the SQL before it will be applied. Note that this event will not fire for every individual change that is being processed; for each round of updates, the Business Processor will only generate each type of SQL statement (INSERT, UPDATE, DELETE and refresh SELECT) once. Therefore, you should not use this event to make change-specific modifications to the SQL code.
property OnGenerateSQL: TDAGenerateSQLEvent read write
delegate: procedure OnGenerateSQL(Sender: TDABusinessProcessor; ChangeType: TDAChangeType; const ReferencedStatement: TDAStatement; const aDelta: IDADelta; var SQL: string)
OnProcessChange
Fires as the Business Processor processes an individual change. Use this event to inspect or log the change being processed, including the actual command and it's parameters that will be run on the dataset. You can also use this event to make last adjustments to the command or its parameters, if needed, but modifications to the change itself will have no effect, as the command has already been fully initialized.
property OnProcessChange: TDAProcessChangeEvent read write
delegate: procedure OnProcessChange(Sender: TDABusinessProcessor; aChangeType: TDAChangeType; aChange: TDADeltaChange; const aCommand: IDASQLCommand)
OnProcessError
Fires if an error occurred while applying an individual change to the back-end database.
property OnProcessError: TDAProcessErrorEvent read write
delegate: procedure OnProcessError(Sender: TDABusinessProcessor; aChangeType: TDAChangeType; aChange: TDADeltaChange; const aCommand: IDASQLCommand; var CanRemoveFromDelta: Boolean; Error: Exception)
OnRefreshDeltaChange
Fires as the business processor executes the data refresh for an individual change. Use this event to inspect or log the refresh, including the actual SQL and dataset parameters . You can also use this event to make last adjustments to the dataset SQL or its parameters.
property OnRefreshDeltaChange: TDARefreshDeltaChangeEvent read write
delegate: procedure OnRefreshDeltaChange(Sender: TDABusinessProcessor; aChangeType: TDAChangeType; aChange: TDADeltaChange; const aRefreshDataSet: IDADataset)