mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
FileterChain support CallableStatement.getObject return ResultSet
This commit is contained in:
@@ -3336,7 +3336,65 @@ public class FilterChainImpl implements FilterChain {
|
||||
if (this.pos < filterSize) {
|
||||
return nextFilter().callableStatement_getObject(this, statement, parameterIndex);
|
||||
}
|
||||
return statement.getRawObject().getObject(parameterIndex);
|
||||
|
||||
Object obj = statement.getRawObject().getObject(parameterIndex);
|
||||
|
||||
if (obj instanceof ResultSet) {
|
||||
return wrap(statement, (ResultSet) obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object callableStatement_getObject(CallableStatementProxy statement, int parameterIndex,
|
||||
java.util.Map<String, Class<?>> map) throws SQLException {
|
||||
if (this.pos < filterSize) {
|
||||
return nextFilter().callableStatement_getObject(this, statement, parameterIndex, map);
|
||||
}
|
||||
|
||||
|
||||
Object obj = statement.getRawObject().getObject(parameterIndex, map);
|
||||
|
||||
if (obj instanceof ResultSet) {
|
||||
return wrap(statement, (ResultSet) obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object callableStatement_getObject(CallableStatementProxy statement, String parameterName)
|
||||
throws SQLException {
|
||||
if (this.pos < filterSize) {
|
||||
return nextFilter().callableStatement_getObject(this, statement, parameterName);
|
||||
}
|
||||
|
||||
Object obj = statement.getRawObject().getObject(parameterName);
|
||||
|
||||
if (obj instanceof ResultSet) {
|
||||
return wrap(statement, (ResultSet) obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object callableStatement_getObject(CallableStatementProxy statement, String parameterName,
|
||||
java.util.Map<String, Class<?>> map) throws SQLException {
|
||||
if (this.pos < filterSize) {
|
||||
return nextFilter().callableStatement_getObject(this, statement, parameterName, map);
|
||||
}
|
||||
|
||||
Object obj = statement.getRawObject().getObject(parameterName, map);
|
||||
|
||||
if (obj instanceof ResultSet) {
|
||||
return wrap(statement, (ResultSet) obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -3348,15 +3406,6 @@ public class FilterChainImpl implements FilterChain {
|
||||
return statement.getRawObject().getBigDecimal(parameterIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object callableStatement_getObject(CallableStatementProxy statement, int parameterIndex,
|
||||
java.util.Map<String, Class<?>> map) throws SQLException {
|
||||
if (this.pos < filterSize) {
|
||||
return nextFilter().callableStatement_getObject(this, statement, parameterIndex, map);
|
||||
}
|
||||
return statement.getRawObject().getObject(parameterIndex, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ref callableStatement_getRef(CallableStatementProxy statement, int parameterIndex) throws SQLException {
|
||||
if (this.pos < filterSize) {
|
||||
@@ -3820,15 +3869,6 @@ public class FilterChainImpl implements FilterChain {
|
||||
return statement.getRawObject().getTimestamp(parameterName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object callableStatement_getObject(CallableStatementProxy statement, String parameterName)
|
||||
throws SQLException {
|
||||
if (this.pos < filterSize) {
|
||||
return nextFilter().callableStatement_getObject(this, statement, parameterName);
|
||||
}
|
||||
return statement.getRawObject().getObject(parameterName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal callableStatement_getBigDecimal(CallableStatementProxy statement, String parameterName)
|
||||
throws SQLException {
|
||||
@@ -3838,15 +3878,6 @@ public class FilterChainImpl implements FilterChain {
|
||||
return statement.getRawObject().getBigDecimal(parameterName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object callableStatement_getObject(CallableStatementProxy statement, String parameterName,
|
||||
java.util.Map<String, Class<?>> map) throws SQLException {
|
||||
if (this.pos < filterSize) {
|
||||
return nextFilter().callableStatement_getObject(this, statement, parameterName, map);
|
||||
}
|
||||
return statement.getRawObject().getObject(parameterName, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ref callableStatement_getRef(CallableStatementProxy statement, String parameterName) throws SQLException {
|
||||
if (this.pos < filterSize) {
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.alibaba.druid.proxy.jdbc.ClobProxy;
|
||||
import com.alibaba.druid.proxy.jdbc.ConnectionProxy;
|
||||
import com.alibaba.druid.proxy.jdbc.PreparedStatementProxy;
|
||||
import com.alibaba.druid.proxy.jdbc.ResultSetProxy;
|
||||
import com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl;
|
||||
import com.alibaba.druid.proxy.jdbc.StatementProxy;
|
||||
import com.alibaba.druid.util.IOUtils;
|
||||
|
||||
@@ -225,12 +224,6 @@ public class EncodingConvertFilter extends FilterAdapter {
|
||||
return new StringReader(decode(stmt.getConnectionProxy(), text));
|
||||
}
|
||||
|
||||
if (object instanceof ResultSet) {
|
||||
long resultSetId = stmt.getConnectionProxy().getDirectDataSource().createResultSetId();
|
||||
ResultSet resultSet = (ResultSet) object;
|
||||
return new ResultSetProxyImpl(stmt, resultSet, resultSetId, stmt.getLastExecuteSql());
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ public abstract class LogFilter extends FilterEventAdapter implements LogFilterM
|
||||
super.connection_rollback(chain, connection);
|
||||
|
||||
if (connectionRollbackAfterLogEnable && isConnectionLogEnabled()) {
|
||||
connectionLog("connect rollback. id " + connection.getId());
|
||||
connectionLog("{conn " + connection.getId() + "} rollback");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ public abstract class LogFilter extends FilterEventAdapter implements LogFilterM
|
||||
super.connection_commit(chain, connection);
|
||||
|
||||
if (connectionCommitAfterLogEnable && isConnectionLogEnabled()) {
|
||||
connectionLog("connect committed. id " + connection.getId());
|
||||
connectionLog("{conn-" + connection.getId() + "} commited");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public abstract class LogFilter extends FilterEventAdapter implements LogFilterM
|
||||
public void connection_setAutoCommit(FilterChain chain, ConnectionProxy connection, boolean autoCommit)
|
||||
throws SQLException {
|
||||
|
||||
connectionLog("connect setAutoCommit " + autoCommit + ". id " + connection.getId());
|
||||
connectionLog("{conn-" + connection.getId() + "} setAutoCommit " + autoCommit);
|
||||
chain.connection_setAutoCommit(connection, autoCommit);
|
||||
}
|
||||
|
||||
@@ -464,6 +464,55 @@ public abstract class LogFilter extends FilterEventAdapter implements LogFilterM
|
||||
|
||||
return moreRows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object callableStatement_getObject(FilterChain chain, CallableStatementProxy statement, int parameterIndex)
|
||||
throws SQLException {
|
||||
Object obj = chain.callableStatement_getObject(statement, parameterIndex);
|
||||
|
||||
if (obj instanceof ResultSetProxy) {
|
||||
resultSetOpenAfter((ResultSetProxy) obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object callableStatement_getObject(FilterChain chain, CallableStatementProxy statement, int parameterIndex,
|
||||
java.util.Map<String, Class<?>> map) throws SQLException {
|
||||
Object obj = chain.callableStatement_getObject(statement, parameterIndex, map);
|
||||
|
||||
if (obj instanceof ResultSetProxy) {
|
||||
resultSetOpenAfter((ResultSetProxy) obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object callableStatement_getObject(FilterChain chain, CallableStatementProxy statement, String parameterName)
|
||||
throws SQLException {
|
||||
Object obj = chain.callableStatement_getObject(statement, parameterName);
|
||||
|
||||
if (obj instanceof ResultSetProxy) {
|
||||
resultSetOpenAfter((ResultSetProxy) obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object callableStatement_getObject(FilterChain chain, CallableStatementProxy statement,
|
||||
String parameterName, java.util.Map<String, Class<?>> map)
|
||||
throws SQLException {
|
||||
Object obj = chain.callableStatement_getObject(statement, parameterName, map);
|
||||
|
||||
if (obj instanceof ResultSetProxy) {
|
||||
resultSetOpenAfter((ResultSetProxy) obj);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resultSetOpenAfter(ResultSetProxy resultSet) {
|
||||
|
||||
Reference in New Issue
Block a user