note 19394 rejected from function.mysql-query by zak
| From: | zak@php.net | Date: | Tue, 26 Feb 2002 18:50:11 +0000 |
| Subject: | note 19394 rejected from function.mysql-query by zak | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-27076@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?