Class NormalizeResultSet
- java.lang.Object
-
- org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
-
- org.apache.derby.impl.sql.execute.NoPutResultSetImpl
-
- org.apache.derby.impl.sql.execute.NormalizeResultSet
-
- All Implemented Interfaces:
CursorResultSet,NoPutResultSet,ResultSet,RowLocationRetRowSource,RowSource
class NormalizeResultSet extends NoPutResultSetImpl implements CursorResultSet
Cast the rows from the source result set to match the format of the result set for the entire statement.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator
-
-
Field Summary
Fields Modifier and Type Field Description private DataValueDescriptor[]cachedDestinationsThis array contains data value descriptors that can be used (and reused) by normalizeRow() to hold the normalized column values.private DataTypeDescriptor[]desiredTypesprivate ExecRownormalizedRowprivate intnumColsprivate ResultDescriptionresultDescriptionNoPutResultSetsourceprivate intstartCol-
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, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArray
-
Fields inherited from interface org.apache.derby.iapi.sql.execute.NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBER
-
Fields inherited from interface org.apache.derby.iapi.sql.ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST
-
-
Constructor Summary
Constructors Constructor Description NormalizeResultSet(NoPutResultSet source, Activation activation, int resultSetNumber, int erdNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost, boolean forUpdate)Constructor for a NormalizeResultSet
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()If the result set has been opened, close the open scan.static intcomputeStartColumn(boolean isUpdate, ResultDescription desc)Compute the start column for an update/insert.private DataTypeDescriptor[]fetchResultTypes(ResultDescription desc)Fetch the result datatypes out of the activation.private DataValueDescriptorgetCachedDestination(int col)Get a cached data value descriptor that can receive the normalized value of the specified column.ExecRowgetCurrentRow()Gets information from last getNextRow call.private DataTypeDescriptorgetDesiredType(int col)Get a data type descriptor that describes the desired type for the specified column.ExecRowgetNextRowCore()Return the requested values computed from the next row (if any) for which the restriction evaluates to true.RowLocationgetRowLocation()Gets information from its source.longgetTimeSpent(int type)Return the total amount of time spent in this ResultSetvoidmarkRowAsDeleted()Marks the resultSet's currentRow as deleted after a delete has been issued by either by using positioned delete or JDBC's deleteRow method.static DataValueDescriptornormalizeColumn(DataTypeDescriptor dtd, ExecRow sourceRow, int sourceColumnPosition, DataValueDescriptor resultCol, ResultDescription desc)Normalize a column.private ExecRownormalizeRow(ExecRow sourceRow)Normalize a row.voidopenCore()open a scan on the source. scan parameters are evaluated at each open, so there is probably some way of altering their values...voidreopenCore()reopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...voidupdateRow(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, needsRowLocationForDeferredCheckConstraints, needsToClone, offendingRowLocation, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setHasDeferrableChecks, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan, unpackHashValue
-
Methods inherited from class org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
addWarning, attachStatementContext, checkCancellationFlag, checkRowPosition, childrenToXML, cleanUp, dumpTimeStats, finish, 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, isXplainOnlyMode, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow, toXML, toXML
-
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
addWarning, checkRowPosition, cleanUp, clearCurrentRow, finish, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCursorName, getEndExecutionTimestamp, getExecuteTime, getFirstRow, getLastRow, getNextRow, getPreviousRow, getRelativeRow, getResultDescription, getRowNumber, getSubqueryTrackingArray, getWarnings, isClosed, modifiedRowCount, open, returnsRows, setAfterLastRow, setBeforeFirstRow, toXML
-
-
-
-
Field Detail
-
source
public NoPutResultSet source
-
normalizedRow
private ExecRow normalizedRow
-
numCols
private int numCols
-
startCol
private int startCol
-
cachedDestinations
private final DataValueDescriptor[] cachedDestinations
This array contains data value descriptors that can be used (and reused) by normalizeRow() to hold the normalized column values.
-
resultDescription
private ResultDescription resultDescription
-
desiredTypes
private DataTypeDescriptor[] desiredTypes
-
-
Constructor Detail
-
NormalizeResultSet
public NormalizeResultSet(NoPutResultSet source, Activation activation, int resultSetNumber, int erdNumber, double optimizerEstimatedRowCount, double optimizerEstimatedCost, boolean forUpdate) throws StandardException
Constructor for a NormalizeResultSet- Parameters:
source- The NoPutResultSet from which to get rows to be normalizedactivation- The activation for this executionresultSetNumber- The resultSetNumbererdNumber- The integer for the ResultDescription- Throws:
StandardException- on error
-
-
Method Detail
-
openCore
public void openCore() throws StandardExceptionopen a scan on the source. scan parameters are evaluated at each open, so there is probably some way of altering their values...- Specified by:
openCorein interfaceNoPutResultSet- Throws:
StandardException- thrown on failure
-
reopenCore
public void reopenCore() throws StandardExceptionreopen a scan on the table. scan parameters are evaluated at each open, so there is probably some way of altering their values...- Specified by:
reopenCorein interfaceNoPutResultSet- Overrides:
reopenCorein classBasicNoPutResultSetImpl- Throws:
StandardException- thrown if cursor finished.- See Also:
NoPutResultSet.openCore()
-
getNextRowCore
public ExecRow getNextRowCore() throws StandardException
Description copied from interface:NoPutResultSetReturn 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.
- Specified by:
getNextRowCorein interfaceNoPutResultSet- Specified by:
getNextRowCorein classBasicNoPutResultSetImpl- Returns:
- the next row in the result
- Throws:
StandardException- thrown on failure- See Also:
NoPutResultSet.getNextRowCore()
-
close
public void close() throws StandardExceptionIf the result set has been opened, close the open scan.- Specified by:
closein interfaceResultSet- Overrides:
closein classNoPutResultSetImpl- Throws:
StandardException- thrown on error
-
getTimeSpent
public long getTimeSpent(int type)
Return the total amount of time spent in this ResultSet- Specified by:
getTimeSpentin interfaceResultSet- 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() throws StandardException
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?- Specified by:
getRowLocationin interfaceCursorResultSet- Returns:
- the row location of the current cursor row.
- Throws:
StandardException- thrown on failure- See Also:
CursorResultSet
-
getCurrentRow
public ExecRow getCurrentRow()
Gets information from last getNextRow call.- Specified by:
getCurrentRowin interfaceCursorResultSet- Returns:
- the last row returned.
- See Also:
CursorResultSet
-
computeStartColumn
public static int computeStartColumn(boolean isUpdate, ResultDescription desc)Compute the start column for an update/insert.
- Parameters:
isUpdate- True if we are executing an UPDATE statementdesc- Metadata describing a result row
-
normalizeColumn
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- Data type to coerce tosourceRow- row holding the source columnsourceColumnPosition- position of column in rowresultCol- where to stuff the coerced valuedesc- Additional metadata for error reporting if necessary- Throws:
StandardException- thrown on failure
-
normalizeRow
private ExecRow normalizeRow(ExecRow sourceRow) throws StandardException
Normalize a row.- Parameters:
sourceRow- The row to normalize- Returns:
- The normalized row
- Throws:
StandardException- thrown on failure
-
getCachedDestination
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- the column number (1-based)- Returns:
- a data value descriptor of the correct type for the column
- Throws:
StandardException- if a new data value descriptor cannot be created
-
getDesiredType
private DataTypeDescriptor getDesiredType(int col)
Get a data type descriptor that describes the desired type for the specified column.- Parameters:
col- the column number (1-based)- Returns:
- a data type descriptor for the column
-
fetchResultTypes
private DataTypeDescriptor[] fetchResultTypes(ResultDescription desc)
Fetch the result datatypes out of the activation.
-
updateRow
public void updateRow(ExecRow row, RowChanger rowChanger) throws StandardException
Description copied from interface:NoPutResultSetUpdates 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:
updateRowin interfaceNoPutResultSet- Overrides:
updateRowin classNoPutResultSetImpl- Parameters:
row- new values for the currentRowrowChanger- 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 StandardExceptionDescription copied from interface:NoPutResultSetMarks 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:
markRowAsDeletedin interfaceNoPutResultSet- Overrides:
markRowAsDeletedin classNoPutResultSetImpl- Throws:
StandardException- thrown on failure.- See Also:
NoPutResultSet.markRowAsDeleted()
-
-