[ic] How to "lock" a record?

Rene Hertell interchange at hertell.com
Wed Jun 23 08:43:32 EDT 2004

> I'm developing a 5.2/foundation based catalog to allow several people to
> collaborate on order processing. The order data is stored in a mysql
> table. I'm nearly finished except for one issue. I need to be sure that
> only one person at a time is working on a given order.
> My first thought is to add a new column to the table that holds the
> order records, and have users "sign out" the records they're working on
> by entering their initials into that field.
> Does anyone have a better way or any other suggestions? Maybe there is
> an existing mechanism that addresses this problem? All suggestions are
> welcome.

I would probably set a new lock-column and a edited_by column, and add a
timestamp + the username when a user starts editing it (check the code that
is found in the UI for activating and deactivating a customer). When the
user is ready with his/her editing, then It would clear the timestamp from
the lock-column. You should then also remeber to have a cron-job that
auto-clears the lock-field if the timestamp is older that x-minutes. The
username would help the same user to return to his/her unfinished record
before the cron resets the field (if eg. browser crashese etc.)


More information about the interchange-users mailing list