Code example for ResultSetMetaData

Methods: getColumnCount

0
public class SmartResultSet { 
 
	public SmartResultSet(ResultSet rs) throws SQLException {
		_rs = rs;
		_metaData = _rs.getMetaData();
		_columnCount = _metaData.getColumnCount();
		_columnIndexCache = new HashMap<String, Integer>();
	} 
 
	public int findColumn(String columnName) throws SQLException {
		Integer columnIndex = _columnIndexCache.get(columnName);
 
		if (columnIndex != null) {
			return columnIndex;
		} 
 
		// Check for the full column name 
 
		for (int i = 1; i <= _columnCount; ++i) {
			String availableName = _metaData.getColumnName(i);