Use this stored procedure to add custom actions after dbmlsync has verified receipt of the upload by the MobiLink server.
Name |
Value |
Description |
---|---|---|
failure cause (in) |
See range of values in Remarks, below |
The cause of failure of an upload. For more information, see Description. |
upload status (in) |
retry | committed | failed | unknown |
Specifies the status returned by the MobiLink server when dbmlsync attempted to verify receipt of the upload. retry - The MobiLink server and dbmlsync had different values for the log offset from which the upload should start. The upload was not committed by the MobiLink server. The dbmlsync utility attempts to send another upload starting from a new log offset. committed - The upload was received by the MobiLink server and committed. failed - The MobiLink server did not commit the upload. unknown - Dbmlsync was started with the -tu option, causing transaction-level uploads. For each transaction that is uploaded, the sp_hook_dbmlsync_upload_begin and sp_hook_dbmlsync_upload_end hooks are called and the upload status value is unknown - each time except the last one. |
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. |
authentication value (in) | value |
This value is generated by the authenticate_user, authenticate_user_hashed, or authenticate_parameters script on the server. The value is an empty string when the upload status is unknown or when the upload_end hook is called after an upload is resent because of a conflict between the log offsets stored in the remote and consolidated databases. |
If a procedure of this name exists, it is called immediately after dbmlsync has sent the upload and received confirmation of it from the MobiLink server.
Actions of this procedure are committed immediately after execution.
The range of possible parameter values for the failure cause row in the #hook_dict table includes:
UPLD_ERR_ABORTED_UPLOAD The upload failed due to an error that occurred on the remote. Typical causes of the failure include communication errors and out-of-memory conditions.
UPLD_ERR_COMMUNICATIONS_FAILURE A communication error occurred.
UPLD_ERR_LOG_OFFSET_MISMATCH The upload failed because of conflict between log offset stored on the remote and consolidated databases.
UPLD_ERR_GENERAL_FAILURE The upload failed for an unknown reason.
UPLD_ERR_INVALID_USERID_OR_PASSWORD The user ID or password was incorrect.
UPLD_ERR_USERID_OR_PASSWORD_EXPIRED The user ID or password expired.
UPLD_ERR_USERID_ALREADY_IN_USE The user ID was already in use.
UPLD_ERR_DOWNLOAD_NOT_AVAILABLE The upload was committed on the consolidated but an error occurred that prevented MobiLink from generating a download.
UPLD_ERR_PROTOCOL_MISMATCH dbmlsync received unexpected data from the MobiLink server.
UPLD_ERR_SQLCODE_n Here, n is an integer. A SQL error occurred in the consolidated database. The integer specified is the SQLCODE for the error encountered.
Assume you use the following table to log synchronization events on the remote database.
CREATE TABLE SyncLog( "event_id" INTEGER NOT NULL DEFAULT AUTOINCREMENT , "event_name" VARCHAR(128) NOT NULL , "ml_user" VARCHAR(128) NULL , "event_time" TIMESTAMP NULL, "table_name" VARCHAR(128) NULL , "upsert_count" VARCHAR(128) NULL , "delete_count" VARCHAR(128) NULL , "exit_code" INTEGER NULL , "status_retval" VARCHAR(128) NULL , "pubs" VARCHAR(128) NULL , "sync_descr " VARCHAR(128) NULL , PRIMARY KEY ("event_id"), ); |
The following example logs the MobiLink user and current timestamp after dbmlsync verifies that the MobiLink server has received the upload.
CREATE PROCEDURE sp_hook_dbmlsync_upload_end () BEGIN DECLARE status_return_value VARCHAR(255); -- store status_return_value SELECT #hook_dict.value INTO status_return_value FROM #hook_dict WHERE #hook_dict.name = 'upload status'; INSERT INTO SyncLog (event_name, ml_user, status_retval, event_time) SELECT 'upload_end', #hook_dict.value, status_return_value, CURRENT TIMESTAMP FROM #hook_dict WHERE name = 'MobiLink user'; END; |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |