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

SQL Anywhere 10.0.1 » MobiLink - Client Administration » Event Hooks for SQL Anywhere Clients

sp_hook_dbmlsync_set_upload_end_progress Next Page


Use this stored procedure to handle database errors that occur during synchronization. For example, you can implement the sp_hook_dbmlsync_sql_error hook to perform a specific action when a specific SQL error occurs.

Rows in #hook_dict table




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.

script version (in)

script version name

The MobiLink script version to be used for the synchronization.

error message (in)error message textThis is the same text that is displayed in the dbmlsync log.
error id (in)numericAn ID that uniquely identifies the message. Use this row to identify the error message, as the error message text may change.
error hook user state (in|out)integer

This value can be set by the hook to pass state information to future calls to the sp_hook_dbmlsync_all_error, sp_hook_dbmlsync_communication_error, sp_hook_dbmlsync_misc_error, sp_hook_dbmlsync_sql_error, or sp_hook_dbmlsync_end hooks. The first time one of these hooks is called, the value of the row is 0. If the hook changes the value of the row, the new value is used in the next hook call.

When you use this hook to pass state information to the sp_hook_dbmlsync_end hook, you can cause the _end hook to perform actions such as retrying the synchronization.

sql code (in)SQL error codeThe SQL error code returned by the database when the operation failed. These values are defined in sqlerr.h in the h subdirectory of your SQL Anywhere installation.
sql state (in)SQLSTATE valueThe SQL state returned by the database when the operation failed.

If an error occurs during startup before a synchronization has been initiated, the #hook_dict entries for MobiLink user and Script version are set to an empty string, and no publication_n rows are set in the #hook_dict table.

You can identify SQL errors using the SQL Anywhere SQLCODE or the ANSI SQL standard SQLSTATE. For a list of SQLCODE or SQLSTATE values, see Database Error Messages.

This procedure executes on a separate connection to ensure that operations it performs are not lost if a rollback is performed on the synchronization connection. If dbmlsync cannot establish a separate connection, the procedure is not called.

By default on Windows CE devices, synchronization tables are locked in exclusive mode, which means that this hook cannot successfully execute if it requires access to any of the synchronization tables. It also cannot execute if it needs to access synchronization tables and you set the dbmlsync extended option LockTables to EXCLUSIVE. See LockTables (lt) extended option.

Actions of this procedure are committed immediately after execution.

See also