diff --git a/src/main/java/com/alibaba/druid/filter/Filter.java b/src/main/java/com/alibaba/druid/filter/Filter.java index c6127f18b0..a38eaa5b30 100644 --- a/src/main/java/com/alibaba/druid/filter/Filter.java +++ b/src/main/java/com/alibaba/druid/filter/Filter.java @@ -51,6 +51,7 @@ import com.alibaba.druid.proxy.jdbc.ClobProxy; 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.ResultSetMetaDataProxy; import com.alibaba.druid.proxy.jdbc.ResultSetProxy; import com.alibaba.druid.proxy.jdbc.StatementProxy; @@ -1286,4 +1287,67 @@ public interface Filter extends Wrapper { DruidPooledConnection dataSource_getConnection(FilterChain chain, DruidDataSource dataSource, long maxWaitMillis) throws SQLException; + + // ///////////////// + int resultSetMetaData_getColumnCount(FilterChain chain, ResultSetMetaDataProxy metaData) throws SQLException; + + boolean resultSetMetaData_isAutoIncrement(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + boolean resultSetMetaData_isCaseSensitive(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + boolean resultSetMetaData_isSearchable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + boolean resultSetMetaData_isCurrency(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + int resultSetMetaData_isNullable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + boolean resultSetMetaData_isSigned(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + int resultSetMetaData_getColumnDisplaySize(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + String resultSetMetaData_getColumnLabel(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + String resultSetMetaData_getColumnName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + String resultSetMetaData_getSchemaName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + int resultSetMetaData_getPrecision(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + int resultSetMetaData_getScale(FilterChain chain, ResultSetMetaDataProxy metaData, int column) throws SQLException; + + String resultSetMetaData_getTableName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + String resultSetMetaData_getCatalogName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + int resultSetMetaData_getColumnType(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + String resultSetMetaData_getColumnTypeName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + boolean resultSetMetaData_isReadOnly(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + boolean resultSetMetaData_isWritable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + boolean resultSetMetaData_isDefinitelyWritable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + + String resultSetMetaData_getColumnClassName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException; + } diff --git a/src/main/java/com/alibaba/druid/filter/FilterAdapter.java b/src/main/java/com/alibaba/druid/filter/FilterAdapter.java index 9869aca93c..2284057e0d 100644 --- a/src/main/java/com/alibaba/druid/filter/FilterAdapter.java +++ b/src/main/java/com/alibaba/druid/filter/FilterAdapter.java @@ -49,6 +49,7 @@ import com.alibaba.druid.proxy.jdbc.ClobProxy; 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.ResultSetMetaDataProxy; import com.alibaba.druid.proxy.jdbc.ResultSetProxy; import com.alibaba.druid.proxy.jdbc.StatementProxy; @@ -67,16 +68,16 @@ public abstract class FilterAdapter extends NotificationBroadcasterSupport imple public void destory() { } - + public void configFromProperties(Properties properties) { - + } - + @Override public boolean isWrapperFor(Class iface) { return iface == this.getClass(); } - + @SuppressWarnings("unchecked") public T unwrap(Class iface) { if (iface == this.getClass()) { @@ -2722,4 +2723,131 @@ public abstract class FilterAdapter extends NotificationBroadcasterSupport imple long maxWaitMillis) throws SQLException { return chain.dataSource_connect(dataSource, maxWaitMillis); } + + // /////////////// + + @Override + public int resultSetMetaData_getColumnCount(FilterChain chain, ResultSetMetaDataProxy metaData) throws SQLException { + return chain.resultSetMetaData_getColumnCount(metaData); + } + + @Override + public boolean resultSetMetaData_isAutoIncrement(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isAutoIncrement(metaData, column); + } + + @Override + public boolean resultSetMetaData_isCaseSensitive(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isCaseSensitive(metaData, column); + } + + @Override + public boolean resultSetMetaData_isSearchable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isSearchable(metaData, column); + } + + @Override + public boolean resultSetMetaData_isCurrency(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isCurrency(metaData, column); + } + + @Override + public int resultSetMetaData_isNullable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isNullable(metaData, column); + } + + @Override + public boolean resultSetMetaData_isSigned(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isSigned(metaData, column); + } + + @Override + public int resultSetMetaData_getColumnDisplaySize(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnDisplaySize(metaData, column); + } + + @Override + public String resultSetMetaData_getColumnLabel(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnLabel(metaData, column); + } + + @Override + public String resultSetMetaData_getColumnName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnName(metaData, column); + } + + @Override + public String resultSetMetaData_getSchemaName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getSchemaName(metaData, column); + } + + @Override + public int resultSetMetaData_getPrecision(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getPrecision(metaData, column); + } + + @Override + public int resultSetMetaData_getScale(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getScale(metaData, column); + } + + @Override + public String resultSetMetaData_getTableName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getTableName(metaData, column); + } + + @Override + public String resultSetMetaData_getCatalogName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getCatalogName(metaData, column); + } + + @Override + public int resultSetMetaData_getColumnType(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnType(metaData, column); + } + + @Override + public String resultSetMetaData_getColumnTypeName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnTypeName(metaData, column); + } + + @Override + public boolean resultSetMetaData_isReadOnly(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isReadOnly(metaData, column); + } + + @Override + public boolean resultSetMetaData_isWritable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isWritable(metaData, column); + } + + @Override + public boolean resultSetMetaData_isDefinitelyWritable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isDefinitelyWritable(metaData, column); + } + + @Override + public String resultSetMetaData_getColumnClassName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnClassName(metaData, column); + } } diff --git a/src/main/java/com/alibaba/druid/filter/FilterChain.java b/src/main/java/com/alibaba/druid/filter/FilterChain.java index 1b5aec5b86..65f3090295 100644 --- a/src/main/java/com/alibaba/druid/filter/FilterChain.java +++ b/src/main/java/com/alibaba/druid/filter/FilterChain.java @@ -48,6 +48,7 @@ import com.alibaba.druid.proxy.jdbc.ClobProxy; 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.ResultSetMetaDataProxy; import com.alibaba.druid.proxy.jdbc.ResultSetProxy; import com.alibaba.druid.proxy.jdbc.StatementProxy; @@ -1136,4 +1137,47 @@ public interface FilterChain { void dataSource_recycle(DruidPooledConnection connection) throws SQLException; DruidPooledConnection dataSource_connect(DruidDataSource dataSource, long maxWaitMillis) throws SQLException; + + // ////////// + int resultSetMetaData_getColumnCount(ResultSetMetaDataProxy metaData) throws SQLException; + + boolean resultSetMetaData_isAutoIncrement(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + boolean resultSetMetaData_isCaseSensitive(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + boolean resultSetMetaData_isSearchable(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + boolean resultSetMetaData_isCurrency(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + int resultSetMetaData_isNullable(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + boolean resultSetMetaData_isSigned(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + int resultSetMetaData_getColumnDisplaySize(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + String resultSetMetaData_getColumnLabel(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + String resultSetMetaData_getColumnName(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + String resultSetMetaData_getSchemaName(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + int resultSetMetaData_getPrecision(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + int resultSetMetaData_getScale(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + String resultSetMetaData_getTableName(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + String resultSetMetaData_getCatalogName(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + int resultSetMetaData_getColumnType(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + String resultSetMetaData_getColumnTypeName(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + boolean resultSetMetaData_isReadOnly(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + boolean resultSetMetaData_isWritable(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + boolean resultSetMetaData_isDefinitelyWritable(ResultSetMetaDataProxy metaData, int column) throws SQLException; + + String resultSetMetaData_getColumnClassName(ResultSetMetaDataProxy metaData, int column) throws SQLException; } diff --git a/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java b/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java index 69b0b80b8c..db1a25e528 100644 --- a/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java +++ b/src/main/java/com/alibaba/druid/filter/FilterChainImpl.java @@ -4544,4 +4544,194 @@ public class FilterChainImpl implements FilterChain { return dataSource.getConnectionDirect(maxWaitMillis); } + @Override + public int resultSetMetaData_getColumnCount(ResultSetMetaDataProxy metaData) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getColumnCount(this, metaData); + } + + return metaData.getColumnCount(); + } + + @Override + public boolean resultSetMetaData_isAutoIncrement(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_isAutoIncrement(this, metaData, column); + } + + return metaData.isAutoIncrement(column); + } + + @Override + public boolean resultSetMetaData_isCaseSensitive(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_isCaseSensitive(this, metaData, column); + } + + return metaData.isCaseSensitive(column); + } + + @Override + public boolean resultSetMetaData_isSearchable(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_isSearchable(this, metaData, column); + } + + return metaData.isSearchable(column); + } + + @Override + public boolean resultSetMetaData_isCurrency(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_isCurrency(this, metaData, column); + } + + return metaData.isCurrency(column); + } + + @Override + public int resultSetMetaData_isNullable(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_isNullable(this, metaData, column); + } + + return metaData.isNullable(column); + } + + @Override + public boolean resultSetMetaData_isSigned(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_isSigned(this, metaData, column); + } + + return metaData.isSigned(column); + } + + @Override + public int resultSetMetaData_getColumnDisplaySize(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getColumnDisplaySize(this, metaData, column); + } + + return metaData.getColumnDisplaySize(column); + } + + @Override + public String resultSetMetaData_getColumnLabel(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getColumnLabel(this, metaData, column); + } + + return metaData.getColumnLabel(column); + } + + @Override + public String resultSetMetaData_getColumnName(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getColumnName(this, metaData, column); + } + + return metaData.getColumnName(column); + } + + @Override + public String resultSetMetaData_getSchemaName(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getSchemaName(this, metaData, column); + } + + return metaData.getSchemaName(column); + } + + @Override + public int resultSetMetaData_getPrecision(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getPrecision(this, metaData, column); + } + + return metaData.getPrecision(column); + } + + @Override + public int resultSetMetaData_getScale(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getScale(this, metaData, column); + } + + return metaData.getScale(column); + } + + @Override + public String resultSetMetaData_getTableName(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getTableName(this, metaData, column); + } + + return metaData.getTableName(column); + } + + @Override + public String resultSetMetaData_getCatalogName(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getCatalogName(this, metaData, column); + } + + return metaData.getCatalogName(column); + } + + @Override + public int resultSetMetaData_getColumnType(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getColumnType(this, metaData, column); + } + + return metaData.getColumnType(column); + } + + @Override + public String resultSetMetaData_getColumnTypeName(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getColumnTypeName(this, metaData, column); + } + + return metaData.getColumnTypeName(column); + } + + @Override + public boolean resultSetMetaData_isReadOnly(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_isReadOnly(this, metaData, column); + } + + return metaData.isReadOnly(column); + } + + @Override + public boolean resultSetMetaData_isWritable(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_isWritable(this, metaData, column); + } + + return metaData.isWritable(column); + } + + @Override + public boolean resultSetMetaData_isDefinitelyWritable(ResultSetMetaDataProxy metaData, int column) + throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_isDefinitelyWritable(this, metaData, column); + } + + return metaData.isDefinitelyWritable(column); + } + + @Override + public String resultSetMetaData_getColumnClassName(ResultSetMetaDataProxy metaData, int column) throws SQLException { + if (this.pos < filterSize) { + return nextFilter().resultSetMetaData_getColumnClassName(this, metaData, column); + } + + return metaData.getColumnClassName(column); + } + } diff --git a/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxy.java b/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxy.java index df2be10011..3c5bee73cc 100644 --- a/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxy.java +++ b/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxy.java @@ -25,4 +25,6 @@ public interface ResultSetMetaDataProxy extends ResultSetMetaData, WrapperProxy ResultSetMetaData getResultSetMetaDataRaw(); + ResultSetProxy getResultSetProxy(); + } diff --git a/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxyImpl.java b/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxyImpl.java index dac5320593..dff7c1d5ef 100644 --- a/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxyImpl.java +++ b/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetMetaDataProxyImpl.java @@ -19,7 +19,7 @@ package com.alibaba.druid.proxy.jdbc; import java.sql.ResultSetMetaData; import java.sql.SQLException; -import com.alibaba.druid.filter.FilterChain; +import com.alibaba.druid.filter.FilterChainImpl; /** * @author kiki @@ -27,128 +27,209 @@ import com.alibaba.druid.filter.FilterChain; public class ResultSetMetaDataProxyImpl extends WrapperProxyImpl implements ResultSetMetaDataProxy { private final ResultSetMetaData metaData; + private final ResultSetProxy resultSet; - private final ResultSetProxy resultSetProxy; + private FilterChainImpl filterChain = null; - public ResultSetMetaDataProxyImpl(ResultSetMetaData metaData, long id, ResultSetProxy resultSetProxy){ + public ResultSetMetaDataProxyImpl(ResultSetMetaData metaData, long id, ResultSetProxy resultSet){ super(metaData, id); this.metaData = metaData; - this.resultSetProxy = resultSetProxy; + this.resultSet = resultSet; } @Override public int getColumnCount() throws SQLException { - return metaData.getColumnCount() - resultSetProxy.getHiddenColumnCount(); + FilterChainImpl chain = createChain(); + int value = chain.resultSetMetaData_getColumnCount(this); + recycleFilterChain(chain); + return value; } @Override public boolean isAutoIncrement(int column) throws SQLException { - return metaData.isAutoIncrement(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + boolean value = chain.resultSetMetaData_isAutoIncrement(this, column); + recycleFilterChain(chain); + return value; } @Override public boolean isCaseSensitive(int column) throws SQLException { - return metaData.isCaseSensitive(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + boolean value = chain.resultSetMetaData_isCaseSensitive(this, column); + recycleFilterChain(chain); + return value; } @Override public boolean isSearchable(int column) throws SQLException { - return metaData.isSearchable(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + boolean value = chain.resultSetMetaData_isSearchable(this, column); + recycleFilterChain(chain); + return value; } @Override public boolean isCurrency(int column) throws SQLException { - return metaData.isCurrency(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + boolean value = chain.resultSetMetaData_isCurrency(this, column); + recycleFilterChain(chain); + return value; } @Override public int isNullable(int column) throws SQLException { - return metaData.isNullable(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + int value = chain.resultSetMetaData_isNullable(this, column); + recycleFilterChain(chain); + return value; } @Override public boolean isSigned(int column) throws SQLException { - return metaData.isSigned(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + boolean value = chain.resultSetMetaData_isSigned(this, column); + recycleFilterChain(chain); + return value; } @Override public int getColumnDisplaySize(int column) throws SQLException { - return metaData.getColumnDisplaySize(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + int value = chain.resultSetMetaData_getColumnDisplaySize(this, column); + recycleFilterChain(chain); + return value; } @Override public String getColumnLabel(int column) throws SQLException { - return metaData.getColumnLabel(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + String value = chain.resultSetMetaData_getColumnLabel(this, column); + recycleFilterChain(chain); + return value; } @Override public String getColumnName(int column) throws SQLException { - return metaData.getColumnName(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + String value = chain.resultSetMetaData_getColumnName(this, column); + recycleFilterChain(chain); + return value; } @Override public String getSchemaName(int column) throws SQLException { - return metaData.getSchemaName(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + String value = chain.resultSetMetaData_getSchemaName(this, column); + recycleFilterChain(chain); + return value; } @Override public int getPrecision(int column) throws SQLException { - return metaData.getPrecision(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + int value = chain.resultSetMetaData_getPrecision(this, column); + recycleFilterChain(chain); + return value; } @Override public int getScale(int column) throws SQLException { - return metaData.getScale(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + int value = chain.resultSetMetaData_getScale(this, column); + recycleFilterChain(chain); + return value; } @Override public String getTableName(int column) throws SQLException { - return metaData.getTableName(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + String value = chain.resultSetMetaData_getTableName(this, column); + recycleFilterChain(chain); + return value; } @Override public String getCatalogName(int column) throws SQLException { - return metaData.getCatalogName(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + String value = chain.resultSetMetaData_getCatalogName(this, column); + recycleFilterChain(chain); + return value; } @Override public int getColumnType(int column) throws SQLException { - return metaData.getColumnType(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + int value = chain.resultSetMetaData_getColumnType(this, column); + recycleFilterChain(chain); + return value; } @Override public String getColumnTypeName(int column) throws SQLException { - return metaData.getColumnTypeName(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + String value = chain.resultSetMetaData_getColumnTypeName(this, column); + recycleFilterChain(chain); + return value; } @Override public boolean isReadOnly(int column) throws SQLException { - return metaData.isReadOnly(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + boolean value = chain.resultSetMetaData_isReadOnly(this, column); + recycleFilterChain(chain); + return value; } @Override public boolean isWritable(int column) throws SQLException { - return metaData.isWritable(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + boolean value = chain.resultSetMetaData_isWritable(this, column); + recycleFilterChain(chain); + return value; } @Override public boolean isDefinitelyWritable(int column) throws SQLException { - return metaData.isDefinitelyWritable(resultSetProxy.getPhysicalColumn(column)); + FilterChainImpl chain = createChain(); + boolean value = chain.resultSetMetaData_isDefinitelyWritable(this, column); + recycleFilterChain(chain); + return value; } @Override public String getColumnClassName(int column) throws SQLException { - return metaData.getColumnClassName(resultSetProxy.getPhysicalColumn(column)); + + FilterChainImpl chain = createChain(); + String value = chain.resultSetMetaData_getColumnClassName(this, column); + recycleFilterChain(chain); + return value; + } + + public FilterChainImpl createChain() { + FilterChainImpl chain = this.filterChain; + if (chain == null) { + chain = new FilterChainImpl(this.resultSet.getStatementProxy().getConnectionProxy().getDirectDataSource()); + } else { + this.filterChain = null; + } + + return chain; + } + + public void recycleFilterChain(FilterChainImpl chain) { + chain.reset(); + this.filterChain = chain; + } + + @Override + public ResultSetProxy getResultSetProxy() { + return this.resultSet; } @Override public ResultSetMetaData getResultSetMetaDataRaw() { - return metaData; - } - - @Override - public FilterChain createChain() { - return null; + return this.metaData; } } diff --git a/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxy.java b/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxy.java index 19881dc44b..28d569a7e4 100644 --- a/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxy.java +++ b/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxy.java @@ -64,6 +64,8 @@ public interface ResultSetProxy extends ResultSet, WrapperProxy { int getPhysicalColumn(int logicColumn); + int getLogicColumn(int physicalColumn); + List getHiddenColumns(); int getHiddenColumnCount(); diff --git a/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java b/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java index 91d58af6fb..8d17b72024 100644 --- a/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java +++ b/src/main/java/com/alibaba/druid/proxy/jdbc/ResultSetProxyImpl.java @@ -185,10 +185,10 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public int findColumn(String columnLabel) throws SQLException { FilterChainImpl chain = createChain(); - int physicalColumn = chain.resultSet_findColumn(this, columnLabel); + int value = chain.resultSet_findColumn(this, columnLabel); recycleFilterChain(chain); - return getLogicColumn(physicalColumn); + return value; } @Override @@ -202,7 +202,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Array getArray(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - Array value = chain.resultSet_getArray(this, getPhysicalColumn(columnIndex)); + Array value = chain.resultSet_getArray(this, columnIndex); recycleFilterChain(chain); return value; } @@ -218,7 +218,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public InputStream getAsciiStream(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - InputStream value = chain.resultSet_getAsciiStream(this, getPhysicalColumn(columnIndex)); + InputStream value = chain.resultSet_getAsciiStream(this, columnIndex); recycleFilterChain(chain); return value; } @@ -234,7 +234,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public BigDecimal getBigDecimal(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - BigDecimal value = chain.resultSet_getBigDecimal(this, getPhysicalColumn(columnIndex)); + BigDecimal value = chain.resultSet_getBigDecimal(this, columnIndex); recycleFilterChain(chain); return value; } @@ -250,7 +250,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { FilterChainImpl chain = createChain(); - BigDecimal value = chain.resultSet_getBigDecimal(this, getPhysicalColumn(columnIndex), scale); + BigDecimal value = chain.resultSet_getBigDecimal(this, columnIndex, scale); recycleFilterChain(chain); return value; } @@ -266,7 +266,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public InputStream getBinaryStream(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - InputStream value = chain.resultSet_getBinaryStream(this, getPhysicalColumn(columnIndex)); + InputStream value = chain.resultSet_getBinaryStream(this, columnIndex); recycleFilterChain(chain); return value; } @@ -282,7 +282,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Blob getBlob(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - Blob value = chain.resultSet_getBlob(this, getPhysicalColumn(columnIndex)); + Blob value = chain.resultSet_getBlob(this, columnIndex); recycleFilterChain(chain); return value; } @@ -298,7 +298,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public boolean getBoolean(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - boolean value = chain.resultSet_getBoolean(this, getPhysicalColumn(columnIndex)); + boolean value = chain.resultSet_getBoolean(this, columnIndex); recycleFilterChain(chain); return value; } @@ -314,7 +314,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public byte getByte(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - byte value = chain.resultSet_getByte(this, getPhysicalColumn(columnIndex)); + byte value = chain.resultSet_getByte(this, columnIndex); recycleFilterChain(chain); return value; } @@ -330,7 +330,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public byte[] getBytes(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - byte[] value = chain.resultSet_getBytes(this, getPhysicalColumn(columnIndex)); + byte[] value = chain.resultSet_getBytes(this, columnIndex); recycleFilterChain(chain); return value; } @@ -346,7 +346,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Reader getCharacterStream(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - Reader value = chain.resultSet_getCharacterStream(this, getPhysicalColumn(columnIndex)); + Reader value = chain.resultSet_getCharacterStream(this, columnIndex); recycleFilterChain(chain); return value; } @@ -362,7 +362,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Clob getClob(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - Clob value = chain.resultSet_getClob(this, getPhysicalColumn(columnIndex)); + Clob value = chain.resultSet_getClob(this, columnIndex); recycleFilterChain(chain); return value; } @@ -394,7 +394,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Date getDate(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - Date value = chain.resultSet_getDate(this, getPhysicalColumn(columnIndex)); + Date value = chain.resultSet_getDate(this, columnIndex); recycleFilterChain(chain); return value; } @@ -410,7 +410,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Date getDate(int columnIndex, Calendar cal) throws SQLException { FilterChainImpl chain = createChain(); - Date value = chain.resultSet_getDate(this, getPhysicalColumn(columnIndex), cal); + Date value = chain.resultSet_getDate(this, columnIndex, cal); recycleFilterChain(chain); return value; } @@ -426,7 +426,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public double getDouble(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - double value = chain.resultSet_getDouble(this, getPhysicalColumn(columnIndex)); + double value = chain.resultSet_getDouble(this, columnIndex); recycleFilterChain(chain); return value; } @@ -458,7 +458,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public float getFloat(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - float value = chain.resultSet_getFloat(this, getPhysicalColumn(columnIndex)); + float value = chain.resultSet_getFloat(this, columnIndex); recycleFilterChain(chain); return value; } @@ -482,7 +482,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public int getInt(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - int value = chain.resultSet_getInt(this, getPhysicalColumn(columnIndex)); + int value = chain.resultSet_getInt(this, columnIndex); recycleFilterChain(chain); return value; } @@ -498,7 +498,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public long getLong(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - long value = chain.resultSet_getLong(this, getPhysicalColumn(columnIndex)); + long value = chain.resultSet_getLong(this, columnIndex); recycleFilterChain(chain); return value; } @@ -522,7 +522,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Reader getNCharacterStream(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - Reader value = chain.resultSet_getNCharacterStream(this, getPhysicalColumn(columnIndex)); + Reader value = chain.resultSet_getNCharacterStream(this, columnIndex); recycleFilterChain(chain); return value; } @@ -538,7 +538,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public NClob getNClob(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - NClob value = chain.resultSet_getNClob(this, getPhysicalColumn(columnIndex)); + NClob value = chain.resultSet_getNClob(this, columnIndex); recycleFilterChain(chain); return value; } @@ -554,7 +554,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public String getNString(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - String value = chain.resultSet_getNString(this, getPhysicalColumn(columnIndex)); + String value = chain.resultSet_getNString(this, columnIndex); recycleFilterChain(chain); return value; } @@ -570,7 +570,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Object getObject(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - Object value = chain.resultSet_getObject(this, getPhysicalColumn(columnIndex)); + Object value = chain.resultSet_getObject(this, columnIndex); recycleFilterChain(chain); return value; } @@ -586,7 +586,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Object getObject(int columnIndex, Map> map) throws SQLException { FilterChainImpl chain = createChain(); - Object value = chain.resultSet_getObject(this, getPhysicalColumn(columnIndex), map); + Object value = chain.resultSet_getObject(this, columnIndex, map); recycleFilterChain(chain); return value; } @@ -602,7 +602,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Ref getRef(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - Ref value = chain.resultSet_getRef(this, getPhysicalColumn(columnIndex)); + Ref value = chain.resultSet_getRef(this, columnIndex); recycleFilterChain(chain); return value; } @@ -626,7 +626,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public RowId getRowId(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - RowId value = chain.resultSet_getRowId(this, getPhysicalColumn(columnIndex)); + RowId value = chain.resultSet_getRowId(this, columnIndex); recycleFilterChain(chain); return value; } @@ -642,7 +642,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public SQLXML getSQLXML(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - SQLXML value = chain.resultSet_getSQLXML(this, getPhysicalColumn(columnIndex)); + SQLXML value = chain.resultSet_getSQLXML(this, columnIndex); recycleFilterChain(chain); return value; } @@ -658,7 +658,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public short getShort(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - short value = chain.resultSet_getShort(this, getPhysicalColumn(columnIndex)); + short value = chain.resultSet_getShort(this, columnIndex); recycleFilterChain(chain); return value; } @@ -682,7 +682,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public String getString(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - String value = chain.resultSet_getString(this, getPhysicalColumn(columnIndex)); + String value = chain.resultSet_getString(this, columnIndex); recycleFilterChain(chain); return value; } @@ -698,7 +698,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Time getTime(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - Time value = chain.resultSet_getTime(this, getPhysicalColumn(columnIndex)); + Time value = chain.resultSet_getTime(this, columnIndex); recycleFilterChain(chain); return value; } @@ -714,7 +714,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Time getTime(int columnIndex, Calendar cal) throws SQLException { FilterChainImpl chain = createChain(); - Time value = chain.resultSet_getTime(this, getPhysicalColumn(columnIndex), cal); + Time value = chain.resultSet_getTime(this, columnIndex, cal); recycleFilterChain(chain); return value; } @@ -730,7 +730,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Timestamp getTimestamp(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - Timestamp value = chain.resultSet_getTimestamp(this, getPhysicalColumn(columnIndex)); + Timestamp value = chain.resultSet_getTimestamp(this, columnIndex); recycleFilterChain(chain); return value; } @@ -746,7 +746,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { FilterChainImpl chain = createChain(); - Timestamp value = chain.resultSet_getTimestamp(this, getPhysicalColumn(columnIndex), cal); + Timestamp value = chain.resultSet_getTimestamp(this, columnIndex, cal); recycleFilterChain(chain); return value; } @@ -770,7 +770,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public URL getURL(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - URL value = chain.resultSet_getURL(this, getPhysicalColumn(columnIndex)); + URL value = chain.resultSet_getURL(this, columnIndex); recycleFilterChain(chain); return value; } @@ -786,7 +786,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public InputStream getUnicodeStream(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - InputStream value = chain.resultSet_getUnicodeStream(this, getPhysicalColumn(columnIndex)); + InputStream value = chain.resultSet_getUnicodeStream(this, columnIndex); recycleFilterChain(chain); return value; } @@ -961,7 +961,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateArray(int columnIndex, Array x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateArray(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateArray(this, columnIndex, x); recycleFilterChain(chain); } @@ -975,7 +975,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateAsciiStream(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateAsciiStream(this, columnIndex, x); recycleFilterChain(chain); } @@ -989,7 +989,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateAsciiStream(this, getPhysicalColumn(columnIndex), x, length); + chain.resultSet_updateAsciiStream(this, columnIndex, x, length); recycleFilterChain(chain); } @@ -1003,7 +1003,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateAsciiStream(this, getPhysicalColumn(columnIndex), x, length); + chain.resultSet_updateAsciiStream(this, columnIndex, x, length); recycleFilterChain(chain); } @@ -1017,7 +1017,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateBigDecimal(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateBigDecimal(this, columnIndex, x); recycleFilterChain(chain); } @@ -1031,7 +1031,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateBinaryStream(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateBinaryStream(this, columnIndex, x); recycleFilterChain(chain); } @@ -1045,7 +1045,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateBinaryStream(this, getPhysicalColumn(columnIndex), x, length); + chain.resultSet_updateBinaryStream(this, columnIndex, x, length); recycleFilterChain(chain); } @@ -1059,7 +1059,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateBinaryStream(this, getPhysicalColumn(columnIndex), x, length); + chain.resultSet_updateBinaryStream(this, columnIndex, x, length); recycleFilterChain(chain); } @@ -1087,7 +1087,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateBlob(int columnIndex, InputStream x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateBlob(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateBlob(this, columnIndex, x); recycleFilterChain(chain); } @@ -1101,7 +1101,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateBlob(int columnIndex, InputStream x, long length) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateBlob(this, getPhysicalColumn(columnIndex), x, length); + chain.resultSet_updateBlob(this, columnIndex, x, length); recycleFilterChain(chain); } @@ -1115,7 +1115,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateBoolean(int columnIndex, boolean x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateBoolean(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateBoolean(this, columnIndex, x); recycleFilterChain(chain); } @@ -1129,7 +1129,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateByte(int columnIndex, byte x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateByte(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateByte(this, columnIndex, x); recycleFilterChain(chain); } @@ -1143,7 +1143,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateBytes(int columnIndex, byte[] x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateBytes(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateBytes(this, columnIndex, x); recycleFilterChain(chain); } @@ -1157,7 +1157,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateCharacterStream(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateCharacterStream(this, columnIndex, x); recycleFilterChain(chain); } @@ -1171,7 +1171,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateCharacterStream(this, getPhysicalColumn(columnIndex), x, length); + chain.resultSet_updateCharacterStream(this, columnIndex, x, length); recycleFilterChain(chain); } @@ -1185,7 +1185,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateCharacterStream(this, getPhysicalColumn(columnIndex), x, length); + chain.resultSet_updateCharacterStream(this, columnIndex, x, length); recycleFilterChain(chain); } @@ -1199,7 +1199,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateClob(int columnIndex, Clob x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateClob(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateClob(this, columnIndex, x); recycleFilterChain(chain); } @@ -1213,7 +1213,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateClob(int columnIndex, Reader x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateClob(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateClob(this, columnIndex, x); recycleFilterChain(chain); } @@ -1227,7 +1227,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateClob(int columnIndex, Reader x, long length) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateClob(this, getPhysicalColumn(columnIndex), x, length); + chain.resultSet_updateClob(this, columnIndex, x, length); recycleFilterChain(chain); } @@ -1241,7 +1241,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateDate(int columnIndex, Date x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateDate(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateDate(this, columnIndex, x); recycleFilterChain(chain); } @@ -1255,7 +1255,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateDouble(int columnIndex, double x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateDouble(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateDouble(this, columnIndex, x); recycleFilterChain(chain); } @@ -1269,7 +1269,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateFloat(int columnIndex, float x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateFloat(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateFloat(this, columnIndex, x); recycleFilterChain(chain); } @@ -1283,7 +1283,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateInt(int columnIndex, int x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateInt(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateInt(this, columnIndex, x); recycleFilterChain(chain); } @@ -1297,7 +1297,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateLong(int columnIndex, long x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateLong(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateLong(this, columnIndex, x); recycleFilterChain(chain); } @@ -1311,7 +1311,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateNCharacterStream(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateNCharacterStream(this, columnIndex, x); recycleFilterChain(chain); } @@ -1325,7 +1325,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateNCharacterStream(this, getPhysicalColumn(columnIndex), x, length); + chain.resultSet_updateNCharacterStream(this, columnIndex, x, length); recycleFilterChain(chain); } @@ -1339,7 +1339,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateNClob(int columnIndex, NClob x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateNClob(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateNClob(this, columnIndex, x); recycleFilterChain(chain); } @@ -1353,7 +1353,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateNClob(int columnIndex, Reader x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateNClob(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateNClob(this, columnIndex, x); recycleFilterChain(chain); } @@ -1395,7 +1395,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateNull(int columnIndex) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateNull(this, getPhysicalColumn(columnIndex)); + chain.resultSet_updateNull(this, columnIndex); recycleFilterChain(chain); } @@ -1409,7 +1409,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateObject(int columnIndex, Object x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateObject(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateObject(this, columnIndex, x); recycleFilterChain(chain); } @@ -1423,7 +1423,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateObject(int columnIndex, Object x, int scaleOrLength) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateObject(this, getPhysicalColumn(columnIndex), x, scaleOrLength); + chain.resultSet_updateObject(this, columnIndex, x, scaleOrLength); recycleFilterChain(chain); } @@ -1437,7 +1437,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateRef(int columnIndex, Ref x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateRef(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateRef(this, columnIndex, x); recycleFilterChain(chain); } @@ -1458,7 +1458,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateRowId(int columnIndex, RowId x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateRowId(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateRowId(this, columnIndex, x); recycleFilterChain(chain); } @@ -1472,7 +1472,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateSQLXML(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateSQLXML(this, columnIndex, x); recycleFilterChain(chain); } @@ -1486,7 +1486,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateShort(int columnIndex, short x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateShort(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateShort(this, columnIndex, x); recycleFilterChain(chain); } @@ -1500,7 +1500,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateString(int columnIndex, String x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateString(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateString(this, columnIndex, x); recycleFilterChain(chain); } @@ -1514,7 +1514,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateTime(int columnIndex, Time x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateTime(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateTime(this, columnIndex, x); recycleFilterChain(chain); } @@ -1528,7 +1528,7 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro @Override public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { FilterChainImpl chain = createChain(); - chain.resultSet_updateTimestamp(this, getPhysicalColumn(columnIndex), x); + chain.resultSet_updateTimestamp(this, columnIndex, x); recycleFilterChain(chain); } @@ -1625,7 +1625,8 @@ public class ResultSetProxyImpl extends WrapperProxyImpl implements ResultSetPro return logicColumnMap.get(logicColumn); } - private int getLogicColumn(int physicalColumn) { + @Override + public int getLogicColumn(int physicalColumn) { if (physicalColumnMap == null) { return physicalColumn; } diff --git a/src/main/java/com/alibaba/druid/wall/WallFilter.java b/src/main/java/com/alibaba/druid/wall/WallFilter.java index 008362c0d4..19230807fd 100644 --- a/src/main/java/com/alibaba/druid/wall/WallFilter.java +++ b/src/main/java/com/alibaba/druid/wall/WallFilter.java @@ -17,11 +17,22 @@ package com.alibaba.druid.wall; import static com.alibaba.druid.util.Utils.getBoolean; +import java.io.InputStream; +import java.io.Reader; +import java.math.BigDecimal; +import java.sql.Array; +import java.sql.Blob; +import java.sql.Clob; import java.sql.DatabaseMetaData; +import java.sql.NClob; +import java.sql.Ref; import java.sql.ResultSetMetaData; +import java.sql.RowId; import java.sql.SQLException; +import java.sql.SQLXML; import java.sql.Wrapper; import java.util.ArrayList; +import java.util.Calendar; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -35,6 +46,7 @@ import com.alibaba.druid.proxy.jdbc.CallableStatementProxy; 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.ResultSetMetaDataProxy; import com.alibaba.druid.proxy.jdbc.ResultSetProxy; import com.alibaba.druid.proxy.jdbc.StatementProxy; import com.alibaba.druid.support.logging.Log; @@ -763,6 +775,440 @@ public class WallFilter extends FilterAdapter implements WallFilterMBean { // //////////////// + @Override + public int resultSet_findColumn(FilterChain chain, ResultSetProxy resultSet, String columnLabel) + throws SQLException { + int physicalColumn = chain.resultSet_findColumn(resultSet, columnLabel); + return resultSet.getLogicColumn(physicalColumn); + } + + @Override + public Array resultSet_getArray(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getArray(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public InputStream resultSet_getAsciiStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getAsciiStream(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public BigDecimal resultSet_getBigDecimal(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getBigDecimal(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public BigDecimal resultSet_getBigDecimal(FilterChain chain, ResultSetProxy resultSet, int columnIndex, int scale) + throws SQLException { + return chain.resultSet_getBigDecimal(resultSet, resultSet.getPhysicalColumn(columnIndex), scale); + } + + @Override + public java.io.InputStream resultSet_getBinaryStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getBinaryStream(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public Blob resultSet_getBlob(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getBlob(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public boolean resultSet_getBoolean(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getBoolean(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public byte resultSet_getByte(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getByte(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public byte[] resultSet_getBytes(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getBytes(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public java.io.Reader resultSet_getCharacterStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getCharacterStream(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public Clob resultSet_getClob(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getClob(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public java.sql.Date resultSet_getDate(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getDate(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public java.sql.Date resultSet_getDate(FilterChain chain, ResultSetProxy resultSet, int columnIndex, Calendar cal) + throws SQLException { + return chain.resultSet_getDate(resultSet, resultSet.getPhysicalColumn(columnIndex), cal); + } + + @Override + public double resultSet_getDouble(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getDouble(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public float resultSet_getFloat(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getFloat(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public int resultSet_getInt(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getInt(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public long resultSet_getLong(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getLong(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public java.io.Reader resultSet_getNCharacterStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getNCharacterStream(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public NClob resultSet_getNClob(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getNClob(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public String resultSet_getNString(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getNString(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public Object resultSet_getObject(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getObject(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public Object resultSet_getObject(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.util.Map> map) throws SQLException { + return chain.resultSet_getObject(resultSet, resultSet.getPhysicalColumn(columnIndex), map); + } + + @Override + public Ref resultSet_getRef(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getRef(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public RowId resultSet_getRowId(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getRowId(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public SQLXML resultSet_getSQLXML(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getSQLXML(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public short resultSet_getShort(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getShort(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public String resultSet_getString(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + return chain.resultSet_getString(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public java.sql.Time resultSet_getTime(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getTime(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public java.sql.Time resultSet_getTime(FilterChain chain, ResultSetProxy resultSet, int columnIndex, Calendar cal) + throws SQLException { + return chain.resultSet_getTime(resultSet, resultSet.getPhysicalColumn(columnIndex), cal); + } + + @Override + public java.sql.Timestamp resultSet_getTimestamp(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getTimestamp(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public java.sql.Timestamp resultSet_getTimestamp(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + Calendar cal) throws SQLException { + return chain.resultSet_getTimestamp(resultSet, resultSet.getPhysicalColumn(columnIndex), cal); + } + + @Override + public java.net.URL resultSet_getURL(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getURL(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public java.io.InputStream resultSet_getUnicodeStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex) + throws SQLException { + return chain.resultSet_getUnicodeStream(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public void resultSet_updateArray(FilterChain chain, ResultSetProxy resultSet, int columnIndex, java.sql.Array x) + throws SQLException { + chain.resultSet_updateArray(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateAsciiStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.InputStream x) throws SQLException { + chain.resultSet_updateAsciiStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateAsciiStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.InputStream x, int length) throws SQLException { + chain.resultSet_updateAsciiStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x, length); + } + + @Override + public void resultSet_updateAsciiStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.InputStream x, long length) throws SQLException { + chain.resultSet_updateAsciiStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x, length); + } + + @Override + public void resultSet_updateBigDecimal(FilterChain chain, ResultSetProxy resultSet, int columnIndex, BigDecimal x) + throws SQLException { + chain.resultSet_updateBigDecimal(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateBinaryStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.InputStream x) throws SQLException { + chain.resultSet_updateBinaryStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateBinaryStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.InputStream x, int length) throws SQLException { + chain.resultSet_updateBinaryStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x, length); + } + + @Override + public void resultSet_updateBinaryStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.InputStream x, long length) throws SQLException { + chain.resultSet_updateBinaryStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x, length); + } + + @Override + public void resultSet_updateBlob(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + InputStream inputStream) throws SQLException { + chain.resultSet_updateBlob(resultSet, resultSet.getPhysicalColumn(columnIndex), inputStream); + } + + @Override + public void resultSet_updateBlob(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + InputStream inputStream, long length) throws SQLException { + chain.resultSet_updateBlob(resultSet, resultSet.getPhysicalColumn(columnIndex), inputStream, length); + } + + @Override + public void resultSet_updateBlob(FilterChain chain, ResultSetProxy resultSet, int columnIndex, java.sql.Blob x) + throws SQLException { + chain.resultSet_updateBlob(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateBoolean(FilterChain chain, ResultSetProxy resultSet, int columnIndex, boolean x) + throws SQLException { + chain.resultSet_updateBoolean(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateByte(FilterChain chain, ResultSetProxy resultSet, int columnIndex, byte x) + throws SQLException { + chain.resultSet_updateByte(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateBytes(FilterChain chain, ResultSetProxy resultSet, int columnIndex, byte[] x) + throws SQLException { + chain.resultSet_updateBytes(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateCharacterStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.Reader x) throws SQLException { + chain.resultSet_updateCharacterStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateCharacterStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.Reader x, int length) throws SQLException { + chain.resultSet_updateCharacterStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x, length); + } + + @Override + public void resultSet_updateCharacterStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.Reader x, long length) throws SQLException { + chain.resultSet_updateCharacterStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x, length); + } + + @Override + public void resultSet_updateClob(FilterChain chain, ResultSetProxy resultSet, int columnIndex, java.sql.Clob x) + throws SQLException { + chain.resultSet_updateClob(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateClob(FilterChain chain, ResultSetProxy resultSet, int columnIndex, Reader reader) + throws SQLException { + chain.resultSet_updateClob(resultSet, resultSet.getPhysicalColumn(columnIndex), reader); + } + + @Override + public void resultSet_updateClob(FilterChain chain, ResultSetProxy resultSet, int columnIndex, Reader reader, + long length) throws SQLException { + chain.resultSet_updateClob(resultSet, resultSet.getPhysicalColumn(columnIndex), reader, length); + } + + @Override + public void resultSet_updateDate(FilterChain chain, ResultSetProxy resultSet, int columnIndex, java.sql.Date x) + throws SQLException { + chain.resultSet_updateDate(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateDouble(FilterChain chain, ResultSetProxy resultSet, int columnIndex, double x) + throws SQLException { + chain.resultSet_updateDouble(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateFloat(FilterChain chain, ResultSetProxy resultSet, int columnIndex, float x) + throws SQLException { + chain.resultSet_updateFloat(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateInt(FilterChain chain, ResultSetProxy resultSet, int columnIndex, int x) + throws SQLException { + chain.resultSet_updateInt(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateLong(FilterChain chain, ResultSetProxy resultSet, int columnIndex, long x) + throws SQLException { + chain.resultSet_updateLong(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateNCharacterStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.Reader x) throws SQLException { + chain.resultSet_updateNCharacterStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateNCharacterStream(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.io.Reader x, long length) throws SQLException { + chain.resultSet_updateNCharacterStream(resultSet, resultSet.getPhysicalColumn(columnIndex), x, length); + } + + @Override + public void resultSet_updateNClob(FilterChain chain, ResultSetProxy resultSet, int columnIndex, NClob nClob) + throws SQLException { + chain.resultSet_updateNClob(resultSet, resultSet.getPhysicalColumn(columnIndex), nClob); + } + + @Override + public void resultSet_updateNClob(FilterChain chain, ResultSetProxy resultSet, int columnIndex, Reader reader) + throws SQLException { + chain.resultSet_updateNClob(resultSet, resultSet.getPhysicalColumn(columnIndex), reader); + } + + @Override + public void resultSet_updateNClob(FilterChain chain, ResultSetProxy resultSet, int columnIndex, Reader reader, + long length) throws SQLException { + chain.resultSet_updateNClob(resultSet, resultSet.getPhysicalColumn(columnIndex), reader, length); + } + + @Override + public void resultSet_updateNString(FilterChain chain, ResultSetProxy resultSet, int columnIndex, String nString) + throws SQLException { + chain.resultSet_updateNString(resultSet, resultSet.getPhysicalColumn(columnIndex), nString); + } + + @Override + public void resultSet_updateNull(FilterChain chain, ResultSetProxy resultSet, int columnIndex) throws SQLException { + chain.resultSet_updateNull(resultSet, resultSet.getPhysicalColumn(columnIndex)); + } + + @Override + public void resultSet_updateObject(FilterChain chain, ResultSetProxy resultSet, int columnIndex, Object x) + throws SQLException { + chain.resultSet_updateObject(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateObject(FilterChain chain, ResultSetProxy resultSet, int columnIndex, Object x, + int scaleOrLength) throws SQLException { + chain.resultSet_updateObject(resultSet, resultSet.getPhysicalColumn(columnIndex), x, scaleOrLength); + } + + @Override + public void resultSet_updateRef(FilterChain chain, ResultSetProxy resultSet, int columnIndex, java.sql.Ref x) + throws SQLException { + chain.resultSet_updateRef(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateRowId(FilterChain chain, ResultSetProxy resultSet, int columnIndex, RowId x) + throws SQLException { + chain.resultSet_updateRowId(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateShort(FilterChain chain, ResultSetProxy resultSet, int columnIndex, short x) + throws SQLException { + chain.resultSet_updateShort(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateSQLXML(FilterChain chain, ResultSetProxy resultSet, int columnIndex, SQLXML xmlObject) + throws SQLException { + chain.resultSet_updateSQLXML(resultSet, resultSet.getPhysicalColumn(columnIndex), xmlObject); + } + + @Override + public void resultSet_updateString(FilterChain chain, ResultSetProxy resultSet, int columnIndex, String x) + throws SQLException { + chain.resultSet_updateString(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateTime(FilterChain chain, ResultSetProxy resultSet, int columnIndex, java.sql.Time x) + throws SQLException { + chain.resultSet_updateTime(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + + @Override + public void resultSet_updateTimestamp(FilterChain chain, ResultSetProxy resultSet, int columnIndex, + java.sql.Timestamp x) throws SQLException { + chain.resultSet_updateTimestamp(resultSet, resultSet.getPhysicalColumn(columnIndex), x); + } + @Override public boolean resultSet_next(FilterChain chain, ResultSetProxy resultSet) throws SQLException { boolean hasNext = chain.resultSet_next(resultSet); @@ -779,6 +1225,136 @@ public class WallFilter extends FilterAdapter implements WallFilterMBean { return hasNext; } + @Override + public int resultSetMetaData_getColumnCount(FilterChain chain, ResultSetMetaDataProxy metaData) throws SQLException { + int count = chain.resultSetMetaData_getColumnCount(metaData); + return count - metaData.getResultSetProxy().getHiddenColumnCount(); + } + + @Override + public boolean resultSetMetaData_isAutoIncrement(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isAutoIncrement(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public boolean resultSetMetaData_isCaseSensitive(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isCaseSensitive(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public boolean resultSetMetaData_isSearchable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isSearchable(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public boolean resultSetMetaData_isCurrency(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isCurrency(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public int resultSetMetaData_isNullable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isNullable(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public boolean resultSetMetaData_isSigned(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isSigned(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public int resultSetMetaData_getColumnDisplaySize(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnDisplaySize(metaData, + metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public String resultSetMetaData_getColumnLabel(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnLabel(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public String resultSetMetaData_getColumnName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnName(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public String resultSetMetaData_getSchemaName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getSchemaName(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public int resultSetMetaData_getPrecision(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getPrecision(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public int resultSetMetaData_getScale(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getScale(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public String resultSetMetaData_getTableName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getTableName(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public String resultSetMetaData_getCatalogName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getCatalogName(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public int resultSetMetaData_getColumnType(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnType(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public String resultSetMetaData_getColumnTypeName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnTypeName(metaData, + metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public boolean resultSetMetaData_isReadOnly(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isReadOnly(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public boolean resultSetMetaData_isWritable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isWritable(metaData, metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public boolean resultSetMetaData_isDefinitelyWritable(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_isDefinitelyWritable(metaData, + metaData.getResultSetProxy().getPhysicalColumn(column)); + } + + @Override + public String resultSetMetaData_getColumnClassName(FilterChain chain, ResultSetMetaDataProxy metaData, int column) + throws SQLException { + return chain.resultSetMetaData_getColumnClassName(metaData, + metaData.getResultSetProxy().getPhysicalColumn(column)); + } + public long getViolationCount() { return this.provider.getViolationCount(); }