Thanks to the idea of RDD driver, a transition from work on DBF to work on the SQL database is practically immediate and it proceeds in two steps
Step One: data and index transfer
Tools provided with Mediator, which are used for data and index transferring to SQL database, ensure fast and effective data migration. The tools are of course written in Clipper/Harbour language, and the source code is attached to the package. Looking through a short source code, it is easy to realize how simple it is to use the data stored in SQL database - as simple as with DBF.
For example, a migration of clients.dbf database and index files ( cli_i1.ntx and cli_i2.ntx) connected with this base may look in the following way:
Dbf2med clients /e
Ntx2med clients cli_i1 cli_i2
Alternatively, instead of using our tools for transferring the data, a programmer can simply write his/her own program, which will create a table using structure of the DBF table (COPY STRUCTURE TO); then he/she will create indexes on it (INDEX ON), and then transfer the records from DBF to SQL (SKIP, APPEND BLANK, REPLACE). All the commands working on DBF databases, work on the tables in SQL database as well.
Step 2: a program code modification and linking to Mediator libraries
In many applications, the only necessary change is adding the following command at the beginning of a program:
RDDSETDEFAULT("MEDNTX")
This command informs xBase application that the default RDD driver is MEDNTX driver from Mediator pack. From now on, all the commands connected with the access to data will be steered to MEDNTX driver and will be executed on SQL database.
An example program in Clipper:
USE clients SHARED
SET INDEX TO CLI_I1, CLI_I2
BROWSE()
An example program that works on SQL databsae:
RDDSETDEFAULT("MEDNTX")
USE clients SHARED
SET INDEX TO CLI_I1, CLI_I2
BROWSE()