RELEASE_LOCK()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns a boolean to indicate if a named user-level lock was released.
USAGE
RELEASE_LOCK(name)
Argument Name | Description |
---|---|
| The string expression for the user-level lock name |
DETAILS
RELEASE_LOCK()
is a locking function that returns a boolean (1
or 0
) to indicate if a named user-level lock was released.
The lock names are determined by the user, and can be used in any desired programming logic.
In addition to being explicitly released, a lock is also implicitly released when the session that locked it is closed. See GET_
A NULL
is returned if the named user lock does not exist (a lock only exists when locked).
If the lock is not held by the current user, nothing is done and a 0
is returned.
An error is returned if the lock name is NULL
.
EXAMPLES
SELECT GET_LOCK('my-lock', 10);
+-------------------------+
| GET_LOCK('my-lock', 10) |
+-------------------------+
| 1 |
+-------------------------+
SELECT RELEASE_LOCK('my-lock');
+-------------------------+
| RELEASE_LOCK('my-lock') |
+-------------------------+
| 1 |
+-------------------------+
SELECT RELEASE_LOCK('my-lock');
+-------------------------+
| RELEASE_LOCK('my-lock') |
+-------------------------+
| NULL |
+-------------------------+