From 1476e8f75cdc59790653d49a787975a087d7226d Mon Sep 17 00:00:00 2001 From: kiki Date: Tue, 14 Jan 2014 15:13:41 +0800 Subject: [PATCH] resultset proxy --- .../com/alibaba/druid/filter/FilterChainImpl.java | 12 +++++++++++- src/main/java/com/alibaba/druid/wall/WallFilter.java | 11 ----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java b/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java index 6482852584..69b0b80b8c 100644 --- a/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java +++ b/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java @@ -58,6 +58,8 @@ import com.alibaba.druid.proxy.jdbc.NClobProxyImpl; import com.alibaba.druid.proxy.jdbc.PreparedStatementProxy; import com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl; +import com.alibaba.druid.proxy.jdbc.ResultSetMetaDataProxy; +import com.alibaba.druid.proxy.jdbc.ResultSetMetaDataProxyImpl; import com.alibaba.druid.proxy.jdbc.ResultSetProxy; import com.alibaba.druid.proxy.jdbc.ResultSetProxyImpl; import com.alibaba.druid.proxy.jdbc.StatementProxy; @@ -965,7 +967,7 @@ public ResultSetMetaData resultSet_getMetaData(ResultSetProxy resultSet) throws if (this.pos < filterSize) { return nextFilter().resultSet_getMetaData(this, resultSet); } - return resultSet.getResultSetRaw().getMetaData(); + return wrap(resultSet.getResultSetRaw().getMetaData(), resultSet); } @Override @@ -4474,6 +4476,14 @@ public ResultSetProxy wrap(StatementProxy statement, ResultSet resultSet) { statement.getLastExecuteSql()); } + public ResultSetMetaDataProxy wrap(ResultSetMetaData metaData, ResultSetProxy resultSet) { + if (metaData == null) { + return null; + } + + return new ResultSetMetaDataProxyImpl(metaData, dataSource.createMetaDataId(), resultSet); + } + public ClobProxy wrap(ConnectionProxy conn, Clob clob) { if (clob == null) { return null; diff --git a/src/main/java/com/alibaba/druid/wall/WallFilter.java b/src/main/java/com/alibaba/druid/wall/WallFilter.java index 982b19385c..008362c0d4 100644 --- a/src/main/java/com/alibaba/druid/wall/WallFilter.java +++ b/src/main/java/com/alibaba/druid/wall/WallFilter.java @@ -35,7 +35,6 @@ import com.alibaba.druid.proxy.jdbc.ConnectionProxy; import com.alibaba.druid.proxy.jdbc.DataSourceProxy; import com.alibaba.druid.proxy.jdbc.PreparedStatementProxy; -import com.alibaba.druid.proxy.jdbc.ResultSetMetaDataProxyImpl; import com.alibaba.druid.proxy.jdbc.ResultSetProxy; import com.alibaba.druid.proxy.jdbc.StatementProxy; import com.alibaba.druid.support.logging.Log; @@ -780,16 +779,6 @@ public boolean resultSet_next(FilterChain chain, ResultSetProxy resultSet) throw return hasNext; } - @Override - public ResultSetMetaData resultSet_getMetaData(FilterChain chain, ResultSetProxy resultSet) throws SQLException { - ResultSetMetaData metaData = chain.resultSet_getMetaData(resultSet); - if (metaData == null) { - return null; - } - - return new ResultSetMetaDataProxyImpl(metaData, chain.getDataSource().createMetaDataId(), resultSet); - } - public long getViolationCount() { return this.provider.getViolationCount(); }