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

public Class OnceResultSet

extends NoPutResultSetImpl
Class Inheritance
Imports
org.apache.derby.iapi.services.monitor.Monitor, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.stream.HeaderPrintWriter, .InfoStreams, org.apache.derby.iapi.sql.conn.StatementContext, org.apache.derby.iapi.sql.execute.ExecRow, .NoPutResultSet, org.apache.derby.iapi.types.DataValueDescriptor, org.apache.derby.iapi.sql.Activation, .ResultSet, org.apache.derby.iapi.services.loader.GeneratedMethod, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.error.StandardException

Takes an expression subquery's result set and verifies that only a single scalar value is being returned.

Note

A row with a single column containing null will be returned from getNextRow() if the underlying subquery ResultSet is empty.

Field Summary

Modifier and TypeField and Description
private int
public static final int
private GeneratedMethod
public static final int
public int
private ExecRow
public NoPutResultSet
private StatementContext
public int
public static final int
Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
checkNullColsclonedExecRowcncLenresultSetNumbertargetResultSet

Constructor Summary

AccessConstructor and Description
public
OnceResultSet(NoPutResultSet s, Activation a, GeneratedMethod emptyRowFun, int cardinalityCheck, int resultSetNumber, int subqueryNumber, int pointOfAttachment, double optimizerEstimatedRowCount, double optimizerEstimatedCost)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides org.apache.derby.impl.sql.execute.NoPutResultSetImpl.close.

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

If the result set has been opened, close the open scan.

public ExecRow
public int
public long

Returns:

long The total amount of time spent (in milliseconds).
getTimeSpent
(int
CURRENT_RESULTSET_ONLY - time spent only in this ResultSet ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.
type
)

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

Return the total amount of time spent in this ResultSet

public void
public void
Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
clearCurrentRowclearOrderableCachecloseRowSourcegetCursorNamegetNextRowFromRowSourcegetResultDescriptiongetValidColumnsisForUpdatemarkRowAsDeletedneedsRowLocationneedsRowLocationForDeferredCheckConstraintsneedsToCloneoffendingRowLocationpositionScanAtRowLocationprintQualifiersresultSetNumberrowLocationsetCurrentRowsetHasDeferrableCheckssetNeedsRowLocationsetTargetResultSetskipRowskipScanunpackHashValueupdateRow

Field Detail

cardinalityCheckback to summary
private int cardinalityCheck
DO_CARDINALITY_CHECKback to summary
public static final int DO_CARDINALITY_CHECK
emptyRowFunback to summary
private GeneratedMethod emptyRowFun
NO_CARDINALITY_CHECKback to summary
public static final int NO_CARDINALITY_CHECK
pointOfAttachmentback to summary
public int pointOfAttachment
rowWithNullsback to summary
private ExecRow rowWithNulls
sourceback to summary
public NoPutResultSet source
statementContextback to summary
private StatementContext statementContext

Hides org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.statementContext.

subqueryNumberback to summary
public int subqueryNumber
UNIQUE_CARDINALITY_CHECKback to summary
public static final int UNIQUE_CARDINALITY_CHECK

Constructor Detail

OnceResultSetback to summary
public OnceResultSet(NoPutResultSet s, Activation a, GeneratedMethod emptyRowFun, int cardinalityCheck, int resultSetNumber, int subqueryNumber, int pointOfAttachment, double optimizerEstimatedRowCount, double optimizerEstimatedCost)

Method Detail

closeback to summary
public void close() throws StandardException

Overrides org.apache.derby.impl.sql.execute.NoPutResultSetImpl.close.

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

If the result set has been opened, close the open scan.

Exceptions
StandardException:
thrown on error
getNextRowCoreback to summary
public ExecRow getNextRowCore() throws StandardException

Implements abstract org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRowCore.

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

Return the requested value computed from the next row.

Returns:ExecRow

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

the next row in the result

Exceptions
StandardException:
thrown on failure. StandardException ScalarSubqueryCardinalityViolation Thrown if scalar subquery returns more than 1 row.
getPointOfAttachmentback to summary
public int getPointOfAttachment()

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

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

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

Return the point of attachment for this subquery. (Only meaningful for Any and Once ResultSets, which can and will only be at the top of a ResultSet for a subquery.)

Returns:int

int Point of attachment (result set number) for this subquery. (-1 if not a subquery - also Sanity violation)

See Also
NoPutResultSet#getPointOfAttachment
getTimeSpentback to summary
public long getTimeSpent(int type)

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

Return the total amount of time spent in this ResultSet

Parameters
type:int

CURRENT_RESULTSET_ONLY - time spent only in this ResultSet ENTIRE_RESULTSET_TREE - time spent in this ResultSet and below.

Returns:long

long The total amount of time spent (in milliseconds).

openCoreback to summary
public void openCore() throws StandardException

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

open a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...

Exceptions
StandardException:
thrown if cursor finished.
reopenCoreback to summary
public void reopenCore() throws StandardException

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

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

reopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...

Exceptions
StandardException:
thrown if cursor finished.