note 19394 added to function.mysql-query
| From: | colin at no dot spam dot wew dot co dot uk | Date: | Tue, 26 Feb 2002 13:39:09 +0000 |
| Subject: | note 19394 added to function.mysql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27063@lists.php.net to get a copy of this message | ||
IIRC, 'LOCK TABLES a b c' query blocks (does not return) until the locks are secured,
after it returns, the lock can be released:
when another LOCK TABLES is issued by the same thread
when UNLOCK TABLES is issued by the same thread
when the thread terminates
......which kind of begs the question....what happens when PHP times out waiting for
mysql_query('LOCK TABLES a b c') to return? I guess the MySQL server thread continues
until it gets the lock then finds that the connection to PHP has gone down and releases the locks.
Not very handy for the poor schmuck hanging on at the browser end tho. This would get messy with
persistent connections where the connection doesn't expire.
I suppose a safer solution might be to use discretionary locks which support a timeout option. (see
GET_LOCK() and RELEASE_LOCK() in the MySQL manual).
Anybody got more experience with this?
--
http://www.php.net/manual/en/function.mysql-query.php
http://master.php.net/manage/user-notes.php?action=edit+19394
http://master.php.net/manage/user-notes.php?action=delete+19394
http://master.php.net/manage/user-notes.php?action=reject+19394