Contents Index sp_hook_dbmlsync_download_log_ri_violation sp_hook_dbmlsync_download_sql_error

MobiLink Synchronization Reference
  Stored Procedures
    Client event-hook procedures

sp_hook_dbmlsync_download_ri_violation


Function 

Allows you to resolve 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 attempt to resolve RI violations before dbmlsync deletes the rows that are causing the conflict.

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. 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 the same connection that dbmlsync uses for the download. This hook should not contain any explicit or implicit commits, because they may lead to inconsistent data in the database. The actions of this hook are committed or rolled back when the download stream is committed or rolled back.

Unlike other hook actions, the operations performed during this hook are not uploaded during the next synchronization.

See also 

sp_hook_dbmlsync_download_log_ri_violation


Contents Index sp_hook_dbmlsync_download_log_ri_violation sp_hook_dbmlsync_download_sql_error