private static Map<String, String> getResultMap(ResultSet rs)
throws SQLException {
Map<String, String> hm = new HashMap<String, String>();
ResultSetMetaData rsmd = rs.getMetaData();
int count = rsmd.getColumnCount();
for (int i = 1; i <= count; i++) {
String key = rsmd.getColumnLabel(i);
String value = rs.getString(i);
hm.put(key, value);
}
return hm;
}
将ResultSet 转换成Map
最新推荐文章于 2022-03-26 18:37:13 发布