com.sas.storage.olap
Interface ResultSetInterface

All Known Subinterfaces:
OLAPDataSetInterface
All Known Implementing Classes:
GraphOLAPDataSet, OLAPDataSet, OLAPDataSet, ResultSet, ResultSet

public interface ResultSetInterface

An interface representing a multidimensional result set.

A ResultSetInterface object is often generated by executing a query on an OLAP provider. The OLAPDataSetInterface, which extends ResultSetInterface, may be used for establishing a connection and executing a query.

The ResultSetInterface provides methods for retrieving metadata and data. The metadata that is available from the ResultSetInterface is specific to the result set, and it is not the same as the metadata defining a Cube. The metadata available via the getResultSetMetadata() method defines the structure of the ResultSet. Details on this distinction between ResultSet metadata and the metadata for a Cube can be found in the documentation for the ResultSetMetadataInterface. The cells represent the data that arises at the crossing between axes. Each cell in the result set has a unique ordinal assigned to it. An algorithm is used to determine the cell ordinal; however, the algorithm that's used may be implementation specific. Both formatted and unformatted data may be available for each cell.

When an error occurs an OLAPException is thrown, which indicates the specific nature of the problem.

See Also:
ResultSetMetadataInterface

Field Summary
static int DEFAULT_END_CELL
           
static int DEFAULT_ENDCELL
          Indicates all remaining cells.
 
Method Summary
 void close()
          Close the ResultSetInterface
 long getCellCount()
          Returns the total number of cells defined in the ResultSet.
 java.lang.Object[] getCells(long startCell, long endCell)
          Returns the unformatted data slice beginning with the startCell (upper left corner ordinal) and ending with endCell (lower right corner ordinal).
 java.lang.String[] getFormattedCells(long startCell, long endCell)
          Returns the formatted data slice beginning with the startCell (upper left corner ordinal) and ending with endCell (lower right corner ordinal).
 java.lang.String getQueryStatement()
          Returns the most recent query statement.
 ResultSetMetadataInterface getResultSetMetadata()
          Returns the metadata that defines the structure of the ResultSet
 boolean isReadOnly()
          An instance of the OLAPDataSetInterface may be readOnly.
 void setCells(long startCell, long endCell, java.lang.Object[] cellValues)
          Sets the values for the cells.
 void setFormattedCells(long startCell, long endCell, java.lang.String[] cellValues)
          Sets the formatted values for the cells.
 

Field Detail

DEFAULT_ENDCELL

static final int DEFAULT_ENDCELL
Indicates all remaining cells.

See Also:
Constant Field Values

DEFAULT_END_CELL

static final int DEFAULT_END_CELL
See Also:
Constant Field Values
Method Detail

getResultSetMetadata

ResultSetMetadataInterface getResultSetMetadata()
                                                throws OLAPException
Returns the metadata that defines the structure of the ResultSet

Returns:
The ResultSetMetadata which defines the structure of the ResultSet.
Throws:
OLAPException - if a database error occurs

getQueryStatement

java.lang.String getQueryStatement()
                                   throws OLAPException
Returns the most recent query statement. This value should be used as a hint for the query that may have generated this ResultSet. It's possible that this value could be null or out of date if the ResultSet is not connected. It is also possible that this query is not in sync with the ResultSet. It could have been set, but not executed, in which case the ResultSet is not a product of this query.

Returns:
The most recent query statement.
Throws:
OLAPException - if a database error occurs

isReadOnly

boolean isReadOnly()
                   throws OLAPException
An instance of the OLAPDataSetInterface may be readOnly. Attempts to update a readOnly OLAPDataSet will result in an OLAPException being thrown.

Returns:
Indicates whether this OLAPDataSet is updateable
Throws:
OLAPException - If a database-access error occurs

getCells

java.lang.Object[] getCells(long startCell,
                            long endCell)
                            throws OLAPException
Returns the unformatted data slice beginning with the startCell (upper left corner ordinal) and ending with endCell (lower right corner ordinal). Because these parameters are used to identify the slice, not all cells between startCell and endCell are necessarily fetched. The cell ordinal can be calculated based on the crossing of tuple coordinates. There are utility methods available in OLAPUtil for making these calculations and details as to how they are calculated.

Parameters:
startCell - A zero-based ordinal position for the starting cell.
endCell - A zero-based ordinal position for the ending cell where DEFAULT_ENDCELL can be used to indicate all remaining cells
Returns:
The data in its raw format.
Throws:
OLAPException - if a database error occurs

getFormattedCells

java.lang.String[] getFormattedCells(long startCell,
                                     long endCell)
                                     throws OLAPException
Returns the formatted data slice beginning with the startCell (upper left corner ordinal) and ending with endCell (lower right corner ordinal). Because these parameters are used to identify the slice, not all cells between startCell and endCell are necessarily fetched. The cell ordinal can be calculated based on the crossing of tuple coordinates. There are utility methods available in OLAPUtil for making these calculations and details as to how they are calculated.

Parameters:
startCell - A zero-based ordinal position for the starting cell.
endCell - A zero-based ordinal position for the ending cell where DEFAULT_ENDCELL can be used to indicate all remaining cells
Returns:
The formatted data.
Throws:
OLAPException - if a database error occurs

getCellCount

long getCellCount()
                  throws OLAPException
Returns the total number of cells defined in the ResultSet.

Returns:
The total number of cells defined in the ResultSet.
Throws:
OLAPException - if a database error occurs

setCells

void setCells(long startCell,
              long endCell,
              java.lang.Object[] cellValues)
              throws OLAPException
Sets the values for the cells. This ResultSet may not be updateable. An OLAPException will be thrown if updates cannot be made.

Parameters:
startCell - A zero-based ordinal position for the starting cell.
endCell - A zero-based ordinal position for the ending cell.
cellValues - Sets the values for the cells.
Throws:
OLAPException - if a database error occurs

setFormattedCells

void setFormattedCells(long startCell,
                       long endCell,
                       java.lang.String[] cellValues)
                       throws OLAPException
Sets the formatted values for the cells. This ResultSet may not be updateable. An OLAPException will be thrown if updates cannot be made.

Parameters:
startCell - A zero-based ordinal position for the starting cell.
endCell - A zero-based ordinal position for the ending cell.
cellValues - Sets the formatted values for the cells.
Throws:
OLAPException - if a database error occurs

close

void close()
           throws OLAPException
Close the ResultSetInterface

Throws:
OLAPException - if a database error occurs



Copyright © 2009 SAS Institute Inc. All Rights Reserved.