|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Disconnected Database Replication Model |
This model allows a sender company to send a snapshot of a set of records of its database to a receiver company, that will import this snapshot in its own database, without altering its UNIQUE_ID range.
The model is based on the following assumptions:
a.The Remote Access mode is enabled
b.Every company has its own UNIQUE_ID range, not overlapped with any other
c.The DBWorks administrator has properly programmed the scripts using the above two commands, with the settings based on the sender and receiver company.
The model can be implemented by using the two DBWShell commands BackupDatabaseRange and RestoreDatabaseRange.
Used together with the Briefcase technology, in it's modality for zipping/unzipping files only, it may allow the import/export of large data set.
When running under DBWARM, the user must have the Scripts→Backup right not denied.
BackupDatabaseRange
RestoreDatabaseRange
Suppose that the company MechWorks sends to a company Extern1 a set of its database records, limited only to Projects, Assemblies and Parts records, and where the CATEGORY1 field value contains the string norm.
Basically, the query showing what will be sent could be written as follows:
SELECT * FROM DOCUMENT WHERE T IN ('0','A','P') AND CATEGORY1 LIKE '%norm%'
The DBWorks administrator will write two scripts, one for the sender company ( MechWorks ) that he knows has a UNIQUE_ID range of 100000000→200000000, and the second for the receiver company ( Extern1 ) that he knows has a UNIQUE_ID range of 1→100000000.
The scripts will be written has follows:
Script for the sender company
sub main()
DBWInit(TRUE)
backupFilePath = replace("C:\FromMechWorksToExtern1.BKP"," ","|")
' MechWorks COMPANY unique id range
uidMin = 100000000
uidMax = 200000000
backupFilter = replace("T IN ('0','A','P') AND CATEGORY1 LIKE '%norm%'"," ","|")
DBWShell("BackupDatabaseRange " & backupFilePath & " " & uidMin & " " & uidMax & " " & backupFilter )
end sub
Script for the receiver company
sub main()
DBWInit(TRUE)
backupFilePath = replace("C:\FromMechWorksToExtern1.BKP"," ","|")
' Extern1 COMPANY unique id range
uidMin = 0
uidMax = 100000000
DBWShell("RestoreDatabaseRange " & backupFilePath & " " & uidMin & " " & uidMax )
end sub