Fixes #425 a low impact change to satisfy an edge-case.

Still, relying on object identities from getResultSet() is an extremely bad idea, regardless of how some drivers seem to implement it.  Relying on that implementation artifact is contrary to the Statement interface documentation, and likely to fail in a variety of environments.  HikariCP itself does not and will not guarantee the future behaviour of this method.
pull/427/head
Brett Wooldridge 10 years ago
parent 3bb13c03db
commit 295ff59ab7

@ -33,6 +33,7 @@ public abstract class ProxyStatement implements Statement
protected final Statement delegate;
private boolean isClosed;
private ResultSet proxyResultSet;
protected ProxyStatement(ProxyConnection connection, Statement statement)
{
@ -212,9 +213,14 @@ public abstract class ProxyStatement implements Statement
public ResultSet getResultSet() throws SQLException {
final ResultSet resultSet = delegate.getResultSet();
if (resultSet != null) {
return ProxyFactory.getProxyResultSet(connection, this, resultSet);
if (proxyResultSet == null || ((ProxyResultSet) proxyResultSet).delegate != resultSet) {
proxyResultSet = ProxyFactory.getProxyResultSet(connection, this, resultSet);
}
}
return null;
else {
proxyResultSet = null;
}
return proxyResultSet;
}
/** {@inheritDoc} */

Loading…
Cancel
Save