Convert all rows of the ResultSet to a Map. The keys of the Map are property names transformed from column names.
@param rs	the result set
@return	A list of Map representations of all the rows in the result set
@throws SQLException
765972
public List<Map<String, Object>> convertAllToMaps(ResultSet rs) throws SQLException{
		return convertAllToMaps(rs, null);
	}
610866
public Collection<String> listColumns(String table) throws SQLException {
	Collection<String> result = new ArrayList<String>();
	DatabaseMetaData dbm = connection.getMetaData();
	ResultSet rs = dbm.getColumns(null, null, table, null);
	while (rs.next()) {
	    result.add(rs.getString("COLUMN_NAME"));
	}
	return result;
    }
1132475
private List<Row> getRows(String sql) throws SQLException
   {
      allocateConnection();

      try
      {
         List<Row> result = new LinkedList<Row>();

         m_ps = m_connection.prepareStatement(sql);
         m_rs = m_ps.executeQuery();
         populateMetaData();
         while (m_rs.next())
         {
            result.add(new MpdResultSetRow(m_rs, m_meta));
         }

         return (result);
      }

      finally
      {
         releaseConnection();
      }
   }
956346
public T mapRow(ResultSet rs) throws SQLException {
    Map<String, Object> map = new HashMap<String, Object>();
    ResultSetMetaData metadata = rs.getMetaData();

    for (int i = 1; i <= metadata.getColumnCount(); ++i) {
      String label = metadata.getColumnLabel(i);

      final Object value;
      // calling getObject on a BLOB/CLOB produces weird results
      switch (metadata.getColumnType(i)) {
        case Types.BLOB:
          value = rs.getBytes(i);
          break;
        case Types.CLOB:
          value = rs.getString(i);
          break;
        default:
          value = rs.getObject(i);
      }

      // don't use table name extractor because we don't want aliased table name
      boolean overwrite = this.tableName != null && this.tableName.equals(metadata.getTableName(i));
      String tableName = TABLE_NAME_EXTRACTOR.getTableName(metadata, i);
      if (tableName != null && !tableName.isEmpty()) {
        String qualifiedName = tableName + "." + metadata.getColumnName(i);
        add(map, qualifiedName, value, overwrite);
      }

      add(map, label, value, overwrite);
    }

    return objectMapper.convertValue(map, type);
  }
1008677
@Override
    public final Map<String, Object> mapRow(final ResultSet rs, final int rowNum) throws SQLException {
        final ResultSetMetaData rsmd = rs.getMetaData();
        final int columnCount = rsmd.getColumnCount();
        final Map<String, Object> mapOfColValues = this.createColumnMap(columnCount);

        for (int i = 1; i <= columnCount; i++) {
            final String columnName = JdbcUtils.lookupColumnName(rsmd, i);
            final Object obj = this.getColumnValue(rs, i);
            if (!this.ignoreNull || obj != null) {
                final String key = this.getColumnKey(columnName);
                mapOfColValues.put(key, obj);
            }
        }

        return mapOfColValues;
    }
125187
public List<SqlResultSetMapping<EntityMappings<T>>> getAllSqlResultSetMapping()
   {
      List<SqlResultSetMapping<EntityMappings<T>>> list = new ArrayList<SqlResultSetMapping<EntityMappings<T>>>();
      List<Node> nodeList = childNode.get("sql-result-set-mapping");
      for(Node node: nodeList)
      {
         SqlResultSetMapping<EntityMappings<T>>  type = new SqlResultSetMappingImpl<EntityMappings<T>>(this, "sql-result-set-mapping", childNode, node);
         list.add(type);
      }
      return list;
   }
193069
public List<TableType> getTableTypes() throws SQLException {
        final List<TableType> list = new ArrayList<>();
        try (ResultSet results = databaseMetadata.getTableTypes()) {
            if (results != null) {
                bind(results, TableType.class, list);
            }
        }
        return list;
    }
679591
public <T> List<T> query(String sql, RowMapper<T> rowMapper) throws DataAccessException{
		//dynamic change catalog name
		sql = changeCatalog(sql);
		try{
			return jdbcTemplate.query(sql, rowMapper);
		}catch(DataAccessException e){
			logger.error("Error SQL: " + sql);
			throw e;
		}
	}
5805
private String[] getColumnNames(ResultSetMetaData rsmd) throws Exception {
        ArrayList<String> names = new ArrayList<String>();

        // Get result set meta data
        int numColumns = rsmd.getColumnCount();

        // Get the column names; column indices start from 1
        for (int i = 1; i < numColumns + 1; i++) {
            String columnName = rsmd.getColumnName(i);

            names.add(columnName);
        }

        return names.toArray(new String[0]);
    }
495061
public static byte[] getBlobColumn(final ResultSet rs, final String columnName) throws SQLException {
		try {
			final Blob blob = rs.getBlob(columnName);
			if (blob == null) {
				return null;
			}

			final InputStream is = blob.getBinaryStream();
			final ByteArrayOutputStream bos = new ByteArrayOutputStream();

			if (is == null) {
				return null;
			} else {
				final byte buffer[] = new byte[64];
				int c = is.read(buffer);
				while (c > 0) {
					bos.write(buffer, 0, c);
					c = is.read(buffer);
				}
				return bos.toByteArray();
			}
		} catch (final IOException e) {
			throw new SQLException("Failed to read BLOB column due to IOException: " + e.getMessage());
		}
	}
691573
@Nullable
    public T query() throws SQLException {
        try (ResultSet r = executeQuery()) {
            if (r.next()) {
                return resultMapper.map(r);
            }
            return null;
        }
    }
811457
public static String fromResultSet(ResultSet resultSet) throws SQLException {
    if (resultSet == null) throw new NullPointerException("resultSet == null");
    if (!resultSet.isBeforeFirst()) throw new IllegalStateException("Result set not at first.");

    List<String> headers = new ArrayList<>();
    ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
    int columnCount = resultSetMetaData.getColumnCount();
    for (int column = 0; column < columnCount; column++) {
      headers.add(resultSetMetaData.getColumnName(column + 1));
    }

    List<String[]> data = new ArrayList<>();
    while (resultSet.next()) {
      String[] rowData = new String[columnCount];
      for (int column = 0; column < columnCount; column++) {
        rowData[column] = resultSet.getString(column + 1);
      }
      data.add(rowData);
    }

    String[] headerArray = headers.toArray(new String[headers.size()]);
    String[][] dataArray = data.toArray(new String[data.size()][]);
    return FlipTable.of(headerArray, dataArray);
  }
1206466
static JobDef map(ResultSet rs, int colShift)
    {
        JobDef tmp = new JobDef();

        try
        {
            tmp.id = rs.getInt(1 + colShift);
            tmp.application = rs.getString(2 + colShift);
            tmp.applicationName = rs.getString(3 + colShift);
            tmp.canBeRestarted = true;
            tmp.classLoader = rs.getInt(4 + colShift) > 0 ? rs.getInt(4 + colShift) : null;
            tmp.description = rs.getString(5 + colShift);
            tmp.enabled = rs.getBoolean(6 + colShift);
            tmp.external = rs.getBoolean(7 + colShift);
            tmp.highlander = rs.getBoolean(8 + colShift);
            tmp.jarPath = rs.getString(9 + colShift);
            tmp.javaClassName = rs.getString(10 + colShift);
            tmp.javaOpts = rs.getString(11 + colShift);
            tmp.keyword1 = rs.getString(12 + colShift);
            tmp.keyword2 = rs.getString(13 + colShift);
            tmp.keyword3 = rs.getString(14 + colShift);
            tmp.maxTimeRunning = rs.getInt(15 + colShift);
            tmp.module = rs.getString(16 + colShift);
            tmp.pathType = PathType.valueOf(rs.getString(17 + colShift));
            tmp.queue_id = rs.getInt(18 + colShift);
            tmp.priority = rs.getInt(19 + colShift) > 0 ? rs.getInt(19 + colShift) : null;
        }
        catch (SQLException e)
        {
            throw new DatabaseException(e);
        }
        return tmp;
    }
394273
public static String[] extractColumnLabels(ResultSet rs) throws SQLException {
        ResultSetMetaData rsmd = rs.getMetaData();
        int numColumns = rsmd.getColumnCount();
        String[] colLabels = new String[numColumns];
        for (int i = 1; i <= numColumns; i++) {
            colLabels[i - 1] = rsmd.getColumnLabel(i);
            if (colLabels[i - 1] == null) {
                colLabels[i - 1] = rsmd.getColumnName(i);
            }
        }
        return colLabels;
    }
1317527
public static void print(ResultSet rs, PrintStream out) throws SQLException {
    ResultSetMetaData meta = rs.getMetaData();
    int columns = meta.getColumnCount();
    for (int i = 0; i < columns; i++) {
      if (i > 0) {
        out.print(",");
      }
      out.print("\"");
      out.print(meta.getColumnName(i + 1));
      out.print("\"");
    }
    out.println();

    while (rs.next()) {
      for (int i = 0; i < columns; i++) {
        if (i > 0) {
          out.print(",");
        }
        String value = rs.getString(i + 1);
        if (value != null) {
          out.print("\"");
          out.print(value.replaceAll("\"", "\"\""));
          out.print("\"");
        } else {
          out.print("NULL");
        }
      }
      out.println();
    }
  }
673248
public static void closeResultSet(ResultSet rs){
		if (rs != null) {
			try {
				rs.close();
			} catch (Exception e) {
				log.warn("Exception when closing database result set.", e);
			}
		}
	}
248416
protected String[] getKeysFromResultSet() throws SQLException {

        String[] keys;
        final ResultSetMetaData md = _resultSet.getMetaData();
        final int columnCount = md.getColumnCount();

        keys = new String[columnCount + 1];
        for (int i = 1; i <= columnCount; i++) {
            keys[i] = md.getColumnName(i).toUpperCase();
        }
        return keys;
    }