62,623
社区成员
发帖
与我相关
我的任务
分享
while (rs.next()) {
Map map = new HashMap();
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
if (rsmd.getColumnTypeName(i).equals("text")) {
StringBuffer sbf = new StringBuffer();
java.io.InputStream ins = rs.getAsciiStream(i);
int ch = 0;
if (ins != null) {
try {
while ((ch = ins.read()) != -1) {
sbf.append((char) ch);
}
ins.close();
map.put(rsmd.getColumnName(i), new String(sbf.toString().getBytes("8859_1"), "GB2312"));
} catch (IOException ioe) {
throw new AppException(this.getClass().getName() + ":_eexecuteQuery(final String sql, final List params):pstmt.executeQuery()失败。IOException错误信息:" + ioe.getMessage() + "。sql:" + sql);
}
} else {
map.put(rsmd.getColumnName(i), null);
}
}else{
map.put(rsmd.getColumnName(i), rs.getObject(i));
}
}
getListResult().add(map);
}
while(rs.next()){
}