Miscellaneous Functions MySQL Tutorial

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>