Use this stored procedure to cancel the synchronization process.
Name | Value | Description |
---|---|---|
abort synchronization (in|out) |
true | false |
If you set the abort synchronization row of the #hook_dict table to true, then synchronization terminates immediately after the event. |
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 synchronized. The numbering of n starts at zero. |
MobiLink user (in) |
MobiLink user name |
The MobiLink user for which you are synchronizing. |
exit code (in|out) |
number |
When abort synchronization is set to TRUE, you can use this value to set the exit code for the aborted synchronization. 0 indicates a successful synchronization. Any other number indicates that the synchronization failed. |
script version (in|out) |
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. There 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 at dbmlsync startup, and then again after each synchronization delay that is caused by the sp_hook_dbmlsync_delay hook.
When dbmlsync is run from the command line, setting the abort synchronization to true causes all remaining synchronizations (including scheduled synchronizations) to be canceled. When the dbmlsync API or the SQL SYNCHRONIZE statement is used, setting abort synchronization to true only causes the current synchronization to be aborted.
Actions of this procedure are committed immediately after execution.
The following procedure prevents synchronization during a scheduled maintenance hour between 19:00 and 20:00 each day.
CREATE PROCEDURE sp_hook_dbmlsync_abort() BEGIN DECLARE down_time_start TIME; DECLARE is_down_time VARCHAR(128); SET down_time_start='19:00'; IF datediff( hour,down_time_start,now(*) ) < 1 THEN set is_down_time='true'; ELSE SET is_down_time='false'; END IF; UPDATE #hook_dict SET value = is_down_time WHERE name = 'abort synchronization' END; |
Suppose you have an abort hook that may abort synchronization for one of two reasons. One of the reasons indicates normal completion of synchronization, so you want dbmlsync to have an exit code of 0. The other reason indicates an error condition, so you want dbmlsync to have a non-zero exit code. You could achieve this with an sp_hook_dbmlsync_abort hook defined as follows.
BEGIN IF [condition that defines the normal abort case] THEN UPDATE #hook_dict SET value = '0' WHERE name = 'exit code'; UPDATE #hook_dict SET value = 'TRUE' WHERE name = 'abort synchronization'; ELSEIF [condition that defines the error abort case] THEN UPDATE #hook_dict SET value = '1' WHERE name = 'exit code'; UPDATE #hook_dict SET value = 'TRUE' WHERE name = 'abort synchronization'; END IF; END; |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |