|
|
|
|
|
- Which data files can be replicated?
- Synchronization parameters
- Locking records during the log-based replication
- Duplicate errors and/or integrity errors
- Variables automatically initialized in the WLanguage procedure
- Example: Replicating the data even if a conflict occurred (using a WLanguage procedure):
- Replication and WithSpace function
- Lifespan of movable replica
- Replication and filter
HSynchronizeReplica (Function)
 No disponible con estos tipos de conexión
Synchronizes master and subscriber replicas: operations performed on one replica are transferred to the other. This function can be used in a log-based replication (between HFSQL data files) or in a universal replication. Remarks: - For a log-based replication, only the data files in the analysis with the option "Manage the replication for this file" checked will be taken into account.
Only the universal replication operates with the HFSQL Client/Server data files.   Only universal replication is available.
Advertencia
A partir de la versión 17, the replication files created with an application or a site in version 17 (or later) cannot be handled by an application or a site in version 16 (or earlier). The applications or the sites in version 17 (or later) continue to handle the replication files created with an application or a site in version 16 (or earlier).
Sintaxis
Synchronization with automatic conflict management Ocultar los detalles
<Result> = HSynchronizeReplica(<Master replica> , <Subscriber replica> , <Replication direction> [, <Management of conflicts>])
<Result>: Boolean - True if the operation was successful,
- False otherwise.
<Master replica>: Character string Location of the master replica. Depending on the replication type and direction, this parameter can correspond to:- the path of the replication file (xxxx.rpm file) for the master database.
- the name of the movable file created by HCreateMovableReplica.
- an empty string (""). The current data files are considered as the master database. The file corresponding to the master replica (".rpm" file) is searched in the replication directory specified in the analysis (by default, RPL subdirectory of the data files), or in the directory specified with HChangeRplDir.
In most cases, this path corresponds either to the full path of a file located in a network directory, or to the path of a movable replica (USB key, email attachment, file retrieved by FTP). For more details, see remarks. <Subscriber replica>: Character string Location of the subscriber replica. Depending on the replication type and direction, this parameter can correspond to:- the path of replication file (xxxx.rpl file) for the subscriber database.
- the name of the movable file created by HCreateMovableReplica
- an empty string (""). The current data files are considered as being the subscriber database. The file corresponding to the subscriber replica (".rpl" file) is searched in the replication directory specified in the analysis (by default, RPL subdirectory of the data files), or in the directory specified with HChangeRplDir.
In most cases, this path corresponds either to the full path of a file located in a network directory, or to the path of a movable replica (USB key, email attachment, file retrieved by FTP). For more details, see remarks. <Replication direction>: Integer constant Direction in which the replication will be performed: | | rplBidirectional | Update the master database AND the subscriber database.
Universal replication: bidirectional replication is not available. | rplToMaster | Update the master database according to the subscriber database.
<Master replica> corresponds to the master replica, <Subscriber replica> corresponds to the movable replica created from the subscriber database. | rplToSubscriber | Update the subscriber database according to the master database.
<Master replica> corresponds to the movable replica created from the master database, <Subscriber replica> corresponds to the subscriber replica |
<Management of conflicts>: Optional Integer constant Constant indicating the management mode of conflicts: | | rplMasterFirst (Default value) | The data found in the master database has priority during the replication. | rplMostRecentFirst | The most recent data has priority. Caution, the most recent data is evaluated according to the time on the subscriber replica. | rplSubscriberFirst | The data found in the subscriber database has priority during the replication. |
Warning: by default, the master has priority: in the case of subscriber-to-master replication, the master's data will not be updated. We recommend that you use another constant (rplMostRecentFirst for example).
Synchronization with custom conflict management (WLanguage procedure) Ocultar los detalles
<Result> = HSynchronizeReplica(<Master replica> , <Subscriber replica> , <Replication direction> [, <Filter procedure>])
<Result>: Boolean - True if the operation was successful,
- False otherwise.
<Master replica>: Character string Location of the master replica. Depending on the replication type and direction, this parameter can correspond to:- the path of the replication file (xxxx.rpm file) for the master database.
- the name of movable file created by HCreateMovableReplica.
- an empty string (""). The current data files are considered as the master database. The file corresponding to the master replica (".rpm" file) is searched in the replication directory specified in the analysis (by default, RPL subdirectory of the data files), or in the directory specified with HChangeRplDir.
In most cases, this path corresponds to the full path of a file located in a network directory or to the path of a movable replica (USB key, email attachment, file retrieved by FTP). For more details, see remarks. <Subscriber replica>: Character string Location of the subscriber replica. Depending on the replication type and direction, this parameter can correspond to:- the path of replication file (xxxx.rpl file) for the subscriber database.
- the name of the movable file created by HCreateMovableReplica
- an empty string (""). The current data files are considered as being the subscriber database. The file corresponding to the subscriber replica (".rpl" file) is searched in the replication directory specified in the analysis (by default, RPL subdirectory of the data files), or in the directory specified with HChangeRplDir.
In most cases, this path corresponds to the full path of a file located in a network directory or to the path of a movable replica (USB key, email attachment, file retrieved by FTP). For more details, see remarks. <Replication direction>: Integer constant Direction in which the replication will be performed: | | rplBidirectional | Update the master database AND the subscriber database.
Universal replication: bidirectional replication is not available. | rplToMaster | Update the master database according to the subscriber database.
<Master replica> corresponds to the movable replica created from the master database, <Subscriber replica> corresponds to the subscriber replica | rplToSubscriber | Update the subscriber database according to the master database.
<Master replica> corresponds to the master replica, <Subscriber replica> corresponds to the movable replica created from the subscriber database. |
<Filter procedure>: Optional procedure name Name of a WLanguage procedure found in the WINDEV or WEBDEV project (this name must be enclosed in quotes). This procedure must be created in your application. This procedure expects no parameter. This procedure is called before each operation performed on the destination file. Several variables can be used in this procedure. If this procedure returns False, the operation is not performed. This procedure is used to:- filter the records that must not be replicated.
- manage the conflicts, by adjusting the values before a duplicate error occurs.
For more details, see the example of HSynchronizeReplica. Observaciones Synchronization parameters The table below presents the different combinations of parameters that must be used according to the replication type and direction: | | | | Replication direction | <Master replica> | <Subscriber replica> | <Replication direction> |
---|
Replication from master to subscriber This replication is performed on the subscriber computer | Name of movable replica (*.rpa) created from the master, with its eventual path | Name of subscriber replica (*.rpl), with its eventual path. | rplToSubscriber | Replication from subscriber to master This replication is performed on the master computer | Name of master replica (*.rpm), with its eventual path. | Name of movable replica (*.rpa) created from the subscriber, with its eventual path. | rplToMaster |
Replication and WithSpace function The replication is not compatible with WithSpace in the code of the client application. This function changes the nehavior of HFSQL. Using this function in the client application can affect the efficiency of replication.
From version 21 update 3 (version 210065), the synchronization functions (programmed or assisted universal replication) return an error to the client application if WithSpace was applied to at least one of the replicated files. Lifespan of movable replica The replica is destroyed at the end of the replication in case of success. Replaying the replica will cause errors (for example, an addition causes a duplicate error). The replica uses the ".syn" file, which is also destroyed (another ".syn" file will replace it, without the unnecessary data). A "movable" replica is moved (copied) between the master and the subscriber or between the subscriber and the master. To store an archive, all you have to do is store the source file (the one created by HCreateMovableReplica). Replication and filter When browsing the data to replicate, the replication takes into account the filters positioned by HFilter. Therefore, for a programmed universal replication without replication server, HFilter can be used to limit the data to synchronize. On the contrary, for a replication performed via a replication server, all the filters must be disabled before performing the replication with HSynchronizeReplica. Note: The HClose function deletes all filters defined by the HFilter function on a data file.
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|