# EsbRemoveLocks

Description

EsbRemoveLocks() removes all data block locks on a Database which are currently held by a user.

Syntax

    EsbRemoveLocks (hCtx, AppName, DbName, LoginId)

    ByVal hCtx    As Long
    ByVal AppName As String
    ByVal DbName  As String
    ByVal LoginId As Long

Parameters

hCtx | Essbase VB API context handle.
AppName | Application name.
DbName | Database name.
LoginId | id of user login whose locks are to be removed.

Return Value

None.

Notes

- The required LoginId can be obtained from the user lock info structure returned by the EsbListLocks() function.
- EssRemoveLocks() terminates the connection of the user specified by LoginId if that user is currently logged in.

Access

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

Example

    Declare Function EsbRemoveLocks Lib "ESBAPIW" (ByVal hCtx As Long, ByVal AppName As String, ByVal DbName As String, ByVal LoginId As Long) As Long

    Sub ESB_RemoveLocks ()
       Dim Items As Integer
       Dim AppName As String
       Dim DbName As String
       Dim LockInfo As ESB_LOCKINFO_T
       Dim sts As Long

       AppName = "Sample"
       DbName = "Basic"
       '***********
       ' List Locks
       '***********
       sts = EsbListLocks (hCtx, AppName, DbName,
             Items)
       '*****************
       ' Remove all locks
       '*****************
       For n = 1 To Items
         '*******************************
         ' Get next user lock structure
         ' from the list and remove locks
         '*******************************
         sts = EsbGetNextItem (hCtx,
               ESB_LOCKINFO_TYPE, LockInfo)
         sts = EsbRemoveLocks (hCtx, AppName,
               DbName, LockInfo.LoginId)
       Next
    End Sub

See Also

EsbListLocks()