[QUOTE=aducom;34943]Be aware that there are several scenario’s that covers the matter. There is a select for update in mysql, and it might be possible to use that. But the problem is that if the user keeps the record locked for whatever reason the other user has no clue.
If it’s realy necessary to lock a certain record for update I would advise the following (custom) scenario (just a raw thought, never had the need of using it)
- create a table ‘mylocks’ containing a few fields: tablename, primary key, lockdatetime, owner.
- delete all entries in this mylocks table that are locked but exceeds a certain update time, i.e. 10 minutes.
- When a record needs to be edited you look into this ‘mylocks’ table to see if it’s there. If it is, you are not allowed to edit. If it isn’t create a new entry and allow the record to be edited.
- Before update check if the lock still persists n the table. if it is, update. If it is, but not owned by the user requesting it (because it was released after 10 minutes and taken by someone else) generate an errormessage. Otherwize update the record.
I think that this would be a pretty simple and easy way to implement the custom lock? You can even report who currently has the record for update…[/QUOTE]
Great idea Albert, thanks a lot, really, it also make sense and easier than going into db locking stuff, I will try to do it ASAP, hopefully works as required, will let you guys know if works, but i’m not sure when it will be though 