| Oracle9i OLAP Services Developer's Guide to the Oracle OLAP API Release 1 (9.0.1) Part Number A88756-01 |
|
Understanding Cursor Classes and Concepts, 3 of 9
The Oracle OLAP API defines the following three interfaces in the oracle.olapi.data.cursor package:
The following figure shows the class hierarchy of the Cursor classes. The CompoundCursor and ValueCursor interfaces extend the Cursor interface.
The structure of a Cursor mirrors the structure of its Source. If the Source does not have any outputs, the Cursor for that Source is a ValueCursor. If the Source has one or more outputs, the Cursor for that Source is a CompoundCursor. A CompoundCursor has as children a base ValueCursor, which has the values of the base of the Source of the CompoundCursor, and one or more output Cursor objects.
The output of a Source is another Source. An output Source can itself have outputs. The child Cursor for an output of a Source is a ValueCursor if the output Source does not have any outputs and a CompoundCursor if it does.
For example, suppose you have created a derived Source called productSel that represents a selection of product identification values from a primary Source that represents values from a dimension of products. You have selected 815, 1050, and 2055 as the values for productSel. If you create a Cursor for productSel, then that Cursor is a ValueCursor because productSel has no outputs.
You have also created a derived Source called timeSel that represents a selection of day values from a primary Source that represents a dimension of time values. The values of timeSel are 1-JAN-00, 1-APR-00, 1-JUL-00, and 1-OCT-00.
You have an MdmMeasure that represents values for the price of product units. The MdmMeasure has as inputs the MdmDimension objects representing products and times. You get a Source called unitPrice from the measure. The Source has products and times as inputs.
You join productSel and timeSel to unitPrice to create a Source, unitPriceByDay, which has productSel and timeSel as outputs, as in the following:
unitPriceByDay=unitPrice.join(productSel).join(timeSel);
The result set defined by unitPriceByDay is unit price values organized by the outputs. Since timeSel is joined to the result of unitPrice.join(productSel), timeSel is the slower varying output, which means that the result set specifies the set of selected products for each selected time value. For each time value the result set has three product values so the product values vary faster than the time values. The values of the base ValueCursor of unitPriceByDay are the fastest varying of all, because there is one price value for each product for each day.
You then create a Cursor, queryCursor, for unitPriceByDay. Since unitPriceByDay has outputs, queryCursor is a CompoundCursor. The base ValueCursor of queryCursor has values from unitPrice, which is the base Source of the operation that created unitPriceByDay. The outputs for queryCursor are a ValueCursor that has values from productSel and a ValueCursor that has values from timeSel.
The following figure illustrates the structure of queryCursor. The top box represents queryCursor, which is the parent CompoundCursor. The bottom row of three boxes represents the three children of queryCursor, which are the base ValueCursor and the two output ValueCursor objects.
The following table displays the values from queryCursor in a table. The left column has time values, the middle column has product values, and the right column has the unit price of the specified product on the specified day.
For examples of getting the values from a ValueCursor, see Chapter 9.
The CursorSpecification objects of a CursorManagerSpecification specify some aspects of the behavior of their corresponding Cursor objects. You must specify the behavior on a CursorSpecification before creating the corresponding Cursor. If you have specified the behavior, you can successfully use the following Cursor methods:
Before you can use the Cursor methods listed above, you must specify the behavior by calling the following CursorSpecification methods:
setDefaultFetchSize
setExtentCalculationSpecified
setParentEndCalculationSpecified
setParentStartCalculationSpecified
specifyDefaultFetchSizeOnChildren CompoundCursorSpecification only)
A CursorSpecification also has methods you can use to discover if the behavior is specified. Those methods are the following:
For examples of specifying Cursor behavior, see Chapter 9. For information on fetch sizes, see "What is the fetch size of a Cursor?". For information on the extent of a Cursor, see "What is the extent of a Cursor?". For information on the starting and ending positions in a parent Cursor of the current value of a Cursor, see "About the parent starting and ending positions in a Cursor".
All Cursor objects have the following methods:
In addition to the methods inherited from Cursor, a CompoundCursor has the following methods:
|
Method |
Return Value |
|---|---|
|
|
A |
|
|
The base |
In addition to the methods inherited from Cursor, a ValueCursor has the following methods:
|
|
![]() Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|