Product: | Syniti Data Replication, DBMoto |
Version: | All |
ID: | 1614 |
Summary: | VB.NET script example that demonstrates how to add information to the log |
You can write a script that adds information to the log for each transaction related to a specific replication. The example below is for IBM Db2 for i, iSeries, AS/400 only and records where the replication process is in terms of knowing the time/date of the journal receiver transaction applied. However, the AddLog function can be used to add any information to the log, with one reservation. While it is possible to track the inserted, updated and deleted records during replication, the operation can produce significant overhead in the replication process to impact performance and considerably increase the size of the log.
To add a replication script that provides additional information in the log:
- Select the replication in the Metadata Explorer.
- From the right mouse button menu, choose Replication Properties.
- In the General tab of the Replication Properties dialog, check the Use Script option and click Script to open the Replication Script Editor.
- Add the code in bold below to the Script Editor.
- Click OK to compile and save the script.
Imports System
Imports System.Data
Imports Microsoft.VisualBasic
Imports DBMotoPublic
Imports DBMotoScript
Imports DBRS.GlobalScript
Namespace DBRS
Public Class ReplicationScript : Inherits IReplicationScript
Public Overrides Sub Record_onAfterMapping(recSource As DBMotoPublic.IRecord, recTarget As DBMotoPublic.IRecord, ByRef AbortRecord As System.Boolean)
AddLog("TransactionID = " + recSource.GetLogValue(enmLogFields.TransactionID).ToString(), 0)
AddLog("TransactionTS = " + recSource.GetLogValue(enmLogFields.TransactionTS).ToString(), 0)
AddLog("UserID = " + recSource.GetLogValue(enmLogFields.UserID).ToString(), 0)
AddLog("RecordID = " + recSource.GetLogValue(enmLogFields.RecordID).ToString(), 0)
AddLog("ReceiverLibrary = " + recSource.GetLogValue(enmLogFields.ReceiverLibrary).ToString(), 0)
AddLog("ReceiverName = " + recSource.GetLogValue(enmLogFields.ReceiverName).ToString(), 0)
End Sub
End Class
End Namespace