Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
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 />
• Translating between GUIDs and OIDs<br />
• Manually updating a SyncTime table<br />
17.3.1 Translating Between GUIDs and OIDs<br />
If you have the GUID or OID for an object and wish to ascertain its OID or GUID, there are<br />
two methods available for this operation:<br />
• %GUID.%GUIDFind(guid) is a class method of the %GUID class that takes a GUID<br />
of an object instance and returns the OID associated with that instance.<br />
• %Persistent.%GUID(oid) is a class method of the %Persistent class that takes an OID<br />
of an object instance and returns the GUID associated with that instance; the method can<br />
only be run if the class' GUIDENABLED parameter is TRUE. This method dispatches<br />
polymorphically and determines the most-specific-type class if the OID does not contain<br />
that information. If the instance has no GUID, the method returns an empty string.<br />
17.3.2 Manually Updating a SyncTime Table<br />
To perform a manual update on the SyncTime table for a database, invoke the SetlTrn method,<br />
which sets the last transaction number:<br />
Set Status=##class(%SyncTime).SetlTrn(syncSYSID, syncNSID, ltrn)<br />
where<br />
• syncSYSID is the ID of the source database's system. If the %occTransaction.inc header<br />
file is included, this value is available through the $$$txSIDlocal macro.<br />
• syncNSID is the ID of the relevant namespace. The $ZUtil(5) function returns the value<br />
of the current namespace.<br />
• ltrn is the last transaction number to be updated. You can get this value by invoking the<br />
SyncSet's GetLastTransaction method.<br />
154 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>