Re: Optimistic Locking

From: Jim Kennedy <kennedy-down_with_spammers_at_attbi.com>
Date: Fri, 09 May 2003 01:59:13 GMT
Message-ID: <XWDua.777782$3D1.426158_at_sccrnsc01>


Or you include all the columns with the prior values in the where clause and if you don't update a row then someone changed the data underneath you. Advantage of this is you don't have to worry about someone changing data and forgetting to update the timestamp.
Jim

-- 
Replace part of the email address: kennedy-down_with_spammers_at_attbi.com
with family.  Remove the negative part, keep the minus sign.  You can figure
it out.
"viki" <vikash_at_dog.com> wrote in message
news:f01186ed.0305080812.7808870f_at_posting.google.com...

> While working on a web-based application, there is no straight forward
> means to lock records. The reason for this is the statelessness of web
> based applications. The web browser sends a request and the web server
> responds to the request. The transaction is restricted to this
> duration and all locks holds only within this transaction.
>
> The only way in which you can achieve locking in such a system is by
> what is called as optimistic locking, where you maintain a time stamp
> column (date and time of last update) in every table. When a page is
> requested, the date and time of last update of the record is also
> sent. Now, when the user updates the record, check if the time stamp
> of the record has changed. If yes you can throw an error.
>
> I guess this should work in you case as well.
>
> Cheers
> Viki
Received on Fri May 09 2003 - 03:59:13 CEST

Original text of this message