TDADelta

Overview

The TDADelta class represents a set of changes to be transmitted between client and server. This can be client-side changes that are pending to be applied to the server database, or server-side changes that are being propagated back to the client.

This class is usually accessed through the IDADelta interface.

Location

  • Unit: uDADelta.pas
  • Ancestry: TDAEngineBaseObject | TDADelta

Implements

 

constructor Create  overload

Creates a new instance.

constructor Create

constructor Create (string, Boolean)  overload

Creates a new instance with given parameters.

constructor Create(const aLogicalName: string; aReducedDelta: Boolean)

Parameters:

  • aLogicalName: logical name
  • aReducedDelta: initializes delta as reduced delta.

constructor Create (TComponent)  overload

Creates a new instance with given parameter.

constructor Create(aDataTable: TComponent)

Parameters:


Add (integer, TDAChangeType, TDAChangeStatus, string): TDADeltaChange  overload

Adds a change to the set of changes.

function Add(aRecordID: integer; aChangeType: TDAChangeType; aStatus: TDAChangeStatus; const aMessage: string): TDADeltaChange

Parameters:

  • aRecordID: record ID
  • aChangeType: type of change
  • aStatus: status of the change:
  • aMessage: message

Add (TDADeltaChange)  overload

Adds a change to the set of changes.

procedure Add(aChange: TDADeltaChange)

Parameters:

  • aChange: given change.

AddFieldName

Adds a new field.

procedure AddFieldName(const aFieldName: string; const aDataType: TDADataType)

Parameters:

  • aFieldName: field name
  • aDataType: data type

AddKeyFieldName

Adds a new key field.

procedure AddKeyFieldName(const aKeyFieldName: string)

Parameters:

  • aKeyFieldName: given key field

AssignDataTable

Sets datatable as owner.

procedure AssignDataTable(aDataTable: TComponent)

Parameters:

  • aDataTable: given datatable.

AssignDeltaProperties  protected

procedure AssignDeltaProperties(aSource: TDADelta)

Parameters:

  • aSource:

CancelChange

Discards the certain change.

procedure CancelChange(aDataTable: TComponent)

Parameters:

  • aDataTable: datatable where changes should be discarded

CancelChangesInAllTables

Discards all changes in all tables.

procedure CancelChangesInAllTables

Changes

Provides access to all the individual changes contained in the delta. The indexer is zero-based and the number of elements is indicated by the Count property.

property Changes[Index: integer]: TDADeltaChange read write

Clear

Clears the delta and discards all the individual changes that it contains.

procedure Clear(DoClearFieldNames: boolean; DoClearKeyFieldNames: boolean)

Parameters:

  • DoClearFieldNames: remove all fields or not
  • DoClearKeyFieldNames: remove all key fields or not

ClearFieldNames

Clears list of fields.

procedure ClearFieldNames

ClearKeyFieldNames

Clears list of key's fields.

procedure ClearKeyFieldNames

Count

Indicates the number of Changes contained within the delta.

property Count: integer read write

CurrentChange

Gives a current change.

function CurrentChange(aDataTable: TComponent): TDADeltaChange

Parameters:

  • aDataTable: given datatable

CurrentChangeID

Gets the ChangeID which the next TDADeltaChange will get when adding a new entry

property CurrentChangeID: integer read write

Delete

Deletes certain on the Index change.

procedure Delete(Index: integer)

Parameters:

  • Index: given index

EndChange

Ends changes for the specified table and applies updates.

procedure EndChange(aDataTable: TComponent)

Parameters:

  • aDataTable: given datatable

EndChangesInAllTables

Ends changes for all tables and applies updates.

procedure EndChangesInAllTables

FindChange

Finds the change with given aRecID

function FindChange(aRecID: integer): TDADeltaChange

Parameters:

  • aRecID: record ID

First  protected safecall

Moves to the first change

function First: boolean

GetAsBoolean (integer): boolean  protected overload safecall

Gets the value of the field as Boolean value.

function GetAsBoolean(Index: integer): boolean

Parameters:

  • Index: Index of the field

GetAsBoolean (string): boolean  protected overload safecall

Gets the value of the field as Boolean value.

function GetAsBoolean(const FieldName: string): boolean

Parameters:

  • FieldName: Name of the field

GetAsCurrency (integer): currency  protected overload safecall

Gets the value of the field as 64-bit fixed point currency value.

function GetAsCurrency(Index: integer): currency

Parameters:

  • Index: Index of the field

GetAsCurrency (string): currency  protected overload safecall

Gets the value of the field as 64-bit fixed point currency value.

function GetAsCurrency(const FieldName: string): currency

Parameters:

  • FieldName: Name of the field

GetAsDateTime (integer): TDateTime  protected overload safecall

Gets the value of the field as TDateTime value.

function GetAsDateTime(Index: integer): TDateTime

Parameters:

  • Index: Index of the field

GetAsDateTime (string): TDateTime  protected overload safecall

Gets the value of the field as TDateTime value.

function GetAsDateTime(const FieldName: string): TDateTime

Parameters:

  • FieldName: Name of the field

GetAsFloat (integer): double  protected overload safecall

Gets the value of the field as Float/Double value.

function GetAsFloat(Index: integer): double

Parameters:

  • Index: Index of the field

GetAsFloat (string): double  protected overload safecall

Gets the value of the field as Float/Double value.

function GetAsFloat(const FieldName: string): double

Parameters:

  • FieldName: Name of the field

GetAsInteger (integer): integer  protected overload safecall

Gets the value of the field as 32-bit integer value.

function GetAsInteger(Index: integer): integer

Parameters:

  • Index: Index of the field

GetAsInteger (string): integer  protected overload safecall

Gets the value of the field as 32-bit integer value.

function GetAsInteger(const FieldName: string): integer

Parameters:

  • FieldName: Name of the field

GetAsString (integer): string  protected overload safecall

Gets the value of the field as string value.

function GetAsString(Index: integer): string

Parameters:

  • Index: Index of the field

GetAsString (string): string  protected overload safecall

Gets the value of the field as string value.

function GetAsString(const FieldName: string): string

Parameters:

  • FieldName: Name of the field

GetAsVariant (integer): variant  protected overload safecall

Gets the value of the field as variant.

function GetAsVariant(Index: integer): variant

Parameters:

  • Index: Index of the field

GetAsVariant (string): variant  protected overload safecall

Gets the value of the field as variant.

function GetAsVariant(const FieldName: string): variant

Parameters:

  • FieldName: Name of the field

GetCountByStatus

Gives the count of changes with certain status.

function GetCountByStatus(aChangeStatus: TDAChangeStatus): integer

Parameters:

  • aChangeStatus: given status

GetDelta  protected

Returns delta instance

function GetDelta: TDADelta

GetFieldCount  protected safecall

Gets the number of fields contained in the dataset.

function GetFieldCount: integer

GetFieldIndexes  protected safecall

Returns the field index assosiated with the field name.

function GetFieldIndexes(const aName: string): integer

Parameters:

  • aName: Name of the field

GetFieldNames  protected safecall

Returns the field name assosiated with the field index.

function GetFieldNames(Index: integer): string

Parameters:

  • Index: Index of the field

GetRecordCount  protected safecall

Returns the number of delta changes

function GetRecordCount: integer

InChange

Checks status of given datatable

function InChange(aDataTable: TComponent): boolean

Parameters:

  • aDataTable: given datatable

IndexOf

Returns the position of a aChange in the list.

function IndexOf(aChange: TDADeltaChange): integer

Parameters:

  • aChange: Change whose index will be returned.

IndexOfLoggedField

Returns the position of a logged field in the list.

function IndexOfLoggedField(const aName: string): integer

Parameters:

  • aName: field name

IsCanEditCurrentRow

Indicates whether it is possible to edit a current row in the specified table.

function IsCanEditCurrentRow(aDataTable: TComponent): Boolean

Parameters:

  • aDataTable: given datatable

isIdenticalProperties  protected

function isIdenticalProperties(aDelta: TDADelta): Boolean

Parameters:

  • aDelta:

IsNewRecord

Indicates whether there is a certain record of new.

function IsNewRecord(aRecordID: integer): boolean

Parameters:

  • aRecordID: record ID

IsNewRecord2

Indicates whether there is a certain record of new.

function IsNewRecord2(aDataTable: TComponent; aRecordID: integer): boolean

Parameters:

  • aDataTable: DataTable
  • aRecordID: record ID

KeyFieldCount

Returns the number of fields that comprise the key for this delta.

property KeyFieldCount: integer read write

KeyFieldNames

Lists the names of the fields that comprise the key for this delta. The indexer is zero-based and the number of elements is indicated by the KeyFieldCount property.

property KeyFieldNames[Index: integer]: string read write

Locate  protected 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.

LoggedFieldCount

Indicates the number of fields that comprise the data for this delta.

property LoggedFieldCount: integer read write

LoggedFieldNames

Holds the names of the fields that comprise the data for this delta. The indexer is zero-based and the number of elements is indicated by the LoggedFieldCount property.

property LoggedFieldNames[Index: integer]: string read write

LoggedFieldTypes

Lists the data types of the fields that comprise the data for this delta. The indexer is zero-based and the number of elements is indicated by the LoggedFieldCount property.

property LoggedFieldTypes[Index: integer]: TDADataType read write

LogicalName

Defines the name of the logical entity that this delta pertains to. Usually, this will be the name of the data table that changes should be applied to.

property LogicalName: string read write

Next  protected safecall

Moves to the next change.

function Next: boolean

ReducedDelta

Status of reduced delta mode

property ReducedDelta: boolean read write

RemoveChange

Removes a delta change to the list of changes maintained within the delta.

procedure RemoveChange(aChange: TDADeltaChange)

Parameters:

  • aChange: given change

RemoveLoggedField (integer)  overload

Deletes certain logged field.

procedure RemoveLoggedField(Index: integer)

Parameters:

  • Index: index of field

RemoveLoggedField (string)  overload

Deletes certain logged field.

procedure RemoveLoggedField(AFieldName: string)

Parameters:

  • AFieldName: field name

RemoveUnchangedChanges

Removes changes that don't contain any modifications.

procedure RemoveUnchangedChanges

RestoreLastChange

Restores the last change.

procedure RestoreLastChange(aDataTable: TComponent)

Parameters:

  • aDataTable: given datatable

SetReducedDelta  protected

Sets reduced delta mode

procedure SetReducedDelta(const aValue: boolean)

Parameters:

  • aValue: mode

StartChange

Starts the Delta for the specified table.

procedure StartChange(aChangeType: TDAChangeType; aDataTable: TComponent)

Parameters:

  • aChangeType: required type
  • aDataTable: given datatable

 

Changes

Provides access to all the individual changes contained in the delta. The indexer is zero-based and the number of elements is indicated by the Count property.

property Changes[Index: integer]: TDADeltaChange read write

Count

Indicates the number of Changes contained within the delta.

property Count: integer read write

CurrentChangeID

Gets the ChangeID which the next TDADeltaChange will get when adding a new entry

property CurrentChangeID: integer read write

KeyFieldCount

Returns the number of fields that comprise the key for this delta.

property KeyFieldCount: integer read write

KeyFieldNames

Lists the names of the fields that comprise the key for this delta. The indexer is zero-based and the number of elements is indicated by the KeyFieldCount property.

property KeyFieldNames[Index: integer]: string read write

LoggedFieldCount

Indicates the number of fields that comprise the data for this delta.

property LoggedFieldCount: integer read write

LoggedFieldNames

Holds the names of the fields that comprise the data for this delta. The indexer is zero-based and the number of elements is indicated by the LoggedFieldCount property.

property LoggedFieldNames[Index: integer]: string read write

LoggedFieldTypes

Lists the data types of the fields that comprise the data for this delta. The indexer is zero-based and the number of elements is indicated by the LoggedFieldCount property.

property LoggedFieldTypes[Index: integer]: TDADataType read write

LogicalName

Defines the name of the logical entity that this delta pertains to. Usually, this will be the name of the data table that changes should be applied to.

property LogicalName: string read write

ReducedDelta

Status of reduced delta mode

property ReducedDelta: boolean read write

 

constructor Create  overload

Creates a new instance.

constructor Create

constructor Create (string, Boolean)  overload

Creates a new instance with given parameters.

constructor Create(const aLogicalName: string; aReducedDelta: Boolean)

Parameters:

  • aLogicalName: logical name
  • aReducedDelta: initializes delta as reduced delta.

constructor Create (TComponent)  overload

Creates a new instance with given parameter.

constructor Create(aDataTable: TComponent)

Parameters:


Add (integer, TDAChangeType, TDAChangeStatus, string): TDADeltaChange  overload

Adds a change to the set of changes.

function Add(aRecordID: integer; aChangeType: TDAChangeType; aStatus: TDAChangeStatus; const aMessage: string): TDADeltaChange

Parameters:

  • aRecordID: record ID
  • aChangeType: type of change
  • aStatus: status of the change:
  • aMessage: message

Add (TDADeltaChange)  overload

Adds a change to the set of changes.

procedure Add(aChange: TDADeltaChange)

Parameters:

  • aChange: given change.

AddFieldName

Adds a new field.

procedure AddFieldName(const aFieldName: string; const aDataType: TDADataType)

Parameters:

  • aFieldName: field name
  • aDataType: data type

AddKeyFieldName

Adds a new key field.

procedure AddKeyFieldName(const aKeyFieldName: string)

Parameters:

  • aKeyFieldName: given key field

AssignDataTable

Sets datatable as owner.

procedure AssignDataTable(aDataTable: TComponent)

Parameters:

  • aDataTable: given datatable.

AssignDeltaProperties  protected

procedure AssignDeltaProperties(aSource: TDADelta)

Parameters:

  • aSource:

CancelChange

Discards the certain change.

procedure CancelChange(aDataTable: TComponent)

Parameters:

  • aDataTable: datatable where changes should be discarded

CancelChangesInAllTables

Discards all changes in all tables.

procedure CancelChangesInAllTables

Clear

Clears the delta and discards all the individual changes that it contains.

procedure Clear(DoClearFieldNames: boolean; DoClearKeyFieldNames: boolean)

Parameters:

  • DoClearFieldNames: remove all fields or not
  • DoClearKeyFieldNames: remove all key fields or not

ClearFieldNames

Clears list of fields.

procedure ClearFieldNames

ClearKeyFieldNames

Clears list of key's fields.

procedure ClearKeyFieldNames

CurrentChange

Gives a current change.

function CurrentChange(aDataTable: TComponent): TDADeltaChange

Parameters:

  • aDataTable: given datatable

Delete

Deletes certain on the Index change.

procedure Delete(Index: integer)

Parameters:

  • Index: given index

EndChange

Ends changes for the specified table and applies updates.

procedure EndChange(aDataTable: TComponent)

Parameters:

  • aDataTable: given datatable

EndChangesInAllTables

Ends changes for all tables and applies updates.

procedure EndChangesInAllTables

FindChange

Finds the change with given aRecID

function FindChange(aRecID: integer): TDADeltaChange

Parameters:

  • aRecID: record ID

First  protected safecall

Moves to the first change

function First: boolean

GetAsBoolean (integer): boolean  protected overload safecall

Gets the value of the field as Boolean value.

function GetAsBoolean(Index: integer): boolean

Parameters:

  • Index: Index of the field

GetAsBoolean (string): boolean  protected overload safecall

Gets the value of the field as Boolean value.

function GetAsBoolean(const FieldName: string): boolean

Parameters:

  • FieldName: Name of the field

GetAsCurrency (integer): currency  protected overload safecall

Gets the value of the field as 64-bit fixed point currency value.

function GetAsCurrency(Index: integer): currency

Parameters:

  • Index: Index of the field

GetAsCurrency (string): currency  protected overload safecall

Gets the value of the field as 64-bit fixed point currency value.

function GetAsCurrency(const FieldName: string): currency

Parameters:

  • FieldName: Name of the field

GetAsDateTime (integer): TDateTime  protected overload safecall

Gets the value of the field as TDateTime value.

function GetAsDateTime(Index: integer): TDateTime

Parameters:

  • Index: Index of the field

GetAsDateTime (string): TDateTime  protected overload safecall

Gets the value of the field as TDateTime value.

function GetAsDateTime(const FieldName: string): TDateTime

Parameters:

  • FieldName: Name of the field

GetAsFloat (integer): double  protected overload safecall

Gets the value of the field as Float/Double value.

function GetAsFloat(Index: integer): double

Parameters:

  • Index: Index of the field

GetAsFloat (string): double  protected overload safecall

Gets the value of the field as Float/Double value.

function GetAsFloat(const FieldName: string): double

Parameters:

  • FieldName: Name of the field

GetAsInteger (integer): integer  protected overload safecall

Gets the value of the field as 32-bit integer value.

function GetAsInteger(Index: integer): integer

Parameters:

  • Index: Index of the field

GetAsInteger (string): integer  protected overload safecall

Gets the value of the field as 32-bit integer value.

function GetAsInteger(const FieldName: string): integer

Parameters:

  • FieldName: Name of the field

GetAsString (integer): string  protected overload safecall

Gets the value of the field as string value.

function GetAsString(Index: integer): string

Parameters:

  • Index: Index of the field

GetAsString (string): string  protected overload safecall

Gets the value of the field as string value.

function GetAsString(const FieldName: string): string

Parameters:

  • FieldName: Name of the field

GetAsVariant (integer): variant  protected overload safecall

Gets the value of the field as variant.

function GetAsVariant(Index: integer): variant

Parameters:

  • Index: Index of the field

GetAsVariant (string): variant  protected overload safecall

Gets the value of the field as variant.

function GetAsVariant(const FieldName: string): variant

Parameters:

  • FieldName: Name of the field

GetCountByStatus

Gives the count of changes with certain status.

function GetCountByStatus(aChangeStatus: TDAChangeStatus): integer

Parameters:

  • aChangeStatus: given status

GetDelta  protected

Returns delta instance

function GetDelta: TDADelta

GetFieldCount  protected safecall

Gets the number of fields contained in the dataset.

function GetFieldCount: integer

GetFieldIndexes  protected safecall

Returns the field index assosiated with the field name.

function GetFieldIndexes(const aName: string): integer

Parameters:

  • aName: Name of the field

GetFieldNames  protected safecall

Returns the field name assosiated with the field index.

function GetFieldNames(Index: integer): string

Parameters:

  • Index: Index of the field

GetRecordCount  protected safecall

Returns the number of delta changes

function GetRecordCount: integer

InChange

Checks status of given datatable

function InChange(aDataTable: TComponent): boolean

Parameters:

  • aDataTable: given datatable

IndexOf

Returns the position of a aChange in the list.

function IndexOf(aChange: TDADeltaChange): integer

Parameters:

  • aChange: Change whose index will be returned.

IndexOfLoggedField

Returns the position of a logged field in the list.

function IndexOfLoggedField(const aName: string): integer

Parameters:

  • aName: field name

IsCanEditCurrentRow

Indicates whether it is possible to edit a current row in the specified table.

function IsCanEditCurrentRow(aDataTable: TComponent): Boolean

Parameters:

  • aDataTable: given datatable

isIdenticalProperties  protected

function isIdenticalProperties(aDelta: TDADelta): Boolean

Parameters:

  • aDelta:

IsNewRecord

Indicates whether there is a certain record of new.

function IsNewRecord(aRecordID: integer): boolean

Parameters:

  • aRecordID: record ID

IsNewRecord2

Indicates whether there is a certain record of new.

function IsNewRecord2(aDataTable: TComponent; aRecordID: integer): boolean

Parameters:

  • aDataTable: DataTable
  • aRecordID: record ID

Locate  protected 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.

Next  protected safecall

Moves to the next change.

function Next: boolean

RemoveChange

Removes a delta change to the list of changes maintained within the delta.

procedure RemoveChange(aChange: TDADeltaChange)

Parameters:

  • aChange: given change

RemoveLoggedField (integer)  overload

Deletes certain logged field.

procedure RemoveLoggedField(Index: integer)

Parameters:

  • Index: index of field

RemoveLoggedField (string)  overload

Deletes certain logged field.

procedure RemoveLoggedField(AFieldName: string)

Parameters:

  • AFieldName: field name

RemoveUnchangedChanges

Removes changes that don't contain any modifications.

procedure RemoveUnchangedChanges

RestoreLastChange

Restores the last change.

procedure RestoreLastChange(aDataTable: TComponent)

Parameters:

  • aDataTable: given datatable

SetReducedDelta  protected

Sets reduced delta mode

procedure SetReducedDelta(const aValue: boolean)

Parameters:

  • aValue: mode

StartChange

Starts the Delta for the specified table.

procedure StartChange(aChangeType: TDAChangeType; aDataTable: TComponent)

Parameters:

  • aChangeType: required type
  • aDataTable: given datatable

See Also