From: Gavin_King/Cirrus%<CI...@ci...> - 2002-03-03 15:35:30
|
> It seems that way. There are formal definitions - optimistic concurrency > control schemes have been around for a while (and not like how you > describe). I went and had a good look on google to see how these terms are commonly used. Everyone agrees that optimistic locking means the application does some work by retaining a version number/timestamp and that pessimistic locking works by the database retaining a "lock" at read time. No-one seems terribly explicit as to whether a read lock constitutes a lock or not. I would have thought it did. Apparently you don't think so.... I would love to be sure of terminology here because when we come to document this I don't want to look clueless ;) > Check out: "Concurrency Control and Recovery in Database Systems" by > Bernstein, Hadzilacos & Goodman (1987). k, i will try to find it (p.s. i am a mathematician not a c.s. major so sometimes im missing authorative sources here) > At the very least, the lock() method on an already loaded object would > do the trick for starters. As long as the call makes its way through to > the database. Yup. After i posted that last email i wondered about this option. Its a nice one i think. Frees you to lock an object even sometime after you first retrieved it. All good. Im guessing its enough to just touch the row, right, ie. just select the primary key with "for update" to lock the whole row? Would probably be good to allow "for update" in query language also, since that would let you lock a bunch of rows in one query. What do we do about databases which don't support the for update syntax? throw exception? ignore it? Is there some other way to lock a row in sybase? |