Compartilhar via


MDStore Interface

ObservaçãoObservação

  Esse recurso será removido na próxima versão do Microsoft SQL Server. Não utilize esse recurso em desenvolvimentos novos e modifique, assim que possível, os aplicativos que atualmente o utilizam.

The MDStore interface is implemented by objects in Decision Support Objects (DSO) that contain multidimensional data. The following table describes these objects.

Object

Description

Database

An object that represents a database on the Analysis server. Databases contain cubes, dimensions, mining models, and roles.

Cube

An object that represents a cube on the Analysis server. Cubes contain dimensions, measures, and commands.

Partition

An object that represents the physical storage for the data in a cube. Partitions contain dimensions, measures, and aggregations.

Aggregation

An object that represents the tables of aggregated (that is, precalculated) data in a cube. Aggregations contain dimensions, measures, and member properties.

Although all of these objects implement their own internal interfaces, the MDStore interface is the primary interface to be used when using these objects. To differentiate between the objects implementing the MDStore interface, the ClassType property is used. The following table lists the objects implementing the MDStore interface and associated ClassType property values.

Object

Class type

Database

clsDatabase

Cube

clsCube

Partition

clsPartition

Aggregation

clsAggregation

The relationships among these objects are maintained through hierarchical linkages using the MDStores collections of each of these objects and the server object. The MDStores collection of a server object contains database objects. Database objects contain cube objects. Cubes contain partitions, and partitions contain aggregations. Together, the MDStore interface and the MDStores collections establish and maintain the hierarchy that defines the structure of OLAP data.

The MDStore interface provides collections, methods, and properties to manipulate these objects, their contained objects, and data. The four objects that implement the MDStore interface do not necessarily implement all of the MDStores collections, properties, and methods. For example, only objects of ClassType clsDatabase have MiningModels collections. Also, some MDStore properties and collections may be restricted to read-only access by some objects. For example, an object of ClassType clsDatabase allows read/write access to its DataSources collection, whereas access to the DataSources collection of an object of ClassType clsAggregation is read-only.

You create objects that implement the MDStore interface by declaring a variable as an MDStore data type and then creating an instance of the object and adding it to the MDStores collection of another object. The AddNew method of the MDStores collection creates the instance, sets the object's name to the name you provide, adds the object to the collection, and sets its parent property to reference the owner of the collection. At the same time, the new object's ClassType is automatically initialized to the appropriate value depending on the object's parent. For example, if you use the AddNew method to create an object in a cube's MDStores collection, the new object's ClassType will be set to clsPartition.

For more information about DSO, see Introducing Decision Support Objects and Interfaces.

Examples

The following examples walk through the hierarchy of usage for the MDStore object. First, a server object is created, which contains an MDStores collection of databases. Next, a database is created in the server's MDStores database collection. Then, a cube is created in this new database's own collection of MDStores objects. The same process continues by creating a new partition and a new aggregation using the same method. Each time, an interface (or placeholder) is defined to hold an MDStore object. Then the AddNew method of the parent object's MDStores collection is used to create the MDStore object.

A. Creating a Server Object

In this example, a new server object is created and a connection is established to a server named LocalHost:

Dim dsoServer As DSO.Server
' Create a server object and connect to an OLAP server.
Set dsoServer = New DSO.Server
dsoServer.Connect("LocalHost") 

B. Adding a Database

The following example declares an MDStore interface (dsoDB) and calls the AddNew method of the server object's MDStores collection. This creates anobject whose ClassType property is set to clsDatabase and is interacted with by means of the MDStore interface that was created for it.

Observação importanteImportante

  In MDStore  MDStore refers to an interface and a collection. The MDStore interface is created first. Because it is an interface, the Microsoft® Visual Basic® keyword new is not used when defining the variable. The MDStores collection is the server object's collection of databases (that is, MDStore objects whose ClassType property has been set to clsDatabase).

' Create and add a database to the server's MDStores collection.
Dim dsoDB As DSO.MDStore
Set dsoDB = dsoServer.MDStores.AddNew("MyDatabase")
'... additional code to set other database object properties

C. Adding a Cube

The following example creates an MDStore interface to hold the MDStore object created by the AddNew method of the database's MDStores collection. The resulting object's ClassType property is automatically set to clsCube.

' Create and add a cube to the database's MDStores collection.
Dim dsoCube As DSO.MDStore
Set dsoCube = dsoDB.MDStores.AddNew("MyCube")
'... additional code to set other cube properties

D. Adding a Partition

The following example creates an MDStore interface to hold the MDStore object created by the AddNew method of the cube's MDStores collection. The resulting object's ClassType property is automatically set to clsPartition.

' Create and add a partition to the cube's MDStores collection.
Dim dsoPart As DSO.Partition
Set dsoPart = dsoCube.MDStores.AddNew("MyPartition")
'... additional code to set other partition properties

E. Adding an Aggregation

The following example creates an MDStore interface to hold the MDStore object created by the AddNew method of the partition's MDStores collection. The resulting object's ClassType property is automatically set to clsAggregation.

' Create and add an aggregation to the partition's MDStores collection.
Dim dsoAgg As DSO.MDStore
Set dsoAgg = dsoPart.MDStores.AddNew("MyAggregation")
'... additional code to set other aggregation properties