Gets all of the column names for a result meta data

@param rsmd Resultset metadata
@return Array of column names
@throws Exception exception
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]);
    }
885561
static public List<ColumnMetaData> createList(ResultSetMetaData m) throws SQLException{
		List<ColumnMetaData> result = new ArrayList<ColumnMetaData>(m.getColumnCount());
		for (int i = 1; i <= m.getColumnCount(); i ++){
			ColumnMetaData cm = new ColumnMetaData(m, i);
			result.add(cm);
		}
		return result;
	}
573022
public Collection<Map<String, Object>> listColumnsDetails(String table)
	    throws SQLException {
	Collection<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
	ResultSet rs = null;
	DatabaseMetaData dbm = connection.getMetaData();
	rs = dbm.getColumns(null, null, table, null);
	while (rs.next()) {
	    Map<String, Object> resMap = new HashMap<String, Object>();

	    resMap.put("COLUMN_NAME", rs.getString("COLUMN_NAME"));
	    resMap.put("DATA_TYPE", rs.getInt("DATA_TYPE"));
	    resMap.put("COLUMN_DEF", rs.getString("COLUMN_DEF"));

	    // System.out.println(rs.getString("COLUMN_NAME")+" type: "+rs.getInt("DATA_TYPE")+" with "+rs.getString("COLUMN_DEF"));

	    result.add(resMap);
	}
	if (rs != null) {
	    rs.close();
	}
	return result;
    }
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;
    }
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();
    }
  }
448970
public static List<String> getGeometryFields(ResultSet resultSet) throws SQLException {
        List<String> fieldsName = new LinkedList<>();
        ResultSetMetaData meta = resultSet.getMetaData();
        int columnCount = meta.getColumnCount();
        for (int i = 1; i <= columnCount; i++) {
            if (meta.getColumnTypeName(i).equalsIgnoreCase("geometry")) {
                fieldsName.add(meta.getColumnName(i));
            }
        }
        return fieldsName;
    }
1208272
@Override
    public ResultSet getSchemas() throws SQLException
    {
        checkClosed();
        VoltTable vtable = new VoltTable(
                new ColumnInfo("TABLE_SCHEM", VoltType.STRING),
                new ColumnInfo("TABLE_CATALOG", VoltType.STRING));
        JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable);
        return res;
    }
946012
public List<String> getTileTables() throws SQLException {

		List<String> tableNames = new ArrayList<String>();

		List<TileMatrixSet> tileMatrixSets = queryForAll();
		for (TileMatrixSet tileMatrixSet : tileMatrixSets) {
			tableNames.add(tileMatrixSet.getTableName());
		}

		return tableNames;
	}
331882
@Override
    public ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
1190572
private void populateMetaData() throws SQLException
   {
      m_meta.clear();

      ResultSetMetaData meta = m_rs.getMetaData();
      int columnCount = meta.getColumnCount() + 1;
      for (int loop = 1; loop < columnCount; loop++)
      {
         String name = meta.getColumnName(loop);
         Integer type = Integer.valueOf(meta.getColumnType(loop));
         m_meta.put(name, type);
      }
   }
1258719
public static <T extends Collection<Entity>> T handleRs(ResultSet rs, T collection) throws SQLException {
		final ResultSetMetaData meta = rs.getMetaData();
		final int columnCount = meta.getColumnCount();

		while (rs.next()) {
			collection.add(HandleHelper.handleRow(columnCount, meta, rs));
		}

		return collection;
	}
1180310
@Override
  public final String getString(final String pColumnName) throws Exception {
    int columnIndex = this.resultSet.getColumnIndex(pColumnName);
    return this.resultSet.getString(columnIndex);
  }
1293697
public List<MetaDataResult> getMetaDataResultList() {
    JSONArray jsonArray = null;
    try {
      jsonArray = _jsonObject.getJSONArray(DATASETS_ARRAY_FIELD);
      List<MetaDataResult> metaDataResults = new ArrayList<MetaDataResult>(jsonArray.length());
      for (int i = 0; i < jsonArray.length(); i++) {
        metaDataResults.add(MetaDataResult.of(jsonArray.getJSONObject(i)));
      }
      return metaDataResults;
    } catch (JSONException ex) {
      s_logger.error("Metadata had unexpected structure - could not extract datasets field, was:\n{}", _jsonObject.toString());
      throw new QuandlRuntimeException("Metadata had unexpected structure", ex);
    }
  }
1233428
@Override
    public List readAll(final String tableName, Class clazz, EntityMetadata m, final List<Object> rowKey,
            List<String> relationNames, String... columns) throws IOException
    {

        List output = null;

        Object entity = null;

        HTableInterface hTable = null;

        hTable = gethTable(tableName);

        // Load raw data from HBase
        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                m.getPersistenceUnit());

        AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(m.getEntityClazz());
        // For secondary tables.
        List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation())
                .getSecondaryTablesName();
        secondaryTables.add(m.getTableName());
        List<HBaseData> results = new ArrayList<HBaseData>();
        for (String colTableName : secondaryTables)
        {
            List table = ((HBaseReader) hbaseReader).loadAll(hTable, rowKey, colTableName, columns);
            // null check for 'table'. addAll method throws exception if table
            // is null
            if (table != null)
            {
                results.addAll(table);
            }
        }

        output = onRead(tableName, clazz, m, output, hTable, entity, relationNames, results);
        return output;
    }
473142
public String columnLabelOrName(ResultSetMetaData rsmd, int col) throws SQLException{
		String columnName = rsmd.getColumnLabel(col);
		if (null == columnName || 0 == columnName.length()) {
			columnName = rsmd.getColumnName(col);
		}
		return columnName;
	}
248813
public List<String> getFeatureTables() throws SQLException {

		List<String> tableNames = new ArrayList<String>();

		List<GeometryColumns> geometryColumns = queryForAll();
		for (GeometryColumns geometryColumn : geometryColumns) {
			tableNames.add(geometryColumn.getTableName());
		}

		return tableNames;
	}
766480
protected String[] getKeysFromResultSet()
            throws SQLException {

        String[] keys = super.getKeysFromResultSet();

        // check schemaProperty mapping names for more accurate column->field mapping
        SchemaProperty[] props = _schemaType.getElementProperties();
        for (int i = 0; i < props.length; i++) {

            int col = -1;
            try {
                col = _resultSet.findColumn(props[i].getName().getLocalPart());
            } catch (SQLException x) {
            }

            if (col > 0) {
                keys[col] = props[i].getJavaPropertyName().toUpperCase();
            }
        }
        return keys;
    }