Here you can find the source of getFieldsPresentInResultSet(ResultSet rs)
Parameter | Description |
---|---|
rs | a parameter |
Parameter | Description |
---|---|
SQLException | an exception |
public static List<String> getFieldsPresentInResultSet(ResultSet rs) throws SQLException
//package com.java2s; //License from project: Apache License import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class Main { /**//from w ww . ja va2 s. c om * @param rs * @return a list of lower case column names present in the result set. * @throws SQLException */ public static List<String> getFieldsPresentInResultSet(ResultSet rs) throws SQLException { List<String> fieldsPresentInResultSet = new ArrayList<String>(); ResultSetMetaData metaData = rs.getMetaData(); for (int index = 1; index <= metaData.getColumnCount(); index++) { fieldsPresentInResultSet.add(metaData.getColumnLabel(index) .toLowerCase()); } return fieldsPresentInResultSet; } }