clsCube
Nota
Esta característica se quitará en la versión siguiente de Microsoft SQL Server. No utilice esta característica en nuevos trabajos de desarrollo y modifique lo antes posible las aplicaciones que actualmente la utilizan.
An object of ClassType clsCube provides an implementation of the MDStore interface of the Decision Support Objects (DSO) library specific to cubes. Each instance of clsCube provides collections, methods, and properties through the MDStore interface.
Ejemplo
Use the following code to create a cube object (that is, an object of ClassType clsCube):
' Assume an object (dsoServer) of ClassType clsServer exists
' and contains a database in its MDStores collection
Dim dsoDB As DSO.MDStore ' Create an interface for the database.
Dim dsoCube As DSO.MDStore ' Create an interface for the cube.
' Assign the database interface to the first database
' in the server's collection of databases.
Set dsoDB = dsoServer.MDStores(1)
' Next, create the new cube by using the AddNew method
' of the database object's MDStores collection of cubes.
Set myCube = dsoDB.MDStores.AddNew("MyCube")
'Set properties and add dimensions, levels, and measures
' . . .
' Next, create a virtual cube.
Dim dsoVCube as DSO.MDStore ' Create an interface for the virtual cube.
' Use the AddNew method of the MDStores collection,
' just as before, but specify that the cube is virtual
' using the SubClassType argument sbclsVirtual.
Set dsoVCube = dsoDB.MDStores.AddNew("MyVCube", sbclsVirtual)
'Add measures, set properties, and add dimensions
Use the following code to create a linked cube. This procedure must involve two different servers. Attempting to create a link to a cube on the same server results in an error.
Dim dsoServer As New DSO.Server
Dim dsoDB As DSO.MDStore ' Create an interface for the database.
Dim dsoLCube As DSO.MDStore ' Create an interface for the linked cube.
Dim dsoLDS As DSO.DataSource
' Connect to the server
dsoServer.Connect "localhost"
' Get a reference for the database that
' will contain the linked cube.
Set dsoDB = dsoServer.MDStores("FoodMart")
' Create a new data source for the linked cube.
Set dsoLDS = dsoDB.DataSources.AddNew("Linked Cube")
' Set the connection string, so that the data source points
' to an Analysis server running SQL Server 2000 Analysis Services.
dsoLDS.ConnectionString = "Provider=MSOLAP;Data Source=servername; _
Initial Catalog=Foodmart;"
' Save this data source in the repository.
dsoLDS.Update
' Create a new cube on the local server, mark it as linked.
Set dsoLCube = dsoDB.MDStores.AddNew("Linked Sales", sbclsLinked)
' Add dsoLDS to the DataSources collection of the linked cube.
dsoLCube.DataSources.Add dsoLDS
' Use the name of the published cube as the
' source table for the subscribed cube.
dsoLCube.SourceTable = """" & "Sales" & """"
' Update the cube.
dsoLCube.Update
' Completely process the linked cube.
dsoLCube.Process processFull
Virtual Cubes
A cube object with a SubClassType of sbclsVirtual is a virtual cube. A virtual cubeis used to encapsulate a subset of the measures, dimensions, and levels contained in a group of cubes. A virtual cube, like a view in a relational database, is a logical construct that contains no data. Just as a view joins multiple relations, a virtual cube joins multiple cubes.
The basic method for managing virtual cubes is to add them to a database with the SubClassType parameter set to sbclsVirtual. Then, you can add dimensions and measures to them as needed. However, the dimensions and measures are derived from previously defined cubes within the database, rather than from a dimension table. Any levels associated with a dimension that has been added to a virtual cube automatically apply to the dimension in the virtual cube. Partitions and aggregations do not apply to virtual cubes.
If you add or remove a dimension or a measure from a virtual cube, you must reprocess the virtual cube so that the change will affect the Analysis server operations. The same is true if you remove a dimension or a measure from a cube after assigning it to a virtual cube, or if you remove a dimension or a measure from a database after assigning it to a cube or virtual cube.
Linked Cubes
A cube object with a SubClassType of sbclsLinked is a linked cube. The contents of a linked cube are based on another cube that is defined and stored on a different Analysis server. Unlike a virtual cube, which can contain portions of one or more cubes, a linked cube references the entire contents of a single cube.
Vea también