Event hooks for SQL Anywhere clients

The SQL Anywhere synchronization client, dbmlsync, provides an optional set of event hooks that you can use to customize the synchronization process. When a hook is implemented, it is called at a specific point in the synchronization process.

You implement an event hook by creating a SQL stored procedure with a specific name. Most event-hook stored procedures are executed on the same connection as the synchronization itself.

You can use event hooks to log and handle synchronization events. For example, you can schedule synchronizations based on logical events, retry connection failures, or handle errors and referential integrity violations.

In addition, you can use event hooks to synchronize subsets of data that cannot be easily defined in a publication. For example, you can synchronize data in a temporary table by writing one event hook procedure to copy data from the temporary table to a permanent table before the synchronization and another to copy the data back afterward.

Caution

The integrity of the synchronization process relies on a sequence of built-in transactions. You must not perform an implicit or explicit commit or rollback within your event-hook procedures.

If you change any connection setting in a hook you must restore the setting to its previous value before the hook ends. Failing to restore the setting may produce unexpected results.

 dbmlsync interfaces

Synchronization event hook sequence
Event-hook procedures
sp_hook_dbmlsync_abort
sp_hook_dbmlsync_all_error
sp_hook_dbmlsync_begin
sp_hook_dbmlsync_communication_error
sp_hook_dbmlsync_delay
sp_hook_dbmlsync_download_begin
sp_hook_dbmlsync_download_end
sp_hook_dbmlsync_download_log_ri_violation
sp_hook_dbmlsync_download_ri_violation
sp_hook_dbmlsync_download_table_begin
sp_hook_dbmlsync_download_table_end
sp_hook_dbmlsync_end
sp_hook_dbmlsync_log_rescan
sp_hook_dbmlsync_logscan_begin
sp_hook_dbmlsync_logscan_end
sp_hook_dbmlsync_misc_error
sp_hook_dbmlsync_ml_connect_failed
sp_hook_dbmlsync_process_exit_code
sp_hook_dbmlsync_schema_upgrade
sp_hook_dbmlsync_set_extended_options
sp_hook_dbmlsync_set_ml_connect_info
sp_hook_dbmlsync_set_upload_end_progress
sp_hook_dbmlsync_sql_error
sp_hook_dbmlsync_upload_begin
sp_hook_dbmlsync_upload_end
sp_hook_dbmlsync_validate_download_file