Hi,
I want to have a record editor in PHP and I want to be able to detect if it's been updated already during the commit.
I've already read some solutions, and they suggest a timestamp column, or rowversion.
Does anyone have any other general solutions that do not involve modifying the database structure?
I was going to hash the record content on the initial select and store in hidden field, and then after user submits changes:
- START TRANSACTION
- Perform same select again, but with an optomisitc lock
- Check the new hash is not different to original, roll back if so.
- Update, relying on DB to catch the optomisitc lock violation possible between stage 3 and 4
- COMMIT
Has anyone got any better methods?
Thanks,
Alan