Package org.apache.derby.diag
Class TransactionTable
java.lang.Object
org.apache.derby.vti.VTITemplate
org.apache.derby.diag.TransactionTable
- All Implemented Interfaces:
AutoCloseable
,ResultSet
,Wrapper
,AwareVTI
,VTICosting
TransactionTable is a virtual table that shows all transactions
currently in the database.
This virtual table can be invoked by calling it
directly
select * from SYSCS_DIAG.TRANSACTION_TABLE
The TransactionTable virtual table takes a snap shot of the transaction table while the system is in flux, so it is possible that some transactions may be in transition state while the snap shot is taken. We choose to do this rather then impose extraneous timing restrictions so that the use of this tool will not alter the normal timing and flow of execution in the application.
The TransactionTable virtual table has the following columns:
- XID varchar(15) - not nullable. The transaction id, this can be joined with the LockTable virtual table's XID.
- GLOBAL_XID varchar(140) - nullable. The global transaction id, only set if this transaction is a participant in a distributed transaction.
- USERNAME varchar(128) - nullable. The user name, or APP by default. May appear null if the transaction is started by Derby.
- TYPE varchar(30) - not nullable. UserTransaction or an internal transaction spawned by Derby.
- STATUS varchar(8) - not nullable. IDLE or ACTIVE. A transaction is IDLE only when it is first created or right after it commits. Any transaction that holds or has held any resource in the database is ACTIVE. Accessing the TransactionTable virtual table without using the class alias will not activate the transaction.
- FIRST_INSTANT varchar(20) - nullable. If null, this is a read only transaction. If not null, this is the first log record instant written by the transaction.
- SQL_TEXT VARCHAR(32672) - nullable. if null, this transaction is currently not being executed in the database. If not null, this is the SQL statement currently being executed in the database.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.derby.vti.VTITemplate
VTITemplate.ColumnDescriptor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ResultColumnDescriptor[]
(package private) int
(package private) boolean
private static final ResultSetMetaData
private TransactionInfo[]
private boolean
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
Fields inherited from interface org.apache.derby.vti.VTICosting
defaultEstimatedCost, defaultEstimatedRowCount
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
double
getEstimatedCostPerInstantiation
(VTIEnvironment vtiEnvironment) Get the estimated cost for a single instantiation of a Table Function.double
getEstimatedRowCount
(VTIEnvironment vtiEnvironment) Get the estimated row count for a single scan of a Table Function.getString
(int columnNumber) All columns in TransactionTable VTI is of String type.boolean
next()
boolean
supportsMultipleInstantiations
(VTIEnvironment vtiEnvironment) Find out if the ResultSet of the Table Function can be instantiated multiple times.boolean
wasNull()
Methods inherited from class org.apache.derby.vti.VTITemplate
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getContext, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getReturnTableSignature, getRow, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, isWrapperFor, last, moveToCurrentRow, moveToInsertRow, notImplemented, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setContext, setFetchDirection, setFetchSize, unwrap, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.sql.ResultSet
updateObject, updateObject, updateObject, updateObject
-
Field Details
-
transactionTable
-
initialized
boolean initialized -
currentRow
int currentRow -
wasNull
private boolean wasNull -
columnInfo
-
metadata
-
-
Constructor Details
-
TransactionTable
- Throws:
StandardException
-
-
Method Details
-
getMetaData
- Specified by:
getMetaData
in interfaceResultSet
- Overrides:
getMetaData
in classVTITemplate
- See Also:
-
next
- Specified by:
next
in interfaceResultSet
- Throws:
SQLException
- if no transaction context can be found- See Also:
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceResultSet
- See Also:
-
getString
All columns in TransactionTable VTI is of String type.- Specified by:
getString
in interfaceResultSet
- Overrides:
getString
in classVTITemplate
- See Also:
-
wasNull
public boolean wasNull()- Specified by:
wasNull
in interfaceResultSet
- Overrides:
wasNull
in classVTITemplate
- See Also:
-
getEstimatedRowCount
Description copied from interface:VTICosting
Get the estimated row count for a single scan of a Table Function.- Specified by:
getEstimatedRowCount
in interfaceVTICosting
- Parameters:
vtiEnvironment
- The state variable for optimizing the Table Function.- Returns:
- The estimated row count for a single scan of the Table Function.
- See Also:
-
getEstimatedCostPerInstantiation
Description copied from interface:VTICosting
Get the estimated cost for a single instantiation of a Table Function.- Specified by:
getEstimatedCostPerInstantiation
in interfaceVTICosting
- Parameters:
vtiEnvironment
- The state variable for optimizing the Table Function.- Returns:
- The estimated cost for a single instantiation of the Table Function.
- See Also:
-
supportsMultipleInstantiations
Description copied from interface:VTICosting
Find out if the ResultSet of the Table Function can be instantiated multiple times.- Specified by:
supportsMultipleInstantiations
in interfaceVTICosting
- Parameters:
vtiEnvironment
- The state variable for optimizing the Table Function.- Returns:
- false
- See Also:
-