org.apache.derby.diag
Class StatementDuration

java.lang.Object
  extended byorg.apache.derby.vti.VTITemplate
      extended byorg.apache.derby.diag.StatementDuration
All Implemented Interfaces:
java.sql.ResultSet

public class StatementDuration
extends VTITemplate

StatementDuration is a virtual table which can be used to analyze the execution duration of the statements of "interest" in db2j.log or a specified file when db2j.language.logStatementText=true.

A limitation is that, for each transaction ID, a row will not be returned for the last statement with that transaction id. (Transaction IDs change within a connection after a commit or rollback, if the transaction that just ended modified data.)

The execution duration is the time between the beginning of execution of two successive statements. There are a number of reasons why this time may not be accurate. The duration could include time spent in the application waiting for user input, doing other work, etc. It may also only include a portion of the actual execution time, if the application executes a new statement before draining the previous open ResultSet. StatementDuration can be used to get a rough sense of where the bottlenecks in an application's JDBC code are.

The StatementDuration virtual table has the following columns:


Field Summary
private static java.lang.String BEGIN_EXECUTING_STRING
           
private static java.lang.String BEGIN_THREAD_STRING
           
private static java.lang.String BEGIN_XID_STRING
           
private  java.io.BufferedReader bufferedReader
           
private static ResultColumnDescriptor[] columnInfo
           
private  java.lang.String[] currentRow
           
private static java.lang.String END_EXECUTING_STRING
           
private static java.lang.String END_THREAD_STRING
           
private static java.lang.String END_XID_STRING
           
private static java.lang.String GMT_STRING
           
private  int gmtIndex
           
private  boolean gotFile
           
private  java.util.Hashtable hashTable
           
private  java.lang.String inputFileName
           
private  java.io.InputStreamReader inputFileStreamReader
           
private  java.io.InputStream inputStream
           
private  int lccidIndex
           
private  java.lang.String line
           
private static java.sql.ResultSetMetaData metadata
           
private  int threadIndex
           
private  int xidIndex
           
 
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
 
Constructor Summary
StatementDuration()
          StatementDuration() accesses the error log in derby.system.home, if set, otherwise it looks in the current directory.
StatementDuration(java.lang.String inputFileName)
           
 
Method Summary
 void close()
           
 java.sql.ResultSetMetaData getMetaData()
           
 java.lang.String getString(int columnNumber)
          All columns in StatementDuration VTI have String data types.
 boolean next()
           
private  java.lang.String setupColumn(int columnNumber)
           
 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, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getInt, getInt, getLong, getLong, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getShort, getShort, getStatement, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gotFile

private boolean gotFile

inputFileStreamReader

private java.io.InputStreamReader inputFileStreamReader

inputStream

private java.io.InputStream inputStream

bufferedReader

private java.io.BufferedReader bufferedReader

inputFileName

private java.lang.String inputFileName

hashTable

private java.util.Hashtable hashTable

line

private java.lang.String line

gmtIndex

private int gmtIndex

threadIndex

private int threadIndex

xidIndex

private int xidIndex

lccidIndex

private int lccidIndex

currentRow

private java.lang.String[] currentRow

GMT_STRING

private static final java.lang.String GMT_STRING
See Also:
Constant Field Values

BEGIN_THREAD_STRING

private static final java.lang.String BEGIN_THREAD_STRING
See Also:
Constant Field Values

END_THREAD_STRING

private static final java.lang.String END_THREAD_STRING
See Also:
Constant Field Values

BEGIN_XID_STRING

private static final java.lang.String BEGIN_XID_STRING
See Also:
Constant Field Values

END_XID_STRING

private static final java.lang.String END_XID_STRING
See Also:
Constant Field Values

BEGIN_EXECUTING_STRING

private static final java.lang.String BEGIN_EXECUTING_STRING
See Also:
Constant Field Values

END_EXECUTING_STRING

private static final java.lang.String END_EXECUTING_STRING
See Also:
Constant Field Values

columnInfo

private static final ResultColumnDescriptor[] columnInfo

metadata

private static final java.sql.ResultSetMetaData metadata
Constructor Detail

StatementDuration

public StatementDuration()
StatementDuration() accesses the error log in derby.system.home, if set, otherwise it looks in the current directory. StatementDuration('filename') will access the specified file name.


StatementDuration

public StatementDuration(java.lang.String inputFileName)
Method Detail

getMetaData

public java.sql.ResultSetMetaData getMetaData()
See Also:
ResultSet.getMetaData()

next

public boolean next()
             throws java.sql.SQLException
Throws:
java.sql.SQLException - If database access error occurs.
See Also:
ResultSet.next()

close

public void close()
See Also:
ResultSet.close()

getString

public java.lang.String getString(int columnNumber)
                           throws java.sql.SQLException
All columns in StatementDuration VTI have String data types.

Specified by:
getString in interface java.sql.ResultSet
Overrides:
getString in class VTITemplate
Throws:
java.sql.SQLException - If database access error occurs.
See Also:
ResultSet.getString(int)

setupColumn

private java.lang.String setupColumn(int columnNumber)
                              throws java.sql.SQLException
Throws:
java.sql.SQLException

wasNull

public boolean wasNull()
Specified by:
wasNull in interface java.sql.ResultSet
Overrides:
wasNull in class VTITemplate
See Also:
ResultSet.wasNull()


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.