LockObject

The LockObject method of the MDStore interface locks an object to prevent actions of multiple users of the object from colliding.

Applies To
clsCube clsPartition
clsDatabase  

Syntax

object.LockObject(LockType, LockDescription)

object
The object to lock.
LockType
One of the lock types of the OlapLockTypes enumeration.
LockDescription
A string containing a description of the lock, available to other applications attempting to obtain a lock.
Remarks

There are four types of locks defined by the OlapLockTypes enumeration: olapLockExtendedRead, olapLockProcess, olapLockRead, and olapLockWrite.

olapLockExtendedRead
The object’s properties can be read by other applications, but cannot be changed or processed. This lock is used to prevent processing of dependent objects of an object that is being processed, such as dimensions that are shared by multiple cubes. Multiple olapLockExtendedRead locks may be applied to an object by multiple applications. However, no application can lock the object for processing or updating until all olapLockExtendedRead locks have been released.
olapLockProcess
The object’s Process method can be initiated, and other applications can only read the object’s properties only until the lock is released. Only one olapLockProcess lock can be applied to an object at a time, and other applications can apply olapLockRead locks only while the olapLockProcess lock is in place.
olapLockRead
The properties of the object can be read from the repository and cannot be changed by another application until the lock is released. Other applications can issue olapLockRead, olapLockExtendedRead, and olapLockProcess locks, but not olapLockWrite locks, while the initial olapLockRead lock is in place.
olapLockWrite
The properties of the object can be modified in the repository using the Update method, and are not available to other applications for any use until the lock is released. No other locks of any type can be applied to the object until the olapLockWrite lock is released.

When two applications (App1 and App2) are accessing the same object, the following table defines the actions available to App2 depending on the lock type obtained by App1.

  App2 can obtain lock    
App1 lock obtained
olapLockRead
olapLock
ExtendedRead
olapLock
Process

olapLockWrite
olapLockRead Yes Yes Yes No
olapLock
ExtendedRead
Yes Yes No No
olapLock
Process
Yes No No No
olapLockWrite No No No No

See Also
About Decision Support Objects Using Decision Support Objects
UnlockObject Methods Cross-Reference

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.