package eu.dnetlib.dlms.jdbc;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.NClob;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Abstract class for ResultSet in the Doroty system. It implements all ResultSet's method. Those performing updates are
 * implemented by throwing a <code>SQLFeatureNotSupportedException</code>. Subclasses should override only methods of
 * interest depending on their needs and the functionalities they want to provide to the end user.
 * 
 * @author lexis
 */
public abstract class DOLResultSet implements ResultSet {

	/** logger. */
	@SuppressWarnings("unused")
	private static final Log log = LogFactory.getLog(DOLResultSet.class);
	/** ResultSet fetch direction. */
	private int fetchDirection;
	/** result set fetch size. */
	private int fetchSize;
	/** ResultSet type. */
	private int type;
	/** Result set concurrency. */
	private int concurrency;
	/** statement whose execution generated this SimpleDOLResultSet. */
	private DOLStatement statement;
	/** metadata. */
	private ResultSetMetaData metaData;
	/** true if this ResultSet is closed, false otherwise. */
	private boolean closed;
	/** result set holdability, either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT. */
	private int holdability;
	/** Info about the columns contained by this result set. */
	private ColumnInfo[] columnInfos;
	/**
	 * Cache to optimize findColumn(String) lookups. Keys are column names, values are indexes of the columnInfos array.
	 */
	private Map<String, Integer> columnMap;
	/** True if last column data retrieved was null. */
	private boolean wasNull;
	/** Current row of the ResultSet. */
	private DataResult currentRow;

	/**
	 * Constructor.
	 * 
	 * @param statement
	 *            the statement whose execution has generated this ResultSet instance.
	 * @param columns
	 *            CoumnInfo array. Each element describes a column of the result set.
	 * @throws SQLException
	 *             getting info from the given statement
	 */
	public DOLResultSet(final DOLStatement statement, final ColumnInfo[] columns) throws SQLException {
		if (statement == null) {
			throw new IllegalArgumentException("Statement parameter must not be null");
		}
		if (statement.getResultSetHoldability() != ResultSet.HOLD_CURSORS_OVER_COMMIT
				&& statement.getResultSetHoldability() != ResultSet.CLOSE_CURSORS_AT_COMMIT)
			throw new IllegalArgumentException("Holdability parameter must be ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT");
		this.statement = statement;
		this.fetchSize = statement.getFetchSize();
		this.columnInfos = columns;
		int columnLength = 0;
		if (columns != null)
			columnLength = columns.length;
		this.columnMap = new HashMap<String, Integer>(columnLength);
		this.metaData = new DOLResultSetMetaData(this);
		this.holdability = statement.getResultSetHoldability();
		this.currentRow = null;
	}

	void setCurrentRow(final DataResult currentRow) {
		this.currentRow = currentRow;
	}

	public DataResult getCurrentRow() {
		return this.currentRow;
	}

	void setWasNull(final boolean wasNull) {
		this.wasNull = wasNull;
	}

	/**
	 * Set this ResultSet type.
	 * 
	 * @param type
	 *            Type of the ResultSet. One of ResultSet.TYPE_FORWARD_ONLY,ResultSet.TYPE_SCROLL_INSENSITIVE,
	 *            ResultSet.TYPE_SCROLL_SENSITIVE
	 * @throws SQLException
	 *             if it is impossibile to set the type to the given value.
	 */
	void setType(final int type) throws SQLException {
		if (type != ResultSet.TYPE_FORWARD_ONLY && type != ResultSet.TYPE_SCROLL_INSENSITIVE && type != ResultSet.TYPE_SCROLL_SENSITIVE)
			throw new SQLException();
		this.type = type;
	}

	/**
	 * Sets this RsultSet concurrency.
	 * 
	 * @param concurrency
	 *            the new concurrency. Allowed values are: ResultSet.CONCUR_READ_ONLY and resultSet.CONCUR_UPDATABLE.
	 * @throws SQLException
	 *             if it is impossible to set the concurrency to the given value.
	 */
	void setConcurrency(final int concurrency) throws SQLException {
		if (concurrency != ResultSet.CONCUR_READ_ONLY && concurrency != ResultSet.CONCUR_UPDATABLE)
			throw new SQLException();
		this.concurrency = concurrency;
	}

	void setHoldability(final int holdability) {
		this.holdability = holdability;
	}

	ColumnInfo[] getColumnInfos() {
		return this.columnInfos;
	}

	void setColumnInfos(final ColumnInfo[] columnInfos) {
		this.columnInfos = columnInfos;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getFetchDirection()
	 */
	public int getFetchDirection() throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return this.fetchDirection;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#setFetchDirection(int)
	 */
	public void setFetchDirection(final int direction) throws SQLException {
		this.fetchDirection = direction;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getType()
	 */
	public int getType() throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return this.type;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getConcurrency()
	 */
	public int getConcurrency() throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return this.concurrency;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#absolute(int)
	 */
	public boolean absolute(final int row) throws SQLException {
		if (this.closed || this.type == ResultSet.TYPE_FORWARD_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#afterLast()
	 */
	public void afterLast() throws SQLException {
		if (this.closed || this.type == ResultSet.TYPE_FORWARD_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#beforeFirst()
	 */
	public void beforeFirst() throws SQLException {
		if (this.closed || this.type == ResultSet.TYPE_FORWARD_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#cancelRowUpdates()
	 */
	public void cancelRowUpdates() throws SQLException {
		if (this.closed || this.concurrency == ResultSet.CONCUR_READ_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#clearWarnings()
	 */
	public void clearWarnings() throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#close()
	 */
	public void close() throws SQLException {
		this.columnInfos = null;
		this.columnMap = null;
		this.statement = null;
		this.closed = true;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#deleteRow()
	 */
	public void deleteRow() throws SQLException {
		if (this.closed || this.concurrency == ResultSet.CONCUR_READ_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#findColumn(java.lang.String)
	 */
	public int findColumn(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		else {
			int foundAt = this.getColumnIndex(columnLabel);
			if (foundAt != -1)
				return foundAt;
			else
				throw new SQLException("No column with name = " + columnLabel);
		}
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#first()
	 */
	public boolean first() throws SQLException {
		if (this.closed || this.type == ResultSet.TYPE_FORWARD_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getArray(int)
	 */
	public Array getArray(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getArray(java.lang.String)
	 */
	public Array getArray(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getAsciiStream(int)
	 */
	public InputStream getAsciiStream(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getAsciiStream(java.lang.String)
	 */
	public InputStream getAsciiStream(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBigDecimal(int)
	 */
	public BigDecimal getBigDecimal(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBigDecimal(java.lang.String)
	 */
	public BigDecimal getBigDecimal(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBigDecimal(int, int)
	 */
	public BigDecimal getBigDecimal(final int columnIndex, final int scale) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int)
	 */
	public BigDecimal getBigDecimal(final String columnLabel, final int scale) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBinaryStream(int)
	 */
	public InputStream getBinaryStream(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBinaryStream(java.lang.String)
	 */
	public InputStream getBinaryStream(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBlob(int)
	 */
	public Blob getBlob(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBlob(java.lang.String)
	 */
	public Blob getBlob(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBoolean(int)
	 */
	public boolean getBoolean(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Boolean) this.getColumnData(columnIndex - 1)).booleanValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBoolean(java.lang.String)
	 */
	public boolean getBoolean(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Boolean) this.getColumnData(this.findColumn(columnLabel))).booleanValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getByte(int)
	 */
	public byte getByte(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getByte(java.lang.String)
	 */
	public byte getByte(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBytes(int)
	 */
	public byte[] getBytes(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getBytes(java.lang.String)
	 */
	public byte[] getBytes(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getCharacterStream(int)
	 */
	public Reader getCharacterStream(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getCharacterStream(java.lang.String)
	 */
	public Reader getCharacterStream(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getClob(int)
	 */
	public Clob getClob(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getClob(java.lang.String)
	 */
	public Clob getClob(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getCursorName()
	 */
	public String getCursorName() throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getDate(int)
	 */
	public Date getDate(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (Date) this.getColumnData(columnIndex - 1);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getDate(java.lang.String)
	 */
	public Date getDate(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (Date) this.getColumnData(this.findColumn(columnLabel));
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getDate(int, java.util.Calendar)
	 */
	public Date getDate(final int columnIndex, final Calendar cal) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar)
	 */
	public Date getDate(final String columnLabel, final Calendar cal) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getDouble(int)
	 */
	public double getDouble(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Double) this.getColumnData(columnIndex - 1)).doubleValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getDouble(java.lang.String)
	 */
	public double getDouble(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Double) this.getColumnData(this.findColumn(columnLabel))).doubleValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getFetchSize()
	 */
	public int getFetchSize() throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return this.fetchSize;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getFloat(int)
	 */
	public float getFloat(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Float) this.getColumnData(columnIndex - 1)).floatValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getFloat(java.lang.String)
	 */
	public float getFloat(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Float) this.getColumnData(this.findColumn(columnLabel))).floatValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getHoldability()
	 */
	public int getHoldability() throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return this.holdability;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getInt(int)
	 */
	public int getInt(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Integer) this.getColumnData(columnIndex - 1)).intValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getInt(java.lang.String)
	 */
	public int getInt(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Integer) this.getColumnData(this.findColumn(columnLabel))).intValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getLong(int)
	 */
	public long getLong(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Long) this.getColumnData(columnIndex - 1)).longValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getLong(java.lang.String)
	 */
	public long getLong(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Long) this.getColumnData(this.findColumn(columnLabel))).longValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getMetaData()
	 */
	public ResultSetMetaData getMetaData() throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return this.metaData;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getNCharacterStream(int)
	 */
	public Reader getNCharacterStream(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getNCharacterStream(java.lang.String)
	 */
	public Reader getNCharacterStream(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getNClob(int)
	 */
	public NClob getNClob(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getNClob(java.lang.String)
	 */
	public NClob getNClob(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getNString(int)
	 */
	public String getNString(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getNString(java.lang.String)
	 */
	public String getNString(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getObject(int)
	 */
	public Object getObject(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return this.getColumnData(columnIndex - 1);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getObject(java.lang.String)
	 */
	public Object getObject(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (this.getColumnData(this.findColumn(columnLabel)));
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getObject(int, java.util.Map)
	 */
	public Object getObject(final int columnIndex, final Map<String, Class<?>> map) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map)
	 */
	public Object getObject(final String columnLabel, final Map<String, Class<?>> map) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getRef(int)
	 */
	public Ref getRef(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getRef(java.lang.String)
	 */
	public Ref getRef(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getRow()
	 */
	public int getRow() throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getRowId(int)
	 */
	public RowId getRowId(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getRowId(java.lang.String)
	 */
	public RowId getRowId(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getSQLXML(int)
	 */
	public SQLXML getSQLXML(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getSQLXML(java.lang.String)
	 */
	public SQLXML getSQLXML(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getShort(int)
	 */
	public short getShort(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Short) this.getColumnData(columnIndex - 1)).shortValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getShort(java.lang.String)
	 */
	public short getShort(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return ((Short) this.getColumnData(this.findColumn(columnLabel))).shortValue();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getStatement()
	 */
	public DOLStatement getStatement() throws SQLException {
		return this.statement;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getString(int)
	 */
	public String getString(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (String) this.getColumnData(columnIndex - 1);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getString(java.lang.String)
	 */
	public String getString(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (String) this.getColumnData(this.findColumn(columnLabel));
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getTime(int)
	 */
	public Time getTime(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (Time) this.getColumnData(columnIndex - 1);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getTime(java.lang.String)
	 */
	public Time getTime(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (Time) this.getColumnData(this.findColumn(columnLabel));
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getTime(int, java.util.Calendar)
	 */
	public Time getTime(final int columnIndex, final Calendar cal) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (Time) this.getColumnData(columnIndex - 1);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar)
	 */
	public Time getTime(final String columnLabel, final Calendar cal) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (Time) this.getColumnData(this.findColumn(columnLabel));
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getTimestamp(int)
	 */
	public Timestamp getTimestamp(final int columnIndex) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (Timestamp) this.getColumnData(columnIndex - 1);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getTimestamp(java.lang.String)
	 */
	public Timestamp getTimestamp(final String columnLabel) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (Timestamp) this.getColumnData(this.findColumn(columnLabel));
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
	 */
	public Timestamp getTimestamp(final int columnIndex, final Calendar cal) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (Timestamp) this.getColumnData(columnIndex - 1);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getTimestamp(java.lang.String, java.util.Calendar)
	 */
	public Timestamp getTimestamp(final String columnLabel, final Calendar cal) throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		return (Timestamp) this.getColumnData(this.findColumn(columnLabel));
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getURL(int)
	 */
	public URL getURL(final int columnIndex) throws SQLException {
		return (URL) this.getColumnData(columnIndex - 1);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getURL(int)
	 */
	public URL getURL(final String columnLabel) throws SQLException {
		return (URL) this.getColumnData(this.findColumn(columnLabel));
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getUnicodeStream(int)
	 */
	public InputStream getUnicodeStream(final int columnIndex) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getUnicodeStream(java.lang.String)
	 */
	public InputStream getUnicodeStream(final String columnLabel) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#getWarnings()
	 */
	public SQLWarning getWarnings() throws SQLException {
		if (this.isClosed())
			throw new SQLException();
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#insertRow()
	 */
	public void insertRow() throws SQLException {
		if (this.closed || this.concurrency == ResultSet.CONCUR_READ_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#isAfterLast()
	 */
	public boolean isAfterLast() throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#isBeforeFirst()
	 */
	public boolean isBeforeFirst() throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#isFirst()
	 */
	public boolean isFirst() throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#isClosed()
	 */
	public boolean isClosed() throws SQLException {
		return this.closed;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#isLast()
	 */
	public boolean isLast() throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#last()
	 */
	public boolean last() throws SQLException {
		if (this.closed || this.type == ResultSet.TYPE_FORWARD_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#moveToCurrentRow()
	 */
	public void moveToCurrentRow() throws SQLException {
		if (this.closed || this.concurrency == ResultSet.CONCUR_READ_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#moveToInsertRow()
	 */
	public void moveToInsertRow() throws SQLException {
		if (this.closed || this.concurrency == ResultSet.CONCUR_READ_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#next()
	 */
	public abstract boolean next() throws SQLException;

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#previous()
	 */
	public boolean previous() throws SQLException {
		if (this.closed || this.type == ResultSet.TYPE_FORWARD_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#refreshRow()
	 */
	public void refreshRow() throws SQLException {
		if (this.closed || this.type == ResultSet.TYPE_FORWARD_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#relative(int)
	 */
	public boolean relative(final int arg0) throws SQLException {
		if (this.closed || this.type == ResultSet.TYPE_FORWARD_ONLY)
			throw new SQLException();
		else
			throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#rowDeleted()
	 */
	public boolean rowDeleted() throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#rowInserted()
	 */
	public boolean rowInserted() throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#rowUpdated()
	 */
	public boolean rowUpdated() throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#setFetchSize(int)
	 */
	public void setFetchSize(final int rows) throws SQLException {
		if (this.isClosed() || rows < 0)
			throw new SQLException();
		this.fetchSize = rows;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateArray(int, java.sql.Array)
	 */
	public void updateArray(final int columnIndex, final Array x) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateArray(java.lang.String, java.sql.Array)
	 */
	public void updateArray(final String columnLabel, final Array x) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream)
	 */
	public void updateAsciiStream(final int arg0, final InputStream arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream)
	 */
	public void updateAsciiStream(final String arg0, final InputStream arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int)
	 */
	public void updateAsciiStream(final int arg0, final InputStream arg1, final int arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, int)
	 */
	public void updateAsciiStream(final String arg0, final InputStream arg1, final int arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, long)
	 */
	public void updateAsciiStream(final int arg0, final InputStream arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, long)
	 */
	public void updateAsciiStream(final String arg0, final InputStream arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBigDecimal(int, java.math.BigDecimal)
	 */
	public void updateBigDecimal(final int arg0, final BigDecimal arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBigDecimal(java.lang.String, java.math.BigDecimal)
	 */
	public void updateBigDecimal(final String arg0, final BigDecimal arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream)
	 */
	public void updateBinaryStream(final int arg0, final InputStream arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream)
	 */
	public void updateBinaryStream(final String arg0, final InputStream arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int)
	 */
	public void updateBinaryStream(final int arg0, final InputStream arg1, final int arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, int)
	 */
	public void updateBinaryStream(final String arg0, final InputStream arg1, final int arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, long)
	 */
	public void updateBinaryStream(final int arg0, final InputStream arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, long)
	 */
	public void updateBinaryStream(final String arg0, final InputStream arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBlob(int, java.sql.Blob)
	 */
	public void updateBlob(final int arg0, final Blob arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBlob(java.lang.String, java.sql.Blob)
	 */
	public void updateBlob(final String arg0, final Blob arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream)
	 */
	public void updateBlob(final int arg0, final InputStream arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream)
	 */
	public void updateBlob(final String arg0, final InputStream arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream, long)
	 */
	public void updateBlob(final int arg0, final InputStream arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream, long)
	 */
	public void updateBlob(final String arg0, final InputStream arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBoolean(int, boolean)
	 */
	public void updateBoolean(final int arg0, final boolean arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBoolean(java.lang.String, boolean)
	 */
	public void updateBoolean(final String arg0, final boolean arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateByte(int, byte)
	 */
	public void updateByte(final int arg0, final byte arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateByte(java.lang.String, byte)
	 */
	public void updateByte(final String arg0, final byte arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBytes(int, byte[])
	 */
	public void updateBytes(final int arg0, final byte[] arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateBytes(java.lang.String, byte[])
	 */
	public void updateBytes(final String arg0, final byte[] arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader)
	 */
	public void updateCharacterStream(final int arg0, final Reader arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader)
	 */
	public void updateCharacterStream(final String arg0, final Reader arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int)
	 */
	public void updateCharacterStream(final int arg0, final Reader arg1, final int arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, int)
	 */
	public void updateCharacterStream(final String arg0, final Reader arg1, final int arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, long)
	 */
	public void updateCharacterStream(final int arg0, final Reader arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, long)
	 */
	public void updateCharacterStream(final String arg0, final Reader arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateClob(int, java.sql.Clob)
	 */
	public void updateClob(final int arg0, final Clob arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateClob(java.lang.String, java.sql.Clob)
	 */
	public void updateClob(final String arg0, final Clob arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateClob(int, java.io.Reader)
	 */
	public void updateClob(final int arg0, final Reader arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader)
	 */
	public void updateClob(final String arg0, final Reader arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateClob(int, java.io.Reader, long)
	 */
	public void updateClob(final int arg0, final Reader arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader, long)
	 */
	public void updateClob(final String arg0, final Reader arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateDate(int, java.sql.Date)
	 */
	public void updateDate(final int arg0, final Date arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateDate(java.lang.String, java.sql.Date)
	 */
	public void updateDate(final String arg0, final Date arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateDouble(int, double)
	 */
	public void updateDouble(final int arg0, final double arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateDouble(java.lang.String, double)
	 */
	public void updateDouble(final String arg0, final double arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateFloat(int, float)
	 */
	public void updateFloat(final int arg0, final float arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateFloat(java.lang.String, float)
	 */
	public void updateFloat(final String arg0, final float arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateInt(int, int)
	 */
	public void updateInt(final int arg0, final int arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateInt(java.lang.String, int)
	 */
	public void updateInt(final String arg0, final int arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateLong(int, long)
	 */
	public void updateLong(final int arg0, final long arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateLong(java.lang.String, long)
	 */
	public void updateLong(final String arg0, final long arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader)
	 */
	public void updateNCharacterStream(final int arg0, final Reader arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader)
	 */
	public void updateNCharacterStream(final String arg0, final Reader arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader, long)
	 */
	public void updateNCharacterStream(final int arg0, final Reader arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader, long)
	 */
	public void updateNCharacterStream(final String arg0, final Reader arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNClob(int, java.sql.NClob)
	 */
	public void updateNClob(final int arg0, final NClob arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNClob(java.lang.String, java.sql.NClob)
	 */
	public void updateNClob(final String arg0, final NClob arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNClob(int, java.io.Reader)
	 */
	public void updateNClob(final int arg0, final Reader arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader)
	 */
	public void updateNClob(final String arg0, final Reader arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNClob(int, java.io.Reader, long)
	 */
	public void updateNClob(final int arg0, final Reader arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader, long)
	 */
	public void updateNClob(final String arg0, final Reader arg1, final long arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNString(int, java.lang.String)
	 */
	public void updateNString(final int arg0, final String arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNString(java.lang.String, java.lang.String)
	 */
	public void updateNString(final String arg0, final String arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNull(int)
	 */
	public void updateNull(final int arg0) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateNull(java.lang.String)
	 */
	public void updateNull(final String arg0) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateObject(int, java.lang.Object)
	 */
	public void updateObject(final int arg0, final Object arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object)
	 */
	public void updateObject(final String arg0, final Object arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();

	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateObject(int, java.lang.Object, int)
	 */
	public void updateObject(final int arg0, final Object arg1, final int arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object, int)
	 */
	public void updateObject(final String arg0, final Object arg1, final int arg2) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateRef(int, java.sql.Ref)
	 */
	public void updateRef(final int arg0, final Ref arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateRef(java.lang.String, java.sql.Ref)
	 */
	public void updateRef(final String arg0, final Ref arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateRow()
	 */
	public void updateRow() throws SQLException {
		throw new SQLException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateRowId(int, java.sql.RowId)
	 */
	public void updateRowId(final int arg0, final RowId arg1) throws SQLException {
		throw new SQLException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateRowId(java.lang.String, java.sql.RowId)
	 */
	public void updateRowId(final String arg0, final RowId arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateSQLXML(int, java.sql.SQLXML)
	 */
	public void updateSQLXML(final int arg0, final SQLXML arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateSQLXML(java.lang.String, java.sql.SQLXML)
	 */
	public void updateSQLXML(final String arg0, final SQLXML arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateShort(int, short)
	 */
	public void updateShort(final int arg0, final short arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateShort(java.lang.String, short)
	 */
	public void updateShort(final String arg0, final short arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateString(int, java.lang.String)
	 */
	public void updateString(final int arg0, final String arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateString(java.lang.String, java.lang.String)
	 */
	public void updateString(final String arg0, final String arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateTime(int, java.sql.Time)
	 */
	public void updateTime(final int arg0, final Time arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateTime(java.lang.String, java.sql.Time)
	 */
	public void updateTime(final String arg0, final Time arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateTimestamp(int, java.sql.Timestamp)
	 */
	public void updateTimestamp(final int arg0, final Timestamp arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#updateTimestamp(java.lang.String, java.sql.Timestamp)
	 */
	public void updateTimestamp(final String arg0, final Timestamp arg1) throws SQLException {
		throw new SQLFeatureNotSupportedException();
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.ResultSet#wasNull()
	 */
	public boolean wasNull() throws SQLException {
		if (this.isClosed()) {
			throw new SQLException();
		}
		return this.wasNull;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
	 */
	public boolean isWrapperFor(final Class<?> iface) throws SQLException {
		throw new SQLException("Do I need to be a wrapper of class " + iface + " ?");
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see java.sql.Wrapper#unwrap(java.lang.Class)
	 */
	public <T> T unwrap(final Class<T> iface) throws SQLException {
		throw new SQLException("Do I need to call unwrap with parameter class " + iface + " ?");
	}

	//******************************Utility methods ***********************************************//

	/**
	 * Gets the index of the column in this result set that has the given name.
	 * 
	 * @param columnName
	 *            column name string
	 * @return the index in columnInfos of the column with the given columnName, -1 if there's no column with that name
	 */
	int getColumnIndex(final String columnName) {
		if (this.columnMap == null) {
			this.columnMap = new HashMap<String, Integer>(this.columnInfos.length);
		} else {
			Integer pos = this.columnMap.get(columnName);
			if (pos != null) {
				return pos.intValue();
			}
		}
		for (int i = 0; i < this.columnInfos.length; i++) {
			if (this.columnInfos[i].getName().equals(columnName)) {
				this.columnMap.put(columnName, new Integer(i));
				return i;
			}
		}
		return -1;
	}

	/**
	 * Gets the current row's data from the column at the given index.
	 * 
	 * @param index
	 *            the column index in the row
	 * @return the column value as an <code>Object</code>
	 * @throws SQLException
	 *             if the connection is closed; if <code>index</code> is less than <code>0</code>; if <code>index</code>
	 *             is greater than the number of columns; if there is no current row
	 */
	abstract Object getColumnData(int index) throws SQLException;
}
