sp_hook_dbmlsync_validate_download_file

Use this hook to implement custom logic to decide if a download file can be applied to the remote database. This hook is called only when a file-based download is applied.

Rows in #hook_dict table

Name

Value

Description

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 n in publication_n and generation number_n match. The numbering of n starts at zero.

MobiLink user (in)

MobiLink user name

The MobiLink user for which you are synchronizing.

file last download time (in)

The download file's last download time. (The download file contains all rows that were changed between its last download time and its next last download time.)

file next last download time (in)

The download file's next last download time. (The download file contains all rows that were changed between its last download time and its next last download time.)

file creation time (in)

The time when the download file was created.

file generation number_n (in)

number

The generation numbers from the download file. There is one file generation number_n for each publication_n entry. The n in publication_n and generation number_n match. The numbering of n starts at zero.

user data (in)

string

The string specified with the dbmlsync -be option when the download file was created.

apply file (in|out)

True|False

If true (the default), the download file is applied only if it passes dbmlsync's other validation checks. If false, the download file is not applied to the remote database.

check generation number (in|out)

True|False

If true (the default), dbmlsync validates generation numbers. If the generation numbers in the download file do not match those in the remote database, dbmlsync does not apply the download file. If false, dbmlsync does not check generation numbers.

setting generation number (in)

true | false

True if the -bg option was used when the download file was created. If -bg was used, the generation numbers on the remote database are updated from the download file and normal generation number checks are not performed.

Remarks

Use this stored procedure to implement custom checks to decide if a download file can be applied.

If you want to compare the generation numbers or timestamps contained in the file with those stored in the remote database, they can be queried from the SYSSYNC and SYSPUBLICATION system views.

This hook is called when the -ba option is specified. It is called before the download file is applied to the remote database.

The actions of this hook are committed immediately after it completes.

See also
Examples

The following example prevents application of download files that don't contain the user string 'sales manager data'.

CREATE PROCEDURE sp_hook_dbmlsync_validate_download_file ()
BEGIN
  IF NOT exists(SELECT * FROM #hook_dict
   WHERE name = 'User data' AND value='sales manager data')
  THEN
    UPDATE #hook_dict
            SET value = 'false' WHERE name = 'Apply file'; 
  END IF;
END;