Re: Record Locking using web forms ?
Date: 1996/09/18
Message-ID: <01bba595$82baa200$12d35bc1_at_FsNetra.forlagsentralen.no>#1/1
Stein-Tore Erdal <hda9ste_at_hda.hydro.com> wrote in article
<323FA12B.6ACA_at_hda.hydro.com>...
> Atif Ahmad Khan <aak2_at_Ra.MsState.Edu> wrote in article
> > 2. Every row be assigned a serial number that is incremented by 1
everytime
> > it is updated. Then that serial number is forwarded to the user as
hidden
> > field like in the above example. If the user wants to update it then
the
> > 2 serial numbers are compared. (This sound like a little less
complicated
> > in theory).
>
> In Sybase you have a datatype called timestamp.
> This is a column that is changed by the database
> each time the record is changed.
> Each record in a table has a unique timestamp value.
>
> Example:
> 1. User1 select the record he get the current timestamp: 0x1
> 2. User2 select the record and he too get the same timestamp: 0x1
> 3. User1 change some data and save:
> update Table
> set ....
> where timestamp = 0x1
> 4. Database change the timestamp for the record to: 0x2
> (You should retrive the new timestamp when this happens
> so that User1 can do more changes)
> 5. User2 change some data and try to save:
> update Table
> set ....
> where timestamp = 0x1
> 6. Update fails as there is no record with timestamp = 0x1 anymore.
>
>
> Stein-Tore
>
...you could also/instead select all columns in your first select, and in your update include all coloumns in the WHERE clause.
SELECT a,b,c,d,e from t
HTML display b,c,d, keep a,b,c,d,e in variables old a, old b, old c, etc. (your WEB server must be capable of this type of operations) ... user updates b,c,d and...
UPDATE t SET a=old a, b=new b, ...... WHERE a=old a, b = new b, ...
-- Geir F Kiste migfk_at_mikromarc.no Mikromarc Library Automation software info can be found on http://www.mikromarc.no.Received on Wed Sep 18 1996 - 00:00:00 CEST