in reply to Concurrency control in web applications
Most web apps don't bother trying to solve this problem because it doesn't matter to them. If a user opens two windows to edit his own phone number and saves in both of them, he probably expects the last save to win, and that's what happens. In the rare case where this does matter, people generally use a couple of standard approaches. The first is optomistic locking, which your version counter is an example of. (You can also use the previous state as a WHERE clause in your update, which accomplishes the same thing without needing the counter field.) The second is pessimistic locking, which your "in use" field is an example of. I've never heard of any other approach that didn't sound like overkill.
|