On 9-Jun-08, at 5:31 AM, Dott. Christian OLIVIERI wrote:
Toby Thain ha scritto:
On 9-Jun-08, at 3:43 AM, Dott. Christian OLIVIERI wrote:
Hi, I'm a newbie and the following is my problem: I have a db
MySQL managing personal information. That I would do is: everyone
can READ single record. If someone open the record x to update/
delete no one other can do the same (edit/update) till first user
don't commit.
I was thinking Local Transaction was the answer but if user A
open a record in update then user B open the same record, B is
hanged untill timeout ends.
Which is exactly what you asked for. :)
How to alter timeout value?
It's a MySQL configuration setting (innodb_lock_wait_timeout).
--Toby
Thanks a lot.
Christian
Hi Toby tnks for your help.
I'll explain my problem:
* All user may (always) views record data form db with SELECT
statement.
* If User A wants edit/delete record xx, this must be locked for
update/delete operations. Other users can read (SELECT) always (If
dirty reading too) but they can't update/delete.
Only User A can edit/delete current record. When updated/deleted
the record will unlocked and other users can edit/delete.
Is possible change innodb_lock_wait_timeout at runtime at runtime,
or do you know a way to intercept hang status using transactions to
throw a messagebox to user to notify record locking?
OK, from your new description database-level locking isn't your
answer. Instead you can set a flag (e.g. "locked by user id") at the
application level and implement whatever user interface you need, in
your client side application.
--Toby
Tnks a lot