Skip to content

Commit

Permalink
Merge pull request alibaba#497 from cutedemons/master
Browse files Browse the repository at this point in the history
resultset metadata proxy
  • Loading branch information
wenshao committed Jan 14, 2014
2 parents 31b90b8 + 91637c4 commit 2aa4da8
Show file tree
Hide file tree
Showing 9 changed files with 1,195 additions and 107 deletions.
64 changes: 64 additions & 0 deletions src/main/java/com/alibaba/druid/filter/Filter.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
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;

Expand Down Expand Up @@ -1286,4 +1287,67 @@ int clob_setString(FilterChain chain, ClobProxy wrapper, long pos, String str, i

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;

}
136 changes: 132 additions & 4 deletions src/main/java/com/alibaba/druid/filter/FilterAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
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;

Expand All @@ -67,16 +68,16 @@ public void init(DataSourceProxy dataSource) {
public void destory() {

}

public void configFromProperties(Properties properties) {

}

@Override
public boolean isWrapperFor(Class<?> iface) {
return iface == this.getClass();
}

@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> iface) {
if (iface == this.getClass()) {
Expand Down Expand Up @@ -2722,4 +2723,131 @@ public DruidPooledConnection dataSource_getConnection(FilterChain chain, DruidDa
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);
}
}
44 changes: 44 additions & 0 deletions src/main/java/com/alibaba/druid/filter/FilterChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
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;

Expand Down Expand Up @@ -1136,4 +1137,47 @@ void callableStatement_setNClob(CallableStatementProxy statement, String paramet
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;
}
Loading

0 comments on commit 2aa4da8

Please sign in to comment.