Make ResultSet.getStatement() return the StatementProxy instead of the delegate.

pull/372/head
Brett Wooldridge 10 years ago
parent a4d1156d08
commit 82536c0fe6

@ -50,7 +50,7 @@ public abstract class PreparedStatementProxy extends StatementProxy implements P
{
connection.markCommitStateDirty();
ResultSet resultSet = ((PreparedStatement) delegate).executeQuery();
return ProxyFactory.getProxyResultSet(connection, resultSet);
return ProxyFactory.getProxyResultSet(connection, this, resultSet);
}
/** {@inheritDoc} */

@ -70,7 +70,7 @@ public final class ProxyFactory
return null;
}
static ResultSet getProxyResultSet(final ConnectionProxy connection, final ResultSet resultSet)
static ResultSet getProxyResultSet(final ConnectionProxy connection, final StatementProxy statement, final ResultSet resultSet)
{
// Body is injected by JavassistProxyFactory
return null;

@ -18,6 +18,7 @@ package com.zaxxer.hikari.proxy;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Wrapper;
/**
@ -28,11 +29,13 @@ import java.sql.Wrapper;
public abstract class ResultSetProxy implements ResultSet
{
protected final ConnectionProxy connection;
protected final StatementProxy statement;
protected final ResultSet delegate;
protected ResultSetProxy(ConnectionProxy connection, ResultSet resultSet)
protected ResultSetProxy(ConnectionProxy connection, StatementProxy statement, ResultSet resultSet)
{
this.connection = connection;
this.statement = statement;
this.delegate = resultSet;
}
@ -55,6 +58,13 @@ public abstract class ResultSetProxy implements ResultSet
// Overridden java.sql.ResultSet Methods
// **********************************************************************
/** {@inheritDoc} */
@Override
public final Statement getStatement() throws SQLException
{
return statement;
}
/** {@inheritDoc} */
@Override
public void updateRow() throws SQLException

@ -108,7 +108,7 @@ public abstract class StatementProxy implements Statement
{
connection.markCommitStateDirty();
ResultSet resultSet = delegate.executeQuery(sql);
return ProxyFactory.getProxyResultSet(connection, resultSet);
return ProxyFactory.getProxyResultSet(connection, this, resultSet);
}
/** {@inheritDoc} */
@ -212,7 +212,7 @@ public abstract class StatementProxy implements Statement
public ResultSet getResultSet() throws SQLException {
final ResultSet resultSet = delegate.getResultSet();
if (resultSet != null) {
return ProxyFactory.getProxyResultSet(connection, resultSet);
return ProxyFactory.getProxyResultSet(connection, this, resultSet);
}
return null;
}

Loading…
Cancel
Save