Top Description Fields Constructors Methods
org.apache.derby.impl.sql.execute

pack-priv abstract Class NoPutResultSetImpl

extends BasicNoPutResultSetImpl
Class Inheritance
Known Direct Subclasses
org.apache.derby.impl.sql.execute.NormalizeResultSet, org.apache.derby.impl.sql.execute.OnceResultSet, org.apache.derby.impl.sql.execute.ProjectRestrictResultSet, org.apache.derby.impl.sql.execute.RowCountResultSet, org.apache.derby.impl.sql.execute.RowResultSet, org.apache.derby.impl.sql.execute.ScanResultSet, org.apache.derby.impl.sql.execute.SetOpResultSet, org.apache.derby.impl.sql.execute.SortResultSet, org.apache.derby.impl.sql.execute.UnionResultSet, org.apache.derby.impl.sql.execute.VTIResultSet, org.apache.derby.impl.sql.execute.WindowResultSet, org.apache.derby.impl.sql.execute.AnyResultSet, org.apache.derby.impl.sql.execute.GenericAggregateResultSet, org.apache.derby.impl.sql.execute.CurrentOfResultSet, org.apache.derby.impl.sql.execute.MaterializedResultSet, org.apache.derby.impl.sql.execute.ScrollInsensitiveResultSet, org.apache.derby.impl.sql.execute.HashTableResultSet, org.apache.derby.impl.sql.execute.IndexRowToBaseRowResultSet, org.apache.derby.impl.sql.execute.JoinResultSet
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.i18n.MessageService, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.iapi.services.monitor.Monitor, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.stream.HeaderPrintWriter, org.apache.derby.iapi.sql.Activation, .ResultDescription, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, org.apache.derby.iapi.sql.execute.ExecIndexRow, .ExecRow, .ExecutionFactory, .ResultSetStatisticsFactory, .RunTimeStatistics, .NoPutResultSet, .TargetResultSet, .RowChanger, org.apache.derby.iapi.sql.execute.xplain.XPLAINVisitor, org.apache.derby.iapi.store.access.Qualifier, .RowLocationRetRowSource, .RowSource, org.apache.derby.iapi.types.DataValueDescriptor, .LocatedRow, .Orderable, .RowLocation

Abstract ResultSet with built in Activation support for operations that return rows but do not allow the caller to put data on output pipes. This implementation of ResultSet is meant to be overridden by subtypes in the execution engine. Its primary users will be DML operations that do not put data on output pipes, but simply return it due to being result sets themselves.

This abstract class does not define the entire ResultSet interface, but leaves the 'get' half of the interface for subtypes to implement. It is package-visible only, with its methods being public for exposure by its subtypes.

Field Summary

Modifier and TypeField and Description
protected int[]
protected ExecRow
protected int
private boolean
private boolean
public final int
protected TargetResultSet
Inherited from org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl:
activationbeginTimecloseTimecompactRowconstructorTimecurrentRowendExecutionTimefinishedisOpenisTopResultSetnextTimenumOpensopenTimeoptimizerEstimatedCostoptimizerEstimatedRowCountresultDescriptionrowsFilteredrowsSeenstartExecutionTimesubqueryTrackingArray

Constructor Summary

AccessConstructor and Description
pack-priv
NoPutResultSetImpl(Activation
The activation
activation
,
int
The resultSetNumber
resultSetNumber
,
double
The optimizer's estimated number of rows.
optimizerEstimatedRowCount
,
double
The optimizer's estimated cost
optimizerEstimatedCost
)

Constructor

Method Summary

Modifier and TypeMethod and Description
public void
protected void
clearOrderableCache(Qualifier[][]
The Qualifiers to clear
qualifiers
)

Clear the Orderable cache for each qualifier.

public void
close()

Implements org.apache.derby.iapi.sql.ResultSet.close.

Close needs to invalidate any dependent statements, if this is a cursor.

public void
closeRowSource()

Implements org.apache.derby.iapi.store.access.RowSource.closeRowSource.

closeRowSource tells the RowSource that it will no longer need to return any rows and it can release any resource it may have.

public String
getCursorName()

Implements org.apache.derby.iapi.sql.ResultSet.getCursorName.

Return my cursor name for JDBC.

public DataValueDescriptor[]
getNextRowFromRowSource()

Implements org.apache.derby.iapi.store.access.RowSource.getNextRowFromRowSource.

Get the next row as an array of column objects.

public ResultDescription
public FormatableBitSet
getValidColumns()

Implements org.apache.derby.iapi.store.access.RowSource.getValidColumns.

getValidColumns describes the DataValueDescriptor[] returned by all calls to the getNextRowFromRowSource() call.

public boolean

Returns:

Whether or not the result set is for update.
isForUpdate
()

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.isForUpdate.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.isForUpdate.

Is this ResultSet or it's source result set for update This method will be overriden in the inherited Classes if it is true

public void
markRowAsDeleted()

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.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.

public boolean
needsRowLocation()

Implements org.apache.derby.iapi.store.access.RowLocationRetRowSource.needsRowLocation.

needsRowLocation returns true iff this the row source expects the drainer of the row source to call rowLocation after getting a row from getNextRowFromRowSource.

public boolean
public boolean
needsToClone()

Implements org.apache.derby.iapi.store.access.RowSource.needsToClone.

Does the caller of getNextRowFromRowSource() need to clone the row in order to keep a reference to the row past the getNextRowFromRowSource() call which returned the row.

public void
public void
positionScanAtRowLocation(RowLocation
row location of the current cursor row
rl
)

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.positionScanAtRowLocation.

Positions the cursor in the specified rowLocation.

public static String
printQualifiers(Qualifier[][] qualifiers)

Return a 2-d array of Qualifiers as a String

public int
resultSetNumber()

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.resultSetNumber.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.resultSetNumber.

Get the number of this ResultSet, which is guaranteed to be unique within a statement.

public void
rowLocation(RowLocation rl)

Implements org.apache.derby.iapi.store.access.RowLocationRetRowSource.rowLocation.

rowLocation is a callback for the drainer of the row source to return the rowLocation of the current row, i.e, the row that is being returned by getNextRowFromRowSource.

public final void
setCurrentRow(ExecRow
the new current row
row
)

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.setCurrentRow.

Set the current row to the row passed in.

public void
setHasDeferrableChecks()

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.setHasDeferrableChecks.

Set that we are acting on behalf of an insert result set that has deferrable check constraints

public void
setNeedsRowLocation(boolean needsRowLocation)

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.setNeedsRowLocation.

Set whether or not the NPRS need the row location when acting as a row source.

public void
setTargetResultSet(TargetResultSet
The TargetResultSet.
trs
)

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.setTargetResultSet.

Notify a NPRS that it is the source for the specified TargetResultSet.

protected boolean

Returns:

true means skip the row because it has null
skipRow
(ExecRow
An index row
row
)

Return true if we should skip the scan due to nulls in the row when the start or stop positioners on the columns containing null do not implement ordered null semantics.

protected boolean

Returns:

true means not to do the scan
skipScan
(ExecIndexRow
An index row for the start position
startPosition
,
ExecIndexRow
An index row for the stop position
stopPosition
)

Return true if we should skip the scan due to nulls in the start or stop position when the predicate on the column(s) in question do not implement ordered null semantics.

protected DataValueDescriptor[]
unpackHashValue(Object hashValue)

Get all of the columns out of a value stored in a BackingStoreHashtable.

public void
updateRow(ExecRow
new values for the currentRow
row
,
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.
rowChanger
)

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.updateRow.

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.

Inherited from org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl:
addWarningattachStatementContextcheckCancellationFlagcheckRowPositionchildrenToXMLcleanUpdumpTimeStatsfinishfinishAndRTSgetAbsoluteRowgetActivationgetAutoGeneratedKeysResultsetgetBeginExecutionTimestampgetCompactRowgetCurrentTimeMillisgetElapsedMillisgetEndExecutionTimestampgetEstimatedRowCountgetExecuteTimegetExecutionFactorygetFirstRowgetLanguageConnectionContextgetLastRowgetNextRowgetNextRowCoregetPointOfAttachmentgetPreviousRowgetRelativeRowgetRowNumbergetScanIsolationLevelgetSubqueryTrackingArraygetTransactionControllergetWarningsisClosedisXplainOnlyModemarkAsTopResultSetmodifiedRowCountopenrecordConstructorTimereopenCorerequiresRelockingreturnsRowssetAfterLastRowsetBeforeFirstRowsetCompactRowsetCompatRowtoXMLtoXML

Field Detail

checkNullColsback to summary
protected int[] checkNullCols
clonedExecRowback to summary
protected ExecRow clonedExecRow
cncLenback to summary
protected int cncLen
needsRowLocationback to summary
private boolean needsRowLocation
needsRowLocationForDeferredCheckConstraintsback to summary
private boolean needsRowLocationForDeferredCheckConstraints
resultSetNumberback to summary
public final int resultSetNumber
targetResultSetback to summary
protected TargetResultSet targetResultSet

Constructor Detail

NoPutResultSetImplback to summary
pack-priv NoPutResultSetImpl(Activation activation, int resultSetNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost)

Constructor

Parameters
activation:Activation

The activation

resultSetNumber:int

The resultSetNumber

optimizerEstimatedRowCount:double

The optimizer's estimated number of rows.

optimizerEstimatedCost:double

The optimizer's estimated cost

Method Detail

clearCurrentRowback to summary
public void clearCurrentRow()

Implements org.apache.derby.iapi.sql.ResultSet.clearCurrentRow.

Clear the current row

clearOrderableCacheback to summary
protected void clearOrderableCache(Qualifier[][] qualifiers) throws StandardException

Clear the Orderable cache for each qualifier. (This should be done each time a scan/conglomerate with qualifiers is reopened.)

Parameters
qualifiers:Qualifier[][]

The Qualifiers to clear

closeback to summary
public void close() throws StandardException

Implements org.apache.derby.iapi.sql.ResultSet.close.

Close needs to invalidate any dependent statements, if this is a cursor. Must be called by any subclasses that override close().

Exceptions
StandardException:
on error
closeRowSourceback to summary
public void closeRowSource()

Implements org.apache.derby.iapi.store.access.RowSource.closeRowSource.

Doc from org.apache.derby.iapi.store.access.RowSource.closeRowSource.

closeRowSource tells the RowSource that it will no longer need to return any rows and it can release any resource it may have. Subsequent call to any method on the RowSource will result in undefined behavior. A closed rowSource can be closed again.

See Also
RowSource#closeRowSource
getCursorNameback to summary
public String getCursorName()

Implements org.apache.derby.iapi.sql.ResultSet.getCursorName.

Return my cursor name for JDBC. Can be null.

Returns:String

Doc from org.apache.derby.iapi.sql.ResultSet.getCursorName.

A String with the name of the cursor, if any. Returns NULL if this is not a cursor statement.

getNextRowFromRowSourceback to summary
public DataValueDescriptor[] getNextRowFromRowSource() throws StandardException

Implements org.apache.derby.iapi.store.access.RowSource.getNextRowFromRowSource.

Doc from org.apache.derby.iapi.store.access.RowSource.getNextRowFromRowSource.

Get the next row as an array of column objects. The column objects can be a JBMS Storable or any Serializable/Externalizable/Formattable/Streaming type.
A return of null indicates that the complete set of rows has been read.

A null column can be specified by leaving the object null, or indicated by returning a non-null getValidColumns. On streaming columns, it can be indicated by returning a non-null get FieldStates.

If RowSource.needToClone() is true then the returned row (the DataValueDescriptor[]) is guaranteed not to be modified by drainer of the RowSource (except that the input stream will be read, of course) and drainer will keep no reference to it before making the subsequent nextRow call. So it is safe to return the same DataValueDescriptor[] in subsequent nextRow calls if that is desirable for performance reasons.

If RowSource.needToClone() is false then the returned row (the DataValueDescriptor[]) may be be modified by drainer of the RowSource, and the drainer may keep a reference to it after making the subsequent nextRow call. In this case the client should severe all references to the row after returning it from getNextRowFromRowSource().

Exceptions
StandardException:
on error
See Also
RowSource#getNextRowFromRowSource
getResultDescriptionback to summary
public ResultDescription getResultDescription()

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getResultDescription.

Implements org.apache.derby.iapi.sql.ResultSet.getResultDescription.

Returns the description of the table's rows

Returns:ResultDescription

Doc from org.apache.derby.iapi.sql.ResultSet.getResultDescription.

A ResultDescription describing the results of the statement.

getValidColumnsback to summary
public FormatableBitSet getValidColumns()

Implements org.apache.derby.iapi.store.access.RowSource.getValidColumns.

Doc from org.apache.derby.iapi.store.access.RowSource.getValidColumns.

getValidColumns describes the DataValueDescriptor[] returned by all calls to the getNextRowFromRowSource() call. If getValidColumns returns null, the number of columns is given by the DataValueDescriptor.length where DataValueDescriptor[] is returned by the preceeding getNextRowFromRowSource() call. Column N maps to DataValueDescriptor[N], where column numbers start at zero. If getValidColumns return a non null validColumns FormatableBitSet the number of columns is given by the number of bits set in validColumns. Column N is not in the partial row if validColumns.get(N) returns false. Column N is in the partial row if validColumns.get(N) returns true. If column N is in the partial row then it maps to DataValueDescriptor[M] where M is the count of calls to validColumns.get(i) that return true where i < N. If DataValueDescriptor.length is greater than the number of columns indicated by validColumns the extra entries are ignored.

See Also
RowSource#getValidColumns
isForUpdateback to summary
public boolean isForUpdate()

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.isForUpdate.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.isForUpdate.

Is this ResultSet or it's source result set for update This method will be overriden in the inherited Classes if it is true

Returns:boolean

Whether or not the result set is for update.

markRowAsDeletedback to summary
public void markRowAsDeleted() throws StandardException

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.markRowAsDeleted.

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.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.

Exceptions
StandardException:
thrown on failure.
See Also
This method is result sets used for scroll insensitive updatable result sets for other result set it is a no-op.
needsRowLocationback to summary
public boolean needsRowLocation()

Implements org.apache.derby.iapi.store.access.RowLocationRetRowSource.needsRowLocation.

Doc from org.apache.derby.iapi.store.access.RowLocationRetRowSource.needsRowLocation.

needsRowLocation returns true iff this the row source expects the drainer of the row source to call rowLocation after getting a row from getNextRowFromRowSource.

Returns:boolean

true iff this row source expects some row location to be returned

See Also
RowLocationRetRowSource#needsRowLocation
needsRowLocationForDeferredCheckConstraintsback to summary
public boolean needsRowLocationForDeferredCheckConstraints()

Implements org.apache.derby.iapi.store.access.RowLocationRetRowSource.needsRowLocationForDeferredCheckConstraints.

needsToCloneback to summary
public boolean needsToClone()

Implements org.apache.derby.iapi.store.access.RowSource.needsToClone.

Doc from org.apache.derby.iapi.store.access.RowSource.needsToClone.

Does the caller of getNextRowFromRowSource() need to clone the row in order to keep a reference to the row past the getNextRowFromRowSource() call which returned the row. This call must always return the same for all rows in a RowSource (ie. the caller will call this once per scan from a RowSource and assume the behavior is true for all rows in the RowSource).

See Also
RowSource#needsToClone
offendingRowLocationback to summary
public void offendingRowLocation(RowLocation rl, long containdId) throws StandardException

Implements org.apache.derby.iapi.store.access.RowLocationRetRowSource.offendingRowLocation.

positionScanAtRowLocationback to summary
public void positionScanAtRowLocation(RowLocation rl) throws StandardException

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.positionScanAtRowLocation.

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.positionScanAtRowLocation.

Positions the cursor in the specified rowLocation. Used for scrollable insensitive result sets in order to position the cursor back to a row that has already be visited.

Parameters
rl:RowLocation

row location of the current cursor row

Exceptions
StandardException:
thrown on failure to get location from storage engine
See Also
This method is result sets used for scroll insensitive updatable result sets for other result set it is a no-op.
printQualifiersback to summary
public static String printQualifiers(Qualifier[][] qualifiers)

Return a 2-d array of Qualifiers as a String

resultSetNumberback to summary
public int resultSetNumber()

Overrides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.resultSetNumber.

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.resultSetNumber.

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.resultSetNumber.

Get the number of this ResultSet, which is guaranteed to be unique within a statement.

See Also
NoPutResultSet#resultSetNumber()
rowLocationback to summary
public void rowLocation(RowLocation rl) throws StandardException

Implements org.apache.derby.iapi.store.access.RowLocationRetRowSource.rowLocation.

Doc from org.apache.derby.iapi.store.access.RowLocationRetRowSource.rowLocation.

rowLocation is a callback for the drainer of the row source to return the rowLocation of the current row, i.e, the row that is being returned by getNextRowFromRowSource. This interface is for the purpose of loading a base table with index. In that case, the indices can be built at the same time the base table is laid down once the row location of the base row is known. This is an example pseudo code on how this call is expected to be used:

		boolean needsRL = rowSource.needsRowLocation();
		DataValueDescriptor[] row;
		while((row = rowSource.getNextRowFromRowSource()) != null)
		{
			RowLocation rl = heapConglomerate.insertRow(row);
			if (needsRL)
				rowSource.rowLocation(rl);
		}
		

NeedsRowLocation and rowLocation will ONLY be called by a drainer of the row source which CAN return a row location. Drainer of row source which cannot return rowLocation will guarantee to not call either callbacks. Conversely, if NeedsRowLocation is called and it returns true, then for every row return by getNextRowFromRowSource, a rowLocation callback must also be issued with the row location of the row. Implementor of both the source and the drain of the row source must be aware of this protocol.
The RowLocation object is own by the caller of rowLocation, in other words, the drainer of the RowSource. This is so that we don't need to new a row location for every row. If the Row Source wants to keep the row location, it needs to clone it (RowLocation is a ClonableObject).
Exceptions
StandardException:
on error
See Also
RowLocationRetRowSource#rowLocation
setCurrentRowback to summary
public final void setCurrentRow(ExecRow row)

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.setCurrentRow.

Set the current row to the row passed in.

Parameters
row:ExecRow

the new current row

setHasDeferrableChecksback to summary
public void setHasDeferrableChecks()

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.setHasDeferrableChecks.

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.setHasDeferrableChecks.

Set that we are acting on behalf of an insert result set that has deferrable check constraints

setNeedsRowLocationback to summary
public void setNeedsRowLocation(boolean needsRowLocation)

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.setNeedsRowLocation.

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.setNeedsRowLocation.

Set whether or not the NPRS need the row location when acting as a row source. (The target result set determines this.)

See Also
NoPutResultSet#setNeedsRowLocation
setTargetResultSetback to summary
public void setTargetResultSet(TargetResultSet trs)

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.setTargetResultSet.

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.setTargetResultSet.

Notify a NPRS that it is the source for the specified TargetResultSet. This is useful when doing bulk insert.

Parameters
trs:TargetResultSet

The TargetResultSet.

See Also
NoPutResultSet#setTargetResultSet
skipRowback to summary
protected boolean skipRow(ExecRow row) throws StandardException

Return true if we should skip the scan due to nulls in the row when the start or stop positioners on the columns containing null do not implement ordered null semantics.

Parameters
row:ExecRow

An index row

Returns:boolean

true means skip the row because it has null

skipScanback to summary
protected boolean skipScan(ExecIndexRow startPosition, ExecIndexRow stopPosition) throws StandardException

Return true if we should skip the scan due to nulls in the start or stop position when the predicate on the column(s) in question do not implement ordered null semantics. beetle 4464, we also compact the areNullsOrdered flags into checkNullCols here.

Parameters
startPosition:ExecIndexRow

An index row for the start position

stopPosition:ExecIndexRow

An index row for the stop position

Returns:boolean

true means not to do the scan

unpackHashValueback to summary
protected DataValueDescriptor[] unpackHashValue(Object hashValue)

Get all of the columns out of a value stored in a BackingStoreHashtable.

updateRowback to summary
public void updateRow(ExecRow row, RowChanger rowChanger) throws StandardException

Implements org.apache.derby.iapi.sql.execute.NoPutResultSet.updateRow.

Doc from org.apache.derby.iapi.sql.execute.NoPutResultSet.updateRow.

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.

Parameters
row:ExecRow

new values for the currentRow

rowChanger: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.

Exceptions
StandardException:
thrown on failure.
See Also
This method is result sets used for scroll insensitive updatable result sets for other result set it is a no-op.