|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
|
|
package com.zaxxer.hikari.proxy;
|
|
|
|
|
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
@ -56,7 +57,7 @@ public class PreparedStatementProxy implements IHikariStatementProxy
|
|
|
|
|
@HikariInject
|
|
|
|
|
public SQLException _checkException(SQLException e)
|
|
|
|
|
{
|
|
|
|
|
return _connection._checkException(e);
|
|
|
|
|
return ((IHikariConnectionProxy) getConnection())._checkException(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// **********************************************************************
|
|
|
|
@ -66,7 +67,7 @@ public class PreparedStatementProxy implements IHikariStatementProxy
|
|
|
|
|
@HikariOverride
|
|
|
|
|
public void close() throws SQLException
|
|
|
|
|
{
|
|
|
|
|
_connection._unregisterStatement(this);
|
|
|
|
|
((IHikariConnectionProxy) getConnection())._unregisterStatement(this);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
__close();
|
|
|
|
@ -81,12 +82,13 @@ public class PreparedStatementProxy implements IHikariStatementProxy
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IHikariResultSetProxy resultSet = (IHikariResultSetProxy) __executeQuery();
|
|
|
|
|
if (resultSet == null)
|
|
|
|
|
ResultSet rs = ((PreparedStatement) delegate).executeQuery();
|
|
|
|
|
if (rs == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IHikariResultSetProxy resultSet = (IHikariResultSetProxy) PROXY_FACTORY.getProxyResultSet(this, rs);
|
|
|
|
|
resultSet._setProxyStatement(this);
|
|
|
|
|
return (ResultSet) resultSet;
|
|
|
|
|
}
|
|
|
|
@ -100,13 +102,14 @@ public class PreparedStatementProxy implements IHikariStatementProxy
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IHikariResultSetProxy resultSet = (IHikariResultSetProxy) __executeQuery(sql);
|
|
|
|
|
if (resultSet == null)
|
|
|
|
|
ResultSet rs = delegate.executeQuery(sql);
|
|
|
|
|
if (rs == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resultSet._setProxyStatement(this);
|
|
|
|
|
ResultSet resultSet = PROXY_FACTORY.getProxyResultSet(this, rs);
|
|
|
|
|
((IHikariResultSetProxy) resultSet)._setProxyStatement(this);
|
|
|
|
|
return (ResultSet) resultSet;
|
|
|
|
|
}
|
|
|
|
|
catch (SQLException e)
|
|
|
|
@ -119,14 +122,15 @@ public class PreparedStatementProxy implements IHikariStatementProxy
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IHikariResultSetProxy resultSet = (IHikariResultSetProxy) __getGeneratedKeys();
|
|
|
|
|
if (resultSet == null)
|
|
|
|
|
ResultSet rs = delegate.getGeneratedKeys();
|
|
|
|
|
if (rs == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resultSet._setProxyStatement(this);
|
|
|
|
|
return (ResultSet) resultSet;
|
|
|
|
|
ResultSet resultSet = PROXY_FACTORY.getProxyResultSet(this, rs);
|
|
|
|
|
((IHikariResultSetProxy) resultSet)._setProxyStatement(this);
|
|
|
|
|
return resultSet;
|
|
|
|
|
}
|
|
|
|
|
catch (SQLException e)
|
|
|
|
|
{
|
|
|
|
@ -134,6 +138,11 @@ public class PreparedStatementProxy implements IHikariStatementProxy
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Connection getConnection()
|
|
|
|
|
{
|
|
|
|
|
return (Connection) _connection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ***********************************************************************
|
|
|
|
|
// These methods contain code we do not want injected into the actual
|
|
|
|
|
// java.sql.Connection implementation class. These methods are only
|
|
|
|
@ -141,11 +150,6 @@ public class PreparedStatementProxy implements IHikariStatementProxy
|
|
|
|
|
// delegating proxies are used.
|
|
|
|
|
// ***********************************************************************
|
|
|
|
|
|
|
|
|
|
public ResultSet __executeQuery() throws SQLException
|
|
|
|
|
{
|
|
|
|
|
ResultSet resultSet = ((PreparedStatement) delegate).executeQuery();
|
|
|
|
|
return PROXY_FACTORY.getProxyResultSet(this, resultSet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void __static()
|
|
|
|
|
{
|
|
|
|
@ -164,16 +168,4 @@ public class PreparedStatementProxy implements IHikariStatementProxy
|
|
|
|
|
|
|
|
|
|
delegate.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResultSet __executeQuery(String sql) throws SQLException
|
|
|
|
|
{
|
|
|
|
|
ResultSet resultSet = delegate.executeQuery(sql);
|
|
|
|
|
return PROXY_FACTORY.getProxyResultSet(this, resultSet);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResultSet __getGeneratedKeys() throws SQLException
|
|
|
|
|
{
|
|
|
|
|
ResultSet generatedKeys = delegate.getGeneratedKeys();
|
|
|
|
|
return PROXY_FACTORY.getProxyResultSet(this, generatedKeys);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|