In this lesson, you create an upload_end hook to clear out the pre-image and delete tables.
This lesson assumes you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Using scripted upload.
This lesson assumes you have completed all preceding lessons. See Lesson 1: Creating the consolidated database.
Context and remarks
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.
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() BEGIN 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; END;
Discuss this page in DocCommentXchange.
|Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0|