org.logicalcobwebs.proxool
Class ProxyStatement

java.lang.Object
  extended by org.logicalcobwebs.proxool.AbstractProxyStatement
      extended by org.logicalcobwebs.proxool.ProxyStatement
All Implemented Interfaces:
Callback, MethodInterceptor

 class ProxyStatement
extends AbstractProxyStatement
implements MethodInterceptor

Delegates to Statement for all calls. But also, for all execute methods, it checks the SQLException and compares it to the fatalSqlException list in the ConnectionPoolDefinition. If it detects a fatal exception it will destroy the Connection so that it isn't used again.

Version:
$Revision: 1.30 $, $Date: 2006/01/16 23:09:28 $
Author:
billhorsman, $Author: billhorsman $ (current maintainer)

Field Summary
private static java.lang.String ADD_BATCH_METHOD
           
private static java.lang.String CLOSE_METHOD
           
private static java.lang.String EQUALS_METHOD
           
private static java.lang.String EXECUTE_BATCH_METHOD
           
private static java.lang.String EXECUTE_FRAGMENT
           
private static java.lang.String FINALIZE_METHOD
           
private static Log LOG
           
private static java.lang.String SET_NULL_METHOD
           
private static java.lang.String SET_PREFIX
           
 
Constructor Summary
ProxyStatement(java.sql.Statement statement, ConnectionPool connectionPool, ProxyConnectionIF proxyConnection, java.lang.String sqlStatement)
           
 
Method Summary
 java.lang.Object intercept(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, MethodProxy proxy)
          All generated proxied methods call this method instead of the original method.
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
 
Methods inherited from class org.logicalcobwebs.proxool.AbstractProxyStatement
appendToSqlLog, close, equals, getConnectionPool, getDateAsString, getDelegateStatement, getStatement, isTrace, putParameter, setSqlStatementIfNull, startExecute, testException, trace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Log LOG

EXECUTE_FRAGMENT

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

EXECUTE_BATCH_METHOD

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

ADD_BATCH_METHOD

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

EQUALS_METHOD

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

CLOSE_METHOD

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

FINALIZE_METHOD

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

SET_NULL_METHOD

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

SET_PREFIX

private static final java.lang.String SET_PREFIX
See Also:
Constant Field Values
Constructor Detail

ProxyStatement

public ProxyStatement(java.sql.Statement statement,
                      ConnectionPool connectionPool,
                      ProxyConnectionIF proxyConnection,
                      java.lang.String sqlStatement)
Method Detail

intercept

public java.lang.Object intercept(java.lang.Object obj,
                                  java.lang.reflect.Method method,
                                  java.lang.Object[] args,
                                  MethodProxy proxy)
                           throws java.lang.Throwable
Description copied from interface: MethodInterceptor
All generated proxied methods call this method instead of the original method. The original method may either be invoked by normal reflection using the Method object, or by using the MethodProxy (faster).

Specified by:
intercept in interface MethodInterceptor
Parameters:
obj - "this", the enhanced object
method - intercepted Method
args - argument array; primitive types are wrapped
proxy - used to invoke super (non-intercepted method); may be called as many times as needed
Returns:
any value compatible with the signature of the proxied method. Method returning void will ignore this value.
Throws:
java.lang.Throwable - any exception may be thrown; if so, super method will not be invoked
See Also:
MethodProxy

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Throws:
java.lang.Throwable