|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.logicalcobwebs.proxool.AbstractProxyStatement
org.logicalcobwebs.proxool.ProxyStatement
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.
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 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 | |
protected void |
appendToSqlLog()
Get the parameters that have been built up and use them to fill in any parameters withing the sqlStatement and produce a log. |
void |
close()
Close the statement and tell the ProxyConnection that it did so. |
boolean |
equals(java.lang.Object obj)
Whether the delegate statements are the same |
protected ConnectionPool |
getConnectionPool()
The connection pool we are using |
java.sql.Statement |
getDelegateStatement()
Gets the real Statement that we got from the delegate driver |
protected java.sql.Statement |
getStatement()
The real, delegate statement |
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)
|
protected boolean |
isTrace()
|
protected void |
putParameter(int index,
java.lang.Object value)
Add a parameter so that we can show its value when tracing |
protected void |
setSqlStatementIfNull(java.lang.String sqlStatement)
Sets sqlStatement if it isn't already set |
protected boolean |
testException(java.lang.Throwable t)
Check to see whether an exception is a fatal one. |
protected void |
trace(long startTime,
java.lang.Exception exception)
Trace the call that was just made |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Log LOG
private static final java.lang.String EXECUTE_FRAGMENT
private static final java.lang.String EXECUTE_BATCH_METHOD
private static final java.lang.String ADD_BATCH_METHOD
private static final java.lang.String EQUALS_METHOD
private static final java.lang.String CLOSE_METHOD
private static final java.lang.String SET_NULL_METHOD
private static final java.lang.String SET_PREFIX
Constructor Detail |
public ProxyStatement(java.sql.Statement statement, ConnectionPool connectionPool, ProxyConnectionIF proxyConnection, java.lang.String sqlStatement)
Method Detail |
public java.lang.Object intercept(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] args, MethodProxy proxy) throws java.lang.Throwable
MethodInterceptor
intercept
in interface MethodInterceptor
obj
- "this", the enhanced objectmethod
- intercepted Methodargs
- argument array; primitive types are wrappedproxy
- used to invoke super (non-intercepted method); may be called
as many times as needed
java.lang.Throwable
- any exception may be thrown; if so, super method will not be invokedMethodProxy
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface InvocationHandler
java.lang.Throwable
java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object)
protected boolean testException(java.lang.Throwable t)
t
- the exception to testpublic java.sql.Statement getDelegateStatement()
protected ConnectionPool getConnectionPool()
protected java.sql.Statement getStatement()
public void close() throws java.sql.SQLException
java.sql.SQLException
- if it couldn't be closedProxyConnectionIF.registerClosedStatement(java.sql.Statement)
public boolean equals(java.lang.Object obj)
Object.equals(java.lang.Object)
protected void putParameter(int index, java.lang.Object value)
index
- within the procedurevalue
- an object describing its valueprotected void trace(long startTime, java.lang.Exception exception) throws java.sql.SQLException
startTime
- so we can log how long it tookexception
- if anything went wrong during execution
java.sql.SQLException
- if the onExecute
method threw one.protected void appendToSqlLog()
protected boolean isTrace()
protected void setSqlStatementIfNull(java.lang.String sqlStatement)
sqlStatement
- the statement we are sending the database
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |