Consultor Eletrônico



Kbase P109613: FIND-FIRST method with NO-ERROR sets ERROR-STATUS:NUM-MESSAGES but does not set ERROR-STATUS:ERROR.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   14/12/2005
Status: Unverified

SYMPTOM(s):

FIND-FIRST method with NO-ERROR sets ERROR-STATUS:NUM-MESSAGES but does not set ERROR-STATUS:ERROR.

FIND-FIRST method does not raise the ERROR condition.

<database name> <buffer name> <field name> must be a quoted constant or an unabbreviated, unambiguous buffer/field reference for buffers known to query <name>. (7328)

Invalid WHERE clause in FIND method for buffer <buffer-name> (10041)

As an example the following code will not raise the error condition although it will generate 2 error messages.

define variable vhBuffer as handle no-undo.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
create buffer vhBuffer for table "customer".
vhBuffer:find-first("where name = john", no-lock) NO-ERROR.
message error-status:ERROR SKIP
error-status:num-messages
view-as alert-box info buttons ok.
IF error-status:NUM-MESSAGES > 0 THEN
DO i = 1 TO error-status:num-messages:
MESSAGE error-status:GET-NUMBER(i)
view-as ALERT-BOX.
END.
delete object vhBuffer.

CAUSE:

This is expected behavior.

FIX:

The on line help message for the find-first method states:
If FIND-FIRST fails, it does not raise an error but displays a message. You can suppress this message by using NO-ERROR on the statement containing the method.

Removing the NO-ERROR on the FIND-FIRST method will result on the full errors 10041 and 7328 displayed on screen. However the ERROR-STATUS:ERROR flag will still be false.