org.apache.derby.impl.sql.execute
Class CurrentOfResultSet

java.lang.Object
  extended by org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
      extended by org.apache.derby.impl.sql.execute.NoPutResultSetImpl
          extended by org.apache.derby.impl.sql.execute.CurrentOfResultSet
All Implemented Interfaces:
CursorResultSet, NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource

 class CurrentOfResultSet
extends NoPutResultSetImpl
implements CursorResultSet

Takes a cursor name and returns the current row of the cursor; for use in generating the source row and row location for positioned update/delete operations.

This result set returns only one row.


Field Summary
private  CursorResultSet cursor
           
private  java.lang.String cursorName
           
private  boolean next
           
private  RowLocation rowLocation
           
private  ExecRow sparseRow
           
private  CursorResultSet target
           
 
Fields inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
checkNullCols, clonedExecRow, cncLen, resultSetNumber, targetResultSet
 
Fields inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
activation, beginTime, closeTime, compactRow, constructorTime, currentRow, endExecutionTime, finished, isOpen, isTopResultSet, nextTime, numOpens, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, resultDescription, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArray
 
Fields inherited from interface org.apache.derby.iapi.sql.ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
 
Fields inherited from interface org.apache.derby.iapi.sql.execute.NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE
 
Constructor Summary
CurrentOfResultSet(java.lang.String cursorName, Activation activation, int resultSetNumber)
           
 
Method Summary
 void close()
          If the result set has been opened, close the open scan.
 void finish()
          Tells the system that there will be no more access to any database information via this result set; in particular, no more calls to open().
 ExecRow getCurrentRow()
          Returns the current row of the result set.
private  void getCursor()
          Because the positioned operation only gets one location per execution, and the cursor could be completely different for each execution (closed and reopened, perhaps), we determine where caching the cursor could be applied.
 ExecRow getNextRowCore()
          If open and not returned yet, returns the row.
 RowLocation getRowLocation()
          This result set has its row location from the last fetch done.
private  ExecRow getSparseRow(ExecRow row, int[] indexCols)
          Return a sparse heap row, based on a compact index row.
 long getTimeSpent(int type)
          Return the total amount of time spent in this ResultSet
 void markRowAsDeleted()
          Marks the resultSet's currentRow as deleted after a delete has been issued by either by using positioned delete or JDBC's deleteRow method.
 void openCore()
          open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...
 void updateRow(ExecRow row, RowChanger rowChanger)
          Updates the resultSet's current row with it's new values after an update has been issued either using positioned update or JDBC's udpateRow method.
 
Methods inherited from class org.apache.derby.impl.sql.execute.NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, isForUpdate, needsRowLocation, needsToClone, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan
 
Methods inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
addWarning, attachStatementContext, checkCancellationFlag, checkRowPosition, cleanUp, dumpTimeStats, finishAndRTS, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCompactRow, getCurrentTimeMillis, getElapsedMillis, getEndExecutionTimestamp, getEstimatedRowCount, getExecuteTime, getExecutionFactory, getFirstRow, getLanguageConnectionContext, getLastRow, getNextRow, getPointOfAttachment, getPreviousRow, getRelativeRow, getRowNumber, getScanIsolationLevel, getSubqueryTrackingArray, getTransactionController, getWarnings, isClosed, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, reopenCore, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.sql.ResultSet
checkRowPosition, cleanUp, clearCurrentRow, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow
 

Field Detail

next

private boolean next

rowLocation

private RowLocation rowLocation

cursor

private CursorResultSet cursor

target

private CursorResultSet target

sparseRow

private ExecRow sparseRow

cursorName

private final java.lang.String cursorName
Constructor Detail

CurrentOfResultSet

CurrentOfResultSet(java.lang.String cursorName,
                   Activation activation,
                   int resultSetNumber)
Method Detail

openCore

public void openCore()
              throws StandardException
open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...

Specified by:
openCore in interface NoPutResultSet
Throws:
StandardException - thrown on failure to open

getNextRowCore

public ExecRow getNextRowCore()
                       throws StandardException
If open and not returned yet, returns the row.

Specified by:
getNextRowCore in interface NoPutResultSet
Specified by:
getNextRowCore in class BasicNoPutResultSetImpl
Returns:
the next row in the result
Throws:
StandardException - thrown on failure.
See Also:
NoPutResultSet.getNextRowCore()

getSparseRow

private ExecRow getSparseRow(ExecRow row,
                             int[] indexCols)
                      throws StandardException
Return a sparse heap row, based on a compact index row.

Parameters:
row - compact referenced index row
indexCols - base column positions of index keys, signed with asc/desc info
Returns:
a sparse heap row with referenced columns
Throws:
StandardException

close

public void close()
           throws StandardException
If the result set has been opened, close the open scan.

Specified by:
close in interface ResultSet
Overrides:
close in class NoPutResultSetImpl
Throws:
StandardException - thrown on error

finish

public void finish()
            throws StandardException
Description copied from interface: ResultSet
Tells the system that there will be no more access to any database information via this result set; in particular, no more calls to open(). Will close the result set if it is not already closed.

Specified by:
finish in interface ResultSet
Overrides:
finish in class BasicNoPutResultSetImpl
Throws:
StandardException - on error

getTimeSpent

public long getTimeSpent(int type)
Return the total amount of time spent in this ResultSet

Specified by:
getTimeSpent in interface ResultSet
Parameters:
type - CURRENT_RESULTSET_ONLY - time spent only in this ResultSet ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.
Returns:
long The total amount of time spent (in milliseconds).

getRowLocation

public RowLocation getRowLocation()
This result set has its row location from the last fetch done. If it is closed, a null is returned.

Specified by:
getRowLocation in interface CursorResultSet
Returns:
the row location of the current row.
Throws:
StandardException - thrown on failure to get row location
See Also:
CursorResultSet

getCurrentRow

public ExecRow getCurrentRow()
Description copied from interface: CursorResultSet
Returns the current row of the result set. REMIND: eventually, this will only return the current row for result sets that need to return it; either some field in the activation or a parameter in the constructor will be used to signal that this needs to function. This will let us limit the number of live objects we are holding on to.

Specified by:
getCurrentRow in interface CursorResultSet
Returns:
the last row returned by getNextRow.
See Also:
CursorResultSet

getCursor

private void getCursor()
                throws StandardException
Because the positioned operation only gets one location per execution, and the cursor could be completely different for each execution (closed and reopened, perhaps), we determine where caching the cursor could be applied.

When cached, we check if the cursor was closed'd, and if so, throw it out and see if there's one in the cache with our name.

Throws:
StandardException

updateRow

public void updateRow(ExecRow row,
                      RowChanger rowChanger)
               throws StandardException
Description copied from interface: NoPutResultSet
Updates the resultSet's current row with it's new values after an update has been issued either using positioned update or JDBC's udpateRow method.

Specified by:
updateRow in interface NoPutResultSet
Overrides:
updateRow in class NoPutResultSetImpl
Parameters:
row - new values for the currentRow
rowChanger - holds information about row: what columns of it is to be used for updating, and what underlying base table column each such column corresponds to.
Throws:
StandardException - thrown on failure.
See Also:
NoPutResultSet.updateRow(org.apache.derby.iapi.sql.execute.ExecRow, org.apache.derby.iapi.sql.execute.RowChanger)

markRowAsDeleted

public void markRowAsDeleted()
                      throws StandardException
Description copied from interface: NoPutResultSet
Marks the resultSet's currentRow as deleted after a delete has been issued by either by using positioned delete or JDBC's deleteRow method.

Specified by:
markRowAsDeleted in interface NoPutResultSet
Overrides:
markRowAsDeleted in class NoPutResultSetImpl
Throws:
StandardException - thrown on failure.
See Also:
NoPutResultSet.markRowAsDeleted()

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.