Quote:
Originally Posted by Creadiv
It seems like this is what I am looking for. I don't understand why it wouldn't.
|
Because the time between when you query the database and display the data to the end user is going to be much, much less than a second. This is an acceptable amount of time to hold a lock for. But the time between when the user sees the data, and goes in and makes the change could be five minutes, or they could click the detail link, to to lunch, and come back an hour later. It's unacceptable to hold a lock that long.
Also, I'm not an expert on MySQL, but how would you do that? The row is locked while the SELECT query is executing, and unlocked as soon as the db sends data to the web server. Then it's locked again when you run your UPDATE is running. But in between the two, it's no locked, available for any kind of change.
Imagine:
User A pulls up the Jon Doe record
User B pulls up the Jon Doe record
User A has a sip of coffee, then changes it to John Doe, and hits save
User B has a conference call with the customer and a manager, and gets approval to mark that the customer should get a 15 % discount on their next order
User B hits save, but they got the data before User A saved it, so the results from the query say Jon Doe, they don't know that a different user changed a different field on the same record. When User B hits save, it wipes out User A's change.
|