Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » MobiLink - Client Administration » SQL Anywhere Clients for MobiLink » Event hooks for SQL Anywhere clients

 

sp_hook_dbmlsync_begin

Use this stored procedure to add custom actions at the beginning of the synchronization process.

Rows in #hook_dict table

Name

Value

Description

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 at the beginning of the synchronization process.

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 compiles a list of publications. It logs the list of publications and other synchronization information at the beginning of the synchronization process.

CREATE PROCEDURE sp_hook_dbmlsync_begin ()
BEGIN
    
    DECLARE pubs_list VARCHAR(1024);
    DECLARE temp_str VARCHAR(128);
    DECLARE qry VARCHAR(128);

-- insert publication list into pubs_list
    SELECT LIST(value) INTO pubs_list
     FROM #hook_dict
     WHERE name LIKE 'publication_%';

-- log publication and synchronization information
    INSERT INTO SyncLog(event_name,ml_user,pubs,event_time)
     SELECT 'dbmlsync_begin',#hook_dict.value,pubs_list,CURRENT TIMESTAMP
     FROM #hook_dict
     WHERE name='MobiLink user'; 
END