org.objectledge.database
Class MonitoringPreparedStatement

java.lang.Object
  extended by org.objectledge.database.impl.DelegatingStatement
      extended by org.objectledge.database.impl.DelegatingPreparedStatement
          extended by org.objectledge.database.MonitoringPreparedStatement
All Implemented Interfaces:
PreparedStatement, Statement

public class MonitoringPreparedStatement
extends DelegatingPreparedStatement

PreparedStatement wrapper that monitors the number of DB reads/writes, and their duration.

Version:
$Id: MonitoringPreparedStatement.java,v 1.1 2005/10/10 09:44:50 rafal Exp $
Author:
RafaƂ Krzewski

Field Summary
private  ThreadDataSource.ThreadConnection threadConn
           
 
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
MonitoringPreparedStatement(PreparedStatement preparedStatement, String sql, ThreadDataSource.ThreadConnection threadConn)
          Creates a new MonitoringPreparedStatement instance.
 
Method Summary
 boolean execute()
          
 int[] executeBatch()
          
 ResultSet executeQuery()
          
 int executeUpdate()
          
 
Methods inherited from class org.objectledge.database.impl.DelegatingPreparedStatement
addBatch, clearParameters, clearParameters2, getBody, getMetaData, getParameterList, getParameterMetaData, getSQL, setArray, setAsciiStream, setBigDecimal, setBinaryStream, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNull, setNull, setObject, setObject, setObject, setRef, setShort, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
 
Methods inherited from class org.objectledge.database.impl.DelegatingStatement
addBatch, addToBatchBuffer, cancel, clearBatch, clearWarnings, close, execute, execute, execute, execute, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getBatchBuffer, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, close, execute, execute, execute, execute, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout
 

Field Detail

threadConn

private final ThreadDataSource.ThreadConnection threadConn
Constructor Detail

MonitoringPreparedStatement

public MonitoringPreparedStatement(PreparedStatement preparedStatement,
                                   String sql,
                                   ThreadDataSource.ThreadConnection threadConn)
Creates a new MonitoringPreparedStatement instance.

Parameters:
preparedStatement - delegate prepared statement.
sql - statement body.
threadConn - the associated ThreadConnection.
Method Detail

execute

public boolean execute()
                throws SQLException

Specified by:
execute in interface PreparedStatement
Overrides:
execute in class DelegatingPreparedStatement
Throws:
SQLException

executeQuery

public ResultSet executeQuery()
                       throws SQLException

Specified by:
executeQuery in interface PreparedStatement
Overrides:
executeQuery in class DelegatingPreparedStatement
Throws:
SQLException

executeUpdate

public int executeUpdate()
                  throws SQLException

Specified by:
executeUpdate in interface PreparedStatement
Overrides:
executeUpdate in class DelegatingPreparedStatement
Throws:
SQLException

executeBatch

public int[] executeBatch()
                   throws SQLException

Specified by:
executeBatch in interface Statement
Overrides:
executeBatch in class DelegatingStatement
Throws:
SQLException


Copyright © 2003-2006 objectledge.org. All Rights Reserved.