Removes all data block locks on a database which are currently held by a user.
Syntax
ESS_FUNC_M EssRemoveLocks (hCtx, AppName, DbName, LoginId);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | API context handle. |
AppName | ESS_STR_T | Application name. |
DbName | ESS_STR_T | Database name. |
LoginId | ESS_LOGINID_T | Id of user login whose locks are to be removed. |
Notes
The required LoginId can be obtained from the user lock info structure returned by the EssListLocks function.
EssRemoveLocks() terminates the connection of the user specified by LoginId if that user is currently logged in.
Return Value
None.
Access
This function requires the caller to have database Design privilege (ESS_PRIV_DBDESIGN) for the specified database.
Example
ESS_FUNC_M ESS_RemoveLocks (ESS_HCTX_T hCtx, ESS_HINST_T hInst ) { ESS_FUNC_M sts = ESS_STS_NOERR; ESS_USHORT_T Count; ESS_PLOCKINFO_T plockinfo = NULL; ESS_PLOCKINFO_T plinfo; ESS_USHORT_T ind; ESS_SHORT_T Item; ESS_STR_T AppName; ESS_STR_T DbName; AppName = "Sample"; DbName = "Basic"; for (ind = 0; ind < Count; ind++) { plinfo = plockinfo + ind; printf ("%-2d %-15s %-12ld %-5d %ld\r\n", ind, plinfo->UserName, plinfo->LoginId, plinfo->nLocks, plinfo->Time); } printf ("\r\n"); /*********************************** * Chooser Lock List Item to Remove * ************************************/ Item = 1; } else { printf ("\r\nExclusive Lock List on %s:%s is empty\r\n\r\n", AppName, DbName); goto exit; } if (!sts) { if ((Item >= 0) && (Item < Count)) { plinfo = plockinfo + Item; sts = EssRemoveLocks (hCtx, AppName, DbName, plinfo->LoginId); } } exit: if (plockinfo) EssFree (hInst, plockinfo); return (sts); }
See Also