|
Build 1.1_r1 (from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ResultSet
An interface for an object which represents a database table entry, returned as the result of the query to the database.
ResultSets have a cursor which points to the current data table row.
When the ResultSet is created, the cursor's location is one position
ahead of the first row. To move the cursor to the first and consecutive rows,
use the next method. The next method returns true as
long as there are more rows in the ResultSet, otherwise it returns
false.
The default type of ResultSet can not be updated and its cursor can
only advance forward through the rows of data. This means that it is only
possible to read through it once. However, other kinds of ResultSet
are implemented: an updatable type and also types where the cursor can
be scrolled forward and backward through the rows of data. How such a
ResultSet is created is demonstrated in the following example:
Connection con;Statement aStatement = con.createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE );ResultSet theResultSet =
theStatement.executeQuery("SELECT price, quantity FROM STOCKTABLE");// theResultSet is both scrollable and updatable
The ResultSet interface provides a series of methods for retrieving
data from columns in the current row, such as getDate and getFloat. The columns are retrieved either by their index number (starting
at 1) or by their name - there are separate methods for both techniques of
column addressing. The column names are case insensitive. If several columns
have the same name, then the getter methods use the first matching column.
This means that if column names are used, it is not possible to guarantee
that the name will retrieve data from the intended column - for certainty it
is better to use column indexes. Ideally the columns should be read
left-to-right and read once only, since not all databases are optimized to
handle other techniques of reading the data.
When reading data via the appropriate getter methods, the JDBC driver maps the SQL data retrieved from the database to the Java type implied by the method invoked by the application. The JDBC specification has a table for the mappings from SQL types to Java types.
There are also methods for writing data into the ResultSet, such as
updateInt and updateString. The update methods can be used
either to modify the data of an existing row or to insert new data rows into
the ResultSet . Modification of existing data involves moving the
cursor to the row which needs modification and then using the update methods
to modify the data, followed by calling the ResultSet.updateRow
method. For insertion of new rows, the cursor is first moved to a special row
called the Insert Row, data is added using the update methods,
followed by calling the ResultSet.insertRow method.
A ResultSet is closed if the statement which generated it closes, the
statement is executed again, or the same statement's next ResultSet
is retrieved (if the statement returned of multiple results).
| Field Summary | |
|---|---|
static int |
CLOSE_CURSORS_AT_COMMIT
A constant used to indicate that a ResultSet object must be
closed when the method Connection.commit is invoked. |
static int |
CONCUR_READ_ONLY
A constant used to indicate the concurrency mode for a ResultSet
object that cannot be updated. |
static int |
CONCUR_UPDATABLE
A constant used to indicate the concurrency mode for a ResultSet
object that can be updated. |
static int |
FETCH_FORWARD
A constant used to indicate processing of the rows of a ResultSet
in the forward direction, first to last. |
static int |
FETCH_REVERSE
A constant used to indicate processing of the rows of a ResultSet
in the reverse direction, last to first. |
static int |
FETCH_UNKNOWN
A constant used to indicate that the order of processing of the rows of a ResultSet is unknown. |
static int |
HOLD_CURSORS_OVER_COMMIT
A constant used to indicate that a ResultSet object must not be
closed when the method Connection.commit is invoked. |
static int |
TYPE_FORWARD_ONLY
A constant used to indicate a ResultSet object whose cursor can
only move forward. |
static int |
TYPE_SCROLL_INSENSITIVE
A constant used to indicate a ResultSet object which is
scrollable but is insensitive to changes made by others. |
static int |
TYPE_SCROLL_SENSITIVE
A constant used to indicate a ResultSet object which is
scrollable and sensitive to changes made by others. |
| Method Summary | |
|---|---|
boolean |
absolute(int row)
Moves the cursor to a specified row number in the ResultSet. |
void |
afterLast()
Moves the cursor to the end of the ResultSet, after the last row. |
void |
beforeFirst()
Moves the cursor to the start of the ResultSet, before the first
row. |
void |
cancelRowUpdates()
Cancels any updates made to the current row in the ResultSet. |
void |
clearWarnings()
Clears all warnings related to this ResultSet. |
void |
close()
Releases this ResultSet's database and JDBC resources. |
void |
deleteRow()
Deletes the current row from the ResultSet and from the
underlying database. |
int |
findColumn(String columnName)
Gets the index number for a column in the ResultSet from the
provided column name. |
boolean |
first()
Shifts the cursor position to the first row in the ResultSet. |
Array |
getArray(int columnIndex)
Gets the content of a column specified by column index in the current row of this ResultSet as a java.sql.Array. |
Array |
getArray(String colName)
Gets the value of a column specified by column name as a java.sql.Array. |
InputStream |
getAsciiStream(int columnIndex)
Gets the value of a column specified by column index as an ASCII character stream. |
InputStream |
getAsciiStream(String columnName)
Gets the value of a column specified by column name as an ASCII character stream. |
BigDecimal |
getBigDecimal(int columnIndex)
Gets the value of a column specified by column index as a java.math.BigDecimal. |
BigDecimal |
getBigDecimal(int columnIndex,
int scale)
Deprecated. use getBigDecimal(int) or
getBigDecimal(String) |
BigDecimal |
getBigDecimal(String columnName)
Gets the value of a column specified by column name, as a java.math.BigDecimal. |
BigDecimal |
getBigDecimal(String columnName,
int scale)
Deprecated. use getBigDecimal(int) or
getBigDecimal(String) |
InputStream |
getBinaryStream(int columnIndex)
Gets the value of a column specified by column index as a binary stream. |
InputStream |
getBinaryStream(String columnName)
Gets the value of a column specified by column name as a binary stream. |
Blob |
getBlob(int columnIndex)
Gets the value of a column specified by column index as a java.sql.Blob object. |
Blob |
getBlob(String columnName)
Gets the value of a column specified by column name, as a java.sql.Blob object. |
boolean |
getBoolean(int columnIndex)
Gets the value of a column specified by column index as a boolean
. |
boolean |
getBoolean(String columnName)
Gets the value of a column specified by column name, as a boolean
. |
byte |
getByte(int columnIndex)
Gets the value of a column specified by column index as a byte. |
byte |
getByte(String columnName)
Gets the value of a column specified by column name as a byte. |
byte[] |
getBytes(int columnIndex)
Gets the value of a column specified by column index as a byte array. |
byte[] |
getBytes(String columnName)
Gets the value of a column specified by column name as a byte array. |
Reader |
getCharacterStream(int columnIndex)
Gets the value of a column specified by column index as a java.io.Reader object. |
Reader |
getCharacterStream(String columnName)
Gets the value of a column specified by column name as a java.io.Reader object. |
Clob |
getClob(int columnIndex)
Gets the value of a column specified by column index as a java.sql.Clob. |
Clob |
getClob(String colName)
Gets the value of a column specified by column name as a java.sql.Clob. |
int |
getConcurrency()
Gets the concurrency mode of this ResultSet. |
String |
getCursorName()
Gets the name of the SQL cursor of this ResultSet. |
Date |
getDate(int columnIndex)
Gets the value of a column specified by column index as a java.sql.Date. |
Date |
getDate(int columnIndex,
Calendar cal)
Gets the value of a column specified by column index as a java.sql.Date. |
Date |
getDate(String columnName)
Gets the value of a column specified by column name as a java.sql.Date. |
Date |
getDate(String columnName,
Calendar cal)
Gets the value of a column specified by column name, as a java.sql.Date object. |
double |
getDouble(int columnIndex)
Gets the value of a column specified by column index as a double
value. |
double |
getDouble(String columnName)
Gets the value of a column specified by column name as a double
value. |
int |
getFetchDirection()
Gets the direction in which rows are fetched for this ResultSet
object. |
int |
getFetchSize()
Gets the fetch size (in number of rows) for this ResultSet. |
float |
getFloat(int columnIndex)
Gets the value of a column specified by column index as a float
value. |
float |
getFloat(String columnName)
Gets the value of a column specified by column name as a float
value. |
int |
getInt(int columnIndex)
Gets the value of a column specified by column index as an int
value. |
int |
getInt(String columnName)
Gets the value of a column specified by column name, as an int
value. |
long |
getLong(int columnIndex)
Gets the value of a column specified by column index as a long
value. |
long |
getLong(String columnName)
Gets the value of a column specified by column name, as a long
value. |
ResultSetMetaData |
getMetaData()
Gets the metadata for this ResultSet. |
Object |
getObject(int columnIndex)
Gets the value of a specified column as a Java Object. |
Object |
getObject(int columnIndex,
Map<String,Class<?>> map)
Gets the value of a column specified by column index as a Java Object. |
Object |
getObject(String columnName)
Gets the value of a specified column as a Java Object. |
Object |
getObject(String columnName,
Map<String,Class<?>> map)
Gets the value of a column specified by column name as a Java Object. |
Ref |
getRef(int columnIndex)
Gets the value of a column specified by column index as a Java java.sql.Ref. |
Ref |
getRef(String colName)
Gets the value of a column specified by column name as a Java java.sql.Ref. |
int |
getRow()
Gets the number of the current row in the ResultSet. |
short |
getShort(int columnIndex)
Gets the value of a column specified by column index as a short value. |
short |
getShort(String columnName)
Gets the value of a column specified by column name, as a short value. |
Statement |
getStatement()
Gets the statement that produced this ResultSet. |
String |
getString(int columnIndex)
Gets the value of a column specified by column index as a String. |
String |
getString(String columnName)
Gets the value of a column specified by column name, as a String. |
Time |
getTime(int columnIndex)
Gets the value of a column specified by column index as a java.sql.Time value. |
Time |
getTime(int columnIndex,
Calendar cal)
Gets the value of a column specified by column index as a java.sql.Time value. |
Time |
getTime(String columnName)
Gets the value of a column specified by column name, as a java.sql.Time value. |
Time |
getTime(String columnName,
Calendar cal)
Gets the value of a column specified by column index, as a java.sql.Time value. |
Timestamp |
getTimestamp(int columnIndex)
Gets the value of a column specified by column index as a java.sql.Timestamp value. |
Timestamp |
getTimestamp(int columnIndex,
Calendar cal)
Gets the value of a column specified by column index, as a java.sql.Timestamp value. |
Timestamp |
getTimestamp(String columnName)
Gets the value of a column specified by column name, as a java.sql.Timestamp value. |
Timestamp |
getTimestamp(String columnName,
Calendar cal)
Gets the value of a column specified by column name, as a java.sql.Timestamp value. |
int |
getType()
Gets the type of the ResultSet. |
InputStream |
getUnicodeStream(int columnIndex)
Deprecated. Use getCharacterStream(int). |
InputStream |
getUnicodeStream(String columnName)
Deprecated. Use getCharacterStream(int) |
URL |
getURL(int columnIndex)
Gets the value of a column specified by column index as a java.net.URL. |
URL |
getURL(String columnName)
Gets the value of a column specified by column name as a java.net.URL object. |
SQLWarning |
getWarnings()
Gets the first warning generated by calls on this ResultSet. |
void |
insertRow()
Insert the insert row into the ResultSet and into the underlying
database. |
boolean |
isAfterLast()
Gets if the cursor is after the last row of the ResultSet. |
boolean |
isBeforeFirst()
Gets if the cursor is before the first row of the ResultSet. |
boolean |
isFirst()
Gets if the cursor is on the first row of the ResultSet. |
boolean |
isLast()
Gets if the cursor is on the last row of the ResultSet |
boolean |
last()
Shifts the cursor position to the last row of the ResultSet. |
void |
moveToCurrentRow()
Moves the cursor to the remembered position, namely the row that was the current row before a call to moveToInsertRow. |
void |
moveToInsertRow()
Moves the cursor position to the Insert Row. |
boolean |
next()
Shifts the cursor position down one row in this ResultSet object. |
boolean |
previous()
Relocates the cursor position to the preceding row in this ResultSet. |
void |
refreshRow()
Refreshes the current row with its most up to date value in the database. |
boolean |
relative(int rows)
Moves the cursor position up or down by a specified number of rows. |
boolean |
rowDeleted()
Indicates whether a row has been deleted. |
boolean |
rowInserted()
Indicates whether the current row has had an insertion operation. |
boolean |
rowUpdated()
Indicates whether the current row has been updated. |
void |
setFetchDirection(int direction)
Indicates which direction (forward/reverse) will be used to process the rows of this ResultSet object. |
void |
setFetchSize(int rows)
Indicates the number of rows to fetch from the database when extra rows are required for this ResultSet. |
void |
updateArray(int columnIndex,
Array x)
Updates a column specified by a column index with a java.sql.Array value. |
void |
updateArray(String columnName,
Array x)
Updates a column specified by a column name with a java.sql.Array
value. |
void |
updateAsciiStream(int columnIndex,
InputStream x,
int length)
Updates a column specified by a column index with an ASCII stream value. |
void |
updateAsciiStream(String columnName,
InputStream x,
int length)
Updates a column specified by a column name with an Ascii stream value. |
void |
updateBigDecimal(int columnIndex,
BigDecimal x)
Updates a column specified by a column index with a java.sql.BigDecimal value. |
void |
updateBigDecimal(String columnName,
BigDecimal x)
Updates a column specified by a column name with a java.sql.BigDecimal value. |
void |
updateBinaryStream(int columnIndex,
InputStream x,
int length)
Updates a column specified by a column index with a binary stream value. |
void |
updateBinaryStream(String columnName,
InputStream x,
int length)
Updates a column specified by a column name with a binary stream value. |
void |
updateBlob(int columnIndex,
Blob x)
Updates a column specified by a column index with a java.sql.Blob
value. |
void |
updateBlob(String columnName,
Blob x)
Updates a column specified by a column name with a java.sql.Blob
value. |
void |
updateBoolean(int columnIndex,
boolean x)
Updates a column specified by a column index with a boolean
value. |
void |
updateBoolean(String columnName,
boolean x)
Updates a column specified by a column name with a boolean value. |
void |
updateByte(int columnIndex,
byte x)
Updates a column specified by a column index with a byte value. |
void |
updateByte(String columnName,
byte x)
Updates a column specified by a column name with a byte value. |
void |
updateBytes(int columnIndex,
byte[] x)
Updates a column specified by a column index with a byte array
value. |
void |
updateBytes(String columnName,
byte[] x)
Updates a column specified by a column name with a byte array value. |
void |
updateCharacterStream(int columnIndex,
Reader x,
int length)
Updates a column specified by a column index with a character stream value. |
void |
updateCharacterStream(String columnName,
Reader reader,
int length)
Updates a column specified by a column name with a character stream value. |
void |
updateClob(int columnIndex,
Clob x)
Updates a column specified by a column index with a java.sql.Clob
value. |
void |
updateClob(String columnName,
Clob x)
Updates a column specified by a column name with a java.sql.Clob
value. |
void |
updateDate(int columnIndex,
Date x)
Updates a column specified by a column index with a java.sql.Date
value. |
void |
updateDate(String columnName,
Date x)
Updates a column specified by a column name with a java.sql.Date
value. |
void |
updateDouble(int columnIndex,
double x)
Updates a column specified by a column index with a double value. |
void |
updateDouble(String columnName,
double x)
Updates a column specified by a column name with a double value. |
void |
updateFloat(int columnIndex,
float x)
Updates a column specified by a column index with a float value. |
void |
updateFloat(String columnName,
float x)
Updates a column specified by a column name with a float value. |
void |
updateInt(int columnIndex,
int x)
Updates a column specified by a column index with an int value. |
void |
updateInt(String columnName,
int x)
Updates a column specified by a column name with an int value. |
void |
updateLong(int columnIndex,
long x)
Updates a column specified by a column index with a long value. |
void |
updateLong(String columnName,
long x)
Updates a column specified by a column name with a long value. |
void |
updateNull(int columnIndex)
Updates a column specified by a column index with a null value. |
void |
updateNull(String columnName)
Updates a column specified by a column name with a null value. |
void |
updateObject(int columnIndex,
Object x)
Updates a column specified by a column index with an Object
value. |
void |
updateObject(int columnIndex,
Object x,
int scale)
Updates a column specified by a column index with an Object
value. |
void |
updateObject(String columnName,
Object x)
Updates a column specified by a column name with an Object value. |
void |
updateObject(String columnName,
Object x,
int scale)
Updates a column specified by a column name with an Object value. |
void |
updateRef(int columnIndex,
Ref x)
Updates a column specified by a column index with a java.sql.Ref
value. |
void |
updateRef(String columnName,
Ref x)
Updates a column specified by a column name with a java.sql.Ref
value. |
void |
updateRow()
Updates the database with the new contents of the current row of this ResultSet object. |
void |
updateShort(int columnIndex,
short x)
Updates a column specified by a column index with a short value. |
void |
updateShort(String columnName,
short x)
Updates a column specified by a column name with a short value. |
void |
updateString(int columnIndex,
String x)
Updates a column specified by a column index with a String value. |
void |
updateString(String columnName,
String x)
Updates a column specified by a column name with a String value. |
void |
updateTime(int columnIndex,
Time x)
Updates a column specified by a column index with a Time value. |
void |
updateTime(String columnName,
Time x)
Updates a column specified by a column name with a Time value. |
void |
updateTimestamp(int columnIndex,
Timestamp x)
Updates a column specified by a column index with a Timestamp
value. |
void |
updateTimestamp(String columnName,
Timestamp x)
Updates a column specified by column name with a Timestamp value. |
boolean |
wasNull()
Determines whether the last column read from this ResultSet
contained SQL NULL. |
| Field Detail |
|---|
static final int CLOSE_CURSORS_AT_COMMIT
ResultSet object must be
closed when the method Connection.commit is invoked.
static final int HOLD_CURSORS_OVER_COMMIT
ResultSet object must not be
closed when the method Connection.commit is invoked.
static final int CONCUR_READ_ONLY
ResultSet
object that cannot be updated.
static final int CONCUR_UPDATABLE
ResultSet
object that can be updated.
static final int FETCH_FORWARD
ResultSet
in the forward direction, first to last.
static final int FETCH_REVERSE
ResultSet
in the reverse direction, last to first.
static final int FETCH_UNKNOWN
ResultSet is unknown.
static final int TYPE_FORWARD_ONLY
ResultSet object whose cursor can
only move forward.
static final int TYPE_SCROLL_INSENSITIVE
ResultSet object which is
scrollable but is insensitive to changes made by others.
static final int TYPE_SCROLL_SENSITIVE
ResultSet object which is
scrollable and sensitive to changes made by others.
| Method Detail |
|---|
boolean absolute(int row)
throws SQLException
ResultSet.
row - the index of the row starting at index 1. Index -1
returns the last row.
true if the new cursor position is on the ResultSet, false otherwise.
SQLException - if a database error happens.
void afterLast()
throws SQLException
ResultSet, after the last row.
SQLException - if a database error happens.
void beforeFirst()
throws SQLException
ResultSet, before the first
row.
SQLException - if a database error happens.
void cancelRowUpdates()
throws SQLException
ResultSet.
SQLException - if a database error happens.
void clearWarnings()
throws SQLException
ResultSet.
SQLException - if a database error happens.
void close()
throws SQLException
ResultSet's database and JDBC resources. You are
strongly advised to use this method rather than relying on the release
being done when the ResultSet's finalize method is called during
garbage collection process. Note that the close() method might
take some time to complete since it is dependent on the behavior of the
connection to the database and the database itself.
SQLException - if a database error happens.
void deleteRow()
throws SQLException
ResultSet and from the
underlying database.
SQLException - if a database error happens.
int findColumn(String columnName)
throws SQLException
ResultSet from the
provided column name.
columnName - the column name.
ResultSet identified by column
name.
SQLException - if a database error happens.
boolean first()
throws SQLException
ResultSet.
true if the position is in a legitimate row, false if the ResultSet contains no rows.
SQLException - if a database error happens.
Array getArray(int columnIndex)
throws SQLException
ResultSet as a java.sql.Array.
columnIndex - the index of the column to read
java.sql.Array with the data from the column.
SQLException - if a database error happens.
Array getArray(String colName)
throws SQLException
java.sql.Array.
colName - the name of the column to read.
java.sql.Array with the data from the specified column.
SQLException - if a database error happens.
InputStream getAsciiStream(int columnIndex)
throws SQLException
columnIndex - the index of the column to read.
InputStream with the data from the column.
SQLException - if a database error happens.
InputStream getAsciiStream(String columnName)
throws SQLException
columnName - the name of the column to read
InputStream with the data from the column.
SQLException - if a database error happens.
BigDecimal getBigDecimal(int columnIndex)
throws SQLException
java.math.BigDecimal.
columnIndex - the index of the column to read.
BigDecimal with the value of the column.
SQLException - if a database error happens.
@Deprecated
BigDecimal getBigDecimal(int columnIndex,
int scale)
throws SQLException
getBigDecimal(int) or
getBigDecimal(String)
java.math.BigDecimal.
columnIndex - the index of the column to read.scale - the number of digits after the decimal point
BigDecimal with the value of the column.
SQLException - if a database error happens.
BigDecimal getBigDecimal(String columnName)
throws SQLException
java.math.BigDecimal.
columnName - the name of the column to read.
SQLException - if a database error happens.
@Deprecated
BigDecimal getBigDecimal(String columnName,
int scale)
throws SQLException
getBigDecimal(int) or
getBigDecimal(String)
java.math.BigDecimal.
columnName - the name of the column to read.scale - the number of digits after the decimal point
SQLException - if a database error happens.
InputStream getBinaryStream(int columnIndex)
throws SQLException
This method can be used to read LONGVARBINARY values. All of the
data in the InputStream should be read before getting data from
any other column. A further call to a getter method will implicitly close
the InputStream.
columnIndex - the index of the column to read.
InputStream with the data from the column. If the
column value is SQL NULL, null is returned.
SQLException - if a database error happens.
InputStream getBinaryStream(String columnName)
throws SQLException
This method can be used to read LONGVARBINARY values. All of the
data in the InputStream should be read before getting data from
any other column. A further call to a getter method will implicitly close
the InputStream.
columnName - the name of the column to read.
InputStream with the data from the column if the
column value is SQL NULL, null is returned.
SQLException - if a database error happens.
Blob getBlob(int columnIndex)
throws SQLException
java.sql.Blob object.
columnIndex - the index of the column to read.
java.sql.Blob with the value of the column.
SQLException - if a database error happens.
Blob getBlob(String columnName)
throws SQLException
java.sql.Blob object.
columnName - the name of the column to read.
java.sql.Blob with the value of the column.
SQLException - if a database error happens.
boolean getBoolean(int columnIndex)
throws SQLException
boolean
.
columnIndex - the index of the column to read.
boolean value from the column. If the column is SQL
NULL, false is returned.
SQLException - if a database error happens.
boolean getBoolean(String columnName)
throws SQLException
boolean
.
columnName - the name of the column to read.
boolean value from the column. If the column is SQL
NULL, false is returned.
SQLException - if a database error happens.
byte getByte(int columnIndex)
throws SQLException
byte.
columnIndex - the index of the column to read.
byte equal to the value of the column. 0 if the value
is SQL NULL.
SQLException - if a database error happens.
byte getByte(String columnName)
throws SQLException
byte.
columnName - the name of the column to read.
byte equal to the value of the column. 0 if the value
is SQL NULL.
SQLException - if a database error happens.
byte[] getBytes(int columnIndex)
throws SQLException
columnIndex - the index of the column to read.
null if
the column contains SQL NULL.
SQLException - if a database error happens.
byte[] getBytes(String columnName)
throws SQLException
columnName - the name of the column to read.
null if
the column contains SQL NULL.
SQLException - if a database error happens.
Reader getCharacterStream(int columnIndex)
throws SQLException
java.io.Reader object.
columnIndex - the index of the column to read.
Reader holding the value of the column. null if
the column value is SQL NULL.
SQLException - if a database error happens.Reader
Reader getCharacterStream(String columnName)
throws SQLException
java.io.Reader object.
columnName - the name of the column to read.
Reader holding the value of the column. null if
the column value is SQL NULL.
SQLException - if a database error happens.
Clob getClob(int columnIndex)
throws SQLException
java.sql.Clob.
columnIndex - the index of the column to read.
Clob object representing the value in the column.
null if the value is SQL NULL.
SQLException - if a database error happens.
Clob getClob(String colName)
throws SQLException
java.sql.Clob.
colName - the name of the column to read.
Clob object representing the value in the column.
null if the value is SQL NULL.
SQLException - if a database error happens.
int getConcurrency()
throws SQLException
ResultSet.
ResultSet.CONCUR_READ_ONLY
, ResultSet.CONCUR_UPDATABLE.
SQLException - if a database error happens.
String getCursorName()
throws SQLException
ResultSet.
SQLException - if a database error happens.
Date getDate(int columnIndex)
throws SQLException
java.sql.Date.
columnIndex - the index of the column to read.
java.sql.Date matching the column value. null
if the column is SQL NULL.
SQLException - if a database error happens.
Date getDate(int columnIndex,
Calendar cal)
throws SQLException
java.sql.Date. This method uses a supplied calendar to compute the Date.
columnIndex - the index of the column to read.cal - a java.util.Calendar to use in constructing the Date.
java.sql.Date matching the column value. null
if the column is SQL NULL.
SQLException - if a database error happens.
Date getDate(String columnName)
throws SQLException
java.sql.Date.
columnName - the name of the column to read.
java.sql.Date matching the column value. null
if the column is SQL NULL.
SQLException - if a database error happens.
Date getDate(String columnName,
Calendar cal)
throws SQLException
java.sql.Date object.
columnName - the name of the column to read.cal - java.util.Calendar to use in constructing the Date.
java.sql.Date matching the column value. null
if the column is SQL NULL.
SQLException - if a database error happens.
double getDouble(int columnIndex)
throws SQLException
double
value.
columnIndex - the index of the column to read.
double equal to the column value. 0.0 if the
column is SQL NULL.
SQLException - if a database error happens.
double getDouble(String columnName)
throws SQLException
double
value.
columnName - the name of the column to read.
double equal to the column value. 0.0 if the
column is SQL NULL.
SQLException - if a database error happens.
int getFetchDirection()
throws SQLException
ResultSet
object.
SQLException - if a database error happens.
int getFetchSize()
throws SQLException
ResultSet.
SQLException - if a database error happens.
float getFloat(int columnIndex)
throws SQLException
float
value.
columnIndex - the index of the column to read.
float equal to the column value. 0.0 if the
column is SQL NULL.
SQLException - if a database error happens.
float getFloat(String columnName)
throws SQLException
float
value.
columnName - the name of the column to read.
float equal to the column value. 0.0 if the
column is SQL NULL.
SQLException - if a database error happens.
int getInt(int columnIndex)
throws SQLException
int
value.
columnIndex - the index of the column to read.
int equal to the column value. 0 if the
column is SQL NULL.
SQLException - if a database error happens.
int getInt(String columnName)
throws SQLException
int
value.
columnName - the name of the column to read.
int equal to the column value. 0 if the
column is SQL NULL.
SQLException - if a database error happens.
long getLong(int columnIndex)
throws SQLException
long
value.
columnIndex - the index of the column to read.
long equal to the column value. 0 if the
column is SQL NULL.
SQLException - if a database error happens.
long getLong(String columnName)
throws SQLException
long
value.
columnName - the name of the column to read.
long equal to the column value. 0 if the
column is SQL NULL.
SQLException - if a database error happens.
ResultSetMetaData getMetaData()
throws SQLException
ResultSet. This defines the number,
types and properties of the columns in the ResultSet.
ResultSetMetaData object with information about this
ResultSet.
SQLException - if a database error happens.
Object getObject(int columnIndex)
throws SQLException
Object. The type
of the returned object will be the default according to the column's SQL
type, following the JDBC specification for built-in types.
For SQL User Defined Types, if a column value is Structured or Distinct,
this method behaves the same as a call to: getObject(columnIndex,this.getStatement().getConnection().getTypeMap())
columnIndex - the index of the column to read.
Object containing the value of the column. null if the column value is SQL NULL.
SQLException - if a database error happens.
Object getObject(int columnIndex,
Map<String,Class<?>> map)
throws SQLException
Object.
The type of the Java object will be determined by the supplied Map to
perform the mapping of SQL Struct or Distinct types into Java
objects.
columnIndex - the index of the column to read.map - a java.util.Map containing a mapping from SQL Type
names to Java classes.
Object containing the value of the column. null if the column value is SQL NULL.
SQLException - if a database error happens.
Object getObject(String columnName)
throws SQLException
Object. The type
of the returned object will be the default according to the column's SQL
type, following the JDBC specification for built-in types.
For SQL User Defined Types, if a column value is structured or distinct,
this method behaves the same as a call to: getObject(columnIndex,this.getStatement().getConnection().getTypeMap())
columnName - the name of the column to read.
Object containing the value of the column. null if the column value is SQL NULL.
SQLException - if a database error happens.
Object getObject(String columnName,
Map<String,Class<?>> map)
throws SQLException
Object.
The type of the Java object will be determined by the supplied Map to perform the mapping of SQL Struct or Distinct types into Java objects.
columnName - the name of the column to read.map - a java.util.Map containing a mapping from SQL Type names to
Java classes.
Object containing the value of the column. null if the column value is SQL NULL.
SQLException - if a database error happens.
Ref getRef(int columnIndex)
throws SQLException
java.sql.Ref.
columnIndex - the index of the column to read.
SQLException - if a database error happens.
Ref getRef(String colName)
throws SQLException
java.sql.Ref.
colName - the name of the column to read.
REF in the column
SQLException - if a database error happens.
int getRow()
throws SQLException
ResultSet. Row numbers
start at 1 for the first row.
0 is returned if
there is no current row.
SQLException - if a database error happens.
short getShort(int columnIndex)
throws SQLException
columnIndex - the index of the column to read.
0 if
the value is SQL NULL.
SQLException - if a database error happens.
short getShort(String columnName)
throws SQLException
columnName - the name of the column to read.
0 if
the value is SQL NULL.
SQLException - if a database error happens.
Statement getStatement()
throws SQLException
ResultSet. If the ResultSet was not created by a statement (i.e. because it was returned
from one of the DatabaseMetaData methods), null is
returned.
ResultSet, or null if the ResultSet was not created by a Statement.
SQLException - if a database error happens.
String getString(int columnIndex)
throws SQLException
columnIndex - the index of the column to read.
null if
the column is SQL NULL.
SQLException - if a database error happens.
String getString(String columnName)
throws SQLException
columnName - the name of the column to read.
null if
the column is SQL NULL.
SQLException - if a database error happens.
Time getTime(int columnIndex)
throws SQLException
java.sql.Time value.
columnIndex - the index of the column to read.
null if the column
value is SQL NULL.
SQLException - if a database error happens.
Time getTime(int columnIndex,
Calendar cal)
throws SQLException
java.sql.Time value. The supplied Calendar is used to
map the SQL Time value to a Java Time value.
columnIndex - the index of the column to read.cal - a Calendar to use in creating the Java Time value.
null if the column
value is SQL NULL.
SQLException - if a database error happens.
Time getTime(String columnName)
throws SQLException
java.sql.Time value.
columnName - the name of the column to read.
null if the column value is SQL NULL.
SQLException - if a database error happens.
Time getTime(String columnName,
Calendar cal)
throws SQLException
java.sql.Time value. The supplied Calendar is used to
map the SQL Time value to a Java Time value.
columnName - the name of the column to read.cal - a Calendar to use in creating the Java time value.
null if the column
value is SQL NULL.
SQLException - if a database error happens.
Timestamp getTimestamp(int columnIndex)
throws SQLException
java.sql.Timestamp value.
columnIndex - the index of the column to read.
null if the
column value is SQL NULL.
SQLException - if a database error happens.
Timestamp getTimestamp(int columnIndex,
Calendar cal)
throws SQLException
java.sql.Timestamp value. The supplied Calendar is used when mapping
the SQL Timestamp value to a Java Timestamp value.
columnIndex - the index of the column to read.cal - Calendar to use in creating the Java timestamp value.
null if the
column value is SQL NULL.
SQLException - if a database error happens.
Timestamp getTimestamp(String columnName)
throws SQLException
java.sql.Timestamp value.
columnName - the name of the column to read.
null if the
column value is SQL NULL.
SQLException - if a database error happens.
Timestamp getTimestamp(String columnName,
Calendar cal)
throws SQLException
java.sql.Timestamp value. The supplied Calendar is used when mapping
the SQL Timestamp value to a Java Timestamp value.
columnName - the name of the column to read.cal - Calendar to use in creating the Java Timestamp value.
null if the
column value is SQL NULL.
SQLException - if a database error happens.
int getType()
throws SQLException
ResultSet.
ResultSet type, one of:
ResultSet.TYPE_FORWARD_ONLYResultSet.TYPE_SCROLL_INSENSITIVEResultSet.TYPE_SCROLL_SENSITIVESQLException - if there is a database error.
@Deprecated
InputStream getUnicodeStream(int columnIndex)
throws SQLException
getCharacterStream(int).
InputStream of unicode
characters.
columnIndex - the index of the column to read.
InputStream holding the value of the column. null if the column value is SQL NULL.
SQLException - if a database error happens.
@Deprecated
InputStream getUnicodeStream(String columnName)
throws SQLException
getCharacterStream(int)
InputStream of Unicode
characters.
columnName - the name of the column to read.
InputStream holding the value of the column. null if the column value is SQL NULL.
SQLException - if a database error happens.
URL getURL(int columnIndex)
throws SQLException
java.net.URL.
columnIndex - the index of the column to read.
null if the column value is SQL NULL.
SQLException - if a database error happens.
URL getURL(String columnName)
throws SQLException
java.net.URL object.
columnName - the name of the column to read.
null if the column value is SQL NULL.
SQLException - if a database error happens.
SQLWarning getWarnings()
throws SQLException
ResultSet.
Subsequent warnings on this ResultSet are chained to the first
one.
The warnings are cleared when a new Row is read from the ResultSet. The warnings returned by this method are only the warnings
generated by ResultSet method calls - warnings generated by
Statement methods are held by the Statement.
An
SQLException is generated if this method is called on a closed
ResultSet.
ResultSet. null if there are no warnings.
SQLException - if a database error happens.
void insertRow()
throws SQLException
ResultSet and into the underlying
database. The cursor must be set to the Insert Row before this method is
invoked.
SQLException - if a database error happens. Particular cases include the
cursor not being on the Insert Row or if any columns in the
row do not have a value where the column is declared as
not-nullable.
boolean isAfterLast()
throws SQLException
ResultSet.
true if the cursor is after the last row in the ResultSet, false if the cursor is at any other position
in the ResultSet.
SQLException - if a database error happens.
boolean isBeforeFirst()
throws SQLException
ResultSet.
true if the cursor is before the first row in the ResultSet, false if the cursor is at any other position
in the ResultSet.
SQLException - if a database error happens.
boolean isFirst()
throws SQLException
ResultSet.
true if the cursor is on the first row in the ResultSet, false if the cursor is at any other position
in the ResultSet.
SQLException - if a database error happens.
boolean isLast()
throws SQLException
ResultSet
true if the cursor is on the last row in the ResultSet, false if the cursor is at any other position
in the ResultSet.
SQLException - if a database error happens.
boolean last()
throws SQLException
ResultSet.
true if the new position is in a legitimate row, false if the ResultSet contains no rows.
SQLException - if there is a database error.
void moveToCurrentRow()
throws SQLException
moveToInsertRow.
This only applies if the cursor is on the Insert Row.
SQLException - if a database error happens.
void moveToInsertRow()
throws SQLException
insertRow to insert the new row into the database.
SQLException - if a database error happens.
boolean next()
throws SQLException
ResultSet object.
Any input streams associated with the current row are closed and any warnings are cleared.
true if the updated cursor position is pointing to a
valid row, false otherwise (i.e. when the cursor is after
the last row in the ResultSet).
SQLException - if a database error happens.
boolean previous()
throws SQLException
ResultSet.
true if the new position is in a legitimate row, false if the cursor is now before the first row.
SQLException - if a database error happens.
void refreshRow()
throws SQLException
If any columns in the current row have been updated but the updateRow has not been called, then the updates are lost when this
method is called.
SQLException - if a database error happens., including if the current row is
the Insert row.
boolean relative(int rows)
throws SQLException
rows - a number of rows to move the cursor - may be positive or
negative
true if the new cursor position is on a row, false otherwise
SQLException - if a database error happens.
boolean rowDeleted()
throws SQLException
true if a row has been deleted and if deletions are
detected, false otherwise.
SQLException - if a database error happens.
boolean rowInserted()
throws SQLException
true if a row has been inserted and if insertions are
detected, false otherwise.
SQLException - if a database error happens.
boolean rowUpdated()
throws SQLException
true if the current row has been updated and if updates
can be detected, false otherwise.
SQLException - if a database error happens.
void setFetchDirection(int direction)
throws SQLException
ResultSet object. This is treated as a hint by the
JDBC driver.
direction - can be ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN
SQLException - if there is a database error.
void setFetchSize(int rows)
throws SQLException
ResultSet. This used as a hint to the JDBC
driver.
rows - the number of rows to fetch. 0 implies that the JDBC
driver can make its own decision about the fetch size. The
number should not be greater than the maximum number of rows
established by the statement that generated the ResultSet.
SQLException - if a database error happens.
void updateArray(int columnIndex,
Array x)
throws SQLException
java.sql.Array value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateArray(String columnName,
Array x)
throws SQLException
java.sql.Array
value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateAsciiStream(int columnIndex,
InputStream x,
int length)
throws SQLException
columnIndex - the index of the column to update.x - the new value for the specified column.length - the length of the data to write from the stream
SQLException - if a database error happens.
void updateAsciiStream(String columnName,
InputStream x,
int length)
throws SQLException
columnName - the name of the column to update.x - the new value for the specified column.length - the length of the data to write from the stream
SQLException - if a database error happens.
void updateBigDecimal(int columnIndex,
BigDecimal x)
throws SQLException
java.sql.BigDecimal value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateBigDecimal(String columnName,
BigDecimal x)
throws SQLException
java.sql.BigDecimal value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateBinaryStream(int columnIndex,
InputStream x,
int length)
throws SQLException
columnIndex - the index of the column to update.x - the new value for the specified column.length - the number of bytes to be read from the the stream.
SQLException - if a database error happens.
void updateBinaryStream(String columnName,
InputStream x,
int length)
throws SQLException
columnName - the name of the column to update.x - the new value for the specified column.length - he number of bytes to be read from the the stream.
SQLException - if a database error happens.
void updateBlob(int columnIndex,
Blob x)
throws SQLException
java.sql.Blob
value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateBlob(String columnName,
Blob x)
throws SQLException
java.sql.Blob
value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateBoolean(int columnIndex,
boolean x)
throws SQLException
boolean
value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateBoolean(String columnName,
boolean x)
throws SQLException
boolean value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateByte(int columnIndex,
byte x)
throws SQLException
byte value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateByte(String columnName,
byte x)
throws SQLException
byte value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateBytes(int columnIndex,
byte[] x)
throws SQLException
byte array
value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateBytes(String columnName,
byte[] x)
throws SQLException
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateCharacterStream(int columnIndex,
Reader x,
int length)
throws SQLException
columnIndex - the index of the column to update.x - the new value for the specified column.length - the length of data to write from the stream
SQLException - if a database error happens.
void updateCharacterStream(String columnName,
Reader reader,
int length)
throws SQLException
columnName - the name of the column to update.reader - the new value for the specified column.length - the length of data to write from the Reader
SQLException - if a database error happens.
void updateClob(int columnIndex,
Clob x)
throws SQLException
java.sql.Clob
value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateClob(String columnName,
Clob x)
throws SQLException
java.sql.Clob
value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateDate(int columnIndex,
Date x)
throws SQLException
java.sql.Date
value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateDate(String columnName,
Date x)
throws SQLException
java.sql.Date
value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateDouble(int columnIndex,
double x)
throws SQLException
double value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateDouble(String columnName,
double x)
throws SQLException
double value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateFloat(int columnIndex,
float x)
throws SQLException
float value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateFloat(String columnName,
float x)
throws SQLException
float value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateInt(int columnIndex,
int x)
throws SQLException
int value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateInt(String columnName,
int x)
throws SQLException
int value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateLong(int columnIndex,
long x)
throws SQLException
long value.
columnIndex - the index of the column to update.x - the new value for the specified column..
SQLException - if a database error happens.
void updateLong(String columnName,
long x)
throws SQLException
long value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateNull(int columnIndex)
throws SQLException
null value.
columnIndex - the index of the column to update.
SQLException - if a database error happens.
void updateNull(String columnName)
throws SQLException
null value.
columnName - the name of the column to update.
SQLException - if a database error happens.
void updateObject(int columnIndex,
Object x)
throws SQLException
Object
value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateObject(int columnIndex,
Object x,
int scale)
throws SQLException
Object
value.
columnIndex - the index of the column to update.x - the new value for the specified column.scale - for the types java.sql.Types.DECIMAL or java.sql.Types.NUMERIC, this specifies the number of digits
after the decimal point.
SQLException - if a database error happens.
void updateObject(String columnName,
Object x)
throws SQLException
Object value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateObject(String columnName,
Object x,
int scale)
throws SQLException
Object value.
columnName - the name of the column to update.x - the new value for the specified column.scale - for the types java.sql.Types.DECIMAL or java.sql.Types.NUMERIC, this specifies the number of digits
after the decimal point.
SQLException - if a database error happens.
void updateRef(int columnIndex,
Ref x)
throws SQLException
java.sql.Ref
value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateRef(String columnName,
Ref x)
throws SQLException
java.sql.Ref
value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateRow()
throws SQLException
ResultSet object.
SQLException - if a database error happens.
void updateShort(int columnIndex,
short x)
throws SQLException
short value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateShort(String columnName,
short x)
throws SQLException
short value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateString(int columnIndex,
String x)
throws SQLException
String value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateString(String columnName,
String x)
throws SQLException
String value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateTime(int columnIndex,
Time x)
throws SQLException
Time value.
columnIndex - the index of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateTime(String columnName,
Time x)
throws SQLException
Time value.
columnName - the name of the column to update.x - the new value for the specified column.
SQLException - if a database error happens.
void updateTimestamp(int columnIndex,
Timestamp x)
throws SQLException
Timestamp
value.
columnIndex - the index of the column to update.x - the new timestamp value for the specified column.
SQLException - if a database error happens.
void updateTimestamp(String columnName,
Timestamp x)
throws SQLException
Timestamp value.
columnName - the name of the column to update.x - the new timestamp value for the specified column.
SQLException - if a database error happens.
boolean wasNull()
throws SQLException
ResultSet
contained SQL NULL.
SQLException - if a database error happens.
|
Build 1.1_r1 (from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||