Understanding the Synergy Change Tracking API

The change tracking API enables you to interact with change tracking information for files that have change tracking enabled. See Change tracking for an overall picture of how change tracking works in Synergy DBL.

You can check whether change tracking is enabled on a file, retrieve change tracking and snapshot information, refresh the array of snapshots that’s being stored and then look at the snapshots individually, and more.

If you have snapshots recorded in your file, you can use the following methods in the Synergex.SynergyDE.Select.Where class to look at changes between snapshots:

When you have enumerated a change tracking record, you can retrieve a CTInfo object using the RestrictedAlphaEnumerator.GetCTInfo property to access the following information:

To access snapshots on a file level, you can use the Synergex.SynergyDE.Select.ChangeTracking class. Once a ChangeTracking object is created, snapshot information can be accessed. For example,

ct = new ChangeTracking(“DAT:curtrans”)

if (applyNow)
  begin
    ct.ApplySnapshot()	; Add a snapshot
    ct.Refresh()
  end
foreach sinfo in ct.SnapShots
  begin
    if (sinfo.Type .eq. SSType.Snapshot)
    ssout(sinfo.Number, sinfo.DateTime, sinfo.Inserts+sinfo.Updates+sinfo.Deletes)
  end

The Select.ChangeTracking class also allows you to programmatically apply a snapshot to a file, using the ApplySnapshot() method.

Note

Use the ChangeTracking.Refresh() method to view changes in ChangeTracking.Snapshots data.