public Map toMap()

in src/main/java/org/apache/commons/dbutils/BasicRowProcessor.java [260:278]


    public Map<String, Object> toMap(final ResultSet resultSet) throws SQLException {
        final ResultSetMetaData rsmd = resultSet.getMetaData();
        final int cols = rsmd.getColumnCount();
        final Map<String, Object> result = createCaseInsensitiveHashMap(cols);

        for (int i = 1; i <= cols; i++) {
            String propKey = rsmd.getColumnLabel(i);
            if (null == propKey || 0 == propKey.length()) {
              propKey = rsmd.getColumnName(i);
            }
            if (null == propKey || 0 == propKey.length()) {
              // The column index can't be null
              propKey = Integer.toString(i);
            }
            result.put(propKey, resultSet.getObject(i));
        }

        return result;
    }