Contents Index sp_hook_dbmlsync_download_fatal_sql_error sp_hook_dbmlsync_download_ri_violation

MobiLink Synchronization Reference
  Stored Procedures
    Client event-hook procedures

sp_hook_dbmlsync_download_log_ri_violation


Function 

Logs referential integrity violations in the download process.

Rows in #hook_dict table  
Name Values Description
publication_n (in) publication name The publications being synchronized, where n is an integer. There is one publication_n entry for each publication being uploaded.
MobiLink user (in) MobiLink user name The MobiLink user for which you are synchronizing.
Foreign key table (in) table name The table containing the foreign key column for which the hook is being called.
Primary key table (in) table name The table referenced by the foreign key for which the hook is being called.
Role name (in) role name The role name of the foreign key for which the hook is being called.
script version (in) script version name The MobiLink script version to be used for the synchronization.
Description 

A download RI violation occurs when rows in the download stream violate foreign key relationships on the remote database. This hook allows you to log RI violations as they occur so that you can investigate their cause later.

After the download is complete, but before it is committed, dbmlsync checks for RI violations. If it finds any, it identifies a foreign key that has an RI violation and calls sp_hook_dbmlsync_download_log_ri_violation (if it is implemented). It then calls sp_hook_dbmlsync_download_ri_conflict (if it is implemented). If there is still a conflict, dbmlsync deletes the rows that violate the foreign key constraint. This process is repeated for remaining foreign keys that have RI violations.

This hook is called only when there are RI violations involving tables that are currently being synchronized. If there are RI violations involving tables that are not being synchronized, this hook is not called and the synchronization fails.

This hook is called on a separate connection from the one that dbmlsync uses for the download. The connection used by the hook has an isolation level of 0 so that the hook can see the rows that have been applied from the download stream that are not yet committed. The actions of the hook are committed immediately after it completes so that changes made by this hook will be preserved regardless of whether the download stream is committed or rolled back.

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. For more information, see LockTables (lt) extended option.

Do not attempt to use this hook to correct RI violation problems. It should be used for logging only. Use sp_hook_dbmlsync_download_ri_violation to resolve RI violations.

See also 

sp_hook_dbmlsync_download_ri_violation


Contents Index sp_hook_dbmlsync_download_fatal_sql_error sp_hook_dbmlsync_download_ri_violation