Consultor Eletrônico



Kbase P5566: DBTASKID() returns the unknown value inside a database trigger.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Unverified

FACT(s) (Environment):

Progress 9.x

SYMPTOM(s):

DBTASKID() returns the unknown value.

DBTASKID() is used within a DELETE or REPLICATION-DELETE database trigger.

CAUSE:

Bug# 20020731-006

CAUSE:

This is a known issue.

The problem occurs only if DBTASKID() is used within the DELETE or REPLICATION-DELETE trigger before any further access to the database. For example:

TRIGGER PROCEDURE FOR REPLICATION-DELETE OF customer.

/* The database is not accessed before DBTASKID() is used.
In this case DBTASKID() may return '?' */
MESSAGE DBTASKID(BUFFER customer:DBNAME)
VIEW-AS ALERT-BOX INFO TITLE "DBTASKID() from REPLICATION-DELETE".
This is unlikely to happen, as DBTASKID() is usually used for auditing and/or replication, which most of the times involve creating new records in other database tables. For example:

TRIGGER PROCEDURE FOR REPLICATION-DELETE OF customer.

/* A record is created in another table.
Because some database activity takes place,
DBTASKID() returns the correct value. */
CREATE replicationTable.
ASSIGN replicationTable.tableName = "customer"
replicationTable.eventType = "DELETE"
replicationTable.taskID = DBTASKID(BUFFER customer:DBNAME).


FIX:

Make sure that some database activity takes place before using DBTASKID().

For example, this can be a FIND to another table, or a change of a field in the record which is going to be deleted.

The problem is fixed in OpenEdge 10.x.