Name

IS_FREE_LOCK()

Synopsis

IS_FREE_LOCK(string)

Use this function to determine whether the name of the lock given in parentheses is free and available as a lock name. The function returns 1 if the lock name is free, and 0 if it’s not (because it is in use by another client). The function returns NULL if there is an error. Locks are created by GET_LOCK(). This function is available as of version 4.0.2 of MySQL. Here is an example:

SELECT IS_FREE_LOCK('my_lock');

+-------------------------+
| IS_FREE_LOCK('my_lock') |
+-------------------------+
|                       0 |
+-------------------------+

The results here indicate that the lock is not free.

Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.