package greencode.util;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
public class DatabaseUtils {
private DatabaseUtils() {}
public static boolean hasColumn(ResultSet rs, String columnName) throws SQLException {
ResultSetMetaData rsmd = rs.getMetaData();
for (int x = 0, columns = rsmd.getColumnCount(); ++x <= columns;) {
if (columnName.equals(rsmd.getColumnName(x))) {
return true;
}
}
return false;
}
}