[Stackoverflow] [Progress OpenEdge ABL] Progress4gl how to lock yourself?

Status
Not open for further replies.
A

AXMIM

Guest
In an unit test, I need to verify that the program skip locked records when processing a table. I have been unable to setup a locked records because the test can't lock itself which make a lot of sense.

Here is a sample of what I'm trying to achieve.

Code:
  DEV VAR v_isCommitted        AS LOGI NO-UNDO.
  DEF VAR hl                   AS HANDLE   NO-UNDO.
  DEF BUFFER bufl              FOR tablename. 
  hl = BUFFER bufl:HANDLE. 

  LOCKED_RECORDS:
  DO TRANSACTION ON ERROR UNDO, LEAVE LOCKED_RECORDS:
      /*Setup : Create record not committed yet*/
      CREATE tablename.
      ASSIGN tablename.fields = fieldsvalue.



      /*ACT :  Code I'm trying to test*/   
      /*...some code...*/  
      v_isCommitted = hl:FIND-BY-ROWID(ROWID(tablename), EXCLUSIVE-LOCK, NO-WAIT)
                                AND AVAILABLE(bufl) 
                                AND NOT LOCKED(bufl).
      /*...some code touching the record if it is commited...*/   

      /*ASSERT :  program left new record tablename AS IS.*/

  END.

The problem is that the record is available and not locked to the test because it was created by it.
Is there a way I could have the test lock a record from itself so the act part can actually skip the record like it was created by someone else?

Progress: 11.7.1

Continue reading...
 
Status
Not open for further replies.
Top