mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修正encodingFilter,兼容SimpleDriver
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@427 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -18,7 +18,10 @@ package com.alibaba.druid.filter.encoding;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.alibaba.druid.filter.FilterAdapter;
|
||||
@@ -86,7 +89,28 @@ public class EncodingConvertFilter extends FilterAdapter {
|
||||
|
||||
@Override
|
||||
public Object resultSet_getObject(FilterChain chain, ResultSetProxy result, int columnIndex) throws SQLException {
|
||||
Object value = super.resultSet_getObject(chain, result, columnIndex);
|
||||
ResultSet rawResultSet = result.getResultSetRaw();
|
||||
ResultSetMetaData metadata = rawResultSet.getMetaData();
|
||||
int columnType = metadata.getColumnType(columnIndex);
|
||||
|
||||
Object value = null;
|
||||
switch (columnType) {
|
||||
case Types.CHAR:
|
||||
value = super.resultSet_getString(chain, result, columnIndex);
|
||||
break;
|
||||
case Types.CLOB:
|
||||
value = super.resultSet_getString(chain, result, columnIndex);
|
||||
break;
|
||||
case Types.LONGVARCHAR:
|
||||
value = super.resultSet_getString(chain, result, columnIndex);
|
||||
break;
|
||||
case Types.VARCHAR:
|
||||
value = super.resultSet_getString(chain, result, columnIndex);
|
||||
break;
|
||||
default:
|
||||
value = super.resultSet_getObject(chain, result, columnIndex);
|
||||
}
|
||||
|
||||
return decodeObject(result.getStatementProxy().getConnectionProxy(), value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user