com.simba.dsi.dataengine.impl
Class DSIMetadataOnlyResultSet

java.lang.Object
  extended by com.simba.dsi.dataengine.impl.DSISimpleResultSet
      extended by com.simba.dsi.dataengine.impl.DSIMetadataOnlyResultSet
All Implemented Interfaces:
IResultSet

public final class DSIMetadataOnlyResultSet
extends DSISimpleResultSet

An empty result set that contains the metadata for a SQL query that will be executed later.


Field Summary
 
Fields inherited from interface com.simba.dsi.dataengine.interfaces.IResultSet
CURSOR_POSITION_BEFORE, RETRIEVE_ALL_DATA, ROW_COUNT_UNKNOWN
 
Constructor Summary
DSIMetadataOnlyResultSet(java.util.ArrayList<? extends IColumn> columns)
          Constructor.
 
Method Summary
protected  void doCloseCursor()
          Clean up memory by closing the cursor.
protected  boolean doMoveToNextRow()
          Moves the result set's internal cursor to the next row.
 boolean getData(int column, long offset, long maxSize, DataWrapper retrievedData)
          Fills in retrievedData with the corresponding chunk of data.
 long getRowCount()
          Returns the number of rows in the result set.
 java.util.ArrayList<? extends IColumn> getSelectColumns()
          Returns an ArrayList of ColumnMetadatas, corresponding to the columns for which data is provided in the result set.
 boolean hasMoreRows()
          Returns true if the ResultSet has more rows to fetch.
 boolean hasRowCount()
          Determine if the number of rows is known or not.
 boolean supportsHasMoreRows()
          Method to notify the JDBC layer if this resultset can support checking if there is a next row through the method IResultSet.hasMoreRows().
 
Methods inherited from class com.simba.dsi.dataengine.impl.DSISimpleResultSet
appendRow, close, closeCursor, deleteRow, getCurrentRow, getDataNeeded, getFetchSize, getWarningListener, moveToNextRow, onFinishRowUpdate, onStartRowUpdate, registerWarningListener, rowDeleted, rowInserted, rowUpdated, setCursorType, setDataNeeded, setFetchSize, writeData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSIMetadataOnlyResultSet

public DSIMetadataOnlyResultSet(java.util.ArrayList<? extends IColumn> columns)
Constructor.

Parameters:
columns - The metadata for the columns of this resultset
Method Detail

getData

public boolean getData(int column,
                       long offset,
                       long maxSize,
                       DataWrapper retrievedData)
                throws com.simba.support.exceptions.ErrorException
Description copied from interface: IResultSet
Fills in retrievedData with the corresponding chunk of data. retrievedData is an uninitialized DataWrapper, and must be modified by this call.

Data is requested from column for the row that the internal cursor is currently positioned at. column is given as a 0-based index, matching the index of the corresponding column metadata in the ArrayList returned by getSelectColumns().

For character and binary data types, offset is used to indicate an offset within the data cell from which to begin the retrieved chunk. maxSize is used to indicate the suggested maximum size of the retrieved data chunk. offset and maxSize are both given in bytes, and should have no effect when retrieving fixed-width data. Please note that since sql_*char data is returned in the UTF-16 encoding, each codepoint is two bytes, so both maxSize and offset should be divided by two to interpret them as # of codepoints. The value RETRIEVE_ALL_DATA may be provided as maxSize to indicate that all available data is to be retrieved.

The return value indicates if there is more data left in the current cell. The return value should always be false when retrieving data of a fixed-width type.

If the driver attribute DSI_RETRIEVE_DATA_ORDER_RESTRICTION is set to DSI_RETRIEVE_DATA_IN_NONDECREASING_ORDER, data will only be requested from a row in non-decreasing column order. Data within a single cell will always be requested in increasing offset order, with no chunk overlap.

When requesting chunks of character and binary data, maxSize will typically match the chunk size specified in the DSI_MAXIMUM_RETRIEVE_DATA_CHUNK_SIZE driver attribute when it isn't set to RETRIEVE_ALL_DATA.

This method will not be called until IQueryExecutor.execute() has been called on the corresponding IQueryExecutor.

Parameters:
column - 0-based column index.
offset - Data offset in bytes.
maxSize - Suggested data chunk size in bytes, or RETRIEVE_ALL_DATA.
retrievedData - Holder for retrieved data.
Returns:
true if more data is left in the current cell; false otherwise. Return value should always be false when retrieving data of a fixed-width type.
Throws:
com.simba.support.exceptions.ErrorException - if an error occurs.
See Also:
DataWrapper

getRowCount

public long getRowCount()
                 throws com.simba.support.exceptions.ErrorException
Description copied from interface: IResultSet
Returns the number of rows in the result set. The value returned is undefined if the row count is unknown, in which case hasRowCount() should return false.

The value returned must fit into a 32-bit integer when targeting a 32-bit platform, or a 64-bit integer for a 64-bit platform. The value must be non-negative, except if the row count is unknown.

This method will not be called until IQueryExecutor.execute() has been called on the corresponding IQueryExecutor.

Returns:
Number of rows in the result set.
Throws:
com.simba.support.exceptions.ErrorException - If an error occurs.

getSelectColumns

public java.util.ArrayList<? extends IColumn> getSelectColumns()
                                                        throws com.simba.support.exceptions.ErrorException
Description copied from interface: IResultSet
Returns an ArrayList of ColumnMetadatas, corresponding to the columns for which data is provided in the result set. Even if there are no rows in the result set, the column metadata should still be accurate. Position in the ArrayList should match position in the result set. The first column should be found at position 0, the second at 1, and so on.

Returns:
An ArrayList of ColumnMetadatas describing the columns in the result set.
Throws:
com.simba.support.exceptions.ErrorException - If an error occurs.

hasMoreRows

public boolean hasMoreRows()
                    throws com.simba.support.exceptions.ErrorException
Description copied from interface: IResultSet
Returns true if the ResultSet has more rows to fetch. Returns false if there are no more rows to fetch.

A driver can choose not to support this method by returning false from IResultSet.supportsHasMoreRows(). A Driver might choose to not support this method if it is difficult / costly to determine if there is a next row. In this case, this method will not be called by the JDBC layer.

If this method is not supported, the JDBC API method ResultSet.isLast() will throw a SQLException if it is called by the application.

Returns:
true if there are more rows to fetch, false otherwise.
Throws:
com.simba.support.exceptions.ErrorException - If an error occurs.

hasRowCount

public boolean hasRowCount()
Description copied from interface: IResultSet
Determine if the number of rows is known or not.

Returns:
true if the number of rows is known, false otherwise.

supportsHasMoreRows

public final boolean supportsHasMoreRows()
Description copied from interface: IResultSet
Method to notify the JDBC layer if this resultset can support checking if there is a next row through the method IResultSet.hasMoreRows(). This method should consistently return the same value per instance.

Specified by:
supportsHasMoreRows in interface IResultSet
Overrides:
supportsHasMoreRows in class DSISimpleResultSet
Returns:
true if IResultSet.hasMoreRows() is supported; false otherwise.

doCloseCursor

protected void doCloseCursor()
                      throws com.simba.support.exceptions.ErrorException
Description copied from class: DSISimpleResultSet
Clean up memory by closing the cursor. Called from closeCursor() to ensure that the ResultSet performs any special handling needed to clear associated memory.

Specified by:
doCloseCursor in class DSISimpleResultSet
Throws:
com.simba.support.exceptions.ErrorException - If an error occurs.

doMoveToNextRow

protected boolean doMoveToNextRow()
                           throws com.simba.support.exceptions.ErrorException
Description copied from class: DSISimpleResultSet
Moves the result set's internal cursor to the next row. Initially, the cursor should be placed before the first row, so the first call to moveToNextRow() moves it to the first row.

This method will not be called until IQueryExecutor.execute() has been called on the corresponding IQueryExecutor.

Specified by:
doMoveToNextRow in class DSISimpleResultSet
Returns:
true if the move was successful, false if there is not another row left to move to.
Throws:
com.simba.support.exceptions.ErrorException - If an error occurs.


Copyright © 2006-2014 Simba Technologies Incorporated. All Rights Reserved.