Use this stored procedure to add custom actions immediately before each table is downloaded.
Name |
Value |
Description |
---|---|---|
table name (in) |
table name |
The table to which operations are about to be applied. |
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. |
If a procedure of this name exists, it is called for each table immediately before downloaded operations are applied to that table. Actions of this procedure are committed or rolled back when the download is committed or rolled back.
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, table name, and current timestamp immediately before a table is downloaded.
CREATE PROCEDURE sp_hook_dbmlsync_download_table_begin() BEGIN DECLARE tbl VARCHAR(255); -- load the table name from #hook_dict SELECT #hook_dict.value INTO tbl FROM #hook_dict WHERE #hook_dict.name = 'table name'; INSERT INTO SyncLog (event_name, ml_user, table_name ,event_time) SELECT 'download_table_begin', #hook_dict.value, tbl ,CURRENT TIMESTAMP FROM #hook_dict WHERE name = 'MobiLink user' ; END; |
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |