Condividi tramite


Range Rowsets

In a range rowset, each row corresponds to a cell in the dataset. Each selected cell property appears as a column in this rowset. The range rowset can be created from the dataset by calling IMDRangeRowset::GetRangeRowset. The range rowset does not have to contain all the cells of the dataset. A subset of cells may be chosen in a manner similar to that used in IMDDataset::GetCellData. IMDRangeRowset is an optional interface on the dataset object. For information about how to determine whether or not the range rowset is supported by the provider, see Data Source Property MDPROP_RANGEROWSET.

Consider the dataset in the SalesData example. The call shown in the following syntax returns the rowset shown in the table, assuming that the default properties VALUE, FORMATTED_VALUE, and CELL_ORDINAL were selected:

IMDRangeRowset::GetRangeRowset(NULL, 1, 19, cProperties, rgPropertySets,
                               &pIRowsetChange);

Note

The quotation marks around values in the FORMATTED_VALUE column in the table are there as a visual aid to indicate that the values are strings. The provider does not return the quotes.

VALUE

FORMATTED_VALUE

CELL_ORDINAL

10

"10"

1

20

"20"

2

30

"30"

3

11

"11"

9

21

"21"

10

31

"31"

11

12

"12"

17

22

"22"

18

32

"32"

19

The primary uses of the range rowset are as follows:

  • Remoting ? Working with a dataset remotely consists of remoting three elements of the dataset: the axis rowsets, the MDAXISINFO structures associated with each axis, and the range rowset. The advantage for the provider of remoting a rowset is that it follows the typical OLE DB conventions of rowset manipulation.

  • Updating ? Because the range rowset specifies the location and data of the selected cells of a cube, updating the cells of a cube is the same as updating the range rowset. For more information about this process, see Working with Cell Data.

The following rules govern the structure of the range rowset:

  1. The columns in the range rowset are ordered according to the following conditions:

    • If the MDX statement that created the dataset had a CELL PROPERTIES clause, the columns appear in the order specified in that clause. Otherwise, the columns are VALUE, FORMATTED_VALUE, and CELL_PROPERTIES, in that order. In the case where the MDX statement has a property specified multiple times in the CELL PROPERTIES clause (for example, CELL PROPERTIES CELL_ORDINAL, VALUE, FORMATTED_VALUE, and VALUE), the results are provider-specific.

    • What happens in either of the following cases is provider-specific: Either the MDX statement has CELL_ORDINAL specified in the CELL PROPERTIES clause, but not as the first property (for example, CELL PROPERTIES VALUE, CELL_ORDINAL), or the MDX statement has a property specified multiple times in the CELL PROPERTIES clause (for example, CELL PROPERTIES CELL_ORDINAL, VALUE, FORMATTED_VALUE, VALUE).

  2. The CELL_ORDINAL column is always read-only.

  3. The other columns may or may not be read-only, based on provider-defined conditions. If the range rowset can be updated (that is, if it supports the IRowsetChange interface), usually at least one column, frequently the VALUE column, can be updated. Providers usually support the updating of other columns as well. To determine whether a column can be updated, consumers must check dwFlags in the DBCOLUMNSINFO structure for the column.

  4. The rows in the range rowset are ordered by CELL_ORDINAL column.