It might be a bit easier to code if you add a timestamp AND userid field.
So, if a user clicks to edit, you set his id and sysdate to the row.  Then,
if a second user clicks to edit that row, you check the aforementioned
fields then tell him before he does anything that this particular row is
locked by joe blow for the next 5 minutes.  That way you dont have to do too
much fancy coding(and business requirements) to give him various choices for
what he can do after you figure out that hes operating on tainted data.  You
dont have to worry about clean up either as you can just ignore timestamps x
many minutes old. Either way, sounds intersting. Keep us posted.  DRE

-----Original Message-----
From: Tero Pikala [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 09, 2002 6:07 AM
To: [EMAIL PROTECTED]
Subject: Re: DB locking


I've also seen implementation where each page with forms
had a hidden applet that talked to servlet that actually handled
row level locking.  I guess servlet also performed data updates
but I didn't learn was it done trough applet or from cfml code.

For most cases I would say Noams suggestion is better option.

Tero Pikala


----- Original Message -----
From: "BOROVOY Noam" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "'Balazs Wellisch'" <[EMAIL PROTECTED]>
Sent: Tuesday, April 09, 2002 2:00 PM
Subject: RE: DB locking


> The solution most systems use is a mix of optimistic locking, and a form
of
> verifying if the underlying data has changed (timestamp or full
comparison).
> That is you only lock the record when a user actually tries to modify data
> (using CFTRANSACTION)
> And then inside the transaction - before writing the data you check if the
> data in the db is the same as the data was when you displayed the form to
> the user (you can use hidden fields for this - either storing all fields
or
> just a timestamp).
> Then if the data was not changed while the user made his modifications
all's
> well write the data.
> BUT if the data was changed by someone else while the user made his
> modifications - you have a problem - typicaly solved by notifying the user
> and showing them THREE sets of data - original, their modification, other
> user's modification and allowing them to choose...
>
> HTH,
> Noam
>
> ----------
> From:  Balazs Wellisch [SMTP:[EMAIL PROTECTED]]
> Sent:  08 April 2002 22:03
> To:  [EMAIL PROTECTED]
> Subject:  DB locking
>
> Hi all,
>
> this isn't exactly a fb3 specific question but you guys might be
> able to
> help me.
>
> I have a problem where I need to restrict access to a row in a
> database
> table to one user at a time. I need to prevent users from reading or
> changing data in a table while that row is open in another user's
> browser.
>
> Is this even possible? Can I use cflock for this purpose? Knowing
> that the
> web is a stateless system how do I even know if that row is still
> open? Can
> I tie locking to a session?
>
> I'm using CF5 on Win2K with SQL2K. Any help would be appreciated.
>
> Thanks,
> Balazs
>
>

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9
Or send an email to: [EMAIL PROTECTED]

T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================

Reply via email to