Mailing List Archive



Back to the month index Back to the list index

Andre van der Vlies (A.G.van.der.Vlies@cb.hva.nl)
Mon, 14 Apr 1997 13:11:44 +0200 (CDT)


Date: Mon, 14 Apr 1997 13:11:44 +0200 (CDT)
From: Andre van der Vlies <A.G.van.der.Vlies@cb.hva.nl>
Subject: Re: Fw: [mSQL] Locking? 
Message-Id: <Pine.SGI.3.94.970414130448.2699J-100000@ice.cb.hva.nl>

On Thu, 10 Apr 1997, Vivek Khera wrote:

> >>>>> "AvdV" == Andre van der Vlies <A.G.van.der.Vlies@cb.hva.nl> writes:
>
>
> AvdV> Perhaps a new clause:
> AvdV> CHANGE IN table salary=40000 TO salary=60000
>
>
> AvdV> Only updating the fields if both conditions are true. salary is
> AvdV> 40000 and after updating is 60000. All in one operation.
>
> And how exactly is this different than
>
> UPDATE table SET salary=60000 WHERE salary=40000
>
> in standard SQL? A single UPDATE operation is still atomic no mater
> how many rows it affects.
>

The difference is something like this:

user1: select free_seats from journey
                if frees_seats > 0 then
                generate reservation
                update ..... <<<< Just before this statement another comes by
                                                        and does the same thing ....

user2: select free_seats from journey
                if frees_seats > 0 then <<<< It is still 1 because the update
                                                                          didn't happen yet .....
                generate reservation
                update ....

Now there are two people have 1 seat ....

                           Andre van der Vlies <A.G.van.der.Vlies@cb.hva.nl>
                           System Administrator
                           Hogeschool van Amsterdam
                           Stadhouderskade 55, Amsterdam
                           tel: (+31) 20 5702670
                           fax: (+31) 20 5702510
                           http://www.cb.hva.nl/~andre
Key fingerprint = 99 DC D6 01 96 C2 48 80 DC 9C D5 D2 34 F6 A6 5D

--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!