[Torque] SELECT for UPDATE
From: T.E. Schmitz (nospam_at_nowhere.com)
Date: 04/23/04
- Next message: Xenofon Grigoriadis: "Re: To JDO or not - that is the question"
- Previous message: T.E. Schmitz: "[Torque] SELECT for UPDATE"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 23 Apr 2004 19:03:09 +0100
Hello,
As far as I can see there is no means of doing a SELECT for UPDATE in
Torque, i.e. it is not possible to lock a record in a transaction.
I need a locking read for the following reason:
Every record is marked with a 'LastUpdated' timestamp in order to enable
checking whether it has been updated in the meantime in another session.
Prior to any UPDATE or DELETE the record is re-read and timestamps are
compared. If the SELECT doesn't return any results the record has been
deleted. If the timestamp has changed the record has been modified in
the meantime. For this to work, the record needs to be locked by the
SELECT operation; otherwise there is still a window between the SELECT
and the UPDATE during which another session could modify or delete it.
Also, this is the only way of knowing whether the UPDATE has been
successful because Torque's doUpdate doesn't return the number of
effected rows.
Has anybody found a work-around for this problem?
Regards,
Tarlika Elisabeth Schmitz
- Next message: Xenofon Grigoriadis: "Re: To JDO or not - that is the question"
- Previous message: T.E. Schmitz: "[Torque] SELECT for UPDATE"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|