Nulls
Nulls appear in the flattened rowset in two different situations:
-
In the flattened dataset of “A More Complex Example” in this chapter, column 2 of rows 4 and 5 contained NULL. This indicates that this member is not present on the axis. Looking back at the dataset, one can see that “Months” for Qtr3 and Qtr4 are not on the axis.
-
When a cell is empty. The flattened dataset of “Example Using DIMENSION PROPERTIES” has NULLs in the last column of the first row. This is because Venkatrao did not have any sales of Microsoft Excel in USA for the first quarter of 1991. The corresponding cell in the dataset is empty.
When a consumer calls IRowset::GetData, DBSTATUS_ISNULL is returned. DBSTATUS_ISNULL is one of the status codes defined in OLE DB. An application allocates a buffer, and for each column it wants, it has space to hold:
-
The actual data value (called the VALUE part).
-
The status after fetch, such as NULL indication or truncation indication (called the STATUS part).
-
The number of bytes of data fetched for variable-length data (called the LENGTH part).
DBSTATUS_ISNULL is written into the STATUS part of the consumer’s buffer. When this status occurs, the VALUE part is meaningless.