ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / HFSQL functions
  • Name of movable replica (universal replication)
  • Variables automatically initialized in the WLanguage procedure for filtering records
  • Replication and WithSpace function
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
HCreateMovableReplica (Function)
In french: HCréeRéplicaTransportable
ODBCOLE DBNot available with these kinds of connection
Warning
From version 27 (87), HCreateMoveableReplica is kept for backward compatibility. This function has been replaced with HCreateMovableReplica.
Creates a movable replication. This file can be used to replicate the data found in the current database toward a remote database (for sending by email or FTP for example).
This function can be used with log-based or universal replications.
Remark: A movable replica can be created from the master database or from the subscriber database. To create a portable replica intended for a subscriber (replication from master to subscriber), the data files of the master must be opened beforehand.
Universal Windows 10 AppAndroidAndroid Widget iPhone/iPad Only the universal replication is available.
Example
WINDEVWEBDEV - Server codeReports and QueriesUser code (UMC)AjaxHFSQL ClassicHFSQL Client/ServerHyper File 5.5
// LOG-BASED REPLICATION
// In Montpellier: Prepare to send messages to Paris
HCreateMovableReplica("P:\MSG\MSG.RPM", "Paris", "C:\Temp\MsgMPL.WDZ")
// Send the file (by FTP for example)
FTPSend("C:\Temp\MsgMPL.WDZ", "FTP.PCSOFT_PARIS.FR\MSG\MsgMPL.WDZ") 
----------------
// In Paris: Retrieve the messages from Montpellier
HSynchronizeReplica("Z:\MSG", "\\FTPSERVER\MSG\MsgMPL.WDZ", rplToMaster)
Syntax
<Result> = HCreateMovableReplica(<Master replica or subscriber replica> , <Identifier of subscriber replica> , <Name of replication file to create> [, <Filter of records to replicate>])
<Result>: Boolean
  • True if the file corresponding to the movable replica was created,
  • False otherwise.
<Master replica or subscriber replica>: Character string
Name and full (or relative) path of Master replica (".RPM" file) or Subscriber replica (".RPL" file). A UNC path is allowed.
If this parameter is not specified or if it corresponds to an empty string (""), the description file will be sought in the current directory.
Caution: this directory must be accessible when HCreateMovableReplica is executed.
<Identifier of subscriber replica>: Integer or character string
Identifier of the subscriber replica to use. This identifier was returned by HCreateSubscriberReplica. This identifier is required only when the replication is performed from the master database to the subscriber database ; otherwise, it is ignored.
In universal replication, this parameter is required in any case.
<Name of replication file to create>: Character string
Full name corresponding to the physical replication file to create. This file contains the data required by the remote replication toward the replica (master or subscriber) identified by its identifier. This file contains the data modified since the last successful replication.
The created file is an archive file (".WDZ" extension by default) containing the description of the master replica or subscriber replica as well as sections of the data files required by the replication. This extension can be modified.
For the universal replication, the content of this parameter is ignored. We recommend that you use an empty string (""): the name of the file will be automatically calculated by the function.
After the call to HCreateMovableReplica, the RPL.File variable contains the name of the movable replication file that was created. Caution: The value of this variable is available until the next call to a replication function.
<Filter of records to replicate>: Optional character string
Name of the WLanguage filter procedure called for each record taken into account by the replication.
This procedure is used to filter the records to replicate. If this procedure returns False, the record is ignored:
  • it will not be copied into the subscriber database during a first synchronization,
  • it will be removed from the subscriber database if it was taken into account during a former synchronization.
If this procedure returns True, the record is taken into account by the replication.
Several variables can be used in this procedure (see Remarks).
Remarks

Name of movable replica (universal replication)

This name is automatically built by HCreateMovableReplica.
This name has the following format:
  • Replica created from the master database to update the subscriber: To_<SubscriberName>_<XXX>.RPA
  • Replica created from the subscriber database to update the master database: From_<SubscriberName>_<XXX>.RPA
    where:
    • <SubscriberName>: Name of the subscriber in readable format (identifier specified in HCreateSubscriberReplica).
    • <XXX>: Number of the replica (incremented per subscriber and per replication direction).
After the call to HCreateMovableReplica, the RPL.File variable contains the name of the movable replication file that was created. Caution: The value of this variable is available until the next call to a replication function.

Variables automatically initialized in the WLanguage procedure for filtering records

The following variables are automatically initialized in the WLanguage procedure for filtering records (the name of the procedure corresponds to the <Filter of records to replicate> parameter).
VariableTypeDescription and values
RPL.FileCharacter stringName of the file whose data will be replicated.
RPL.OperationInteger constantHFSQL operation that will be replicated:
  • rplHAdd: replicate an addition.
  • rplHModify: replicate a modification.
  • rplHDelete: replicate a deletion.
RPL.ConflictInteger constantIndicates whether a conflict was detected during the replication. The possible values are as follows:
  • rplNoConflict: no conflict was detected.
  • rplModifyConflict: The record was modified both in the source replica and in the destination replica.
  • rplDeleteConflict: The record was deleted from the destination replica and it was modified or deleted in the source replica.
To force the replication if a conflict occurred, RPL.Conflict must be initialized with the rplNoConflict variable.
Otherwise, the replication will be performed only if the conflict is a modification conflict and if the data to replicate comes from the master database.
RPL.DirectionInteger constantIndicates the direction of replication (useful for a bidirectional replication):
  • rplToSubscriber: replication from master to subscriber.
  • rplToMaster: replication from subscriber to master.
RPL.OperationNumIntegerNumber of the current operation. This value is included between 1 and RPL.OperationMax. This variable allows you to easily manage a progress bar.
RPL.OperationMaxIntegerTotal number of operations to replicate. This variable allows you to easily manage a progress bar.
RPL.SourceAliasCharacter stringName of the source alias for the replicated file (RPL.File). This file contains the values of the items that will be copied (HModify) or added (HAdd) into the data file currently replicated.
RPL.TargetAliasCharacter stringName of target alias of replicated file (RPL.File). This file contains the values of the items before the copy or the deletion in the data file currently replicated.

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.
Component: wd290rpl.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 12/13/2023

Send a report | Local help