How do you manage concurrent access to forms?

前端 未结 8 1340
离开以前
离开以前 2020-12-17 15:27

We\'ve got a set of forms in our web application that is managed by multiple staff members. The forms are common for all staff members. Right now, we\'ve implemented a locki

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-17 16:00

    We put in a very simple optimistic locking scheme that works like this:

    • every table has a last_update_date field in it
    • when the form is created the last_update_date for the record is stored in a hidden input field
    • when the form is POSTED the server checks the last_update_date in the database against the date in the hidden input field.
    • If they match, then no one else has changed the record since the form was created so the system updates the data.
    • If they don't match, then someone else has changed the record since the form was created. The system sends the user back to the form edit page and tells the user that someone else edited the record and they must reapply their changes.

    It is very simple and works well enough.

提交回复
热议问题