MobiLink Synchronization Reference
Stored Procedures
The following stored procedures provide the interface for customizing synchronization at Adaptive Server Anywhere clients.
Do not perform any COMMIT or ROLLBACK operations in event-hook procedures. The procedures are executed on the same connection as the synchronization, and a COMMIT or ROLLBACK may interfere with synchronization.
Do not define more than one hook with the same name. If more than one hook with the same name is created (say by different users), then which hook is called is undefined.
Hook procedures must be created by a user with DBA authority.
If a *_begin hook executes successfully, the corresponding *_end hook is called regardless of any error that occurs afterwards. If the *_begin hook is not defined, but you have defined an *_end hook, then the *_end hook is called unless an error occurs prior the point in time where the *_begin hook would normally be called.
For more information about using client event hooks, see Customizing the client synchronization process.
Immediately before a hook is called, dbmlsync creates the #hook_dict table in the remote database, using the following CREATE statement. The # before the table name means that the table is temporary.
CREATE TABLE #hook_dict( name VARCHAR(128) NOT NULL UNIQUE, value VARCHAR(255) NOT NULL)
dbmlsync uses the #hook_dict table to pass values to hook functions, and hook functions use the #hook_dict table to pass values back to dbmlsync.
For example, for the following dbmlsync command line,
dbmlsync -c 'dsn=MyDsn' -n pub1,pub2 -u MyUser
when the sp_hook_dbmlsync_abort hook is called, the #hook_dict table will contain the following rows:
Name | Value |
---|---|
publication_0 |
pub1 |
publication_1 |
pub2 |
MobiLink user |
MyUser |
Abort synchronization |
false |
Your abort hook can retrieve values from the #hook_dict table and use them to customize behavior. For example, to retrieve the MobiLink user you would use a SELECT statement like this:
SELECT value FROM #hook_dict WHERE name = 'MobiLink user'
In/out parameters can be updated by your hook to modify the behavior of dbmlsync. For example, your hook could instruct dbmlsync to abort synchronization by updating the abort synchronization row of the table using a statement like this:
UPDATE #hook_dict SET value='true' WHERE name='abort synchronization'
The description of each hook lists the rows in the #hook_dict table.
sp_hook_dbmlsync_abort
sp_hook_dbmlsync_begin
sp_hook_dbmlsync_delay
sp_hook_dbmlsync_download_begin
sp_hook_dbmlsync_download_com_error
sp_hook_dbmlsync_download_end
sp_hook_dbmlsync_download_fatal_sql_error
sp_hook_dbmlsync_download_log_ri_violation
sp_hook_dbmlsync_download_ri_violation
sp_hook_dbmlsync_download_sql_error
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_process_return_code
sp_hook_dbmlsync_schema_upgrade
sp_hook_dbmlsync_upload_begin
sp_hook_dbmlsync_upload_end
sp_hook_dbmlsync_validate_download_file