Sanjay,
Thank you for sharing this very useful technique for safely updating a
database record without locking out other readers for a lengthy period
of time. As a little known historical note, this is the way DataPerfect
has done record updates since its version 2.2, released back in 1989. In
practice, this new technique took DP from saturating the network at 20
users to supporting over 200 users with negligible network usage. The
technique was invented by A. Lewis Bastian in the late 70's or early
80's.
FWIW,
Bruce

-----Original Message-----
From: Radhakrishnan, Sanjay [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 17, 1999 8:30 AM
To: [EMAIL PROTECTED]
Subject: Re: Database locking in multiple page Web application


When you do the update you would have to include all the modifiable
columns
in the where clause for the update statement.

IF you have cols A, B, C, D, E & F

and lets say only A B & C are updateable by any user.

then you would select a,b,c,d,e,f from table

the user would make the changes to columns(corresponding gui controls on
the
webpage(s)) then you would have to fire the update statement.

update <set values>

from table
where a = <original retrieve value of a>
and b = <original retrieve value of b>
and c = <original retrieve value of c>

consider this scenario where

User 1 retirieves a record from the database at lets say 3pm
User 2 retrieves the same record at 3:05 pm
User 2 updates the record at 3:10 pm
User 1 tries to update at 3:12 pm

Now if User 1 hits the update button(and fires the above update
statement
the update will fail(ie. will not affect any rows) as the original
values
retrieved by user 1 have already been changed by user 2.

HTH
Sanjay

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
For JSP FAQ, http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to