IS_FREE_LOCK( )

Use this MySQL function to determine whether the name of the lock given in parentheses is free and available as a lock name.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

IS_FREE_LOCK(string)

Explanation

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; 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.

Examples

SELECT IS_FREE_LOCK('my_lock');

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

The results here indicate that the lock is not free.