Delen via


LockObject (Dimension Interface)

Note

  This feature will be removed in the next version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible.

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)

Remarks

  • 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