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

pack-priv Class NormalizeResultSet

extends NoPutResultSetImpl
implements CursorResultSet
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.sql.execute.CursorResultSet, org.apache.derby.iapi.sql.ResultSet
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.Activation, .ResultColumnDescriptor, .ResultDescription, org.apache.derby.iapi.sql.execute.CursorResultSet, .ExecRow, .NoPutResultSet, .RowChanger, org.apache.derby.iapi.types.DataTypeDescriptor, .DataValueDescriptor, .RowLocation

Cast the rows from the source result set to match the format of the result set for the entire statement.

Field Summary

Modifier and TypeField and Description
private final DataValueDescriptor[]
cachedDestinations

This array contains data value descriptors that can be used (and reused) by normalizeRow() to hold the normalized column values.

private DataTypeDescriptor[]
private ExecRow
private int
private ResultDescription
public NoPutResultSet
private int
Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
checkNullColsclonedExecRowcncLenresultSetNumbertargetResultSet

Constructor Summary

AccessConstructor and Description
public
NormalizeResultSet(NoPutResultSet
The NoPutResultSet from which to get rows to be normalized
source
,
Activation
The activation for this execution
activation
,
int
The resultSetNumber
resultSetNumber
,
int
The integer for the ResultDescription
erdNumber
,
double optimizerEstimatedRowCount, double optimizerEstimatedCost, boolean forUpdate)

Constructor for a NormalizeResultSet

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 static int
computeStartColumn(boolean
True if we are executing an UPDATE statement
isUpdate
,
ResultDescription
Metadata describing a result row

desc
)

Compute the start column for an update/insert.

private DataTypeDescriptor[]
fetchResultTypes(ResultDescription desc)

Fetch the result datatypes out of the activation.

private DataValueDescriptor

Returns:

a data value descriptor of the correct type for the column
getCachedDestination
(int
the column number (1-based)
col
)

Get a cached data value descriptor that can receive the normalized value of the specified column.

public ExecRow

Returns:

the last row returned.
getCurrentRow
()

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getCurrentRow.

Gets information from last getNextRow call.

private DataTypeDescriptor

Returns:

a data type descriptor for the column
getDesiredType
(int
the column number (1-based)
col
)

Get a data type descriptor that describes the desired type for the specified column.

public ExecRow
getNextRowCore()

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

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

Return the requested values computed from the next row (if any) for which the restriction evaluates to true.

public RowLocation

Returns:

the row location of the current cursor row.
getRowLocation
()

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getRowLocation.

Gets information from its source.

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
markRowAsDeleted()

Overrides org.apache.derby.impl.sql.execute.NoPutResultSetImpl.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 static DataValueDescriptor
normalizeColumn(DataTypeDescriptor
Data type to coerce to
dtd
,
ExecRow
row holding the source column
sourceRow
,
int
position of column in row
sourceColumnPosition
,
DataValueDescriptor
where to stuff the coerced value
resultCol
,
ResultDescription
Additional metadata for error reporting if necessary
desc
)

Normalize a column.

private ExecRow

Returns:

The normalized row
normalizeRow
(ExecRow
The row to normalize
sourceRow
)

Normalize a row.

public void
public void
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
)

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

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.NoPutResultSetImpl:
clearCurrentRowclearOrderableCachecloseRowSourcegetCursorNamegetNextRowFromRowSourcegetResultDescriptiongetValidColumnsisForUpdateneedsRowLocationneedsRowLocationForDeferredCheckConstraintsneedsToCloneoffendingRowLocationpositionScanAtRowLocationprintQualifiersresultSetNumberrowLocationsetCurrentRowsetHasDeferrableCheckssetNeedsRowLocationsetTargetResultSetskipRowskipScanunpackHashValue

Field Detail

cachedDestinationsback to summary
private final DataValueDescriptor[] cachedDestinations

This array contains data value descriptors that can be used (and reused) by normalizeRow() to hold the normalized column values.

desiredTypesback to summary
private DataTypeDescriptor[] desiredTypes
normalizedRowback to summary
private ExecRow normalizedRow
numColsback to summary
private int numCols
resultDescriptionback to summary
private ResultDescription resultDescription

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

sourceback to summary
public NoPutResultSet source
startColback to summary
private int startCol

Constructor Detail

NormalizeResultSetback to summary
public NormalizeResultSet(NoPutResultSet source, Activation activation, int resultSetNumber, int erdNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost, boolean forUpdate) throws StandardException

Constructor for a NormalizeResultSet

Parameters
source:NoPutResultSet

The NoPutResultSet from which to get rows to be normalized

activation:Activation

The activation for this execution

resultSetNumber:int

The resultSetNumber

erdNumber:int

The integer for the ResultDescription

Exceptions
StandardException:
on error

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
computeStartColumnback to summary
public static int computeStartColumn(boolean isUpdate, ResultDescription desc)

Compute the start column for an update/insert.

Parameters
isUpdate:boolean

True if we are executing an UPDATE statement

desc:ResultDescription

Metadata describing a result row

fetchResultTypesback to summary
private DataTypeDescriptor[] fetchResultTypes(ResultDescription desc)

Fetch the result datatypes out of the activation.

getCachedDestinationback to summary
private DataValueDescriptor getCachedDestination(int col) throws StandardException

Get a cached data value descriptor that can receive the normalized value of the specified column.

Parameters
col:int

the column number (1-based)

Returns:DataValueDescriptor

a data value descriptor of the correct type for the column

Exceptions
StandardException:
if a new data value descriptor cannot be created
getCurrentRowback to summary
public ExecRow getCurrentRow()

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getCurrentRow.

Gets information from last getNextRow call.

Returns:ExecRow

the last row returned.

See Also
CursorResultSet
getDesiredTypeback to summary
private DataTypeDescriptor getDesiredType(int col)

Get a data type descriptor that describes the desired type for the specified column.

Parameters
col:int

the column number (1-based)

Returns:DataTypeDescriptor

a data type descriptor for the column

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.

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

Return the requested values computed from the next row (if any) for which the restriction evaluates to true.

restriction and projection parameters are evaluated for each row.

Returns:ExecRow

the next row in the result

Exceptions
StandardException:
thrown on failure
getRowLocationback to summary
public RowLocation getRowLocation() throws StandardException

Implements org.apache.derby.iapi.sql.execute.CursorResultSet.getRowLocation.

Gets information from its source. We might want to have this take a CursorResultSet in its constructor some day, instead of doing a cast here?

Returns:RowLocation

the row location of the current cursor row.

Exceptions
StandardException:
thrown on failure
See Also
CursorResultSet
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).

markRowAsDeletedback to summary
public void markRowAsDeleted() throws StandardException

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

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
NoPutResultSet#markRowAsDeleted
normalizeColumnback to summary
public static DataValueDescriptor normalizeColumn(DataTypeDescriptor dtd, ExecRow sourceRow, int sourceColumnPosition, DataValueDescriptor resultCol, ResultDescription desc) throws StandardException

Normalize a column. For now, this means calling constructors through the type services to normalize a type to itself. For example, if you're putting a char(30) value into a char(15) column, it calls a SQLChar constructor with the char(30) value, and the constructor truncates the value and makes sure that no non-blank characters are truncated.

Parameters
dtd:DataTypeDescriptor

Data type to coerce to

sourceRow:ExecRow

row holding the source column

sourceColumnPosition:int

position of column in row

resultCol:DataValueDescriptor

where to stuff the coerced value

desc:ResultDescription

Additional metadata for error reporting if necessary

Exceptions
StandardException:
thrown on failure
normalizeRowback to summary
private ExecRow normalizeRow(ExecRow sourceRow) throws StandardException

Normalize a row.

Parameters
sourceRow:ExecRow

The row to normalize

Returns:ExecRow

The normalized row

Exceptions
StandardException:
thrown on failure
openCoreback to summary
public void openCore() throws StandardException

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

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

Exceptions
StandardException:
thrown on failure
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.
updateRowback to summary
public void updateRow(ExecRow row, RowChanger rowChanger) throws StandardException

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

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
NoPutResultSet#updateRow