Collections:
IS_USED_LOCK() - Checking Lock Owner
How to check the owner of a user defined lock using the IS_USED_LOCK() function?
✍: FYIcenter.com
IS_USED_LOCK(lock) is a MySQL built-in function that returns the connection id the lock associated with if the lock is in use, NULL otherwise. For example:
SELECT GET_LOCK('MyLock', 60), IS_USED_LOCK('MyLock'); -- +------------------------+------------------------+ -- | GET_LOCK('MyLock', 60) | IS_USED_LOCK('MyLock') | -- +------------------------+------------------------+ -- | 1 | 307 | -- +------------------------+------------------------+ SELECT RELEASE_LOCK('MyLock'), IS_USED_LOCK('MyLock'); -- +------------------------+------------------------+ -- | RELEASE_LOCK('MyLock') | IS_USED_LOCK('MyLock') | -- +------------------------+------------------------+ -- | 1 | NULL | -- +------------------------+------------------------+
Reference information of the IS_USED_LOCK() function:
IS_USED_LOCK(lock): boolean Returns the connection id the lock associated with if the lock is in use, NULL otherwise. Arguments, return value and availability: lock: Required. The lock name to be examined. boolean: Return value. Connection id the lock associated with if the lock is in use, NULL otherwise. Available since MySQL 4.
⇒ ISNULL() - Detecting NULL Value
⇐ IS_IPV6() - Detecting IPv6 Address
2023-12-20, 248🔥, 0💬
Popular Posts:
How To Break Query Output into Pages in MySQL? If you have a query that returns hundreds of rows, an...
How To Turn on mysql Extension on the PHP Engine in MySQL? The "mysql" API extension is provided as ...
How To Get a List of All Tables with "sys.tables" View in SQL Server? If you want to see the table y...
How to run Queries with SQL Server Management Studio Express in SQL Server? 1. Launch and connect SQ...
What is dba.FYIcenter.com Website about? dba.FYIcenter.com is a Website for DBAs (database administr...