Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » MobiLink - Client Administration » SQL Anywhere clients for MobiLink » Scripted upload » Tutorial: Using scripted upload


Lesson 6: Clearing out the pre-image table

This lesson assumes you have completed all preceding lessons. See Lesson 1: Creating the consolidated database.

 Clear out the pre-image table
  1. Using the instance of Interactive SQL connected to the remote database, create an upload_end hook to clean up the employee_preimage and employee_delete tables when an upload is successful.

    CREATE PROCEDURE sp_hook_dbmlsync_upload_end()
        DECLARE val   varchar(256);
        SELECT value
        INTO val 
        FROM #hook_dict
        WHERE name = 'upload status';
        IF val = 'committed' THEN
          DELETE FROM employee_delete;
          DELETE FROM employee_preimages;
        END IF;

    This tutorial uses the default setting for the dbmlsync extended option LockTables, so the tables are locked during synchronization. So, you do not have to worry about leaving rows in the tables for operations that occurred after the end_progress. Locking prevents such operations from occurring.

  2. Proceed to Lesson 7: Creating a publication, MobiLink user, and subscription.