com.simba.dsi.dataengine.impl
Class DSIEmptyResultSet

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

public class DSIEmptyResultSet
extends DSISimpleResultSet

Implementation of an empty IResultSet. This class is used to support returning an empty result set for Statement.getGeneratedKeys().


Field Summary
 
Fields inherited from interface com.simba.dsi.dataengine.interfaces.IResultSet
CURSOR_POSITION_BEFORE, RETRIEVE_ALL_DATA, ROW_COUNT_UNKNOWN
 
Constructor Summary
DSIEmptyResultSet()
           
 
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<ColumnMetadata> 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()
          Returns true if the ResultSet has a known row count.
 
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, supportsHasMoreRows, writeData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSIEmptyResultSet

public DSIEmptyResultSet()
Method Detail

doCloseCursor

protected void doCloseCursor()
                      throws com.simba.support.exceptions.ErrorException
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
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.

getData

public boolean getData(int column,
                       long offset,
                       long maxSize,
                       DataWrapper retrievedData)
                throws com.simba.support.exceptions.ErrorException
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. 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
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<ColumnMetadata> getSelectColumns()
                                                     throws com.simba.support.exceptions.ErrorException
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
Returns true if the ResultSet has more rows to fetch. Returns false if there are no more rows to fetch.

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()
Returns true if the ResultSet has a known row count. Returns false if the number of rows in the result set is unknown.

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


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