TCcReplicator Class

TCcReplicator provides the core replication functionality of CopyCat.

TCcReplicator = class(TComponent);
class TCcReplicator : public TComponent;


How to use TCcReplicator:

  1. Fill in the Nodes.LocalNode.Connector and Nodes.RemoteNode.Connector

properties with the connectors of your choice for accessing the local and remote databases

  1. Provide the names of the local and remote nodes via the Nodes.LocalNode.Name

and Nodes.RemoteNode.Name properties. See Nodes for more information.

  1. Call the Replicate method.
  2. Optionnaly, implement a few of the events, in order to provide user feedback

at every stage of the replication process.

  1. Optionnaly, you may set up automatic timer-based replication, using the

AutoReplicate property. 


If an exception occurs during replication, an OnReplicationError event is fired, where you can choose to either abort the whole replication process, or to continue trying to replicate the next record. The default behaviour depends on the AbortOnError property. 

If an exception occurs at any other point (e.g. during database connection), an OnException event is fired, and replication is aborted. 

TCcReplicator frequently fires the OnProgress event, in order to allow the application to refresh user interface, process any pending user messages, and possibly, update a progress bar. It is also possible to abort the replication at any time, using the AbortReplication method. Refer to the provided example projects for an illustration of the use of most of the events and properties.

Fired just before replication begins. 
Fired whenever the replication transactions are auto-committed. 
Event fired in order to determine whether the current record should be replicated or not 
Fired just before the transaction is commited at the end of the replication process. 
Fired when a conflict is detected. 
Fired when a database connection is lost. 
Fired before connecting to the local database. 
Fired before connecting to the remote database. 
Fired before disconnecting from both local and remote database. 
Fired when neither local nor remote replication logs contain any records. 
Fired when an error occurs while no records are being replicated. 
Fired when the replication process is finished. 
Fired if an error occurs when trying to update the local value of a generator field. 
Fired just before replicating the generator fields of a record. 
This event fires during replication if ExtraFields are defined. 
Fired after creating the list of fields to be replicated for a table 
Fired after a generator field was replicated. 
Fired after a non-empty replication log has been loaded 
Frequently fired to give the application a chance to refresh the display. 
Fired for every query that is executing while replicating a record. 
Fired every time a stored procedure is replicated. 
Fired when the replication is aborted 
Fired when an error occurs while records are being replicated. 
Fired as soon as a conflict has been detected; 
Fired upon starting to replicate a new record. 
Fired after a record has been replicated, just before removing row from RPL$LOG 
Fired after a record has been replicated. 
Fired during replication of each record 
This event fires if one of the SQL statements used during replication (INSERT, UPDATE or DELETE) fails. 
Fired for every query executed during replication of a record. 
Fired upon beginning a new table. 
Fired upon finishing a table. 
LastResult holds the result of the last call to Replicate
Call AbortReplication to stop the current replication process. 
Synchronize a batch of records 
Clear list of fields for each table 
Connect to both local and remote databases. 
Disconnect local and remote databases. 
Returns the table name in the local database corresponding to the supplied remote table name 
Returns the table name in the remote database corresponding to the supplied local table name 
Call Replicate to start replicating the two databases. 
Synchronize one or several rows between local and remote databases 
Determines whether or not to abort replication when an error occurs. 
Clear cached metadata after every replication cycle 
Handles automatic, timer-based committing during replication. 
Specify whether to handle priorities automatically or not 
Handles automatic, timer-based replication. 
Indicates whether the replicator component is available or not. 
Indicates that the replication in the process of closing. 
Determines how the transaction is ended after replication. 
Name of the currently selected configuration, coming either from a TCcReplicatorList, or from a ConfigStorage component 
Set Direction to sdLocalToRemote or sdRemoteToLocal to enable various performance optimizations when replicating only one way 
If this property is set, empty string values are set to null for field types other than ftString This is useful only for database types (such as SQLite) with loose data type management, such that it may be possible to get a string value out of an integer or date column. 
Use ExtraFields to hold the list of fields which are needed in the destination database but do not exist in the source database. 
Indicates whether tables with no primary key are accepted or not If FailIfNoPK is true (the default value), then an error will be raised if a table is detected with no primary key. 
Indicates that replication is finished. 
Harmonize field list between local and remote databases. 
Keep the database connections open after replication ends. 
Short cut for Nodes.LocalNode.Connection 
Short cut for Nodes.LocalNode 
Replication log. 
Set LogErrors to indicate whether replication errors should get automatically logged to the RPL$ERRORS table in the local database. 
Merges values of changed fields from both nodes, so as to avoid conflicts where possible 
Connection parameters for the local and remote nodes 
Fired at the end of the replication, whatever the outcome 
The number of records to replicate at a time 
Short cut for Nodes.RemoteNode.Connection 
Short cut for Nodes.RemoteNode 
Set ReplicateOnlyChangedFields to True to replicate only the fields that were changed, as opposed to whole records 
Summmary: Map table names between local and remote databases 
Indicates whether you would like to trace the replication events to the database or not 
Indicates whether or not char fields (data type ftString or ftMemo) should be trimmed during replication 
Indicates whether primary key synchronization features are activated or not. 
Data Member 
read only 
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at
Copyright (c) 2015. All rights reserved.
What do you think about this topic? Send feedback through our contact form