English 中文(简体)
Transaction & Locks Problem
原标题:

with in do transaction, i defined a label and in this label i am accessing a table with exclusive-lock.and at the end of label i have done all the changes in that table. bt now i am with in transaction block. Now, i tried to access that same table in another session.then it show an error, Table used by another user. So is it possible that, can we release teh table with in transaction,so another user can access it.

For example:

Session 1)

DO TRANSACTION:
  ---
  ---
  loopb:
  REPEAT:
    --
    --
    ---------------------> control is here right now.
  END. /*repeat*/
  -- 
  --
END. /*do transaction*/

Session 2)

I tried to access same table, but it show an error, that table locked by another user.

问题回答

All those records you touched in the loop using EXCLUSIVE-LOCK will not be available to be locked by another user until the TRANSACTION is complete. There is no getting around this. If the second process needs to lock those records, then all you can do is decrease your TRANSACTION scope in the first process. This is a safety feature so that if an error happens later on in the TRANSACTION, all the changes made during the TRANSACTION will be rolled back. Another way to look at it is if you could release some record locks during a TRANSACTION, you would lose the atomicity (all-or-nothingness) that is part of the definition of a TRANSACTION.

It should be noted that if you don t really need to lock those records in the second process but just need to see their updated value, that is possible. Once the updated records are no longer in the record buffer (or the record lock status is downgraded to a NO-LOCK in the TRANSACTION), they will become limbo locks and you can view their updated values using a NO-LOCK. To make the last record in the loop become a limbo lock, you can either do this

FIND CURRENT tablerecord NO-LOCK.

Or this, if you do not need to access the record buffer any longer:

RELEASE tablerecord.

Other sessions can do a "dirty read" of the record using NO-LOCK. But they will not be able to lock it or update it until the transaction is committed (or rolled back). And that won t happen until the repeat block iterates or you leave it.





相关问题
Progress 4GL that calls a C function

I have been working in some C language function that is going to be called from a Progress 4GL application and I found myself with the following doubts: The C function uses malloc to dynamically ...

How can I display and manipulate record arrays?

Looking for the following forms functionality with INFORMIX 4GL?, ISQL with ESQL/C?, PROGRESS-4GL?, ORACLE? etc? I have a CRUD form which displays a customer[master] with all of their asociated ...

Transaction & Locks Problem

with in do transaction, i defined a label and in this label i am accessing a table with exclusive-lock.and at the end of label i have done all the changes in that table. bt now i am with in ...

Delphi connection to OpenEdge Progress-4GL Database

Folks: Has anyone had success connecting to a Progress-4GL database with Delphi?   I ve been unable to establish any connection with the ODBC driver provided by the vendor (Progress OpenEdge ...

Progress 4GL and .Net

I m trying to get data out of a Progress 4GL database, into SQL Server. Ideally, I d like to do this directly and within .NET, rather than through an ODBC driver since the ODBC driver gateway in ...

How do I do HTTP GET and POST in Progress/OpenEdge ABL?

The Progress docs spill plenty of ink on SOAP, but I m having trouble finding the example for a simple HTTP GET/POST with Progress ABL. How do I GET and POST strings to/from a URL? Can the URL be ...

热门标签