| java.lang.Object com.internetcds.jdbc.tds.ResultSet_base
All known Subclasses: com.internetcds.jdbc.tds.ResultSet_2_0,
ResultSet_base | public class ResultSet_base (Code) | | A ResultSet provides access to a table of data generated by
executing a Statement. The table rows are retrieved in
sequence. Within a row its column values can be accessed in any
order.
A ResultSet maintains a cursor pointing to its current row of
data. Initially the cursor is positioned before the first row.
The 'next' method moves the cursor to the next row.
The getXXX methods retrieve column values for the current
row. You can retrieve values either using the index number of the
column, or by using the name of the column. In general using the
column index will be more efficient. Columns are numbered from 1.
For maximum portability, ResultSet columns within each row should be
read in left-to-right order and each column should be read only once.
For the getXXX methods, the JDBC driver attempts to convert the
underlying data to the specified Java type and returns a suitable
Java value. See the JDBC specification for allowable mappings
from SQL types to Java types with the ResultSet.getXXX methods.
Column names used as input to getXXX methods are case
insensitive. When performing a getXXX using a column name, if
several columns have the same name, then the value of the first
matching column will be returned. The column name option is
designed to be used when column names are used in the SQL
query. For columns that are NOT explicitly named in the query, it
is best to use column numbers. If column names were used there is
no way for the programmer to guarantee that they actually refer to
the intended columns.
A ResultSet is automatically closed by the Statement that
generated it when that Statement is closed, re-executed, or is used
to retrieve the next result from a sequence of multiple results.
The number, types and properties of a ResultSet's columns are
provided by the ResulSetMetaData object returned by the getMetaData
method.
author: Craig Spannring author: The FreeTDS project version: $Id: ResultSet_base.java,v 1.2 2007-10-19 13:21:40 sinisa Exp $ See Also: Statement.executeQuery See Also: Statement.getResultSet See Also: ResultSetMetaData See Also: Tds.getRow |
Method Summary | |
protected void | NotImplemented() | public void | clearWarnings() After this call getWarnings returns null until a new warning is
reported for this ResultSet. | public void | close() In some cases, it is desirable to immediately release a
ResultSet's database and JDBC resources instead of waiting for
this to happen when it is automatically closed; the close
method provides this immediate release.
Note: A ResultSet is automatically closed by the
Statement that generated it when that Statement is closed,
re-executed, or is used to retrieve the next result from a
sequence of multiple results. | public int | findColumn(String columnName) Map a Resultset column name to a ResultSet column index. | public java.io.InputStream | getAsciiStream(int columnIndex) A column value can be retrieved as a stream of ASCII characters
and then read in chunks from the stream. | public java.io.InputStream | getAsciiStream(String columnName) A column value can be retrieved as a stream of ASCII characters
and then read in chunks from the stream. | public BigDecimal | getBigDecimal(int columnIndex, int scale) Get the value of a column in the current row as a
java.lang.BigDecimal object. | public BigDecimal | getBigDecimal(String columnName, int scale) Get the value of a column in the current row as a
java.lang.BigDecimal object. | public java.io.InputStream | getBinaryStream(int columnIndex) A column value can be retrieved as a stream of uninterpreted bytes
and then read in chunks from the stream. | public java.io.InputStream | getBinaryStream(String columnName) A column value can be retrieved as a stream of uninterpreted bytes
and then read in chunks from the stream. | public boolean | getBoolean(int columnIndex) Get the value of a column in the current row as a Java boolean.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public boolean | getBoolean(String columnName) Get the value of a column in the current row as a Java boolean. | public byte | getByte(int columnIndex) Get the value of a column in the current row as a Java byte.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public byte | getByte(String columnName) Get the value of a column in the current row as a Java byte. | public byte[] | getBytes(int columnIndex) Get the value of a column in the current row as a Java byte array.
The bytes represent the raw values returned by the driver.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public byte[] | getBytes(String columnName) Get the value of a column in the current row as a Java byte array. | public String | getCursorName() Get the name of the SQL cursor used by this ResultSet.
In SQL, a result table is retrieved through a cursor that is
named. | public java.sql.Date | getDate(int columnIndex) Get the value of a column in the current row as a java.sql.Date object.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public java.sql.Date | getDate(String columnName) Get the value of a column in the current row as a java.sql.Date object. | public double | getDouble(int columnIndex) Get the value of a column in the current row as a Java double.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public double | getDouble(String columnName) Get the value of a column in the current row as a Java double. | public float | getFloat(int columnIndex) Get the value of a column in the current row as a Java float.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public float | getFloat(String columnName) Get the value of a column in the current row as a Java float. | public int | getInt(int columnIndex) Get the value of a column in the current row as a Java int.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public int | getInt(String columnName) Get the value of a column in the current row as a Java int. | public long | getLong(int columnIndex) Get the value of a column in the current row as a Java long.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public long | getLong(String columnName) Get the value of a column in the current row as a Java long. | public java.sql.ResultSetMetaData | getMetaData() The number, types and properties of a ResultSet's columns
are provided by the getMetaData method. | public Object | getObject(int columnIndex) Get the value of a column in the current row as a Java object.
This method will return the value of the given column as a
Java object. | public Object | getObject(String columnName) Get the value of a column in the current row as a Java object.
This method will return the value of the given column as a
Java object. | public short | getShort(int columnIndex) Get the value of a column in the current row as a Java short.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public short | getShort(String columnName) Get the value of a column in the current row as a Java short. | public String | getString(int columnIndex) Get the value of a column in the current row as a Java String.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public String | getString(String columnName) Get the value of a column in the current row as a Java String. | public java.sql.Time | getTime(int columnIndex) Get the value of a column in the current row as a java.sql.Time object.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public java.sql.Time | getTime(String columnName) Get the value of a column in the current row as a java.sql.Time object. | public java.sql.Timestamp | getTimestamp(int columnIndex) Get the value of a column in the current row as a java.sql.Timestamp object.
Parameters: columnIndex - the first column is 1, the second is 2, ... | public java.sql.Timestamp | getTimestamp(String columnName) Get the value of a column in the current row as a java.sql.Timestamp object. | public java.io.InputStream | getUnicodeStream(int columnIndex) A column value can be retrieved as a stream of Unicode characters
and then read in chunks from the stream. | public java.io.InputStream | getUnicodeStream(String columnName) A column value can be retrieved as a stream of Unicode characters
and then read in chunks from the stream. | public SQLWarning | getWarnings() The first warning reported by calls on this ResultSet is
returned. | public boolean | next() A ResultSet is initially positioned before its first row; the
first call to next makes the first row the current row; the
second call makes the second row the current row, etc.
If an input stream from the previous row is open, it is
implicitly closed. | public boolean | wasNull() A column may have the value of SQL NULL; wasNull reports whether
the last column read had this special value. |
hitEndOfData | boolean hitEndOfData(Code) | | |
isClosed | boolean isClosed(Code) | | |
lastGetWasNull | boolean lastGetWasNull(Code) | | |
clearWarnings | public void clearWarnings() throws SQLException(Code) | | After this call getWarnings returns null until a new warning is
reported for this ResultSet.
exception: SQLException - if a database-access error occurs. |
close | public void close() throws SQLException(Code) | | In some cases, it is desirable to immediately release a
ResultSet's database and JDBC resources instead of waiting for
this to happen when it is automatically closed; the close
method provides this immediate release.
Note: A ResultSet is automatically closed by the
Statement that generated it when that Statement is closed,
re-executed, or is used to retrieve the next result from a
sequence of multiple results. A ResultSet is also automatically
closed when it is garbage collected.
exception: SQLException - if a database-access error occurs. |
findColumn | public int findColumn(String columnName) throws SQLException(Code) | | Map a Resultset column name to a ResultSet column index.
Parameters: columnName - the name of the column the column index exception: SQLException - if a database-access error occurs. |
getAsciiStream | public java.io.InputStream getAsciiStream(int columnIndex) throws SQLException(Code) | | A column value can be retrieved as a stream of ASCII characters
and then 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 get method implicitly closes the stream. . Also, a
stream may return 0 for available() whether there is data
available or not.
Parameters: columnIndex - the first column is 1, the second is 2, ... a Java input stream that delivers the database column valueas a stream of one byte ASCII characters. If the value is SQL NULLthen the result is null. exception: SQLException - if a database-access error occurs. |
getAsciiStream | public java.io.InputStream getAsciiStream(String columnName) throws SQLException(Code) | | A column value can be retrieved as a stream of ASCII characters
and then 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 get method implicitly closes the stream.
Parameters: columnName - is the SQL name of the column a Java input stream that delivers the database column valueas a stream of one byte ASCII characters. If the value is SQL NULLthen the result is null. exception: SQLException - if a database-access error occurs. |
getBigDecimal | public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException(Code) | | Get the value of a column in the current row as a
java.lang.BigDecimal object.
Parameters: columnIndex - the first column is 1, the second is 2, ... Parameters: scale - the number of digits to the right of the decimal the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getBigDecimal | public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException(Code) | | Get the value of a column in the current row as a
java.lang.BigDecimal object.
Parameters: columnName - is the SQL name of the column Parameters: scale - the number of digits to the right of the decimal the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getBinaryStream | public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException(Code) | | A column value can be retrieved as a stream of uninterpreted bytes
and then 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 get method implicitly closes the stream. Also, a
stream may return 0 for available() whether there is data
available or not.
Parameters: columnIndex - the first column is 1, the second is 2, ... a Java input stream that delivers the database column valueas a stream of uninterpreted bytes. If the value is SQL NULLthen the result is null. exception: SQLException - if a database-access error occurs. |
getBinaryStream | public java.io.InputStream getBinaryStream(String columnName) throws SQLException(Code) | | A column value can be retrieved as a stream of uninterpreted bytes
and then 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 get method implicitly closes the stream.
Parameters: columnName - is the SQL name of the column a Java input stream that delivers the database column valueas a stream of uninterpreted bytes. If the value is SQL NULLthen the result is null. exception: SQLException - if a database-access error occurs. |
getBoolean | public boolean getBoolean(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a Java boolean.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is false exception: SQLException - if a database-access error occurs. |
getBoolean | public boolean getBoolean(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a Java boolean.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is false exception: SQLException - if a database-access error occurs. |
getByte | public byte getByte(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a Java byte.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getByte | public byte getByte(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a Java byte.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getBytes | public byte[] getBytes(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a Java byte array.
The bytes represent the raw values returned by the driver.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getBytes | public byte[] getBytes(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a Java byte array.
The bytes represent the raw values returned by the driver.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getCursorName | public String getCursorName() throws SQLException(Code) | | Get the name of the SQL cursor used by this ResultSet.
In SQL, a result table is retrieved through a cursor that is
named. The current row of a result can be updated or deleted
using a positioned update/delete statement that references the
cursor name.
JDBC supports this SQL feature by providing the name of the
SQL cursor used by a ResultSet. The current row of a ResultSet
is also the current row of this SQL cursor.
Note: If positioned update is not supported a
SQLException is thrown
the ResultSet's SQL cursor name exception: SQLException - if a database-access error occurs. |
getDate | public java.sql.Date getDate(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a java.sql.Date object.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getDate | public java.sql.Date getDate(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a java.sql.Date object.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getDouble | public double getDouble(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a Java double.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getDouble | public double getDouble(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a Java double.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getFloat | public float getFloat(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a Java float.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getFloat | public float getFloat(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a Java float.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getInt | public int getInt(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a Java int.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getInt | public int getInt(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a Java int.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getLong | public long getLong(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a Java long.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getLong | public long getLong(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a Java long.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getMetaData | public java.sql.ResultSetMetaData getMetaData() throws SQLException(Code) | | The number, types and properties of a ResultSet's columns
are provided by the getMetaData method.
the description of a ResultSet's columns exception: SQLException - if a database-access error occurs. |
getObject | public Object getObject(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a Java object.
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 specified in the JDBC spec.
This method may also be used to read datatabase specific abstract
data types.
JDBC 2.0
In the JDBC 2.0 API, the behavior of method
getObject is extended to materialize
data of SQL user-defined types. When the 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()).
Parameters: columnIndex - the first column is 1, the second is 2, ... A java.lang.Object holding the column value. exception: SQLException - if a database-access error occurs. |
getObject | public Object getObject(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a Java object.
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 specified in the JDBC spec.
JDBC 2.0
In the JDBC 2.0 API, the behavior of method
getObject is extended to materialize
data of SQL user-defined types. When the 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()).
This method may also be used to read datatabase specific abstract
data types.
Parameters: columnName - is the SQL name of the column A java.lang.Object holding the column value. exception: SQLException - if a database-access error occurs. |
getShort | public short getShort(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a Java short.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getShort | public short getShort(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a Java short.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is 0 exception: SQLException - if a database-access error occurs. |
getString | public String getString(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a Java String.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getString | public String getString(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a Java String.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getTime | public java.sql.Time getTime(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a java.sql.Time object.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getTime | public java.sql.Time getTime(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a java.sql.Time object.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getTimestamp | public java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException(Code) | | Get the value of a column in the current row as a java.sql.Timestamp object.
Parameters: columnIndex - the first column is 1, the second is 2, ... the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getTimestamp | public java.sql.Timestamp getTimestamp(String columnName) throws SQLException(Code) | | Get the value of a column in the current row as a java.sql.Timestamp object.
Parameters: columnName - is the SQL name of the column the column value; if the value is SQL NULL, the result is null exception: SQLException - if a database-access error occurs. |
getUnicodeStream | public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException(Code) | | A column value can be retrieved as a stream of Unicode characters
and then 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 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 get method implicitly closes the stream. . Also, a
stream may return 0 for available() whether there is data
available or not.
Parameters: columnIndex - the first column is 1, the second is 2, ... a Java input stream that delivers the database column valueas a stream of two byte Unicode characters. If the value is SQL NULLthen the result is null. exception: SQLException - if a database-access error occurs. |
getUnicodeStream | public java.io.InputStream getUnicodeStream(String columnName) throws SQLException(Code) | | A column value can be retrieved as a stream of Unicode characters
and then 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 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 get method implicitly closes the stream.
Parameters: columnName - is the SQL name of the column a Java input stream that delivers the database column valueas a stream of two byte Unicode characters. If the value is SQL NULLthen the result is null. exception: SQLException - if a database-access error occurs. |
getWarnings | public SQLWarning getWarnings() throws SQLException(Code) | | The first warning reported by calls on this ResultSet is
returned. Subsequent ResultSet warnings will be chained to this
SQLWarning.
The warning chain is automatically cleared each time a new
row is read.
Note: This warning chain only covers warnings caused
by ResultSet methods. Any warning caused by statement methods
(such as reading OUT parameters) will be chained on the
Statement object.
the first SQLWarning or null exception: SQLException - if a database-access error occurs. |
next | public boolean next() throws SQLException(Code) | | A ResultSet is initially positioned before its first row; the
first call to next makes the first row the current row; the
second call makes the second row the current row, etc.
If an input stream from the previous row is open, it is
implicitly closed. The ResultSet's warning chain is cleared
when a new row is read.
true if the new current row is valid; false if thereare no more rows exception: SQLException - if a database-access error occurs. |
wasNull | public boolean wasNull() throws SQLException(Code) | | A column may have the value of SQL NULL; wasNull reports whether
the last column read had this special value.
Note that you must first call getXXX on a column to try to read
its value and then call wasNull() to find if the value was
the SQL NULL.
true if last column read was SQL NULL exception: SQLException - if a database-access error occurs. |
|
|