Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Step("SQL: Convert ResultSet:`{0}` to List<HashMap<String, String>> form and return as list (atomic).")
- private static List<HashMap<String, String>> lGetListOfDataFromResultSet(ResultSet rs) throws SQLException {
- ResultSetMetaData rsmd = rs.getMetaData();
- int count = rsmd.getColumnCount();
- String[] colNames = new String[count];
- List<HashMap<String, String>> list = new ArrayList<>();
- while (rs.next()) {
- HashMap<String, String> map = new HashMap<>();
- for (int i = 1; i <= count; i++) {
- colNames[i - 1] = rsmd.getColumnLabel(i);
- map.put(colNames[i - 1], String.valueOf(rs.getObject(i)));
- }
- list.add(map);
- }
- return list;
- }
Advertisement
Add Comment
Please, Sign In to add comment