sp_hook_dbmlsync_download_fatal_sql_error (deprecated)

Take action when a synchronization download is about to be rolled back because of a database error.

This hook is deprecated. See Handling errors and warnings in event hook procedures.

Rows in #hook_dict table

Name

Value

Description

table name (in)

table name

The table to which operations were being applied when the error occurred. The value is an empty string if dbmlsync is unable to identify the table.

SQL error code (in)

SQL error code

Identifies the SQL error code returned by the database when the operation failed.

publication_n (in)

publication

The publications being synchronized, where n is an integer. There is one publication_n entry for each publication being uploaded. The numbering of n starts at zero.

MobiLink user (in)

MobiLink user name

The MobiLink user for which you are synchronizing.

script version (in)

script version name

The MobiLink script version to be used for the synchronization.

Remarks

If a procedure of this name exists, it is called immediately before a synchronization download is rolled back because of a database error. This occurs whenever a SQL error is encountered that cannot be ignored, or when the sp_hook_dbmlsync_download_SQL_error hook has already been called and has chosen not to ignore the error.

This procedure executes on a separate connection, so that failures can be logged. Otherwise, the action of logging would be rolled back along with the synchronization actions. If dbmlsync cannot establish a separate connection, the procedure is not called.

By default on Windows Mobile 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. See LockTables (lt) extended option.

Actions of this procedure are committed immediately after execution.

See also
Examples

Assume you use the following table to log SQL errors.

CREATE TABLE "DBA"."SyncLogComErrorTable"
(
   " error_code "       VARCHAR(255) NOT NULL ,
   " event_time "       TIMESTAMP NOT NULL ,
);

The following example logs the SQL error code and current time stamp when SQL errors occur while reading the download. The information is stored in SyncLogSQLErrorTable on the remote database.

CREATE PROCEDURE sp_hook_dbmlsync_download_fatal_sql_error ()
BEGIN
 INSERT INTO SyncLogSQLErrorTable (error_code, event_time)
  SELECT #hook_dict.value, CURRENT TIMESTAMP
  FROM #hook_dict
  WHERE name = 'SQL error code';
END;