LockObject (Dimension Interface)

Analysis Services Programming

Analysis Services Programming

LockObject (Dimension Interface)

The LockObject method of the Dimension interface locks an object to prevent multiple users from concurrently changing the object.

Applies To

clsDatabaseDimension

Syntax

object.LockObject(ByVal LockType As OlapLockTypes, ByVal LockDescription As String)

object

The Dimension object to lock.

LockType

One of the enumerated constants of the OlapLockTypes enumeration. For more information, see OlapLockTypes.

LockDescription

A string containing the description of the lock, available to other applications attempting to obtain a lock.

Remarks

This table explains how each value that can be specified in LockType affects a lock made on a dimension object.

Lock type Description
OlapLockRead Applications can read the properties of the dimension object from the repository but cannot make changes until the lock is released (this includes the application that created the lock). This lock does not affect dependent objects of the dimension (data source objects).
OlapLockWrite The application that created the lock can modify the dimension object's properties and save them in the repository using the Update method. Other applications cannot read the properties of the object until the lock is released.
OlapLockExtendedRead The properties of the dimension object and all of its dependent objects can be read (but not changed or processed) by other applications until the lock is released. This lock is used to prevent processing of dependent objects of a locked object (for example, dimensions that are shared by multiple cubes).
OlapLockProcess This lock is similar to olapLockExtendedRead, except the dimension object's Process method can be called by the application that created the lock. Other applications can read (but cannot change) the object's properties while the lock is in effect.
Example

The following example locks the Product dimension of the FoodMart 2000 database, completely reprocesses it, and then unlocks it so others can make changes:

    Dim dsoServer As New DSO.Server
    Dim dsoDB As DSO.MDStore
    Dim dsoDim As DSO.Dimension
    
    ' Connect to local Analysis server.
    dsoServer.Connect "LocalHost"
    
    ' Open FoodMart 2000 database.
    Set dsoDB = dsoServer.MDStores("FoodMart 2000")

    ' Open the Product dimension.
    Set dsoDim = dsoDB.Dimensions("Product")
    
    ' Lock the dimension for processing.
    dsoDim.LockObject olapLockProcess, "Locked for processing."
    
    ' Completely reprocess the dimension.
    dsoDim.Process processFull
    
    ' Once complete, unlock the dimension.
    dsoDim.UnlockObject
    
    ' Clean up.
    Set dsoDim = Nothing
    Set dsoDB = Nothing
    dsoServer.CloseServer
    Set dsoServer = Nothing

See Also

UnlockObject