Java SQL Table Column getColumns(ResultSetMetaData rsMetaData)

Here you can find the source of getColumns(ResultSetMetaData rsMetaData)

Description

get Columns

License

Open Source License

Declaration

public static String[] getColumns(ResultSetMetaData rsMetaData) throws SQLException 

Method Source Code

//package com.java2s;
/**//  w ww.j a  v a  2 s .  co  m
 * JDBCPersistence framework for java
 *   Copyright (C) 2004-2014 Alex Rojkov
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation; either
 *    version 2.1 of the License, or (at your option) any later version.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *    You can contact me by email jdbcpersistence   a t   gmail    d o t    com
 * */

import java.sql.*;

public class Main {
    public static String[] getColumns(ResultSetMetaData rsMetaData) throws SQLException {
        int colcount = rsMetaData.getColumnCount();
        String[] result = new String[colcount];
        for (int i = 0; i < result.length; i++) {
            result[i] = rsMetaData.getColumnName(i + 1);
        }

        return result;
    }
}

Related

  1. getColumnNames(ResultSet rs)
  2. getColumnNames(ResultSet rs)
  3. getColumnNames(ResultSet rs)
  4. getColumnNamesFromResultSet(ResultSet rs)
  5. getColumns(ResultSetMetaData rsmd)
  6. getColumnsNames(ResultSet rs)
  7. getColumnType(ResultSet resultSet, int i, Map typeCache)
  8. getColumnType(ResultSetMetaData rsm)
  9. getColumnType(ResultSetMetaData rsmd, int idx)