Purpose
This function releases a named lock (a lock named str) obtained by using the GET_LOCK() function in the current session.
Syntax
RELEASE_LOCK('str')
Purpose
Parameters
str: the name of the lock to be released. Type of string.
Return value
- Return 1: the lock is released from the current session.
- 0: The current session does not hold the lock, and the lock has not been released by the current session.
- Returns
NULL: indicates that the lock does not exist. This can occur when the lock was never acquired by usingGET_LOCK()or when it was released previously.
Examples
Releases the lock named my_lock.
obclient [(none)]> SELECT RELEASE_LOCK('my_lock');
The results are as follows:
+-------------------------+
| RELEASE_LOCK('my_lock') |
+-------------------------+
| 0 |
+-------------------------+
1 row in set
When the procedure returns 0, it means that the current session is not the holder of the my_lock lock, and the current session did not release the lock.
