Lists all users who are connected to a specific application and database, together with a count of data blocks which they currently have locked. Similar to EssListLocks, but includes users hosted in a user directory.
Syntax
ESS_FUNC_M EssListLocksEx (hCtx, AppName, DbName, pCount, ppLockList);
Parameter | Data Type | Description |
---|---|---|
hCtx | ESS_HCTX_T | API context handle (input). |
AppName | ESS_STR_T | Application name (input). |
DbName | ESS_STR_T | Database name (input). |
pCount | ESS_PUSHORT_T | Address of variable to receive the user count (output). |
ppLockList | ESS_PPLOCKINFOEX_T | Address of pointer to receive an allocated array of user lock information structures (output). The information structures can include user directories and unique identity attributes. |
Notes
This function is a "snapshot", in that only those users who are connected to the server when this function is called will be listed.
The memory allocated for ppLockList should be freed using EssFree().
Return Value
If successful, returns a count of the number of connected users in pCount, and list of user lock structures in ppLockList.
Access
This function requires the caller to have database Design privilege (ESS_PRIV_DBDESIGN) for the specified database.
Example
void DisplayLock(ESS_LOCKINFOEX_T lockinfo) { ESS_STS_T sts = ESS_STS_NOERR; printf("\tUser Name: %s\n", lockinfo.UserName); printf("\tProvider Name: %s\n", lockinfo.ProviderName); printf("\tConnection Parameter: %s\n", lockinfo.connparam); printf("\tNumber of Locks: %d\n", lockinfo.nLocks); printf("\tTime: %ld\n", lockinfo.Time); printf("\tLoginId: %ld\n", lockinfo.LoginId); printf("\n"); } ESS_FUNC_M ESS_ListLocksEx (ESS_HCTX_T hCtx, ESS_HINST_T hInst) { ESS_STS_T sts; ESS_USHORT_T count, i; ESS_PLOCKINFOEX_T plockinfo = NULL; ESS_ACCESS_T Access; sts = EssSetActive(hCtx, AppName, DbName, &Access); printf("EssSetActive sts: %ld\n",sts); sts = EssListLocksEx (hCtx, AppName, DbName, &count, &plockinfo); printf("EssListLocksEx sts: %ld\n", sts); if(!sts) { printf("\nNumber of lock info returned: %d\n", count); for(i = 0; i < count; i++) { DisplayLock(plockinfo[i]); } } return (sts); }
See Also