Consultor Eletrônico



Kbase P81739: 4GL: Error (2869) running a database schema WRITE trigger
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/29/2008
Status: Unverified

SYMPTOM(s):

4GL: Error (2869) running a database schema WRITE trigger

Attempt to disconnect a record, which is running a trigger. (2869)

Here is one version of the code which creates the error.

TRIGGER PROCEDURE FOR WRITE OF er-1st-TestTrig
NEW BUFFER TblBuffer-New
OLD BUFFER TblBuffer-Old.
DO:
IF NEW TblBuffer-New THEN DO:
MESSAGE "New Record Trigger - Skip" VIEW-AS ALERT-BOX.
END.
ELSE DO:
/* Handles for Table Buffers */
DEF VAR hdlBuffer-New AS HANDLE NO-UNDO.
DEF VAR hdlBuffer-Old AS HANDLE NO-UNDO.
/* Handle for Field Buffer */
DEF VAR hdlField-Old AS HANDLE NO-UNDO.
---
---
---
END.
/* Clean up handles */
IF VALID-HANDLE(hdlBuffer-New) THEN DELETE OBJECT hdlBuffer-New.
IF VALID-HANDLE(hdlBuffer-Old) THEN DELETE OBJECT hdlBuffer-Old.
IF VALID-HANDLE(hdlField-Old) THEN DELETE OBJECT hdlField-Old.
END. /* do */

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.1C

CAUSE:

Inside a database trigger procedure, you cannot do anything to release the record that is the object of the trigger. You cannot execute a RELEASE statement that would release the record, nor can you execute any FIND or FOR EACH that would read any record into the same buffer (this would force a RELEASE of the current record).

The culprit in the above are the last three statements that attempt to delete the buffers. This amounts to an attempt to release the record that is the object of the trigger. Hence the error.

FIX:

Remove the statements:
IF VALID-HANDLE(hdlBuffer-New) THEN DELETE OBJECT hdlBuffer-New.
IF VALID-HANDLE(hdlBuffer-Old) THEN DELETE OBJECT hdlBuffer-Old.
IF VALID-HANDLE(hdlField-Old) THEN DELETE OBJECT hdlField-Old.
Notice that it is not necessary to DELETE STATIC buffers as in the code above as Progress takes care of that automatically. Also, since you do not create the buffer-field objects and Progress creates them automatically when you reference any field of a buffer object, it is never necessary to DELETE a BUFFER-FIELD handle objects.