Logical write triggers

Logical write triggers can be used to write the business logic associated with the write operation on the table. The default write trigger x/xxxxtwrite.p automatically executes the logical write triggers x/xxxxlwrite.p when available. The default and logical write triggers are executed in a single transaction such that failure at any point will revert the entire write operation. When the write trigger is first generated, the trigger file will contain a procedure stub p-commit as shown below:

/* ------------------------ Copyright Javra Software ---------------------------

File : C/Custlwrite.p
Description : Write trigger for Customer
Created : 16/12/14 javra

Date Author Version Description

16/12/14 javra 1.00 Created
------------------------------------------------------------------------------*/
{x/xxxxlwrite.i}
{x/xxxxpvar.i} /*
- default variables -*/

procedure p-commit :
/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*
/

find Customer where rowid(Customer) = p-bufferhdl:rowid exclusive-lock no-error no-wait.

message program-name(1) skip
''
view-as alert-box.

release Customer.

end procedure. /* p-commit*/

The p-commit procedure is executed whenever a record is committed to the table. One of the included files contained in the logical write file is x/xxxxlwrite.i. This file contains 3 input parameters which hold the values for current buffer handle of the table (record being committed), old buffer handle of the table (old copy of the record being committed) and the handle of the procedure which starts the transaction.

The input parameters are shown in the code snippet below:

def input param p-bufferhdl as handle no-undo./* handle of the trigger buffer */

def input param p-oldbufferhdl as handle no-undo./* handle of the trigger buffer */

def input param p-xproc as handle no-undo./* handle of the program with the transaction */

results matching ""

    No results matching ""