|
| How to avoid users to modify the same record |
| Iniciado por guest, 22,feb. 2016 12:01 - 5 respuestas |
| |
| | | |
|
| |
| Publicado el 22,febrero 2016 - 12:01 |
Hi Windevers,
I have to build a program where 2 or more users can save and modify the same record. That´s normal. I use the method "the (last) winner takes it all" which means, that the last "saving" user overwrites the record changes from the concurrent user. Thats not the elegantest way ...
Whats your way to handle this ? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,febrero 2016 - 12:24 |
Hi Michael,
I think it's the only way. It's the same way it goes in the physical world.
Regards, Piet |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,febrero 2016 - 12:34 |
Hi everybody
when necessary, this is how I generally work, it's still last in wins, but at the FIELD level:
1. When OPENING the form, save the original record content 2. when saving the form (hmodify), read and block the record from disk 3.Do a comparison: original record/Form content. This gives me a list of fields that the user/process has modified in the form 4. Set in the file buffer ONLY the field that THIS FORM has modified
This methods keeps all changes made by somebody else if they are in different fields, and overwrite the fields if both side have modified them (last in wins)
The same system is used in WXReplication to replicate/transfer only the modified fields, so you have an example of the method I use (with halias) to do all that.
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,febrero 2016 - 12:39 |
Hi Michael,
I add a "LastModification" field to my file. (datetime field). Every time I update a record, i also update this field with the current date/time.
A user want to change a record : I read it from the db and store the lastmodification in a local variabele.
Before I update a record, i read it again from the db and check if the lastmodification timestamp is the same as in my local variabele. Only then I perform the update, otherwise I give a message to the user that the record is changed and reload the record...
Regards, Bart |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,febrero 2016 - 13:12 |
OK folks,
thx.
It looks like there is no built-in mechanism to make this with a 3 rows of code .... |
| |
| |
| | | |
|
| | |
| |
| Publicado el 22,febrero 2016 - 13:21 |
| |
| |
| | | |
|
| | | | |
| | |
|