package com.ejie.ad74a.dao.comun;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;

public class UtilDAO {

	/**
	 * Constructor de UtilDAO.
	 */
	private UtilDAO() {

	}

	/**
	 * 
	 * @param rs         resultset
	 * @param columnName String
	 * @return boolean
	 * @throws SQLException excepción
	 */
	public static boolean hasColumn(ResultSet rs, String columnName) throws SQLException {
		ResultSetMetaData rsmd = rs.getMetaData();
		int columns = rsmd.getColumnCount();
		for (int x = 1; x <= columns; x++) {
			if (columnName.equals(rsmd.getColumnName(x))) {
				return true;
			}
		}
		return false;
	}
}