Use this stored procedure to add custom actions immediately after each table is downloaded.
Name | Value | Description |
---|---|---|
table name (in) |
table name |
The table to which operations have just been applied. |
delete count (in) |
number of rows |
The number of rows in this table deleted by the download. |
upsert count (in) |
number of rows |
The number of rows in this table updated or inserted by the download. |
publication_n (in) |
publication |
Deprecated. Use subscription_n instead. The publications being synchronized, where n is an integer. There is one publication_n entry for each publication being synchronization. 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. |
subscription_n (in) | subscription name(s) | The names of subscriptions being synchronized where n is an integer. This is one subscription_n entry for each subscription being synchronized. The numbering of n starts at zero. |
If a procedure of this name exists, it is called immediately after all operations in the download for a table have been applied.
Actions of this procedure are committed or rolled back when the download is committed or rolled back.
Hook procedures can be created by any user with the MANAGE REPLICATION system privilege. However, to ensure that the hook can access the #hook_dict table, which is used to pass information in and out of hooks, hooks must meet one of the following requirements:
Be owned by a user with the SELECT ANY TABLE and UPDATE ANY TABLE system privileges.
Be defined using the SQL SECURITY INVOKER clause of the CREATE PROCEDURE statement.
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_time" timestamp NULL, "event_name" varchar(128) NOT NULL , "subs" varchar(1024) NULL , PRIMARY KEY ("event_id") ) |
The following logs the end of the download for each table for each synchronization.
CREATE PROCEDURE sp_hook_dbmlsync_download_table_end () BEGIN DECLARE subs_list VARCHAR(1024); -- build a list of subscriptions being synchronized SELECT LIST(value) INTO subs_list FROM #hook_dict WHERE name LIKE 'subscription_%'; -- log the event INSERT INTO SyncLog(event_time, event_name, subs) VALUES( CURRENT TIMESTAMP, 'sp_hook_dbmlsync_download_table_end, subs_list ); END |
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0 |