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

SQL Anywhere 11.0.1 » MobiLink - Client Administration » SQL Anywhere Clients for MobiLink » Event hooks for SQL Anywhere clients



Use this stored procedure to add custom actions immediately before synchronization is complete.

Rows in #hook_dict table




restart (out)

sync | download | none

If set to sync, then dbmlsync retries the synchronization it just completed. The value sync replaces true, which is identical but is deprecated.

If set to none (the default), then dbmlsync shuts down or restarts according to its command line arguments. The value none replaces false, which is identical but is deprecated.

If set to download and the restartable download parameter is true, then dbmlsync attempts to restart the download that just failed.

exit code (in)


If set to anything other than zero (the default), this represents a synchronization error.

publication_n (in)


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.

upload status (in)

not sent | committed | failed

Specifies the status returned by the MobiLink server when dbmlsync attempted to verify receipt of the upload. The status can be:

  • not sent - No upload was sent to the MobiLink server, either because an error prevented it or because the requested synchronization did not require it, which would happen in cases such as download-only synchronization, a restarted download, or file-based download.
  • committed - The upload was received by the MobiLink server, and committed.
  • failed - The MobiLink server did not commit the upload. For a transactional upload, the upload status is 'failed' when some but not all the transactions were successfully uploaded and acknowledged by the server.

script version (in)

script version name

The MobiLink script version to be used for the synchronization.

restartable download (in) true|false

If true, the download for the current synchronization failed and can be restarted. If false, the download was successful or it cannot be restarted.

restartable download size (in) integer

When the restartable download parameter is true, this parameter indicates the number of bytes that were received before the download failed. When restartable download is false, this value is meaningless.

error hook user state (in) integer

This value contains information about errors and can be sent from the hooks sp_hook_dbmlsync_all_error, sp_hook_dbmlsync_communication_error, sp_hook_dbmlsync_misc_error, or sp_hook_dbmlsync_sql_error.


If a procedure of this name exists, it is called at the end of each synchronization.

Actions of this procedure are committed immediately after execution.

If an sp_hook_dbmlsync_end hook is defined so that the hook always sets the restart parameter to sync, and you specify multiple publications on the dbmlsync command line in the form -n pub1, -n pub2, and so on, then dbmlsync repeatedly synchronizes the first publication and never synchronizes the second.

See also

In the following example the download is manually restarted if the download for the current synchronization failed and can be restarted.

CREATE PROCEDURE sp_hook_dbmlsync_end()
  -- Restart the download if the download for the current sync
  --  failed and can be restarted  
  IF EXISTS (SELECT * FROM #hook_dict
    WHERE name = 'restartable download' AND value='true')
   UPDATE #hook_dict SET value ='download' WHERE name='restart';