MobiLink Synchronization Reference
Stored Procedures
Client event-hook procedures
Use this stored procedure to manage return codes.
Name | Values | Description |
---|---|---|
publication_n (in) | publication name | The publications being synchronized, where n is an integer. There is one publication_n entry for each publication being uploaded. |
MobiLink user (in) | MobiLink user name | The MobiLink user for which you are synchronizing. |
fatal error (in) | True|False | True when the hook is called because of an error that will cause dbmlsync to terminate. |
aborted synchronization (in) | True|False | True when the hook is called because of an abort request from the sp_hook_dbmlsync_abort hook. |
return code (in) | number | The return code from the most recent synchronization attempt. 0 indicates a successful synchronization. Any other value indicates that the synchronization failed. This value can be set by sp_hook_dbmlsync_abort when that hook is used to abort synchronization. |
last return code (in) | number | The value stored in the new return code row of the #hook_dict table the last time this hook was called, or 0 if this is the first call to the hook. |
new return code (in|out) | number | The desired return code for the process. When dbmlsync exits, dblmsync's return code is the value stored in this row by the last call to the hook. The value must be -32768 to 32767. |
script version (in) | script version name | The MobiLink script version to be used for the synchronization. |
A dbmlsync session can run multiple synchronizations when you use the -n option, when you use scheduling, or when you use the restart parameter in the end_hook. In these cases, if one or more of the synchronizations fail, the default return code does not indicate which failed. Use this hook to define the return code for the dbmlsync process based on the return codes from the synchronizations. This hook can also be used to log return codes.
Suppose that you run dbmlsync to perform five synchronizations and you want the return code to indicate how many of the synchronizations failed, with a return code of 0 indicating that there were no failures, a return code of 1 indicating that one synchronization failed, and so on. You can achieve this by defining the sp_hook_dbmlsync_process_return_code hook as follows. In this case, if three synchronizations fail, the new return code is 3.
BEGIN DECLARE rc integer; SELECT value INTO rc FROM #hook_dict WHERE name = 'return code'; IF rc <> 0 THEN SELECT value INTO rc FROM #hook_dict WHERE name = 'last return code'; UPDATE #hook_dict SET value = rc + 1 WHERE name = 'new return code'; END IF; END;
Synchronization event hook sequence