br.ufg.integrate.wrapper.csv
Class CsvResultSet

java.lang.Object
  extended by br.ufg.integrate.wrapper.jdbc.IntegrateResultSet
      extended by br.ufg.integrate.wrapper.jdbc.impl.ResultSetImpl
          extended by br.ufg.integrate.wrapper.csv.CsvResultSet
All Implemented Interfaces:
ResultSet, Wrapper

public class CsvResultSet
extends ResultSetImpl

This class implements the ResultSet interface for the CsvJdbc driver.

Version:
$Id: CsvResultSet.java,v 1.17 2007/09/19
Author:
Jonathan Ackerman, Michael Maraya, Tomasz Skutnik, Chetan Gupta, Rogerio Arantes Gaioso

Field Summary
protected  String[] columnNames
          Array of available columns for referenced table
protected  InputStream is
          InputStream to keep track of
protected  int isScrollable
           
protected  int lastIndexRead
          Last column name index read
protected  CSVReaderAdapter reader
          Helper class that performs the actual file reads
protected  ResultSetMetaData resultSetMetaData
          Metadata for this ResultSet
protected  CsvStatement statement
          Statement that produced this ResultSet
protected  String tableName
          Table referenced by the Statement
protected  String whereColumnName
          Column that is used on the where clause
protected  String whereValue
          String that is sought for on the where column
 
Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
 
Constructor Summary
protected CsvResultSet(CsvStatement statement, CSVReaderAdapter reader, String tableName, String[] columnNames, int isScrollable)
          Constructor for the CsvResultSet object
protected CsvResultSet(CsvStatement statement, CSVReaderAdapter reader, String tableName, String[] columnNames, int isScrollable, String whereColumnName, String whereValue)
          Constructor for the CsvResultSet object
 
Method Summary
 boolean absolute(int row)
          Moves the cursor to the given row number in this ResultSet object.
 void afterLast()
          Moves the cursor to the end of this ResultSet object, just after the last row.
 void beforeFirst()
          Moves the cursor to the front of this ResultSet object, just before the first row.
 void close()
          Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
 int findColumn(String columnName)
          Maps the given ResultSet column name to its ResultSet column index.
 boolean first()
          Moves the cursor to the first row in this ResultSet object.
 InputStream getAsciiStream(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a stream of ASCII characters.
 InputStream getAsciiStream(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a stream of ASCII characters.
 BigDecimal getBigDecimal(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal with full precision.
 BigDecimal getBigDecimal(int columnIndex, int scale)
          Deprecated.  
 BigDecimal getBigDecimal(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal with full precision.
 BigDecimal getBigDecimal(String columnName, int scale)
          Deprecated.  
 InputStream getBinaryStream(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a binary stream of uninterpreted bytes.
 InputStream getBinaryStream(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a stream of uninterpreted bytes.
 boolean getBoolean(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.
 boolean getBoolean(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.
 byte getByte(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a byte in the Java programming language.
 byte getByte(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a byte in the Java programming language.
 byte[] getBytes(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a byte array in the Java programming language.
 byte[] getBytes(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a byte array in the Java programming language.
 Reader getCharacterStream(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object.
 Reader getCharacterStream(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object.
 int getConcurrency()
          Retrieves the concurrency mode of this ResultSet object.
 Date getDate(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.
 Date getDate(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.
 double getDouble(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a double in the Java programming language.
 double getDouble(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a double in the Java programming language.
 float getFloat(int columnIndex)
          Gets the value of the designated column in the current row of this ResultSet object as a float in the Java programming language.
 float getFloat(String columnName)
          Gets the value of the designated column in the current row of this ResultSet object as a float in the Java programming language.
 int getInt(int columnIndex)
          Gets the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.
 int getInt(String columnName)
          Gets the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.
 long getLong(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language.
 long getLong(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language.
 ResultSetMetaData getMetaData()
          Retrieves the number, types and properties of this ResultSet object's columns.
 Object getObject(int columnIndex)
          Gets the value of the designated column in the current row of this ResultSet object as an Object in the Java programming language.
 Object getObject(String columnName)
          Gets the value of the designated column in the current row of this ResultSet object as an Object in the Java programming language.
 int getRow()
          Retrieves the current row number.
 short getShort(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.
 short getShort(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.
 Statement getStatement()
          Retrieves the Statement object that produced this ResultSet object.
 String getString(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.
 String getString(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.
 Time getTime(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.
 Time getTime(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.
 Timestamp getTimestamp(int columnIndex)
          Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object in the Java programming language.
 Timestamp getTimestamp(String columnName)
          Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object.
 int getType()
          Retrieves the type of this ResultSet object.
 InputStream getUnicodeStream(int columnIndex)
          Deprecated. use getCharacterStream in place of getUnicodeStream
 InputStream getUnicodeStream(String columnName)
          Deprecated. use getCharacterStream instead
 boolean isAfterLast()
          Retrieves whether the cursor is after the last row in this ResultSet object.
 boolean isBeforeFirst()
          Retrieves whether the cursor is before the first row in this ResultSet object.
 boolean isClosed()
          Implements method in interface java.sql.ResultSet
 boolean isFirst()
          Retrieves whether the cursor is on the first row of this ResultSet object.
 boolean isLast()
          Retrieves whether the cursor is on the last row of this ResultSet object.
 boolean last()
          Moves the cursor to the last row in this ResultSet object.
 boolean next()
          Moves the cursor down one row from its current position.
 boolean previous()
          Moves the cursor to the previous row in this ResultSet object.
 boolean relative(int rows)
          Moves the cursor a relative number of rows, either positive or negative.
 boolean wasNull()
          Reports whether the last column read had a value of SQL NULL.
 
Methods inherited from class br.ufg.integrate.wrapper.jdbc.impl.ResultSetImpl
cancelRowUpdates, clearWarnings, deleteRow, getArray, getArray, getBlob, getBlob, getClob, getClob, getCursorName, getDate, getDate, getFetchDirection, getFetchSize, getHoldability, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getRef, getRef, getRowId, getRowId, getSQLXML, getSQLXML, getTime, getTime, getTimestamp, getTimestamp, getURL, getURL, getWarnings, insertRow, isWrapperFor, moveToCurrentRow, moveToInsertRow, refreshRow, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, unwrap, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resultSetMetaData

protected ResultSetMetaData resultSetMetaData
Metadata for this ResultSet


statement

protected CsvStatement statement
Statement that produced this ResultSet


isScrollable

protected int isScrollable

reader

protected CSVReaderAdapter reader
Helper class that performs the actual file reads


tableName

protected String tableName
Table referenced by the Statement


columnNames

protected String[] columnNames
Array of available columns for referenced table


lastIndexRead

protected int lastIndexRead
Last column name index read


whereColumnName

protected String whereColumnName
Column that is used on the where clause


whereValue

protected String whereValue
String that is sought for on the where column


is

protected InputStream is
InputStream to keep track of

Constructor Detail

CsvResultSet

protected CsvResultSet(CsvStatement statement,
                       CSVReaderAdapter reader,
                       String tableName,
                       String[] columnNames,
                       int isScrollable)
Constructor for the CsvResultSet object

Parameters:
statement - Statement that produced this ResultSet
reader - Helper class that performs the actual file reads
tableName - Table referenced by the Statement
columnNames - Array of available columns for referenced table

CsvResultSet

protected CsvResultSet(CsvStatement statement,
                       CSVReaderAdapter reader,
                       String tableName,
                       String[] columnNames,
                       int isScrollable,
                       String whereColumnName,
                       String whereValue)
Constructor for the CsvResultSet object

Parameters:
statement - Statement that produced this ResultSet
reader - Helper class that performs the actual file reads
tableName - Table referenced by the Statement
columnNames - Array of available columns for referenced table
whereColumnName - The zero base number for the column
whereValue - The string to be sought for
Method Detail

absolute

public boolean absolute(int row)
                 throws SQLException
Moves the cursor to the given row number in this ResultSet object.

If the row number is positive, the cursor moves to the given row number with respect to the beginning of the result set. The first row is row 1, the second is row 2, and so on.

If the given row number is negative, the cursor moves to an absolute row position with respect to the end of the result set. For example, calling the method absolute(-1) positions the cursor on the last row; calling the method absolute(-2) moves the cursor to the next-to-last row, and so on.

An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before the first row or after the last row.

Note: Calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last().

Specified by:
absolute in interface ResultSet
Overrides:
absolute in class ResultSetImpl
Parameters:
row - the number of the row to which the cursor should move. A positive number indicates the row number counting from the beginning of the result set; a negative number indicates the row number counting from the end of the result set
Returns:
true if the cursor is on the result set; false otherwise
Throws:
SQLException - if a database access error occurs, or the result set type is TYPE_FORWARD_ONLY
See Also:
ResultSet.absolute(int)

close

public void close()
           throws SQLException
Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.

Note: A ResultSet object is automatically closed by the Statement object that generated it when that Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results. A ResultSet object is also automatically closed when it is garbage collected.

Specified by:
close in interface ResultSet
Overrides:
close in class ResultSetImpl
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.close()

getAsciiStream

public InputStream getAsciiStream(int columnIndex)
                           throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a stream of ASCII characters. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the database format into ASCII.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a getter method implicitly closes the stream. Also, a stream may return 0 when the method InputStream.available is called whether there is data available or not.

Specified by:
getAsciiStream in interface ResultSet
Overrides:
getAsciiStream in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
a Java input stream that delivers the database column value as a stream of one-byte ASCII characters; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getAsciiStream(int)

getAsciiStream

public InputStream getAsciiStream(String columnName)
                           throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a stream of ASCII characters. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the database format into ASCII.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a getter method implicitly closes the stream. Also, a stream may return 0 when the method available is called whether there is data available or not.

Specified by:
getAsciiStream in interface ResultSet
Overrides:
getAsciiStream in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
a Java input stream that delivers the database column value as a stream of one-byte ASCII characters. If the value is SQL NULL, the value returned is null.
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getAsciiStream(int)

getBigDecimal

public BigDecimal getBigDecimal(int columnIndex,
                                int scale)
                         throws SQLException
Deprecated. 

Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.BigDecimal in the Java programming language.

Specified by:
getBigDecimal in interface ResultSet
Overrides:
getBigDecimal in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
scale - the number of digits to the right of the decimal point
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getBigDecimal(int, int)

getBigDecimal

public BigDecimal getBigDecimal(String columnName,
                                int scale)
                         throws SQLException
Deprecated. 

Retrieves the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal in the Java programming language.

Specified by:
getBigDecimal in interface ResultSet
Overrides:
getBigDecimal in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
scale - the number of digits to the right of the decimal point
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getBigDecimal(int, int)

getBinaryStream

public InputStream getBinaryStream(int columnIndex)
                            throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a binary stream of uninterpreted bytes. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARBINARY values.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a getter method implicitly closes the stream. Also, a stream may return 0 when the method InputStream.available is called whether there is data available or not.

Specified by:
getBinaryStream in interface ResultSet
Overrides:
getBinaryStream in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
a Java input stream that delivers the database column value as a stream of uninterpreted bytes; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getBinaryStream(int)

getBinaryStream

public InputStream getBinaryStream(String columnName)
                            throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a stream of uninterpreted bytes. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARBINARY values.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a getter method implicitly closes the stream. Also, a stream may return 0 when the method available is called whether there is data available or not.

Specified by:
getBinaryStream in interface ResultSet
Overrides:
getBinaryStream in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
a Java input stream that delivers the database column value as a stream of uninterpreted bytes; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getBinaryStream(int)

getBoolean

public boolean getBoolean(int columnIndex)
                   throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.

Specified by:
getBoolean in interface ResultSet
Overrides:
getBoolean in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is false
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getBoolean(int)

getBoolean

public boolean getBoolean(String columnName)
                   throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java programming language.

Specified by:
getBoolean in interface ResultSet
Overrides:
getBoolean in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is false
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getBoolean(int)

getByte

public byte getByte(int columnIndex)
             throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a byte in the Java programming language.

Specified by:
getByte in interface ResultSet
Overrides:
getByte in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getByte(int)

getByte

public byte getByte(String columnName)
             throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a byte in the Java programming language.

Specified by:
getByte in interface ResultSet
Overrides:
getByte in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getByte(int)

getBytes

public byte[] getBytes(int columnIndex)
                throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a byte array in the Java programming language. The bytes represent the raw values returned by the driver.

Specified by:
getBytes in interface ResultSet
Overrides:
getBytes in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getBytes(int)

getBytes

public byte[] getBytes(String columnName)
                throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a byte array in the Java programming language. The bytes represent the raw values returned by the driver.

Specified by:
getBytes in interface ResultSet
Overrides:
getBytes in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getBytes(int)

getDate

public Date getDate(int columnIndex)
             throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.

Specified by:
getDate in interface ResultSet
Overrides:
getDate in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getDate(int)

getDouble

public double getDouble(int columnIndex)
                 throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a double in the Java programming language.

Specified by:
getDouble in interface ResultSet
Overrides:
getDouble in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getDouble(int)

getDouble

public double getDouble(String columnName)
                 throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a double in the Java programming language.

Specified by:
getDouble in interface ResultSet
Overrides:
getDouble in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getDouble(int)

getFloat

public float getFloat(int columnIndex)
               throws SQLException
Gets the value of the designated column in the current row of this ResultSet object as a float in the Java programming language.

Specified by:
getFloat in interface ResultSet
Overrides:
getFloat in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getFloat(int)

getFloat

public float getFloat(String columnName)
               throws SQLException
Gets the value of the designated column in the current row of this ResultSet object as a float in the Java programming language.

Specified by:
getFloat in interface ResultSet
Overrides:
getFloat in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getFloat(int)

getInt

public int getInt(int columnIndex)
           throws SQLException
Gets the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.

Specified by:
getInt in interface ResultSet
Overrides:
getInt in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getInt(int)

getInt

public int getInt(String columnName)
           throws SQLException
Gets the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.

Specified by:
getInt in interface ResultSet
Overrides:
getInt in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getInt(int)

getLong

public long getLong(int columnIndex)
             throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language.

Specified by:
getLong in interface ResultSet
Overrides:
getLong in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getLong(int)

getLong

public long getLong(String columnName)
             throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language.

Specified by:
getLong in interface ResultSet
Overrides:
getLong in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getLong(int)

getShort

public short getShort(int columnIndex)
               throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.

Specified by:
getShort in interface ResultSet
Overrides:
getShort in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getShort(int)

getShort

public short getShort(String columnName)
               throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.

Specified by:
getShort in interface ResultSet
Overrides:
getShort in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getShort(int)

getString

public String getString(int columnIndex)
                 throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.

Specified by:
getString in interface ResultSet
Overrides:
getString in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getString(int)

getString

public String getString(String columnName)
                 throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.

Specified by:
getString in interface ResultSet
Overrides:
getString in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getString(int)

getTime

public Time getTime(int columnIndex)
             throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.

Specified by:
getTime in interface ResultSet
Overrides:
getTime in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getTime(int)

getTimestamp

public Timestamp getTimestamp(int columnIndex)
                       throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object in the Java programming language.

Specified by:
getTimestamp in interface ResultSet
Overrides:
getTimestamp in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getTimestamp(int)

getUnicodeStream

public InputStream getUnicodeStream(int columnIndex)
                             throws SQLException
Deprecated. use getCharacterStream in place of getUnicodeStream

Retrieves the value of the designated column in the current row of this ResultSet object as as a stream of two-byte Unicode characters. The first byte is the high byte; the second byte is the low byte. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARCHARvalues. The JDBC driver will do any necessary conversion from the database format into Unicode.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a getter method implicitly closes the stream. Also, a stream may return 0 when the method InputStream.available is called, whether there is data available or not.

Specified by:
getUnicodeStream in interface ResultSet
Overrides:
getUnicodeStream in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
a Java input stream that delivers the database column value as a stream of two-byte Unicode characters; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getUnicodeStream(int)

getDate

public Date getDate(String columnName)
             throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Date object in the Java programming language.

Specified by:
getDate in interface ResultSet
Overrides:
getDate in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getDate(int)

getTime

public Time getTime(String columnName)
             throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time object in the Java programming language.

Specified by:
getTime in interface ResultSet
Overrides:
getTime in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getTime(int)

getTimestamp

public Timestamp getTimestamp(String columnName)
                       throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp object.

Specified by:
getTimestamp in interface ResultSet
Overrides:
getTimestamp in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
the column value; if the value is SQL NULL, the value returned is null
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getTimestamp(int)

getUnicodeStream

public InputStream getUnicodeStream(String columnName)
                             throws SQLException
Deprecated. use getCharacterStream instead

Retrieves the value of the designated column in the current row of this ResultSet object as a stream of two-byte Unicode characters. The first byte is the high byte; the second byte is the low byte. The value can then be read in chunks from the stream. This method is particularly suitable for retrieving large LONGVARCHAR values. The JDBC technology-enabled driver will do any necessary conversion from the database format into Unicode.

Note: All the data in the returned stream must be read prior to getting the value of any other column. The next call to a getter method implicitly closes the stream. Also, a stream may return 0 when the method InputStream.available is called, whether there is data available or not.

Specified by:
getUnicodeStream in interface ResultSet
Overrides:
getUnicodeStream in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
a Java input stream that delivers the database column value as a stream of two-byte Unicode characters. If the value is SQL NULL, the value returned is null.
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getUnicodeStream(int)

getMetaData

public ResultSetMetaData getMetaData()
                              throws SQLException
Retrieves the number, types and properties of this ResultSet object's columns.

Specified by:
getMetaData in interface ResultSet
Overrides:
getMetaData in class ResultSetImpl
Returns:
the description of this ResultSet object's columns
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getMetaData()

getObject

public Object getObject(int columnIndex)
                 throws SQLException

Gets the value of the designated column in the current row of this ResultSet object as an Object in the Java programming language.

This method will return the value of the given column as a Java object. The type of the Java object will be the default Java object type corresponding to the column's SQL type, following the mapping for built-in types specified in the JDBC specification. If the value is an SQL NULL, the driver returns a Java null.

This method may also be used to read datatabase-specific abstract data types. In the JDBC 2.0 API, the behavior of method getObject is extended to materialize data of SQL user-defined types. When a column contains a structured or distinct value, the behavior of this method is as if it were a call to: getObject(columnIndex, this.getStatement().getConnection().getTypeMap()).

Specified by:
getObject in interface ResultSet
Overrides:
getObject in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
a java.lang.Object holding the column value
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getObject(int)

getObject

public Object getObject(String columnName)
                 throws SQLException

Gets the value of the designated column in the current row of this ResultSet object as an Object in the Java programming language.

This method will return the value of the given column as a Java object. The type of the Java object will be the default Java object type corresponding to the column's SQL type, following the mapping for built-in types specified in the JDBC specification. If the value is an SQL NULL, the driver returns a Java null.

This method may also be used to read datatabase-specific abstract data types.

In the JDBC 2.0 API, the behavior of the method getObject is extended to materialize data of SQL user-defined types. When a column contains a structured or distinct value, the behavior of this method is as if it were a call to: getObject(columnIndex, this.getStatement().getConnection().getTypeMap()).

Specified by:
getObject in interface ResultSet
Overrides:
getObject in class ResultSetImpl
Parameters:
columnName - the SQL name of the column
Returns:
a java.lang.Object holding the column value
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getObject(int)

findColumn

public int findColumn(String columnName)
               throws SQLException
Maps the given ResultSet column name to its ResultSet column index.

Specified by:
findColumn in interface ResultSet
Overrides:
findColumn in class ResultSetImpl
Parameters:
columnName - the name of the column
Returns:
the column index of the given column name
Throws:
SQLException - if the ResultSet object does not contain columnName or a database access error occurs
See Also:
ResultSet.findColumn(java.lang.String)

getCharacterStream

public Reader getCharacterStream(int columnIndex)
                          throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object.

Specified by:
getCharacterStream in interface ResultSet
Overrides:
getCharacterStream in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
a java.io.Reader object that contains the column value; if the value is SQL NULL, the value returned is null in the Java programming language.
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getCharacterStream(int)

getCharacterStream

public Reader getCharacterStream(String columnName)
                          throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader object.

Specified by:
getCharacterStream in interface ResultSet
Overrides:
getCharacterStream in class ResultSetImpl
Parameters:
columnName - the name of the column
Returns:
a java.io.Reader object that contains the column value; if the value is SQL NULL, the value returned is null in the Java programming language
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getCharacterStream(int)

getBigDecimal

public BigDecimal getBigDecimal(int columnIndex)
                         throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal with full precision.

Specified by:
getBigDecimal in interface ResultSet
Overrides:
getBigDecimal in class ResultSetImpl
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value (full precision); if the value is SQL NULL, the value returned is null in the Java programming language.
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getBigDecimal(int, int)

getBigDecimal

public BigDecimal getBigDecimal(String columnName)
                         throws SQLException
Retrieves the value of the designated column in the current row of this ResultSet object as a java.math.BigDecimal with full precision.

Specified by:
getBigDecimal in interface ResultSet
Overrides:
getBigDecimal in class ResultSetImpl
Parameters:
columnName - the column name
Returns:
the column value (full precision); if the value is SQL NULL, the value returned is null in the Java programming language.
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getBigDecimal(int, int)

isBeforeFirst

public boolean isBeforeFirst()
                      throws SQLException
Retrieves whether the cursor is before the first row in this ResultSet object.

Specified by:
isBeforeFirst in interface ResultSet
Overrides:
isBeforeFirst in class ResultSetImpl
Returns:
true if the cursor is before the first row; false if the cursor is at any other position or the result set contains no rows
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.isBeforeFirst()

isAfterLast

public boolean isAfterLast()
                    throws SQLException
Retrieves whether the cursor is after the last row in this ResultSet object.

Specified by:
isAfterLast in interface ResultSet
Overrides:
isAfterLast in class ResultSetImpl
Returns:
true if the cursor is after the last row; false if the cursor is at any other position or the result set contains no rows
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.isAfterLast()

isFirst

public boolean isFirst()
                throws SQLException
Retrieves whether the cursor is on the first row of this ResultSet object.

Specified by:
isFirst in interface ResultSet
Overrides:
isFirst in class ResultSetImpl
Returns:
true if the cursor is on the first row; false otherwise
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.isFirst()

isLast

public boolean isLast()
               throws SQLException
Retrieves whether the cursor is on the last row of this ResultSet object. Note: Calling the method isLast may be expensive because the JDBC driver might need to fetch ahead one row in order to determine whether the current row is the last row in the result set.

Specified by:
isLast in interface ResultSet
Overrides:
isLast in class ResultSetImpl
Returns:
true if the cursor is on the last row; false otherwise
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.isLast()

beforeFirst

public void beforeFirst()
                 throws SQLException
Moves the cursor to the front of this ResultSet object, just before the first row. This method has no effect if the result set contains no rows.

Specified by:
beforeFirst in interface ResultSet
Overrides:
beforeFirst in class ResultSetImpl
Throws:
SQLException - if a database access error occurs or the result set type is TYPE_FORWARD_ONLY
See Also:
ResultSet.beforeFirst()

afterLast

public void afterLast()
               throws SQLException
Moves the cursor to the end of this ResultSet object, just after the last row. This method has no effect if the result set contains no rows.

Specified by:
afterLast in interface ResultSet
Overrides:
afterLast in class ResultSetImpl
Throws:
SQLException - if a database access error occurs or the result set type is TYPE_FORWARD_ONLY
See Also:
ResultSet.afterLast()

first

public boolean first()
              throws SQLException
Moves the cursor to the first row in this ResultSet object.

Specified by:
first in interface ResultSet
Overrides:
first in class ResultSetImpl
Returns:
true if the cursor is on a valid row; false if there are no rows in the result set
Throws:
SQLException - if a database access error occurs or the result set type is TYPE_FORWARD_ONLY
See Also:
ResultSet.first()

last

public boolean last()
             throws SQLException
Moves the cursor to the last row in this ResultSet object.

Specified by:
last in interface ResultSet
Overrides:
last in class ResultSetImpl
Returns:
true if the cursor is on a valid row; false if there are no rows in the result set
Throws:
SQLException - if a database access error occurs or the result set type is TYPE_FORWARD_ONLY
See Also:
ResultSet.last()

getRow

public int getRow()
           throws SQLException
Retrieves the current row number. The first row is number 1, the second number 2, and so on.

Specified by:
getRow in interface ResultSet
Overrides:
getRow in class ResultSetImpl
Returns:
the current row number; 0 if there is no current row
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getRow()

relative

public boolean relative(int rows)
                 throws SQLException
Moves the cursor a relative number of rows, either positive or negative. Attempting to move beyond the first/last row in the result set positions the cursor before/after the the first/last row. Calling relative(0) is valid, but does not change the cursor position.

Note: Calling the method relative(1) is identical to calling the method next() and calling the method relative(-1) is identical to calling the method previous().

Specified by:
relative in interface ResultSet
Overrides:
relative in class ResultSetImpl
Parameters:
rows - an int specifying the number of rows to move from the current row; a positive number moves the cursor forward; a negative number moves the cursor backward
Returns:
true if the cursor is on a row; false otherwise
Throws:
SQLException - if a database access error occurs, there is no current row, or the result set type is TYPE_FORWARD_ONLY
See Also:
ResultSet.relative(int)

previous

public boolean previous()
                 throws SQLException
Moves the cursor to the previous row in this ResultSet object.

Specified by:
previous in interface ResultSet
Overrides:
previous in class ResultSetImpl
Returns:
true if the cursor is on a valid row; false if it is off the result set
Throws:
SQLException - if a database access error occurs or the result set type is TYPE_FORWARD_ONLY
See Also:
ResultSet.previous()

getType

public int getType()
            throws SQLException
Retrieves the type of this ResultSet object. The type is determined by the Statement object that created the result set.

Specified by:
getType in interface ResultSet
Overrides:
getType in class ResultSetImpl
Returns:
ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getType()

getConcurrency

public int getConcurrency()
                   throws SQLException
Retrieves the concurrency mode of this ResultSet object. The concurrency used is determined by the Statement object that created the result set.

Specified by:
getConcurrency in interface ResultSet
Overrides:
getConcurrency in class ResultSetImpl
Returns:
the concurrency type, either ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getConcurrency()

next

public boolean next()
             throws SQLException
Moves the cursor down one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on.

If an input stream is open for the current row, a call to the method next will implicitly close it. A ResultSet object's warning chain is cleared when a new row is read.

Specified by:
next in interface ResultSet
Overrides:
next in class ResultSetImpl
Returns:
true if the new current row is valid; false if there are no more rows
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.next()

wasNull

public boolean wasNull()
                throws SQLException
Reports whether the last column read had a value of SQL NULL. Note that you must first call one of the getter methods on a column to try to read its value and then call the method wasNull to see if the value read was SQL NULL.

Specified by:
wasNull in interface ResultSet
Overrides:
wasNull in class ResultSetImpl
Returns:
true if the last column value read was SQL NULL and false otherwise
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.wasNull()

getStatement

public Statement getStatement()
                       throws SQLException
Retrieves the Statement object that produced this ResultSet object. If the result set was generated some other way, such as by a DatabaseMetaData method, this method returns null.

Specified by:
getStatement in interface ResultSet
Overrides:
getStatement in class ResultSetImpl
Returns:
the Statment object that produced this ResultSet object or null if the result set was produced some other way
Throws:
SQLException - if a database access error occurs
See Also:
ResultSet.getStatement()

isClosed

public boolean isClosed()
                 throws SQLException
Description copied from class: ResultSetImpl
Implements method in interface java.sql.ResultSet

Specified by:
isClosed in interface ResultSet
Overrides:
isClosed in class ResultSetImpl
Throws:
SQLException
See Also:
ResultSet.isClosed()


Copyright © 2008 Rogério Arantes Gaioso. All Rights Reserved.