Java SQL ResultSet extractResultSetFiledNames(ResultSet result)

Here you can find the source of extractResultSetFiledNames(ResultSet result)

Description

extract Result Set Filed Names

License

Apache License

Declaration

public static Set<String> extractResultSetFiledNames(ResultSet result) throws SQLException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Set;

public class Main {
    public static Set<String> extractResultSetFiledNames(ResultSet result) throws SQLException {
        ResultSetMetaData rsmd = result.getMetaData();
        Set<String> columnsSet = new HashSet<>();
        int columns = rsmd.getColumnCount();
        for (int x = 1; x <= columns; x++) {
            columnsSet.add(rsmd.getColumnName(x));
        }/*from ww  w.  jav a2  s  . c om*/
        return columnsSet;
    }
}

Related

  1. createUid(final String[] keys, final ResultSet rs, final String keySeparator)
  2. encodeHeader(ResultSetMetaData metaData)
  3. extractGeneratedId(ResultSet generatedKeys)
  4. extractIntResult(ResultSet rs, ResultSetMetaData rsmd, int index)
  5. extractResults(ResultSet resultSet)
  6. fillRowNames(Map metaData, ResultSet rs)
  7. hasCompleted(ResultSet rs)
  8. hasGeometryField(ResultSet resultSet)
  9. isNull(ResultSet rs, String name)