LockObject (Dimension Interface)

[!附註]

  下一版的 Microsoft SQL Server 將不再提供此功能。請勿在新的開發工作中使用此功能,並且儘速修改使用此功能的應用程式。

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

Applies To:clsDatabaseDimension

語法

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.

備註

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.

範例

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