Consultor Eletrônico



Kbase P22889: WRITE trigger does not fire with the BUFFER-RELEASE() method.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/10/2008
Status: Unverified

FACT(s) (Environment):

Progress 9.1B
Progress 9.1C

SYMPTOM(s):

WRITE trigger does not fire with the BUFFER-RELEASE() method.

Problem may appear 'randomly'.

CAUSE:

The BUFFER-RELEASE() method does not actually release the record if another active buffer points to the same record. The following code demonstrate this:

DEF BUFFER bCust FOR customer.

/* Dummy write trigger. */
ON WRITE OF customer DO:
MESSAGE "Writing customer: " customer.custnum
VIEW-AS ALERT-BOX.
END.

/* Here you have a buffer pointing to the first record. */
FIND FIRST bCust NO-LOCK.

DO TRANSACTION:

/* Here you re-find the first customer with another buffer. */
FIND FIRST customer EXCLUSIVE-LOCK.
ASSIGN customer.name = customer.name + ".".

/* You would expect the trigger to fire here,
as the 'customer' buffer will be released. */
BUFFER customer:BUFFER-RELEASE().

/* Instead the trigger fires here, when both buffers are released.
If the trigger exits with a RETURN ERROR, the ERROR condition
will be fired here, not at the BUFFER-RELEASE() call. */
RELEASE bCust.
END.

This behaviour only occurs with BUFFER-RELEASE(). With a RELEASE() statement, the trigger would fire where you'd expect it to.

FIX:

The behaviour was changed in 9.1C + latest patch and 9.1D: the BUFFER-RELEASE() method will always fire the WRITE trigger.