[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: A question about REST and transaction isolation


transaction isolation sybase
K. Ari Krupnikov wrote:
> User A GETs a resource and edits it. User B GETs a resource and edits
> it. User A PUTs the modified resource back. User B PUTs her version of
> the modified resource back, unaware of A's edits. A's edits are lost
> without anyone noticing. What I want to happen is B to get a 409
> "Conflict" or some such.

Can you use an optimistic locking approach?

The resource representation includes an integer changestamp, managed by 
the server. Everytime the server stores a representation, it increments 
the changestamp. If you try to store a representation with a changestamp 
that doesn't match the current one, the server give you the 409.

So in your scenario, User A GETs the resource with changestamp set to 1, 
as does User B. User A PUTs the modified resource back. The changestamp 
of 1 matches the server's value, so it accepts the change and increments 
the changestamp. User B PUTs her version. Her changestamp of 1 no longer 
matchs the version on the server, so the server returns 409. User B must 
GET the current version and try again.

We were doing this with PowerBuilder and Sybase back in '92, but I guess 
it should still work.

Jim

S/MIME Cryptographic Signature


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.