|
Oracle® OLAP Java API Reference 11g Release 2 (11.2) E10794-06 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Cursor
An interface for objects that provide access to the result set of a query. A query is represented by a Source
. A Cursor
communicates the query to Oracle OLAP and fetches the resulting data.
At any time, one element of a Cursor
is in the current position of the Cursor
. The getPosition
method returns the current position and the setPosition
and next
methods change the current position. The extent of a Cursor
is the total number of positions of the Cursor
.
An Source
is associated with a Transaction
. A Source
is active in the Transaction
with which it is associated or in a descendent of that Transaction
. Before an application can create a Cursor
for a Source
, the current Transaction
must be the one with which the Source
is associated or it must be a descendent of that Transaction
. For more information on transactions, see the TransactionProvider
interface.
An application creates a Cursor
for a Source
by calling the createCursor
method of a CursorManager
. The following example demonstrates creating a Cursor
for a Source
named query
.
CursorManager cursorManager = dataProvider.createCursorManager(query); Cursor cursor = cursorManager.createCursor();
An application can create more than one Cursor
from the same CursorManager
. It would do this if, for example, it wanted to display different views of the same data.
The Cursor
interface has two subinterfaces: CompoundCursor
and ValueCursor
. The type of Cursor
returned by the createCursor
method is determined by the structure of the Source
for the Cursor
. If the Source
for the Cursor
has no outputs, then the Cursor
has only one set of values and the createCursor
method returns a ValueCursor
, the elements of which have the values specified by the Source
. If the Source
has one or more outputs, then the createCursor
method returns a CompoundCursor
.
A CompoundCursor
has two or more child Cursor
objects. The children are the base ValueCursor
for the CompoundCursor
and a Cursor
object for each output of the Source
. If the output of the Source
is a Source
that itself has one or more outputs, then the child Cursor
for that output is another CompoundCursor
. If the output is a Source
that has no outputs, then the child Cursor
is a ValueCursor
. Each position of a CompoundCursor
specifies a position for each of the ValueCursor
objects in the tree of the descendents of the CompoundCursor
.
An application can affect the behavior of a Cursor
by creating a CursorSpecification
, which implements the CursorInfoSpecification
interface. An application creates a CursorInfoSpecification
with the createCursorInfoSpecification
method of a DataProvider
. With a CursorSpecification
, an application can specify whether Oracle OLAP calculates the extent of a Cursor
or the starting and ending positions of the current value of a child Cursor
in the parent Cursor
. If a CursorSpecification
specifies those calculations, then the application can retrieve information with the getExtent
, getParentStart
, or getParentEnd
methods. By subtracting the starting position of the current value of a child in the parent from the ending position of the value and adding one, you can calculate the range of positions, or span, of the value of the child Cursor
.
The extent of a child ValueCursor
in a parent CompoundCursor
is the number of positions the ValueCursor
has for the set of values specified by the other ValueCursor
descendents. For example, if a Source
defines the result set for a measure, which has only one value for any set of values of the dimensions of the measure, then the ValueCursor
that has the values of the measure has only one position for any one set of output values. The extent of that ValueCursor
is, therefore, always 1.
The fetch size of a Cursor
specifies the number of elements of the Cursor
that Oracle OLAP sends to the client application during a single fetch from the data store. If the CursorSpecification
for the Cursor
is set to specify the default fetch size, you can retrieve the fetch size by calling the getFetchSize
method. You can change the fetch size by calling the setFetchSize
method.
Some Source
objects cannot have a Cursor
. You cannot retrieve results with a Cursor
for a Source
if one of the following is true:
Source
has an input.Source
has no elements or the Source
has an input that has no elements.Source
represents all integers.Field Summary | |
---|---|
static int |
FETCH_SIZE_NOT_SPECIFIED A constant value returned by the getDefaultFetchSize method of a CursorSpecification object if the default fetch size is not specified by the CursorSpecification . |
Method Summary | |
---|---|
long |
getExtent() Gets the total number of positions of the Cursor if the CursorSpecification associated with the Cursor is set to calculate the extent. |
int |
getFetchSize() Gets the fetch size for the Cursor if the CursorSpecification for the Cursor is set to specify the fetch size. |
long |
getParentEnd() Gets the position in the parent Cursor at which the current element of the child Cursor ends if the CursorSpecification for the Cursor is set to calculate the ending position. |
long |
getParentStart() Gets the position in the parent Cursor at which the current element of the child Cursor begins if the CursorSpecification for the Cursor is set to calculate the beginning position. |
long |
getPosition() Gets the current position of the Cursor . |
SourceIdentifier |
getSource() Gets the SourceIdentifier for the Cursor . |
boolean |
next() Advances the position of the Cursor to the next element if the current position is not the last position of the Cursor . |
void |
setFetchSize(int fetchSize) Specifies the fetch size for the Cursor if the CursorSpecification for the Cursor is set to specify the fetch size. |
void |
setPosition(long position) Specifies a position to set as the current position of the Cursor . |
Field Detail |
---|
static final int FETCH_SIZE_NOT_SPECIFIED
getDefaultFetchSize
method of a CursorSpecification
object if the default fetch size is not specified by the CursorSpecification
.
Method Detail |
---|
SourceIdentifier getSource()
SourceIdentifier
for the Cursor
.SourceIdentifier
for the Cursor
.long getPosition()
Cursor
.Cursor
.void setPosition(long position) throws PositionOutOfBoundsException
Cursor
.position
- The position to set as the current position of the Cursor
.PositionOutOfBoundsException
- Indicates that the specified position is not valid.boolean next()
Cursor
to the next element if the current position is not the last position of the Cursor
.true
when the method successfully advances the position of the Cursor
and false
when it does not.long getExtent() throws NotSpecifiedException
Cursor
if the CursorSpecification
associated with the Cursor
is set to calculate the extent. The extent of a ValueCursor
that is a descendent in a CompoundCursor
is determined by the values of the other outputs.Cursor
.NotSpecifiedException
- Indicates that the CursorSpecification
does not specify calculating the extent.long getParentStart() throws NotSpecifiedException
Cursor
at which the current element of the child Cursor
begins if the CursorSpecification
for the Cursor
is set to calculate the beginning position.Cursor
at which the current element of the child Cursor
begins.NotSpecifiedException
- Indicates that the CursorSpecification
does not specify calculating the beginning position.long getParentEnd() throws NotSpecifiedException
Cursor
at which the current element of the child Cursor
ends if the CursorSpecification
for the Cursor
is set to calculate the ending position.Cursor
at which the current element of the child Cursor
ends.NotSpecifiedException
- Indicates that the CursorSpecification
does not specify calculating the ending position.int getFetchSize() throws NotSpecifiedException
Cursor
if the CursorSpecification
for the Cursor
is set to specify the fetch size.Cursor
.NotSpecifiedException
void setFetchSize(int fetchSize) throws NotSpecifiedException
Cursor
if the CursorSpecification
for the Cursor
is set to specify the fetch size.fetchSize
- The fetch size to specify for the Cursor
.NotSpecifiedException
- Indicates that the CursorSpecification
does not specify setting a fetch size.
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |