org.jmonit.support.jdbc
Class MonitoredStatement

java.lang.Object
  extended by org.jmonit.support.jdbc.MonitoredStatement
All Implemented Interfaces:
java.sql.Statement, java.sql.Wrapper
Direct Known Subclasses:
MonitoredPreparedStatement

public class MonitoredStatement
extends java.lang.Object
implements java.sql.Statement

Wrapped to monitor JDBC Statement

Author:
Nicolas De Loof

Field Summary
 
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
 
Constructor Summary
MonitoredStatement(java.sql.Statement statement, java.sql.Connection connection, JdbcMonitor monitor)
           
 
Method Summary
 void addBatch(java.lang.String sql)
          
 void cancel()
          
 void clearBatch()
          
 void clearWarnings()
          
 void close()
          
 boolean execute(java.lang.String sql)
          
 boolean execute(java.lang.String sql, int autoGeneratedKeys)
          
 boolean execute(java.lang.String sql, int[] columnIndexes)
          
 boolean execute(java.lang.String sql, java.lang.String[] columnNames)
          
 int[] executeBatch()
          
 java.sql.ResultSet executeQuery(java.lang.String sql)
          
 int executeUpdate(java.lang.String sql)
          
 int executeUpdate(java.lang.String sql, int autoGeneratedKeys)
          
 int executeUpdate(java.lang.String sql, int[] columnIndexes)
          
 int executeUpdate(java.lang.String sql, java.lang.String[] columnNames)
          
 java.sql.Connection getConnection()
          
 int getFetchDirection()
          
 int getFetchSize()
          
 java.sql.ResultSet getGeneratedKeys()
          
 int getMaxFieldSize()
          
 int getMaxRows()
          
 boolean getMoreResults()
          
 boolean getMoreResults(int current)
          
 int getQueryTimeout()
          
 java.sql.ResultSet getResultSet()
          
 int getResultSetConcurrency()
          
 int getResultSetHoldability()
          
 int getResultSetType()
          
 int getUpdateCount()
          
 java.sql.SQLWarning getWarnings()
          
protected  java.sql.SQLException handleException(java.sql.SQLException sqle)
           
 boolean isClosed()
           
 boolean isPoolable()
           
 boolean isWrapperFor(java.lang.Class<?> iface)
           
 void setCursorName(java.lang.String name)
          
 void setEscapeProcessing(boolean enable)
          
 void setFetchDirection(int direction)
          
 void setFetchSize(int rows)
          
 void setMaxFieldSize(int max)
          
 void setMaxRows(int max)
          
 void setPoolable(boolean poolable)
           
 void setQueryTimeout(int seconds)
          
<T> T
unwrap(java.lang.Class<T> iface)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonitoredStatement

public MonitoredStatement(java.sql.Statement statement,
                          java.sql.Connection connection,
                          JdbcMonitor monitor)
Parameters:
statement - target statement
connection - monitored connection
monitor - the JDBC monitor on this connection
Method Detail

handleException

protected java.sql.SQLException handleException(java.sql.SQLException sqle)
Parameters:
sqle - catched exception
Returns:
SQLException exception to throw

addBatch

public final void addBatch(java.lang.String sql)
                    throws java.sql.SQLException

Specified by:
addBatch in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.addBatch(java.lang.String)

cancel

public final void cancel()
                  throws java.sql.SQLException

Specified by:
cancel in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.cancel()

clearBatch

public final void clearBatch()
                      throws java.sql.SQLException

Specified by:
clearBatch in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.clearBatch()

clearWarnings

public final void clearWarnings()
                         throws java.sql.SQLException

Specified by:
clearWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.clearWarnings()

close

public final void close()
                 throws java.sql.SQLException

Specified by:
close in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.close()

execute

public final boolean execute(java.lang.String sql)
                      throws java.sql.SQLException

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.execute(java.lang.String)

executeBatch

public final int[] executeBatch()
                         throws java.sql.SQLException

Specified by:
executeBatch in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.executeBatch()

executeQuery

public final java.sql.ResultSet executeQuery(java.lang.String sql)
                                      throws java.sql.SQLException

Specified by:
executeQuery in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.executeQuery(java.lang.String)

executeUpdate

public final int executeUpdate(java.lang.String sql)
                        throws java.sql.SQLException

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.executeUpdate(java.lang.String)

getConnection

public final java.sql.Connection getConnection()
                                        throws java.sql.SQLException

Specified by:
getConnection in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getConnection()

getFetchDirection

public final int getFetchDirection()
                            throws java.sql.SQLException

Specified by:
getFetchDirection in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getFetchDirection()

getFetchSize

public final int getFetchSize()
                       throws java.sql.SQLException

Specified by:
getFetchSize in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getFetchSize()

getMaxFieldSize

public final int getMaxFieldSize()
                          throws java.sql.SQLException

Specified by:
getMaxFieldSize in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getMaxFieldSize()

getMaxRows

public final int getMaxRows()
                     throws java.sql.SQLException

Specified by:
getMaxRows in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getMaxRows()

getMoreResults

public final boolean getMoreResults()
                             throws java.sql.SQLException

Specified by:
getMoreResults in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getMoreResults()

getQueryTimeout

public final int getQueryTimeout()
                          throws java.sql.SQLException

Specified by:
getQueryTimeout in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getQueryTimeout()

getResultSet

public final java.sql.ResultSet getResultSet()
                                      throws java.sql.SQLException

Specified by:
getResultSet in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getResultSet()

getResultSetConcurrency

public final int getResultSetConcurrency()
                                  throws java.sql.SQLException

Specified by:
getResultSetConcurrency in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getResultSetConcurrency()

getResultSetType

public final int getResultSetType()
                           throws java.sql.SQLException

Specified by:
getResultSetType in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getResultSetType()

getUpdateCount

public final int getUpdateCount()
                         throws java.sql.SQLException

Specified by:
getUpdateCount in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getUpdateCount()

getWarnings

public final java.sql.SQLWarning getWarnings()
                                      throws java.sql.SQLException

Specified by:
getWarnings in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getWarnings()

setCursorName

public final void setCursorName(java.lang.String name)
                         throws java.sql.SQLException

Specified by:
setCursorName in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.setCursorName(java.lang.String)

setEscapeProcessing

public final void setEscapeProcessing(boolean enable)
                               throws java.sql.SQLException

Specified by:
setEscapeProcessing in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.setEscapeProcessing(boolean)

setFetchDirection

public final void setFetchDirection(int direction)
                             throws java.sql.SQLException

Specified by:
setFetchDirection in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.setFetchDirection(int)

setFetchSize

public final void setFetchSize(int rows)
                        throws java.sql.SQLException

Specified by:
setFetchSize in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.setFetchSize(int)

setMaxFieldSize

public final void setMaxFieldSize(int max)
                           throws java.sql.SQLException

Specified by:
setMaxFieldSize in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.setMaxFieldSize(int)

setMaxRows

public final void setMaxRows(int max)
                      throws java.sql.SQLException

Specified by:
setMaxRows in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.setMaxRows(int)

setQueryTimeout

public final void setQueryTimeout(int seconds)
                           throws java.sql.SQLException

Specified by:
setQueryTimeout in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.setQueryTimeout(int)

execute

public final boolean execute(java.lang.String sql,
                             int autoGeneratedKeys)
                      throws java.sql.SQLException

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.execute(java.lang.String, int)

execute

public final boolean execute(java.lang.String sql,
                             int[] columnIndexes)
                      throws java.sql.SQLException

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.execute(java.lang.String, int[])

execute

public final boolean execute(java.lang.String sql,
                             java.lang.String[] columnNames)
                      throws java.sql.SQLException

Specified by:
execute in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.execute(java.lang.String, java.lang.String[])

executeUpdate

public final int executeUpdate(java.lang.String sql,
                               int autoGeneratedKeys)
                        throws java.sql.SQLException

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.executeUpdate(java.lang.String, int)

executeUpdate

public final int executeUpdate(java.lang.String sql,
                               int[] columnIndexes)
                        throws java.sql.SQLException

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.executeUpdate(java.lang.String, int[])

executeUpdate

public final int executeUpdate(java.lang.String sql,
                               java.lang.String[] columnNames)
                        throws java.sql.SQLException

Specified by:
executeUpdate in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.executeUpdate(java.lang.String, java.lang.String[])

getGeneratedKeys

public final java.sql.ResultSet getGeneratedKeys()
                                          throws java.sql.SQLException

Specified by:
getGeneratedKeys in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getGeneratedKeys()

getMoreResults

public final boolean getMoreResults(int current)
                             throws java.sql.SQLException

Specified by:
getMoreResults in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getMoreResults(int)

getResultSetHoldability

public final int getResultSetHoldability()
                                  throws java.sql.SQLException

Specified by:
getResultSetHoldability in interface java.sql.Statement
Throws:
java.sql.SQLException
See Also:
Statement.getResultSetHoldability()

isClosed

public final boolean isClosed()
                       throws java.sql.SQLException
Specified by:
isClosed in interface java.sql.Statement
Throws:
java.sql.SQLException

isPoolable

public final boolean isPoolable()
                         throws java.sql.SQLException
Specified by:
isPoolable in interface java.sql.Statement
Throws:
java.sql.SQLException

isWrapperFor

public final boolean isWrapperFor(java.lang.Class<?> iface)
                           throws java.sql.SQLException
Specified by:
isWrapperFor in interface java.sql.Wrapper
Throws:
java.sql.SQLException

setPoolable

public final void setPoolable(boolean poolable)
                       throws java.sql.SQLException
Specified by:
setPoolable in interface java.sql.Statement
Throws:
java.sql.SQLException

unwrap

public final <T> T unwrap(java.lang.Class<T> iface)
               throws java.sql.SQLException
Specified by:
unwrap in interface java.sql.Wrapper
Throws:
java.sql.SQLException


Copyright © 2007 Nicolas De Loof. All Rights Reserved.