db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From T E Schmitz <mail...@numerixtechnology.de>
Date Sat, 24 Apr 2004 09:57:43 GMT
Yes, I am doing the following in a transaction:

1) SELECT the record which is to be updated
2) compare timestamps of the newly read record and the one passed down
3) IF timestamps are equal (ie nobody else has updated the record in the 
meantime) THEN UPDATE the record as per passed object setting the 
timestamp to current time.

The above transaction will not be water-tight if the SELECT isn't a 
SELECT FOR UPDATE. Only a SELECT FOR UPDATE will lock the record. If the 
record isn't locked, it could be modified/deleted in another session 
between steps 1) and 3).


Tarlika Elisabeth Schmitz

Dave Newton wrote:
> On Fri, 2004-04-23 at 11:22, T E Schmitz wrote:
>>Is there any means of doing a SELECT for UPDATE, ie to lock a record in 
>>a transaction?
> Can you just do the entire operation in a transaction using the Torque
> transaction methods? 
> http://db.apache.org/torque-31/apidocs/org/apache/torque/util/Transaction.html
> HTH,
> Dave

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message