Top Description Fields Constructors Methods
org.apache.derby.diag

public final Class StatementCache

extends VTITemplate
Class Inheritance
Imports
java.sql.ResultSetMetaData, .Timestamp, .Types, java.util.Collection, .Iterator, .Vector, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.reference.Limits, org.apache.derby.iapi.services.cache.CacheManager, org.apache.derby.iapi.services.context.Context, .ContextService, org.apache.derby.iapi.sql.ResultColumnDescriptor, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, org.apache.derby.iapi.util.StringUtil, org.apache.derby.impl.jdbc.EmbedResultSetMetaData, org.apache.derby.impl.sql.GenericPreparedStatement, .GenericStatement, org.apache.derby.impl.sql.conn.CachedStatement, org.apache.derby.vti.VTITemplate

StatementCache is a virtual table that shows the contents of the SQL statement cache. This virtual table can be invoked by calling it directly.
 select * from new org.apache.derby.diag.StatementCache() t

The StatementCache virtual table has the following columns:

The internal identifier of a cached statement matches the toString() method of a PreparedStatement object for a Derby database.

This class also provides a static method to empty the statement cache, StatementCache.emptyCache()

Field Summary

Modifier and TypeField and Description
private static final ResultColumnDescriptor[]
private GenericPreparedStatement
private Vector<GenericPreparedStatement>
private static final ResultSetMetaData
private int
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.sql.ResultSet.close.

Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.

public boolean
getBoolean(int
the first column is 1, the second is 2, ...
colId
)

Overrides org.apache.derby.vti.VTITemplate.getBoolean.

Implements java.sql.ResultSet.getBoolean.

Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.

private static Context
getContextOrNull(final String contextID)

Must be private so that user code can't call this entry point.

public ResultSetMetaData
getMetaData()

Overrides org.apache.derby.vti.VTITemplate.getMetaData.

Implements java.sql.ResultSet.getMetaData.

Retrieves the number, types and properties of this ResultSet object's columns.

public String
getString(int
the first column is 1, the second is 2, ...
colId
)

Overrides org.apache.derby.vti.VTITemplate.getString.

Implements java.sql.ResultSet.getString.

Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.

public Timestamp
getTimestamp(int
the first column is 1, the second is 2, ...
colId
)

Overrides org.apache.derby.vti.VTITemplate.getTimestamp.

Implements java.sql.ResultSet.getTimestamp.

Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object in the Java programming language.

public boolean
next()

Implements java.sql.ResultSet.next.

Moves the cursor forward one row from its current position.

public boolean
wasNull()

Overrides org.apache.derby.vti.VTITemplate.wasNull.

Implements java.sql.ResultSet.wasNull.

Reports whether the last column read had a value of SQL NULL.

Inherited from org.apache.derby.vti.VTITemplate:
absoluteafterLastbeforeFirstcancelRowUpdatesclearWarningsdeleteRowfindColumnfirstgetArraygetArraygetAsciiStreamgetAsciiStreamgetBigDecimalgetBigDecimalgetBigDecimalgetBigDecimalgetBinaryStreamgetBinaryStreamgetBlobgetBlobgetBooleangetBytegetBytegetBytesgetBytesgetCharacterStreamgetCharacterStreamgetClobgetClobgetConcurrencygetContextgetCursorNamegetDategetDategetDategetDategetDoublegetDoublegetFetchDirectiongetFetchSizegetFloatgetFloatgetHoldabilitygetIntgetIntgetLonggetLonggetNCharacterStreamgetNCharacterStreamgetNClobgetNClobgetNStringgetNStringgetObjectgetObjectgetObjectgetObjectgetObjectgetObjectgetRefgetRefgetReturnTableSignaturegetRowgetRowIdgetRowIdgetShortgetShortgetSQLXMLgetSQLXMLgetStatementgetStringgetTimegetTimegetTimegetTimegetTimestampgetTimestampgetTimestampgetTypegetUnicodeStreamgetUnicodeStreamgetURLgetURLgetWarningsinsertRowisAfterLastisBeforeFirstisClosedisFirstisLastisWrapperForlastmoveToCurrentRowmoveToInsertRownotImplementedpreviousrefreshRowrelativerowDeletedrowInsertedrowUpdatedsetContextsetFetchDirectionsetFetchSizeunwrapupdateArrayupdateArrayupdateAsciiStreamupdateAsciiStreamupdateAsciiStreamupdateAsciiStreamupdateAsciiStreamupdateAsciiStreamupdateBigDecimalupdateBigDecimalupdateBinaryStreamupdateBinaryStreamupdateBinaryStreamupdateBinaryStreamupdateBinaryStreamupdateBinaryStreamupdateBlobupdateBlobupdateBlobupdateBlobupdateBlobupdateBlobupdateBooleanupdateBooleanupdateByteupdateByteupdateBytesupdateBytesupdateCharacterStreamupdateCharacterStreamupdateCharacterStreamupdateCharacterStreamupdateCharacterStreamupdateCharacterStreamupdateClobupdateClobupdateClobupdateClobupdateClobupdateClobupdateDateupdateDateupdateDoubleupdateDoubleupdateFloatupdateFloatupdateIntupdateIntupdateLongupdateLongupdateNCharacterStreamupdateNCharacterStreamupdateNCharacterStreamupdateNCharacterStreamupdateNClobupdateNClobupdateNClobupdateNClobupdateNClobupdateNClobupdateNStringupdateNStringupdateNullupdateNullupdateObjectupdateObjectupdateObjectupdateObjectupdateRefupdateRefupdateRowupdateRowIdupdateRowIdupdateShortupdateShortupdateSQLXMLupdateSQLXMLupdateStringupdateStringupdateTimeupdateTimeupdateTimestampupdateTimestamp

Field Detail

columnInfoback to summary
private static final ResultColumnDescriptor[] columnInfo
currentPsback to summary
private GenericPreparedStatement currentPs
databack to summary
private Vector<GenericPreparedStatement> data
metadataback to summary
private static final ResultSetMetaData metadata
positionback to summary
private int position
wasNullback to summary
private boolean wasNull

Constructor Detail

StatementCacheback to summary
public StatementCache() throws StandardException

Method Detail

closeback to summary
public void close()

Implements java.sql.ResultSet.close.

Doc from java.sql.ResultSet.close.

Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.

The closing of a ResultSet object does not close the Blob, Clob or NClob objects created by the ResultSet. Blob, Clob or NClob objects remain valid for at least the duration of the transaction in which they are created, unless their free method is invoked.

When a ResultSet is closed, any ResultSetMetaData instances that were created by calling the getMetaData method remain accessible.

Note

A ResultSet object is automatically closed by the Statement object that generated it when that Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results.

Calling the method close on a ResultSet object that is already closed is a no-op.

getBooleanback to summary
public boolean getBoolean(int colId)

Overrides org.apache.derby.vti.VTITemplate.getBoolean.

Implements java.sql.ResultSet.getBoolean.

Doc from java.sql.ResultSet.getBoolean.

Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.

If the designated column has a datatype of CHAR or VARCHAR and contains a "0" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 0, a value of false is returned. If the designated column has a datatype of CHAR or VARCHAR and contains a "1" or has a datatype of BIT, TINYINT, SMALLINT, INTEGER or BIGINT and contains a 1, a value of true is returned.

Parameters
colId:int

the first column is 1, the second is 2, ...

Returns:boolean

the column value; if the value is SQL NULL, the value returned is false

getContextOrNullback to summary
private static Context getContextOrNull(final String contextID)

Must be private so that user code can't call this entry point.

getMetaDataback to summary
public ResultSetMetaData getMetaData()

Overrides org.apache.derby.vti.VTITemplate.getMetaData.

Implements java.sql.ResultSet.getMetaData.

Doc from java.sql.ResultSet.getMetaData.

Retrieves the number, types and properties of this ResultSet object's columns.

Returns:ResultSetMetaData

the description of this ResultSet object's columns

getStringback to summary
public String getString(int colId)

Overrides org.apache.derby.vti.VTITemplate.getString.

Implements java.sql.ResultSet.getString.

Doc from java.sql.ResultSet.getString.

Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.

Parameters
colId:int

the first column is 1, the second is 2, ...

Returns:String

the column value; if the value is SQL NULL, the value returned is null

getTimestampback to summary
public Timestamp getTimestamp(int colId)

Overrides org.apache.derby.vti.VTITemplate.getTimestamp.

Implements java.sql.ResultSet.getTimestamp.

Doc from java.sql.ResultSet.getTimestamp.

Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object in the Java programming language.

Parameters
colId:int

the first column is 1, the second is 2, ...

Returns:Timestamp

the column value; if the value is SQL NULL, the value returned is null

nextback to summary
public boolean next()

Implements java.sql.ResultSet.next.

Doc from java.sql.ResultSet.next.

Moves the cursor forward one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on.

When a call to the next method returns false, the cursor is positioned after the last row. Any invocation of a ResultSet method which requires a current row will result in a SQLException being thrown. If the result set type is TYPE_FORWARD_ONLY, it is vendor specified whether their JDBC driver implementation will return false or throw an SQLException on a subsequent call to next.

If an input stream is open for the current row, a call to the method next will implicitly close it. A ResultSet object's warning chain is cleared when a new row is read.

Returns:boolean

true if the new current row is valid; false if there are no more rows

wasNullback to summary
public boolean wasNull()

Overrides org.apache.derby.vti.VTITemplate.wasNull.

Implements java.sql.ResultSet.wasNull.

Doc from java.sql.ResultSet.wasNull.

Reports whether the last column read had a value of SQL NULL. Note that you must first call one of the getter methods on a column to try to read its value and then call the method wasNull to see if the value read was SQL NULL.

Returns:boolean

true if the last column value read was SQL NULL and false otherwise