PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Principle of automatic assisted universal replication
  • The steps for implementing an automatic assisted universal replication are as follows:
  • Adapting the application (if necessary)
  • Using a database not in HFSQL format
  • Preparing the files required by the assisted universal replication
  • Using the replication
  • Direct assisted universal replication
  • Assisted universal replication by replication server
  • Offline mode/Online mode
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
The automatic assisted replication is used to easily implement a replication on an existing application. Very few modifications are required at application level, and the standard replication tools allow the end users to start their own replication of data.
The automatic assisted replication allows you to use all the available replication modes:
  • direct replication,
  • replication by server with immediate or periodic replica.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
Versions 19 and later
Note: The automatic assisted replication is available for the replication of mobile data (Android or iOS). See Replication of mobile data (Android or iOS) for more details.
New in version 19
Note: The automatic assisted replication is available for the replication of mobile data (Android or iOS). See Replication of mobile data (Android or iOS) for more details.
Note: The automatic assisted replication is available for the replication of mobile data (Android or iOS). See Replication of mobile data (Android or iOS) for more details.
Principle of automatic assisted universal replication
Regardless of the type of application used, a local database is automatically created when implementing the automatic assisted universal replication. This local database (or subscriber database) contains the data required for the application to operate. Then, the data of the local database is replicated with the data of the master database (database found in the application) according to the selected replication mode.
The synchronization is directly performed by the users with ReplicAdmin and ReplicSynchro. These tools are automatically installed and configured on the end-user computer by the setup program of the application.
Warning
From version 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).

The steps for implementing an automatic assisted universal replication are as follows:

  1. Adapting the application if necessary.
  2. Preparing the files required by the replication:
    • Describing the replication with ReplicEdit. This description can be done by the creator of the application (recommended) or by the end user. The replication is described in a ".WER" file.
    • Creating the setup program.
    • Installing the application.
  3. Using the replication.
Note: Some features are not available in this version. See the Limitations regarding the assisted universal replication for more details.
Adapting the application (if necessary)
The assisted universal replication can be implemented on applications that use data files in HFSQL Classic format, in HFSQL Client/Server format, in OLE DB format, or handled by the Native Accesses.
The files in the analysis are in HFSQL Classic format: no modification must be performed. The master files can be configured:
  • when defining the replication with ReplicEdit,
  • when creating the setup,
  • when installing the application.
The files in the analysis use a connection (HFSQL Client/Server, native accesses, OLE DB files, ...): you must define the connection to the master server in the analysis and associate the files with this connection.
The master server used by the connection can correspond to:
  • the operating server (if it is already known when the application is created). This is the case for example of the applications developed by the company that is using them.
  • the local test server. In this case, the operating master server can be configured:
    • when defining the replication with ReplicEdit,
    • when creating the setup,
    • when installing the application.
Caution: Regardless of the format of the data files, to use the automatic assisted universal replication, the information for accessing the files MUST NOT BE modified by programming. YOU MUST NOT USE:
Indeed, the mechanism of automatic assisted replication automatically manages an Online/Offline mode and automatically performs the changes required to access the local database or the central database.

Using a database not in HFSQL format

To implement the assisted universal replication on different databases (Oracle, ...), a DateTime item must be created in each file taken into account by in the replication. This item will have to be updated by the application when modifying or adding a record.
If the databases use different time zones, we recommend that you use a universal format (GMT date and time for example).
Example: Managing a specific item for the replication between a HFSQL database and a MySQL database:
A trigger is implemented in order to automatically fill the "Itm_DateTime" item found in the MySQL database:
  • Code of the trigger
    TriggerResult is boolean
    TriggerResult = HDescribeTrigger("*", "HADD,HMODIFY,HDELETE,HCROSS,HWRITE", ...
    "AddDateTime", hTriggerBefore)
    IF TriggerResult = False THEN Error(HErrorInfo())
  • Procedure called by the trigger
    PROCEDURE AddDateTime()
    TestReplic.Itm_DateTime = DateSys()+TimeSys()
Preparing the files required by the assisted universal replication
The files required by the automatic assisted universal replication are prepared on the development computer:
The replication file (.WER file) is created by ReplicEdit.
When creating the setup program, you have the ability to configure:
  • Direct replication or replication by server,
  • Using the online mode or the offline mode.
Reminder: To create the setup program, select "Workshop .. Create the setup procedure". Reminder: To create the setup program, on the "Project" pane, in the "Generation" group, expand "Setup procedure" and select "Create the setup procedure".
This information can be modified when installing the application.
Using the replication

Direct assisted universal replication

The principle for the direct assisted replication is as follows:
During a direct replication, the application is installed on the local computer by the setup program (the setup can be a stand-alone setup or a setup with automatic update).
During this setup, a local database (in HFSQL Classic format) is automatically created. This database is identical to the master database.
If the user cannot access the master database, the application operates in offline mode with the local database (salesperson using a laptop computer for example).
To synchronize, the user starts ReplicSynchro and performs the synchronization of data. In our example, the salesperson can perform a synchronization every evening.
If the local computer can directly access the master database (in our example, the salesperson is visiting the office and he can access the network), the master database can be used directly. This change of mode is performed by ReplicAdmin.
Note: the principle is identical for an application that is using a setup with automatic update.

Assisted universal replication by replication server

During a replication by server, the application is installed on the local computer by the setup program (the setup can be a stand-alone setup or a setup with automatic update).
During this setup, a local database (in HFSQL Classic format) is automatically created. This database is identical to the master database. The replication server can also be installed when the application is installed.
If the user cannot access the master database, the application operates in offline mode with the local database (salesperson using a laptop computer for example).
To synchronize, the user starts ReplicSynchro and performs the synchronization of data. In our example, the salesperson can perform a synchronization every evening.
If the local computer can directly access the master database (in our example, the salesperson is visiting the office and he can access the network), the master database can be used directly. This change of mode is performed by ReplicAdmin.
Note: the principle is identical for an application that is using a setup with automatic update.

Offline mode/Online mode

ReplicAdmin allows you to switch from the offline mode (using the local database) to the online mode (using the master database), and conversely.
When the application is in offline mode configured by ReplicAdmin, the application is always using the local data files. No automatic mechanism is implemented. To use the master database, a synchronization must be performed and ReplicAdmin must be used to switch to the online mode.
When the application is in online mode configured by ReplicAdmin, an automatic control mechanism is implemented. This mechanism is as follows:
  • If the connection to the master database is successfully established when starting the application, the application is in online mode and it is using the data of master database.
  • If the connection to the master database fails when the application is started, a message proposes to automatically switch to the offline mode and to use the local data.
Note: in order to have the most updated local data when switching to the offline mode, an immediate synchronization of the local data can be triggered whenever the application is closed (option in the setup program of the application).
When the application is automatically switched to local mode, during the next application start:
  • If the connection to the master database is successfully established when the application is started, a message proposes to synchronize the local data and to switch back to the online in order to use the network data.
  • If the connection to the master database fails, the application remains in offline mode and it continues to use the local database.
Note: this mechanism can be used for Windows 32-bit and 64-bit executables.
Related Examples:
WD Universal Replication Training (WINDEV): WD Universal Replication
[ + ] This examples explains how to use the universal replication to synchronize data of different sites.
The universal replication is used to synchronize the data of a site (master site) with the same data of one or more replicated sites (subscriber sites). The data structures are identical on each site but they can be exploited via different data managers. HFSQL Classic and Access will be used in this example.
The example presents the processes that must be included in your applications to allow the user, via a simple action (menu, button, ...), to:
- create a master replica,
- create one or more subscriber replicas,
- see and modify the data of these replicas,
- export the created or modified data to a site (portable replica),
- import the created or modified data into another site...
Minimum required version
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment