Olivier_Desmars
Member
Progress 9.1B , Windows 2000 SP3.
OK, this is just for fun. I was wondering why a LOCKED record could still be delete or modified in this particular case : Procedure1.p is locking a record in exclusive lock and launch procedure2.p if the record is found and lockable. Procedure2.p use the recid of the record, locked it and delete it.
I thought that , AS THE RECORD WAS LOCKED by procedure1 , PROCEDURE2 COULDn'T LOCK the SAME RECORD ? Removing the DO TRANSACTION does not change anything.
I don't really understand what's happening ???
PROCEDURE1.p
------------
DO TRANSACTION:
FIND FIRST <table> EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE <table> THEN
DO:
Run procedure2.p (INPUT RECID(<table>)).
END.
END. /* End of Transaction */
END. /* End of Procedure 1 */
---------------------------------------------------------------------
PROCEDURE2.p :
--------------
DEFINE INPUT PARAMETER rid_table AS RECID NO-UNDO.
FIND FIRST <table> WHERE RECID(<table>) = rid_table EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE <table> THEN
DO:
DELETE <table>.
END.
END. /* End of Procedure2.p */
OK, this is just for fun. I was wondering why a LOCKED record could still be delete or modified in this particular case : Procedure1.p is locking a record in exclusive lock and launch procedure2.p if the record is found and lockable. Procedure2.p use the recid of the record, locked it and delete it.
I thought that , AS THE RECORD WAS LOCKED by procedure1 , PROCEDURE2 COULDn'T LOCK the SAME RECORD ? Removing the DO TRANSACTION does not change anything.
I don't really understand what's happening ???
PROCEDURE1.p
------------
DO TRANSACTION:
FIND FIRST <table> EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE <table> THEN
DO:
Run procedure2.p (INPUT RECID(<table>)).
END.
END. /* End of Transaction */
END. /* End of Procedure 1 */
---------------------------------------------------------------------
PROCEDURE2.p :
--------------
DEFINE INPUT PARAMETER rid_table AS RECID NO-UNDO.
FIND FIRST <table> WHERE RECID(<table>) = rid_table EXCLUSIVE-LOCK NO-ERROR.
IF AVAILABLE <table> THEN
DO:
DELETE <table>.
END.
END. /* End of Procedure2.p */