# EssListLocks

Description

EssListLocks() lists all users who are connected to a specific application and database, together with a count of data blocks which they currently have locked.

Syntax

    ESS_FUNC_M EssListLocks (hCtx, AppName, DbName, pCount, ppLockList);

ESS_HCTX_T | hCtx
ESS_STR_T | AppName
ESS_STR_T | DbName
ESS_PUSHORT_T | pCount
ESS_PPLOCKINFO_T | ppLockList

Parameters

hCtx | Essbase API context handle.
AppName | Application name.
DbName | databasename.
pCount | Address of variable to receive count of users.
ppLockList | Address of pointer to receive an allocated array of user lock info structures.

Return Value

If successful, returns a count of the number of connected users in pCount, and list of user lock structures in ppLockList.

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().

Access

This function requires the caller to have database Design privilege (ESS_PRIV_DBDESIGN) for the specified database.

Example

    ESS_FUNC_M
    ESS_ListLocks (ESS_HCTX_T   hCtx,
                   ESS_HINST_T  hInst
                  )
    {
       ESS_FUNC_M          sts;
       ESS_USHORT_T     Count;
       ESS_PLOCKINFO_T  plockinfo = NULL;
       ESS_STR_T        AppName;
       ESS_STR_T        DbName;
       AppName = "Sample";
       DbName  = "Basic";
       sts = EssListLocks (hCtx, AppName, DbName,
             &Count, &plockinfo);
       if (!sts)
       {
          if (Count && plockinfo)
             EssFree (hInst, plockinfo);
          else
             printf ("\r\nExclusive Lock List on %s:%s is empty\r\n\r\n", AppName, DbName);
       }
       return (sts);
    }

See Also

EssListConnections()
EssListUsers()
EssRemoveLocks()