I'm writing a postgres database with a PHP front end
for a small work-group , and I want to prevent two editors
working on the same record at the same time overwriting each
others entry's.
The standard solution is to add a lock field to the
database and toggle it from 0 (unlocked) to 1 (locked) when the
record is selected for editing, however I cannot guarantee that a
record will get unlocked when an editor has finished with it (a browser
crash would force visiting an unlock page to allow a record to be edited).
I also do not want to place any particular limitations on how long a record
can be checked out for editing.
What I have in mind is saving the original data in hidden fields
in the form then diff the data with the database when the form data is
saved, if there is a difference (ie something has been changed between
checking out the record and saving it) the form is put into a 'diff mode'
which highlights what has been done.
Another option would be to generate an MD5 checksums for each
row on the table store it in a checksum column and use that to spot
alterations.
Is there any other better options I'm missing?
--
Michael
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~
NPC rights activist | Nameless Abominations are people too.
for a small work-group , and I want to prevent two editors
working on the same record at the same time overwriting each
others entry's.
The standard solution is to add a lock field to the
database and toggle it from 0 (unlocked) to 1 (locked) when the
record is selected for editing, however I cannot guarantee that a
record will get unlocked when an editor has finished with it (a browser
crash would force visiting an unlock page to allow a record to be edited).
I also do not want to place any particular limitations on how long a record
can be checked out for editing.
What I have in mind is saving the original data in hidden fields
in the form then diff the data with the database when the form data is
saved, if there is a difference (ie something has been changed between
checking out the record and saving it) the form is put into a 'diff mode'
which highlights what has been done.
Another option would be to generate an MD5 checksums for each
row on the table store it in a checksum column and use that to spot
alterations.
Is there any other better options I'm missing?
--
Michael
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~
NPC rights activist | Nameless Abominations are people too.
Comment