Class VTIResultSet
java.lang.Object
org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl
org.apache.derby.impl.sql.execute.NoPutResultSetImpl
org.apache.derby.impl.sql.execute.VTIResultSet
- All Implemented Interfaces:
CursorResultSet, NoPutResultSet, ResultSet, RowLocationRetRowSource, RowSource, VTIEnvironment
-
Nested Class Summary
Nested classes/interfaces inherited from class BasicNoPutResultSetImpl
BasicNoPutResultSetImpl.FieldComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ExecRowprivate final FormatableHashtableprivate GeneratedMethodprivate IFastPathprivate booleanprivate booleanprivate booleanprivate Qualifier[][]private FormatableBitSetprivate DataTypeDescriptor[]private final TypeDescriptorprivate booleanintprivate boolean[]private intSpecified isolation level of SELECT (scan).private PreparedStatementprivate ResultSetprivate booleanprivate Stringprivate String[]private Restrictionprivate StringFields inherited from class NoPutResultSetImpl
checkNullCols, clonedExecRow, cncLen, resultSetNumber, targetResultSetFields inherited from class BasicNoPutResultSetImpl
activation, beginTime, closeTime, compactRow, constructorTime, currentRow, endExecutionTime, finished, isOpen, isTopResultSet, nextTime, numOpens, openTime, optimizerEstimatedCost, optimizerEstimatedRowCount, resultDescription, rowsFiltered, rowsSeen, startExecutionTime, subqueryTrackingArrayFields inherited from interface NoPutResultSet
ABSOLUTE, FIRST, LAST, NEXT, PREVIOUS, RELATIVE, TEMPORARY_RESULT_SET_NUMBERFields inherited from interface ResultSet
CURRENT_RESULTSET_ONLY, ENTIRE_RESULTSET_TREE, ISAFTERLAST, ISBEFOREFIRST, ISFIRST, ISLAST -
Constructor Summary
ConstructorsConstructorDescriptionVTIResultSet(Activation activation, int row, int resultSetNumber, GeneratedMethod constructor, String javaClassName, Qualifier[][] pushedQualifiers, int erdNumber, boolean version2, boolean reuseablePs, int ctcNumber, boolean isTarget, int scanIsolationLevel, double optimizerEstimatedRowCount, double optimizerEstimatedCost, boolean isDerbyStyleTableFunction, int returnTypeNumber, int vtiProjectionNumber, int vtiRestrictionNumber, String vtiSchema, String vtiName) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcast(DataTypeDescriptor dtd, DataValueDescriptor dvd) Cast the value coming out of the user-coded ResultSet.private voidcastDecimal(DataTypeDescriptor dtd, DataValueDescriptor dvd) Set the correct precision and scale for a decimal value.private voidTruncate long varbinary values to the legal maximum.private voidTruncate long varchars to the legal maximum.private RestrictioncloneRestriction(Activation activation) Clone the restriction for a Restricted VTI, filling in parameter values as necessary.private RestrictioncloneRestriction(Activation activation, Restriction original) voidclose()Close needs to invalidate any dependent statements, if this is a cursor.voidfinish()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().private ExecRowCache the ExecRow for this result set.This is not used in positioned update and delete, so just return a null.If open and not returned yet, returns the row after plugging the parameters into the expressions.final StringReturn the SQL text of the original SQL statement.private int[]private DataTypeDescriptor[]Get the types of the columns returned by a Derby-style table function.This is not operating against a stored table, so it has no row location to report.final intReturn the isolation level of the scan in the result set.getSharedState(String key) Get an object associated with a key from set of objects maintained with the statement plan.final intGet the specific JDBC isolation of the statement.longgetTimeSpent(int type) Return the total amount of time spent in this ResultSet(package private) GeneratedMethodReturn the GeneratedMethod for instantiating the VTI.final booleanReturn true if this instance of the Table Function has been created for compilation, false if it is for runtime execution.(package private) booleanvoidopenCore()Sets state to 'open'.voidvoidIf the VTI is a version2 vti that does not need to be instantiated multiple times then we simply close the current ResultSet and create a new one via a call to PreparedStatement.executeQuery().private boolean[]final voidsetSharedState(String key, Serializable value) Saves an object associated with a key that will be maintained for the lifetime of the statement plan.Produce an xml image of this ResultSet and its descendant ResultSets.Methods inherited from class NoPutResultSetImpl
clearCurrentRow, clearOrderableCache, closeRowSource, getCursorName, getNextRowFromRowSource, getResultDescription, getValidColumns, isForUpdate, markRowAsDeleted, needsRowLocation, needsRowLocationForDeferredCheckConstraints, needsToClone, offendingRowLocation, positionScanAtRowLocation, printQualifiers, resultSetNumber, rowLocation, setCurrentRow, setHasDeferrableChecks, setNeedsRowLocation, setTargetResultSet, skipRow, skipScan, unpackHashValue, updateRowMethods inherited from class BasicNoPutResultSetImpl
addWarning, attachStatementContext, checkCancellationFlag, checkRowPosition, childrenToXML, cleanUp, dumpTimeStats, finishAndRTS, getAbsoluteRow, getActivation, getAutoGeneratedKeysResultset, getBeginExecutionTimestamp, getCompactRow, getCurrentTimeMillis, getElapsedMillis, getEndExecutionTimestamp, getEstimatedRowCount, getExecuteTime, getExecutionFactory, getFirstRow, getLanguageConnectionContext, getLastRow, getNextRow, getPointOfAttachment, getPreviousRow, getRelativeRow, getRowNumber, getSubqueryTrackingArray, getTransactionController, getWarnings, isClosed, isXplainOnlyMode, markAsTopResultSet, modifiedRowCount, open, recordConstructorTime, requiresRelocking, returnsRows, setAfterLastRow, setBeforeFirstRow, setCompactRow, setCompatRow, toXMLMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ResultSet
addWarning, 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 Details
-
rowsReturned
public int rowsReturned -
javaClassName
-
constructor
-
userPS
-
userVTI
-
allocatedRow
-
referencedColumns
-
version2
private boolean version2 -
reuseablePs
private boolean reuseablePs -
isTarget
private boolean isTarget -
compileTimeConstants
-
pushedProjection
private boolean pushedProjection -
fastPath
-
pushedQualifiers
-
runtimeNullableColumn
private boolean[] runtimeNullableColumn -
isDerbyStyleTableFunction
private boolean isDerbyStyleTableFunction -
returnType
-
returnColumnTypes
-
vtiProjection
-
vtiRestriction
-
vtiSchema
-
vtiName
-
scanIsolationLevel
private int scanIsolationLevelSpecified isolation level of SELECT (scan). If not set or not application, it will be set to TransactionControl.UNSPECIFIED_ISOLATION_LEVEL
-
-
Constructor Details
-
VTIResultSet
VTIResultSet(Activation activation, int row, int resultSetNumber, GeneratedMethod constructor, String javaClassName, Qualifier[][] pushedQualifiers, int erdNumber, boolean version2, boolean reuseablePs, int ctcNumber, boolean isTarget, int scanIsolationLevel, double optimizerEstimatedRowCount, double optimizerEstimatedCost, boolean isDerbyStyleTableFunction, int returnTypeNumber, int vtiProjectionNumber, int vtiRestrictionNumber, String vtiSchema, String vtiName) throws StandardException - Throws:
StandardException
-
-
Method Details
-
openCore
Sets state to 'open'.- Specified by:
openCorein interfaceNoPutResultSet- Throws:
StandardException- thrown if activation closed.
-
cloneRestriction
Clone the restriction for a Restricted VTI, filling in parameter values as necessary.- Throws:
StandardException
-
cloneRestriction
private Restriction cloneRestriction(Activation activation, Restriction original) throws StandardException - Throws:
StandardException
-
setNullableColumnList
- Throws:
SQLExceptionStandardException
-
reopenCore
If the VTI is a version2 vti that does not need to be instantiated multiple times then we simply close the current ResultSet and create a new one via a call to PreparedStatement.executeQuery().- Specified by:
reopenCorein interfaceNoPutResultSet- Overrides:
reopenCorein classBasicNoPutResultSetImpl- Throws:
StandardException- thrown if cursor finished.- See Also:
-
getNextRowCore
If open and not returned yet, returns the row after plugging the parameters into the expressions.- Specified by:
getNextRowCorein interfaceNoPutResultSet- Specified by:
getNextRowCorein classBasicNoPutResultSetImpl- Returns:
- the next row in the result
- Throws:
StandardException- thrown on failure.- See Also:
-
close
Description copied from class:NoPutResultSetImplClose needs to invalidate any dependent statements, if this is a cursor. Must be called by any subclasses that override close().- Specified by:
closein interfaceResultSet- Overrides:
closein classNoPutResultSetImpl- Throws:
StandardException- thrown on error- See Also:
-
finish
Description copied from interface:ResultSetTells 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:
finishin interfaceResultSet- Overrides:
finishin classBasicNoPutResultSetImpl- Throws:
StandardException- 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
This is not operating against a stored table, so it has no row location to report.- Specified by:
getRowLocationin interfaceCursorResultSet- Returns:
- a null.
- See Also:
-
getCurrentRow
This is not used in positioned update and delete, so just return a null.- Specified by:
getCurrentRowin interfaceCursorResultSet- Returns:
- a null.
- See Also:
-
getVTIConstructor
GeneratedMethod getVTIConstructor()Return the GeneratedMethod for instantiating the VTI.- Returns:
- The GeneratedMethod for instantiating the VTI.
-
isReuseablePs
boolean isReuseablePs() -
getAllocatedRow
Cache the ExecRow for this result set.- Returns:
- The cached ExecRow for this ResultSet
- Throws:
StandardException- thrown on failure.
-
getProjectedColList
private int[] getProjectedColList() -
populateFromResultSet
- Throws:
StandardException- thrown on failure to open
-
getScanIsolationLevel
public final int getScanIsolationLevel()Description copied from interface:NoPutResultSetReturn the isolation level of the scan in the result set. Only expected to be called for those ResultSets that contain a scan.- Specified by:
getScanIsolationLevelin interfaceNoPutResultSet- Overrides:
getScanIsolationLevelin classBasicNoPutResultSetImpl- Returns:
- The isolation level of the scan (in TransactionController constants).
- See Also:
-
isCompileTime
public final boolean isCompileTime()Description copied from interface:VTIEnvironmentReturn true if this instance of the Table Function has been created for compilation, false if it is for runtime execution.- Specified by:
isCompileTimein interfaceVTIEnvironment
-
getOriginalSQL
Description copied from interface:VTIEnvironmentReturn the SQL text of the original SQL statement.- Specified by:
getOriginalSQLin interfaceVTIEnvironment
-
getStatementIsolationLevel
public final int getStatementIsolationLevel()Description copied from interface:VTIEnvironmentGet the specific JDBC isolation of the statement. If it returns Connection.TRANSACTION_NONE then no isolation was specified and the connection's isolation level is implied.- Specified by:
getStatementIsolationLevelin interfaceVTIEnvironment
-
getReturnColumnTypes
Get the types of the columns returned by a Derby-style table function.
- Throws:
StandardException
-
cast
Cast the value coming out of the user-coded ResultSet. The rules are described in CastNode.getDataValueConversion().
- Throws:
StandardException
-
castLongvarchar
private void castLongvarchar(DataTypeDescriptor dtd, DataValueDescriptor dvd) throws StandardException Truncate long varchars to the legal maximum.
- Throws:
StandardException
-
castLongvarbinary
private void castLongvarbinary(DataTypeDescriptor dtd, DataValueDescriptor dvd) throws StandardException Truncate long varbinary values to the legal maximum.
- Throws:
StandardException
-
castDecimal
Set the correct precision and scale for a decimal value.
- Throws:
StandardException
-
toXML
Description copied from interface:ResultSetProduce an xml image of this ResultSet and its descendant ResultSets. Appends an element to the parentNode and returns the appended element.
- Specified by:
toXMLin interfaceResultSet- Overrides:
toXMLin classBasicNoPutResultSetImpl- Parameters:
parentNode- Node to put content into.tag- Element tag for content- Returns:
- the content as an element with the given tag name
- Throws:
Exception
-