|
The TableDataComparer is used for comparing and synchronizing data between database tables. It can synchronize records within the tables between two different databases. This component works with all databases supported by DBC VCL and capable of synchronizing of data between databases of different type (e.g. MS SQL and Oracle). TableDataComparer uses the TDBCConnectionXXX connection components to connect to databases.
TableDataComparer creates the resulting update script which contains INSERT, UPDATE and DELETE statements which will alter the Target database table to make it identical to Master database tables. This resulting update script can be saved into a file and later executed against the Target database using standard SQL console for given database or executed via TxxxSQLExec component (where xxx will be different for given databases).
TableDataComparer has wide set of options, properties and events which make possible replication of data between tables with different structures. E.g. if tables have different fields, you can manually set-up list fields used for comparison and fields mapping.
Any SQL-statement which returns a set of records can be used for data comparison and replication. It can be complex SQL statement with multiple joins and sub-selects or view or just a record-set returned by stored procedure and so on. Use the SelectSQL property or OnGetSelectSQL event to set-up the desired SQL statements.
TableDataComparer also gives you the control over the Insert/Update/Delete operations. So you can create a script which will add or update records without deleting old records.
Please see the Demos code (TableDataComparer) and also the indexed Help documentation provided with the Database Comparer VCL installation for more details about using this component.
Name |
Description |
AllowedOperations |
A set of allowed operations which can be performed on Target database. |
BlobFileName |
File name where to store data of Blob-type when comparing tables. |
CompareBlobs |
If true, binary values of Blob fields will be compared. Otherwise, blob fields will not be counted during comparison. |
CustomDataFields |
List of fields to be copied. |
CustomKeyFields |
List of key fields. |
DBCConnectionMaster |
Connection to Master database. |
DBCConnectionTarget |
Connection to Target database. |
ExcludeDataFields |
List of fields excluded from copying. |
SQLExec |
Saves and executes the resulting update SQL script. |
TableNameMaster |
Name of the Master table. |
TableNameTarget |
Name of the Target table. |
TableOptionsMaster |
Master table options. |
TableOptionsTarget |
Target table options. |
TrimCharFields |
Trims string fields. |
UpdateImmediately |
Updates Target table immediately after comparing of records. |
|
Name |
Description |
CompareData |
Performs comparison of Master and Target tables. |
|
Name |
Description |
OnAddResultSQL |
Occurs when a new SQL statement created. |
OnCompareFields |
Occurs when two fields are compared. |
OnErrorMessage |
Occurs when error detected. |
OnGetDataFields |
Occurs when a list of data fields is requested. |
OnGetDataValue |
Occurs when the field value is requested. |
OnGetKeyFields |
Occurs when a list of key fields is requested. |
OnGetSelectSQL |
Occurs when an SQL statement for selecting data from tables (datasets) is requested. |
OnProgressUpdateMaster |
Occurs when Master record was processed. |
OnProgressUpdateTarget |
Occurs when Target record was processed. |
|
|