Re: Re[2]: Table locking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <001701c46a5a$48dfbd80$a03baed4@tasarimxp>, Emre Erdogan wrote:
> Hi...
> 
> I want to say some words about the "Table Locking" problem.
> 
> I had a problem something like this one, I find solution for this by locking
> only the item that will updated. I added two areas one that has a value 0 or
> 1 giving it is currently used by someone, and second time it is started to
> use, default 0. When someone trying to update the item, first area has the
> value 1 and the second has the current time. After update completes, ifrst
> has the value 0, and second also 0.

I think one row will satisfy, namele a timestamp last_update.

If you generate a form for the user to update the values of the current
record, just add the timestamp as a hidden value. If the user submits
the updated values compare the submitted last_update with the value in
the database. If they are equal, perform the update (and change the
value for last_update). If they are not equal, somebody else has changed 
the values in the meantime and the update should not be executed.

If you are looking for other synchronization techniques you should have
a look at the algorithms by Dekker and Peterson etc... Every website on
computer algorithms will know how they work...

-- 
Tim Van Wassenhove <http://home.mysth.be/~timvw>

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux