sp_hook_dbmlsync_logscan_begin

Use this stored procedure to add custom actions immediately before the transaction log is scanned for upload.

Rows in #hook_dict table

Name

Value

Description

starting log offset_n (in)

number

The log offset value where scanning is to begin. There is one value for each publication being uploaded. The numbering of n starts at zero. This value matches the Publication-n. For example, log offset_0 is the offset for publication_0.

log scan retry (in)

true | false

If this is the first time the transaction log has been scanned for this synchronization, the value is false; otherwise it is true. The log is scanned twice when the MobiLink server and dbmlsync have different information about where the scanning should begin.

publication_n (in)

publication

The publications being synchronized, where n is an integer. There is one publication_n entry for each publication being uploaded. The numbering of n starts at zero.

MobiLink user (in)

MobiLink user name

The MobiLink user for which you are synchronizing.

script version (in)

script version name

The MobiLink script version to be used for the synchronization.

Remarks

If a procedure of this name exists, it is called immediately before dbmlsync scans the transaction log to assemble the upload.

Actions of this procedure are committed immediately after execution.

See also
Examples

Assume you use the following table to log synchronization events on the remote database.

CREATE TABLE SyncLog
(
 "event_id"          INTEGER NOT NULL DEFAULT AUTOINCREMENT ,
   "event_name"       VARCHAR(128) NOT NULL ,
   "ml_user"            VARCHAR(128) NULL ,
   "event_time"         TIMESTAMP NULL,
   "table_name"         VARCHAR(128) NULL ,
   "upsert_count"       VARCHAR(128) NULL ,
   "delete_count"       VARCHAR(128) NULL ,
   "exit_code"          INTEGER NULL ,
   "status_retval"      VARCHAR(128) NULL ,
   "pubs"                VARCHAR(128) NULL ,
   "sync_descr "         VARCHAR(128) NULL , 
    PRIMARY KEY ("event_id"),
);

The following example logs the MobiLink user and current timestamp immediately before the transaction log is scanned for upload.

CREATE PROCEDURE sp_hook_dbmlsync_logscan_begin ()
BEGIN
 -- log the synchronization event
 INSERT INTO SyncLog (event_name, ml_user,event_time)
  SELECT 'logscan_begin', #hook_dict.value, CURRENT TIMESTAMP
  FROM #hook_dict
  WHERE name = 'MobiLink user' ;  
END;