MobiLink Synchronization User's Guide
Adaptive Server Anywhere Clients
Customizing the client synchronization process
The following pseudo-code shows the available events and the point at which each is called during the synchronization process. For example, sp_hook_dbmlsync_abort is the first event hook to be invoked.
Each event makes particular parameter values available, which you can use when you implement the procedure. In some cases, you can modify the value to return a new value; others are read-only. These parameters are not stored procedure arguments. No arguments are passed to any of the event-hook stored procedures. Instead, arguments are exchanged by reading and modifying rows in the #hook_dict table.
For example, the sp_hook_dbmlsync_begin procedure has a parameter, which is the user name that the application supplied in the synchronization call. You can retrieve this value from the #hook_dict table.
Although the sequence has similarities to the event sequence at the MobiLink synchronization server, there is little overlap in the kind of logic you would want to add to the consolidated and remote databases. The two interfaces are therefore separate and distinct.
Any *_end hook will be called if the corresponding _begin hook is called and completed successfully. A *_begin hook is considered to have run successfully if it was not implemented when it would have been called.
sp_hook_dbmlsync_abort loop until return codes direct otherwise ( sp_hook_dbmlsync_abort sp_hook_dbmlsync_delay ) sp_hook_dbmlsync_abort // start synchronization sp_hook_dbmlsync_begin // upload events sp_hook_dbmlsync_logscan_begin sp_hook_dbmlsync_logscan_end sp_hook_dbmlsync_upload_begin sp_hook_dbmlsync_upload_end // download events
sp_hook_dbmlsync_validate_download_file (only called when -ba option is used) sp_hook_dbmlsync_download_begin for each table sp_hook_dbmlsync_download_table_begin sp_hook_dbmlsync_download_table_end next table sp_hook_dbmlsync_download_end // end synchronization sp_hook_dbmlsync_end sp_hook_dbmlsync_process_return_code
In addition, the following event-hook procedures are available for error handling.
sp_hook_dbmlsync_download_com_error sp_hook_dbmlsync_download_SQL_error sp_hook_dbmlsync_download_fatal_SQL_error sp_hook_dbmlsync_download__ri_violation sp_hook_dbmlsync_download_log_ri_violation
Once implemented, each procedure is automatically executed whenever an error of the named type occurs.
For more information, see Client event-hook procedures.