Consultor Eletrônico



Kbase P115120: Crash referencing THIS- or TARGET-PROCEDURE within a dynamic QUERY-PREPARE( ) predicate.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   15/10/2008
Status: Unverified

SYMPTOM(s):

Client crashes invoking the QUERY-PREPARE() method of a QUERY object.

The predicate expression given to QUERY-PREPARE() contains a reference to THIS-PROCEDURE or TARGET-PROCEDURE.

Stack trace contains references to the following:

rnqsmprep
rnqsmsem
rnDynQryPrepare
umDynqGetAttr

CAUSE:

This is a known issue being investigated by Development.

When the QUERY-PREPARE() is executed, the query compiler does not have the correct information to interpret THIS-PROCEDURE nor TARGET-PROCEDURE. The crash is caused by the QUERY-PREPARE() method trying to deference a NULL pointer.

FIX:

The following example gives a pattern to follow in order to amend your code.

Suppose the crash occurs with the following statement:

hQuery:QUERY-PREPARE("FOR EACH customer WHERE customer.custNum = DYNAMIC-FUNCTION('getCustNum' IN TARGET-PROCEDURE)").

You can change the predicate expression to:

hQuery:QUERY-PREPARE("FOR EACH customer WHERE customer.custNum = DYNAMIC-FUNCTION('getCustNum' IN WIDGET-HANDLE(' " + STRING(TARGET-PROCEDURE) + " '))").

By doing so, TARGET-PROCEDURE is resolved to a handle *before* the QUERY-PREPARE() method is invoked.
The same workaround can be applied to THIS-PROCEDURE.