com.simba.dsi.ext
Class DSIExtResultSet

java.lang.Object
  extended by com.simba.dsi.ext.DSIExtResultSet
All Implemented Interfaces:
IResultSet

public abstract class DSIExtResultSet
extends java.lang.Object
implements IResultSet

An abstract class that represents a result set from the DSII.

A concrete implementation of this abstract class could represent,

  1. A physical table or view from the data store, or
  2. The filtered result if the DSII supports passing down FILTERs, or
  3. The joined result if the DSII supports passing down JOINs, or
  4. The aggregated result if the DSII supports passing down AGGREGATIONs, or
  5. The projected result if the DSII supports passing down PROJECTIONs, etc.


Nested Class Summary
static class DSIExtResultSet.DMLType
          An enum representing the type of DML statements that are supported..
 
Field Summary
static int INVALID_COLUMN_NUMBER
          Invalid column number.
 
Fields inherited from interface com.simba.dsi.dataengine.interfaces.IResultSet
CURSOR_POSITION_BEFORE, RETRIEVE_ALL_DATA, ROW_COUNT_UNKNOWN
 
Constructor Summary
DSIExtResultSet()
           
 
Method Summary
abstract  java.lang.String getCatalogName()
          Get the catalog name of the table.
 boolean getDataNeeded(int column)
          Indicates whether getData() might be called on the given column after the next call to moveToNextRow().
 int getFetchSize()
          Retrieves the number of rows that should be fetched from the database.
abstract  java.lang.String getSchemaName()
          Get the schema name of the table.
abstract  java.lang.String getTableName()
          Get the name of the table.
 boolean hasMoreRows()
          Indicates whether there are more rows available to be fetched.
 IResultSet onFinishDMLBatch()
          Indicate that the current DML batch (started with onStartDMLBatch) is done.
 void onStartDMLBatch(DSIExtResultSet.DMLType dmlType, long in_numAffectedRows, java.util.List<java.lang.Integer> generatedColumns)
          Indicate the SDK is about to perform a batch of DML operations on this table.
abstract  void reset()
          Resets the result set's internal cursor.
 int resolveColumn(DSIExtResultSet originalTable, int colIndex)
          Resolve the column reference that refers the given table to this result set.
 boolean rowDeleted()
          Retrieves whether the current row has been deleted.
 boolean rowInserted()
          Retrieves whether the current row has been inserted.
 boolean rowUpdated()
          Retrieves whether the current row has been updated.
 void setDataNeeded(int column, boolean isDataNeeded)
          Indicates whether getData() might be called on the given column after the next call to moveToNextRow().
 void setFetchSize(int fetchSize)
          Gives the driver a hint as to the number of rows that should be fetched from the database.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.simba.dsi.dataengine.interfaces.IResultSet
appendRow, close, closeCursor, deleteRow, getData, getRowCount, getSelectColumns, hasRowCount, moveToNextRow, onFinishRowUpdate, onStartRowUpdate, registerWarningListener, setCursorType, writeData
 

Field Detail

INVALID_COLUMN_NUMBER

public static final int INVALID_COLUMN_NUMBER
Invalid column number.

See Also:
Constant Field Values
Constructor Detail

DSIExtResultSet

public DSIExtResultSet()
Method Detail

getCatalogName

public abstract java.lang.String getCatalogName()
Get the catalog name of the table. If catalog is not supported, the returned catalog name will be NULL.

Returns:
The catalog name of the table.

getDataNeeded

public boolean getDataNeeded(int column)
Indicates whether getData() might be called on the given column after the next call to moveToNextRow().

Specified by:
getDataNeeded in interface IResultSet
Parameters:
column - A column index. The first column uses index 0.
Returns:
true if data may be retrieved from the given column; false otherwise.

getFetchSize

public int getFetchSize()
                 throws com.simba.support.exceptions.ErrorException
Retrieves the number of rows that should be fetched from the database. Zero indicates that the default is used.

Specified by:
getFetchSize in interface IResultSet
Returns:
the number of rows to attempt to fetch at a time.
Throws:
com.simba.support.exceptions.ErrorException - if an error occurs.
See Also:
IResultSet.getFetchSize()

getSchemaName

public abstract java.lang.String getSchemaName()
Get the schema name of the table. If schema is not supported, the returned schema name will be NULL.

Returns:
The schema name of the table.

getTableName

public abstract java.lang.String getTableName()
Get the name of the table.

Returns:
The name of the table.

hasMoreRows

public boolean hasMoreRows()
                    throws com.simba.support.exceptions.ErrorException
Indicates whether there are more rows available to be fetched.

If row count information is unavailable, this cannot be determined.

Specified by:
hasMoreRows in interface IResultSet
Returns:
true if there are more rows to fetch; false otherwise.
Throws:
com.simba.support.exceptions.ErrorException - If an error occurs.

onFinishDMLBatch

public IResultSet onFinishDMLBatch()
                            throws com.simba.support.exceptions.ErrorException
Indicate that the current DML batch (started with onStartDMLBatch) is done.

Returns:
If the generatedColumns parameter to the matching call of onStartDMLBatch was null, then null. Otherwise, the result requested in onStartDMLBatch
Throws:
com.simba.support.exceptions.ErrorException

onStartDMLBatch

public void onStartDMLBatch(DSIExtResultSet.DMLType dmlType,
                            long in_numAffectedRows,
                            java.util.List<java.lang.Integer> generatedColumns)
                     throws com.simba.support.exceptions.ErrorException
Indicate the SDK is about to perform a batch of DML operations on this table.

Note: The default implementation will throw if generatedColumns is non-null.

Parameters:
dmlType - What operation the SDK will perform in this batch.
in_numAffectedRows - How many rows will be affected in this batch (i.e. how many rows inserted/deleted/updated). ROW_COUNT_UNKNOWN if not known.
generatedColumns - if non-null, must be non-empty, and indicates that onFinishDMLBatch() should return a resultset containing the specified columns, with 1 row for each row modified during the DML batch.
Specifically:

In the case of DSIExtResultSet.DMLType.INSERT, the rows in the return resultset must be in the order they were added via IResultSet.appendRow(). Otherwise, they may be returned in any order.

The returned resultset will contain one column for every element of this list, with the i'th (0-based) column of the returned resultset returned from the j'th (0-based) column of this table, with j = generatedColumns.get(i).

Throws:
com.simba.support.exceptions.ErrorException

reset

public abstract void reset()
                    throws com.simba.support.exceptions.ErrorException
Resets the result set's internal cursor.

This method will not be called by the Table implementation's moveToBeforeFirstRow().

Throws:
com.simba.support.exceptions.ErrorException - If an error occurs.

resolveColumn

public int resolveColumn(DSIExtResultSet originalTable,
                         int colIndex)
                  throws com.simba.support.exceptions.ErrorException
Resolve the column reference that refers the given table to this result set.

IMPORTANT: This method applies only when this table represents a joined result after a JOIN operation is passed down. Before the pass down JOIN operation is finalized, all column references in the SQL statement need to be resolved so that they no longer reference the original tables. Instead, they reference this table.

For example in the following query,

   select T1.C1, T2.C2 from T1 JOIN T2 on T1.C1 = T2.C1
 
After the JOIN operation is passed down, resolveColumn() will be called on the returned table to resolve T1.C1 and T2.C2 in the SELECT_LIST.

Parameters:
originalTable - The original table that the column refers to.
colIndex - The column number in the original table (originalTable).
Returns:
Resolved zero-based column index if successful, SE_INVALID_COLUMN_NUMBER otherwise.
Throws:
com.simba.support.exceptions.ErrorException - If the table does not represent a joined result.

rowDeleted

public boolean rowDeleted()
Retrieves whether the current row has been deleted.

Specified by:
rowDeleted in interface IResultSet
Returns:
True if the current row has been deleted; false otherwise.

rowInserted

public boolean rowInserted()
Retrieves whether the current row has been inserted.

Specified by:
rowInserted in interface IResultSet
Returns:
True if the current row has been inserted; false otherwise.

rowUpdated

public boolean rowUpdated()
Retrieves whether the current row has been updated.

Specified by:
rowUpdated in interface IResultSet
Returns:
True if the current row has been updated; false otherwise.

setDataNeeded

public void setDataNeeded(int column,
                          boolean isDataNeeded)
Indicates whether getData() might be called on the given column after the next call to moveToNextRow(). The value given here applies for any subsequent moveToNextRow() calls.

Specified by:
setDataNeeded in interface IResultSet
Parameters:
column - A column index. The first column uses index 0.
isDataNeeded - Indicates whether data may be retrieved from the given column.

setFetchSize

public void setFetchSize(int fetchSize)
                  throws com.simba.support.exceptions.ErrorException
Gives the driver a hint as to the number of rows that should be fetched from the database. This may be safely ignored.

Specified by:
setFetchSize in interface IResultSet
Parameters:
fetchSize - The fetch size to set.
Throws:
com.simba.support.exceptions.ErrorException - If an error occurs.
See Also:
IResultSet.setFetchSize(int)

supportsHasMoreRows

public 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
Returns:
true if IResultSet.hasMoreRows() is supported; false otherwise.


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