Consultor Eletrônico



Kbase P119914: The AVAILABLE function on a static buffer behaves differently to the AVAILABLE method on a dynamic q
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/27/2006
Status: Unverified

SYMPTOM(s):

The AVAILABLE function on a static buffer behaves differently to the AVAILABLE method on a dynamic query buffer.

If a FIND FIRST fails because a records is locked the AVAILABLE function returns FALSE.

IF A GET-FIRST fails on a dynamic query buffer the AVAILABLE method returns TRUE.

The AVAILABLE method and the AVAILABLE function are supposed to be equivalent.

CAUSE:

NO-WAIT is being used with FIND FIRST and GET-FIRST, and this option behaves differently for the two statements.


If an attempt is made to lock a record exclusively with FIND FIRST and NO-WAIT, then if the record cannot be locked the FIND returns immediately and raises the ERROR condition.
With GET-FIRST, NO-WAIT in the same situation the record is returned NO-LOCK. This is why the AVAILABLE method returns TRUE.

The on line help for GET-FIRST says:

"Specifies that the method returns immediately if the record cannot be accessed because it is locked by another user. If you do not use the NO-WAIT option, the method waits until the record can be accessed. This applies to all buffers in a join. If you specify NO-WAIT and the record is locked by another user, the record is returned to you with NO-LOCK and the LOCKED function returns TRUE for the record."

FIX:

When using the NO-WAIT option on the AVAILABLE method, also use the LOCKED function to determine if another user has the records locked.