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

pack-priv Class VTIResultSet

extends NoPutResultSetImpl
implements CursorResultSet, VTIEnvironment
Class Inheritance
All Implemented Interfaces
org.apache.derby.vti.VTIEnvironment, org.apache.derby.iapi.sql.execute.CursorResultSet, org.apache.derby.iapi.sql.ResultSet
Imports
org.apache.derby.catalog.TypeDescriptor, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.iapi.sql.execute.CursorResultSet, .ExecPreparedStatement, .ExecRow, .ExecRowBuilder, .NoPutResultSet, .ExecutionContext, org.apache.derby.iapi.sql.Activation, .ParameterValueSet, org.apache.derby.iapi.types.TypeId, .DataTypeDescriptor, .DataValueDescriptor, .VariableSizeDataValue, .RowLocation, org.apache.derby.iapi.store.access.Qualifier, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.services.loader.GeneratedMethod, org.apache.derby.iapi.transaction.TransactionControl, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.iapi.services.io.FormatableBitSet, .FormatableHashtable, org.apache.derby.vti.DeferModification, .IFastPath, .VTIEnvironment, .AwareVTI, .RestrictedVTI, .Restriction, .VTIContext, java.sql.PreparedStatement, .ResultSet, .SQLException, .SQLWarning, .ResultSetMetaData, org.w3c.dom.Element

Field Summary

Modifier and TypeField and Description
private final ExecRow
private final FormatableHashtable
private GeneratedMethod
private IFastPath
private boolean
private boolean
public String
private boolean
private Qualifier[][]
private FormatableBitSet
private DataTypeDescriptor[]
private final TypeDescriptor
private boolean
public int
private boolean[]
private int
scanIsolationLevel

Specified isolation level of SELECT (scan).

private PreparedStatement
private ResultSet
private boolean
private String
private String[]
private Restriction
private String
Inherited from org.apache.derby.impl.sql.execute.NoPutResultSetImpl:
checkNullColsclonedExecRowcncLenresultSetNumbertargetResultSet

Constructor Summary

AccessConstructor and Description
pack-priv
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)

Method Summary

Modifier and TypeMethod and Description
private void
cast(DataTypeDescriptor dtd, DataValueDescriptor dvd)

Cast the value coming out of the user-coded ResultSet.

private void
castDecimal(DataTypeDescriptor dtd, DataValueDescriptor dvd)

Set the correct precision and scale for a decimal value.

private void
castLongvarbinary(DataTypeDescriptor dtd, DataValueDescriptor dvd)

Truncate long varbinary values to the legal maximum.

private void
castLongvarchar(DataTypeDescriptor dtd, DataValueDescriptor dvd)

Truncate long varchars to the legal maximum.

private Restriction
cloneRestriction(Activation activation)

Clone the restriction for a Restricted VTI, filling in parameter values as necessary.

private Restriction
cloneRestriction(Activation activation, Restriction original)

public void
close()

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

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

Tells the system that there will be no more calls to getNextRow() (until the next open() call), so it can free up the resources associated with the ResultSet.

public void
finish()

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

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

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 ExecRow

Returns:

The cached ExecRow for this ResultSet
getAllocatedRow
()

Cache the ExecRow for this result set.

public ExecRow

Returns:

a null.
getCurrentRow
()

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

This is not used in positioned update and delete, so just return a null.

public ExecRow
getNextRowCore()

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

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

If open and not returned yet, returns the row after plugging the parameters into the expressions.

public final String
getOriginalSQL()

Implements org.apache.derby.vti.VTIEnvironment.getOriginalSQL.

Return the SQL text of the original SQL statement.

private int[]
private DataTypeDescriptor[]
getReturnColumnTypes()

Get the types of the columns returned by a Derby-style table function.

public RowLocation

Returns:

a null.
getRowLocation
()

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

This is not operating against a stored table, so it has no row location to report.

public final int
public Object
getSharedState(String
Key into a cache of context variables
key
)

Implements org.apache.derby.vti.VTIEnvironment.getSharedState.

Get an object associated with a key from set of objects maintained with the statement plan.

public final int
getStatementIsolationLevel()

Implements org.apache.derby.vti.VTIEnvironment.getStatementIsolationLevel.

Get the specific JDBC isolation of the statement.

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

pack-priv GeneratedMethod

Returns:

The GeneratedMethod for instantiating the VTI.
getVTIConstructor
()

Return the GeneratedMethod for instantiating the VTI.

public final boolean
isCompileTime()

Implements org.apache.derby.vti.VTIEnvironment.isCompileTime.

Return true if this instance of the Table Function has been created for compilation, false if it is for runtime execution.

pack-priv boolean
public void
public void
public void
reopenCore()

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

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

private boolean[]
public final void
setSharedState(String
Key into a cache of context variables
key
,
Serializable
Value to associate with the key
value
)

Implements org.apache.derby.vti.VTIEnvironment.setSharedState.

Saves an object associated with a key that will be maintained for the lifetime of the statement plan.

public Element
toXML(Element
Node to put content into.
parentNode
,
String
Element tag for content
tag
)

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

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

Produce an xml image of this ResultSet and its descendant ResultSets.

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

Field Detail

allocatedRowback to summary
private final ExecRow allocatedRow
compileTimeConstantsback to summary
private final FormatableHashtable compileTimeConstants
constructorback to summary
private GeneratedMethod constructor
fastPathback to summary
private IFastPath fastPath
isDerbyStyleTableFunctionback to summary
private boolean isDerbyStyleTableFunction
isTargetback to summary
private boolean isTarget
javaClassNameback to summary
public String javaClassName
pushedProjectionback to summary
private boolean pushedProjection
pushedQualifiersback to summary
private Qualifier[][] pushedQualifiers
referencedColumnsback to summary
private FormatableBitSet referencedColumns
returnColumnTypesback to summary
private DataTypeDescriptor[] returnColumnTypes
returnTypeback to summary
private final TypeDescriptor returnType
reuseablePsback to summary
private boolean reuseablePs
rowsReturnedback to summary
public int rowsReturned
runtimeNullableColumnback to summary
private boolean[] runtimeNullableColumn
scanIsolationLevelback to summary
private int scanIsolationLevel

Specified isolation level of SELECT (scan). If not set or not application, it will be set to TransactionControl.UNSPECIFIED_ISOLATION_LEVEL

userPSback to summary
private PreparedStatement userPS
userVTIback to summary
private ResultSet userVTI
version2back to summary
private boolean version2
vtiNameback to summary
private String vtiName
vtiProjectionback to summary
private String[] vtiProjection
vtiRestrictionback to summary
private Restriction vtiRestriction
vtiSchemaback to summary
private String vtiSchema

Constructor Detail

VTIResultSetback to summary
pack-priv 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

Method Detail

castback to summary
private void cast(DataTypeDescriptor dtd, DataValueDescriptor dvd) throws StandardException

Cast the value coming out of the user-coded ResultSet. The rules are described in CastNode.getDataValueConversion().

castDecimalback to summary
private void castDecimal(DataTypeDescriptor dtd, DataValueDescriptor dvd) throws StandardException

Set the correct precision and scale for a decimal value.

castLongvarbinaryback to summary
private void castLongvarbinary(DataTypeDescriptor dtd, DataValueDescriptor dvd) throws StandardException

Truncate long varbinary values to the legal maximum.

castLongvarcharback to summary
private void castLongvarchar(DataTypeDescriptor dtd, DataValueDescriptor dvd) throws StandardException

Truncate long varchars to the legal maximum.

cloneRestrictionback to summary
private Restriction cloneRestriction(Activation activation) throws StandardException

Clone the restriction for a Restricted VTI, filling in parameter values as necessary.

cloneRestrictionback to summary
private Restriction cloneRestriction(Activation activation, Restriction original) throws StandardException
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.

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

Tells the system that there will be no more calls to getNextRow() (until the next open() call), so it can free up the resources associated with the ResultSet.

Exceptions
StandardException:
thrown on error
See Also
org.apache.derby.iapi.sql.ResultSet#close
finishback to summary
public void finish() throws StandardException

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

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

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

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(). Will close the result set if it is not already closed.

Exceptions
StandardException:
on error
getAllocatedRowback to summary
private ExecRow getAllocatedRow() throws StandardException

Cache the ExecRow for this result set.

Returns:ExecRow

The cached ExecRow for this ResultSet

Exceptions
StandardException:
thrown on failure.
getCurrentRowback to summary
public ExecRow getCurrentRow()

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

This is not used in positioned update and delete, so just return a null.

Returns:ExecRow

a null.

See Also
CursorResultSet
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.

If open and not returned yet, returns the row after plugging the parameters into the expressions.

Returns:ExecRow

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

the next row in the result

Exceptions
StandardException:
thrown on failure.
getOriginalSQLback to summary
public final String getOriginalSQL()

Implements org.apache.derby.vti.VTIEnvironment.getOriginalSQL.

Doc from org.apache.derby.vti.VTIEnvironment.getOriginalSQL.

Return the SQL text of the original SQL statement.

Returns:String

the SQL text of the original SQL statement

getProjectedColListback to summary
private int[] getProjectedColList()
getReturnColumnTypesback to summary
private DataTypeDescriptor[] getReturnColumnTypes() throws StandardException

Get the types of the columns returned by a Derby-style table function.

getRowLocationback to summary
public RowLocation getRowLocation()

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

This is not operating against a stored table, so it has no row location to report.

Returns:RowLocation

a null.

See Also
CursorResultSet
getScanIsolationLevelback to summary
public final int getScanIsolationLevel()

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

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

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

Return the isolation level of the scan in the result set. Only expected to be called for those ResultSets that contain a scan.

Returns:int

The isolation level of the scan (in TransactionController constants).

getSharedStateback to summary
public Object getSharedState(String key)

Implements org.apache.derby.vti.VTIEnvironment.getSharedState.

Doc from org.apache.derby.vti.VTIEnvironment.getSharedState.

Get an object associated with a key from set of objects maintained with the statement plan.

Parameters
key:String

Key into a cache of context variables

Returns:Object

the value associated with the key

getStatementIsolationLevelback to summary
public final int getStatementIsolationLevel()

Implements org.apache.derby.vti.VTIEnvironment.getStatementIsolationLevel.

Doc from org.apache.derby.vti.VTIEnvironment.getStatementIsolationLevel.

Get 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.

Returns:int

the specific JDBC isolation of the statement

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).

getVTIConstructorback to summary
pack-priv GeneratedMethod getVTIConstructor()

Return the GeneratedMethod for instantiating the VTI.

Returns:GeneratedMethod

The GeneratedMethod for instantiating the VTI.

isCompileTimeback to summary
public final boolean isCompileTime()

Implements org.apache.derby.vti.VTIEnvironment.isCompileTime.

Doc from org.apache.derby.vti.VTIEnvironment.isCompileTime.

Return true if this instance of the Table Function has been created for compilation, false if it is for runtime execution.

Returns:boolean

true if this instance of the Table Function has been created for compilation

isReuseablePsback to summary
pack-priv boolean isReuseablePs()
openCoreback to summary
public void openCore() throws StandardException

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

Sets state to 'open'.

Exceptions
StandardException:
thrown if activation closed.
populateFromResultSetback to summary
public void populateFromResultSet(ExecRow row) throws StandardException
Exceptions
StandardException:
thrown on failure to open
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.

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

Exceptions
StandardException:
thrown if cursor finished.
See Also
NoPutResultSet#openCore
setNullableColumnListback to summary
private boolean[] setNullableColumnList() throws SQLException, StandardException
setSharedStateback to summary
public final void setSharedState(String key, Serializable value)

Implements org.apache.derby.vti.VTIEnvironment.setSharedState.

Doc from org.apache.derby.vti.VTIEnvironment.setSharedState.

Saves an object associated with a key that will be maintained for the lifetime of the statement plan. Any previous value associated with the key is discarded. Any saved object can be seen by any JDBC Connection that has a Statement object that references the same statement plan.

Parameters
key:String

Key into a cache of context variables

value:Serializable

Value to associate with the key

toXMLback to summary
public Element toXML(Element parentNode, String tag) throws Exception

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

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

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

Produce an xml image of this ResultSet and its descendant ResultSets. Appends an element to the parentNode and returns the appended element.

Parameters
parentNode:Element

Node to put content into.

tag:String

Element tag for content

Returns:Element

the content as an element with the given tag name

Exceptions
Exception:
on error