* Thus wrote anders thoresson ([EMAIL PROTECTED]):
> set_lock($table_name, $row_id), check_lock($table_name, $row_id) and 
> release_lock($table_name, $row_id). Whenever an editor opens some content 


> for editing, check_lock() will be called to se if table_lock contains a row 
> with the same table_name and row_id. If, the content isn't loaded and the 
> editor is told that someone else is working on the content, and are asked 
> to try again later. If not, set_lock() is called to make sure that no other 
> editor opens the content before it's saved and release_lock() is called, 
> which will remove the line from table_lock again.

What happens when the user doesn't finish editing or the browser
simply crashes on him?  

If you do use this method, it needs to be atomic.  if two users
access the page at the same time they both will pass the
check_lock() function but only one will pass set_lock(), if the
database constraints are enforced.

You'd want something like:
  if (! set_lock() ) {
    // table is already locked 
  } else {
    // we have the lock
  }



Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to