4D v13.4SYNCHRONIZE |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
SYNCHRONIZE
SYNCHRONIZE
The SYNCHRONIZE command lets you synchronize two tables located on two different 4D SQL servers. Any change made to one of the tables is also carried out in the other. The 4D SQL server that executes the command is called the local server and the other server is called the remote server. The SYNCHRONIZE command is a combination of two internal calls to the REPLICATE command. The first call replicates the data from the remote server to the local server and the second carries out the opposite operation: replication of local server data to the remote server. The tables to be synchronized must therefore be configured for replication:
For more information, please refer to the description of the REPLICATE command. The SYNCHRONIZE command accepts four stamps as "parameters": two input stamps and two output stamps (last modification). The input stamps are used to indicate the moment of the last synchronization on each server. The output stamps return the value of the modification stamps on each server right after the last modification. Thanks to this principle, when the SYNCHRONIZE command is called regularly, it is possible to use the output stamps of the last synchronization as input stamps for the next one. Note: Input and output stamps are expressed as number values and not as timestamps. For more information about these stamps, please refer to the description of the REPLICATE command. In the event of an error, the output stamp of the server concerned contains the stamp of the record at the origin of the error. If the error stems from a cause other than the synchronization (network problems for example), the stamp will contain 0. You can "force" the synchronization direction using the REMOTE OVER LOCAL and LOCAL OVER REMOTE clauses, depending on the characteristics of your application. For more information about the implementation mechanisms, please refer to the description of the REPLICATE command. In the 4d_language_ref variables of the LATEST REMOTE STAMP and LATEST LOCAL STAMP clauses, 4D returns the values of the last stamps of distant and local tables. This information lets you automate the handling of the synchronization procedure. They correspond to the value of the stamps just after the end of the replication operation: if you use them in a subsequent REPLICATE or SYNCHRONIZE statement, you do not need to increment them; they are incremented automatically before being returned by the REPLICATE command. To understand the mechanisms involved in a synchronization operation, we are going to look at the different possibilities related to updating of an existing record in both of the synchronized databases. The synchronization method takes the following form: C_LONGINT(vRemoteStamp) The initial data is:
Here are the synchronizations made by the SYNCHRONIZE command according to the values passed in the LOCAL STAMP and REMOTE STAMP parameters as well as the priority option used: ROL (for REMOTE OVER LOCAL) or LOR (for LOCAL OVER REMOTE):
|
PROPERTIES
Product: 4D INDEX SEE ALSO |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||