25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Object Synchronization<br />

Do SrcSyncSet.AddTransactions(,,ExcludedDB)<br />

This gets all transactions, beginning with the first unsynchronized transaction to the most<br />

recent transaction. The method uses information in the SyncTime table to determine the<br />

values.<br />

ExcludedDB is a $List assembled from the code:<br />

Set ExcludedDB = $ListBuild(##class(%SYS.System).InstanceGUID(),$ZUtil(5))<br />

where<br />

• ##class(%SYS.System).InstanceGUID() returns the value of the GUID that has<br />

been established for the local <strong>Caché</strong> instance.<br />

• $ZUtil(5) returns the value of the current namespace for the local <strong>Caché</strong> instance.<br />

3. After running AddTransactions, run the ErrCount method to determine how many<br />

errors were encountered. If there have been errors, the SyncSet.Errors query provides<br />

more detailed information.<br />

4. Export the data to a local file using the ExportFile method:<br />

Do SrcSyncSet.ExportFile(file,displaymode,bUpdate)<br />

where<br />

• file is the file to which the transactions are being exported; it is a name with a relative<br />

or absolute path.<br />

• displaymode specifies whether or not output appears for the method's actions, where<br />

“d” specifies that output appears and “-d” specifies that it is silent.<br />

• bUpdate is a boolean that specifies whether or not the SyncTime table is updated<br />

(where the default is 1, meaning True). It may be helpful to explicitly set this to 0 at<br />

this point, and then set it to 1 after the source receives assurance that the target has<br />

indeed received the data and performed the synchronization.<br />

5. Move the exported file from the source database's machine to the target database's machine.<br />

You can do this using various facilities available within <strong>Caché</strong>, such as Web services.<br />

6. Create a SyncSet object on the target machine using the SyncSet.%New method. Use<br />

the same value for the argument of %New as on the source machine — this is what<br />

identifies the source of the synchronized transactions.<br />

7. Read the SyncSet object into the <strong>Caché</strong> instance on the target machine using the Import<br />

method:<br />

152 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!