MySQL Tutorial/Miscellaneous Functions/GET LOCK

Материал из SQL эксперт
Перейти к: навигация, поиск

GET_LOCK(str,timeout)

mysql>
mysql> SELECT GET_LOCK("lock1",10);
+----------------------+
| GET_LOCK("lock1",10) |
+----------------------+
|                    1 |
+----------------------+
1 row in set (0.00 sec)
mysql> SELECT IS_FREE_LOCK("lock2");
+-----------------------+
| IS_FREE_LOCK("lock2") |
+-----------------------+
|                     1 |
+-----------------------+
1 row in set (0.00 sec)
mysql> SELECT GET_LOCK("lock2",10);
+----------------------+
| GET_LOCK("lock2",10) |
+----------------------+
|                    1 |
+----------------------+
1 row in set (0.01 sec)
mysql> SELECT RELEASE_LOCK("lock2");
+-----------------------+
| RELEASE_LOCK("lock2") |
+-----------------------+
|                     1 |
+-----------------------+
1 row in set (0.00 sec)
mysql> SELECT RELEASE_LOCK("lock1");
+-----------------------+
| RELEASE_LOCK("lock1") |
+-----------------------+
|                  NULL |
+-----------------------+
1 row in set (0.00 sec)
mysql>