|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.objectweb.cjdbc.driver.DriverResultSet
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
insenstive. 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 guarentee 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
ResultSetMetaData object returned by the
getMetaData method.
ResultSetMetaData,
ResultSet,
Serialized Form| Field Summary | |
protected java.util.Hashtable |
columnNameToIndex
column name -> index in ResultSet data array |
private Connection |
connection
The driver connection we were received from (null on the controller side) |
protected int |
currentRow
Cursor to current row |
private java.lang.String |
cursorName
ResultSet cursor name |
protected java.util.ArrayList |
data
The results |
private java.sql.PreparedStatement |
deleteStatement
Statement for deleting rows with Updatable ResultSets * |
protected int |
fetchDirection
The fetch direction (not used yet) |
protected int |
fetchSize
The fetch size |
protected Field[] |
fields
The fields |
protected java.util.Hashtable |
fullColumnNameToIndex
full column name -> index in ResultSet data array |
private boolean |
hasMoreData
True if there is more data to fetch from the controller |
private boolean |
inserting
Indicates whether cursor is on the insert row * |
private java.sql.PreparedStatement |
insertStatement
Statement for inserting rows with Updatable ResultSets * |
private boolean |
isClosed
|
protected int |
nbOfColumns
Number of columns |
protected int |
nbOfRows
Number of rows |
protected Statement |
owningStatement
Statement corresponding to this ResultSet, if any (not for metadata) |
private java.lang.String[] |
primaryKeyColumns
Cache the columns forming the primary key * |
private java.sql.PreparedStatement |
refreshStatement
Statement for refreshing rows with Updatable ResultSets * |
protected int |
resultSetConcurrency
Concurrency for this ResultSet |
protected int |
resultSetType
Type of ResultSet |
private SQLDataSerialization.Serializer[] |
serializers
Pointers to column-specific de/serializer |
private static long |
serialVersionUID
|
private java.lang.Object[] |
tempRow
Temporary object for not yet comitted ResultSet updates * |
private static java.lang.String |
UPDATEABLE_MESSAGE
|
private java.sql.PreparedStatement |
updateStatement
Statement for updating rows with Updatable ResultSets * |
private boolean |
updating
Indicates if the current row is being updated * |
protected java.sql.SQLWarning |
warnings
the warning chain |
protected boolean |
wasNullFlag
for wasNull() |
| 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 | |
DriverResultSet(Connection conn)
Creates a new DriverResultSet object, deserializing it from
an input stream. |
|
DriverResultSet(Field[] fields,
java.util.ArrayList resultData)
Creates a new DriverResultSet from a non-null ArrayList of
rows. |
|
DriverResultSet(Field[] fields,
java.util.ArrayList resultData,
boolean crsHasMoreData,
java.lang.String cursorName)
Creates a new DriverResultSet object from information we get
back from a ControllerResultSet. |
|
| Method Summary | |
boolean |
absolute(int row)
JDBC 2.0 Move to an absolute row number in the result set. |
void |
afterLast()
JDBC 2.0 Moves to the end of the result set, just after the last row. |
void |
beforeFirst()
JDBC 2.0 Moves to the front of the result set, just before the first row. |
private void |
buildDeleteStatement()
Builds a delete statement for deleting rows with Updatable ResultSets |
private void |
buildIndexMapping()
Builds a hash between column names and their indices for fast retrieval. |
private void |
buildInsertStatement()
Builds a insert statement for inserting rows with Updatable ResultSets |
private void |
buildRefreshStatement()
Builds a select statement for refreshing rows in Updatable ResultSets |
private void |
buildUpdateStatement()
Builds an update statement for updating rows with Updatable ResultSets |
void |
cancelRowUpdates()
JDBC 2.0 The cancelRowUpdates() method may be called after calling an updateXXX() method(s) and before calling updateRow() to rollback the updates made to a row. |
private void |
checkIfClosed()
Check if the ResultSet if closed and throws a SQLException if so. |
private void |
checkRowAndColPosAndSetNullFlag(int columnIndex)
Sanity checks for result parsing |
private void |
checkRowPos()
Checks that the cursor is on row in the ResultSet |
private void |
checkUpdatability()
Basic checks for Updatable ResultSets |
private void |
checkUpdateFlagAndPrepareUpdateIfNeeded()
Checks that the update flag is set when updating a row. |
void |
clearWarnings()
After this call, getWarnings returns null until a new warning is reported for this ResultSet |
void |
close()
Closes the remote ResultSet if the ResultSet was streamed else just closes the ResultSet locally. |
void |
deleteRow()
JDBC 2.0 Delete the current row from the result set and the underlying database. |
private void |
extractPrimaryKey()
Retrieves the primary key for the table referenced by this ResultSet |
int |
findColumn(java.lang.String columnName)
Map a ResultSet column name to a ResultSet
column index |
boolean |
first()
JDBC 2.0 Moves to the first row in the result set. |
java.sql.Array |
getArray(int columnIndex)
JDBC 2.0 Gets an array column. |
java.sql.Array |
getArray(java.lang.String colName)
JDBC 2.0 Get an array column. |
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. |
java.io.InputStream |
getAsciiStream(java.lang.String columnName)
|
java.math.BigDecimal |
getBigDecimal(int columnIndex)
JDBC 2.0 Get the value of a column in the current row as a java.math.BigDecimal object. |
java.math.BigDecimal |
getBigDecimal(int columnIndex,
int scale)
Deprecated. |
java.math.BigDecimal |
getBigDecimal(java.lang.String columnName)
|
java.math.BigDecimal |
getBigDecimal(java.lang.String columnName,
int scale)
Deprecated. |
java.io.InputStream |
getBinaryStream(int columnIndex)
A column value can also be retrieved as a binary strea. |
java.io.InputStream |
getBinaryStream(java.lang.String columnName)
|
java.sql.Blob |
getBlob(int columnIndex)
JDBC 2.0 Gets a BLOB column. |
java.sql.Blob |
getBlob(java.lang.String colName)
JDBC 2.0 Get a BLOB column. |
boolean |
getBoolean(int columnIndex)
Get the value of a column in the current row as a Java boolean |
boolean |
getBoolean(java.lang.String columnName)
|
byte |
getByte(int columnIndex)
Get the value of a column in the current row as a Java byte. |
byte |
getByte(java.lang.String columnName)
|
byte[] |
getBytes(int columnIndex)
Get the value of a column in the current row as a Java byte array. |
byte[] |
getBytes(java.lang.String columnName)
|
java.io.Reader |
getCharacterStream(int columnIndex)
|
java.io.Reader |
getCharacterStream(java.lang.String columnName)
|
java.sql.Clob |
getClob(int columnIndex)
JDBC 2.0 Gets a CLOB column. |
java.sql.Clob |
getClob(java.lang.String colName)
JDBC 2.0 Get a CLOB column. |
int |
getConcurrency()
JDBC 2.0 Return the concurrency of this result set. |
java.lang.String |
getCursorName()
|
java.sql.Date |
getDate(int columnIndex)
Get the value of a column in the current row as a java.sql.Date object |
java.sql.Date |
getDate(int columnIndex,
java.util.Calendar cal)
JDBC 2.0 Get the value of a column in the current row as a java.sql.Date object. |
java.sql.Date |
getDate(java.lang.String columnName)
|
java.sql.Date |
getDate(java.lang.String columnName,
java.util.Calendar cal)
Get the value of a column in the current row as a java.sql.Date object. |
double |
getDouble(int columnIndex)
Get the value of a column in the current row as a Java double. |
double |
getDouble(java.lang.String columnName)
|
int |
getFetchDirection()
JDBC 2.0 Return the fetch direction for this result set. |
int |
getFetchSize()
JDBC 2.0 Return the fetch size for this result set. |
float |
getFloat(int columnIndex)
Get the value of a column in the current row as a Java float. |
float |
getFloat(java.lang.String columnName)
|
int |
getInt(int columnIndex)
Get the value of a column in the current row as a Java int. |
int |
getInt(java.lang.String columnName)
|
long |
getLong(int columnIndex)
Get the value of a column in the current row as a Java long. |
long |
getLong(java.lang.String columnName)
|
java.sql.ResultSetMetaData |
getMetaData()
The numbers, types and properties of a ResultSet's columns
are provided by the getMetaData method |
java.lang.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. |
java.lang.Object |
getObject(int i,
java.util.Map map)
JDBC 2.0 Returns the value of column as a Java object. |
java.lang.Object |
getObject(java.lang.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. |
java.lang.Object |
getObject(java.lang.String colName,
java.util.Map map)
JDBC 2.0 Returns the value of column as a Java object. |
java.sql.Ref |
getRef(int i)
JDBC 2.0 Get a REF(<structured-type>) column. |
java.sql.Ref |
getRef(java.lang.String colName)
JDBC 2.0 Get a REF(<structured-type>) column. |
int |
getRow()
JDBC 2.0 Determine the current row number. |
short |
getShort(int columnIndex)
Get the value of a column in the current row as a Java short. |
short |
getShort(java.lang.String columnName)
|
java.sql.Statement |
getStatement()
JDBC 2.0 Return the Statement that produced the
ResultSet. |
java.lang.String |
getString(int columnIndex)
Get the value of a column in the current row as a Java String |
java.lang.String |
getString(java.lang.String columnName)
The following routines simply convert the columnName into a columnIndex and then call the appropriate routine above. |
java.sql.Time |
getTime(int columnIndex)
Get the value of a column in the current row as a java.sql.Time object |
java.sql.Time |
getTime(int columnIndex,
java.util.Calendar cal)
Get the value of a column in the current row as a java.sql.Time object. |
java.sql.Time |
getTime(java.lang.String columnName)
|
java.sql.Time |
getTime(java.lang.String columnName,
java.util.Calendar cal)
Get the value of a column in the current row as a java.sql.Time object. |
java.sql.Timestamp |
getTimestamp(int columnIndex)
Get the value of a column in the current row as a java.sql.Timestamp object |
java.sql.Timestamp |
getTimestamp(int columnIndex,
java.util.Calendar cal)
Get the value of a column in the current row as a java.sql.Timestamp object. |
java.sql.Timestamp |
getTimestamp(java.lang.String columnName)
|
java.sql.Timestamp |
getTimestamp(java.lang.String columnName,
java.util.Calendar cal)
Get the value of a column in the current row as a java.sql.Timestamp object. |
int |
getType()
JDBC 2.0 Return the type of this result set. |
java.io.InputStream |
getUnicodeStream(int columnIndex)
Deprecated. |
java.io.InputStream |
getUnicodeStream(java.lang.String columnName)
Deprecated. |
java.net.URL |
getURL(int columnIndex)
Retrieves the value of the designated column in the current row of this ResultSet object as a java.net.URL object in
the Java programming language. |
java.net.URL |
getURL(java.lang.String columnName)
Retrieves the value of the designated column in the current row of this ResultSet object as a java.net.URL object in
the Java programming language. |
java.sql.SQLWarning |
getWarnings()
The first warning reported by calls on this ResultSet is returned. |
private void |
initSerializers()
Initialize serializers based on the analysis of actual Java Objects of the ResultSet to send (typically issued by backend's driver readObject() method). |
void |
insertRow()
JDBC 2.0 Insert the contents of the insert row into the result set and the database. |
boolean |
isAfterLast()
JDBC 2.0 Determine if the cursor is after the last row in the result set. |
boolean |
isBeforeFirst()
JDBC 2.0. |
boolean |
isFirst()
JDBC 2.0 Determine if the cursor is on the first row of the result set. |
boolean |
isLast()
JDBC 2.0 Determine if the cursor is on the last row of the result set. |
boolean |
last()
JDBC 2.0 Moves to the last row in the result set. |
void |
moveToCurrentRow()
JDBC 2.0 Move the cursor to the remembered cursor position, usually the current row. |
void |
moveToInsertRow()
JDBC 2.0 Move to the insert row. |
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. |
boolean |
prev()
The prev method is not part of JDBC, but because of the architecture of this driver it is possible to move both forward and backward within the result set. |
boolean |
previous()
JDBC 2.0 Moves to the previous row in the result set. |
(package private) void |
receiveRows(CJDBCInputStream input)
De-serialize only data rows, not any metadata. |
void |
refreshRow()
JDBC 2.0 Refresh the value of the current row with its current value in the database. |
boolean |
relative(int rows)
JDBC 2.0 Moves a relative number of rows, either positive or negative. |
boolean |
rowDeleted()
JDBC 2.0 Determine if this row has been deleted. |
boolean |
rowInserted()
JDBC 2.0 Determine if the current row has been inserted. |
boolean |
rowUpdated()
JDBC 2.0 Determine if the current row has been updated. |
void |
sendRowsToStream(CJDBCOutputStream output)
Serialize only rows, not any metadata. |
void |
sendToStream(CJDBCOutputStream output)
Serialize the DriverResultSet on the output stream by
sending only the needed parameters to reconstruct it on the driver. |
void |
setData(java.util.ArrayList newData)
Set the ResultSet data with the given ArrayList. |
void |
setFetchDirection(int direction)
JDBC 2.0 Give a hint as to the direction in which the rows in this result set will be processed. |
void |
setFetchSize(int rows)
JDBC 2.0 Give the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for this result set. |
void |
setHasMoreData(boolean hasMore)
Set the hasMoreData boolean (is there more data to fetch from the controller). |
protected void |
setStatement(Statement stmt)
Set the statement. |
java.lang.String |
toString()
|
void |
updateArray(int columnIndex,
java.sql.Array x)
Updates the designated column with a java.sql.Array value.
|
void |
updateArray(java.lang.String columnName,
java.sql.Array x)
Updates the designated column with a java.sql.Array value.
|
void |
updateAsciiStream(int columnIndex,
java.io.InputStream x,
int length)
JDBC 2.0 Update a column with an ascii stream value. |
void |
updateAsciiStream(java.lang.String columnName,
java.io.InputStream x,
int length)
JDBC 2.0 Update a column with an ascii stream value. |
void |
updateBigDecimal(int columnIndex,
java.math.BigDecimal x)
JDBC 2.0 Update a column with a BigDecimal value. |
void |
updateBigDecimal(java.lang.String columnName,
java.math.BigDecimal x)
JDBC 2.0 Update a column with a BigDecimal value. |
void |
updateBinaryStream(int columnIndex,
java.io.InputStream x,
int length)
JDBC 2.0 Update a column with a binary stream value. |
void |
updateBinaryStream(java.lang.String columnName,
java.io.InputStream x,
int length)
JDBC 2.0 Update a column with a binary stream value. |
void |
updateBlob(int columnIndex,
java.sql.Blob x)
Updates the designated column with a java.sql.Blob value.
|
void |
updateBlob(java.lang.String columnName,
java.sql.Blob x)
Updates the designated column with a java.sql.Blob value.
|
void |
updateBoolean(int columnIndex,
boolean x)
JDBC 2.0 Update a column with a boolean value. |
void |
updateBoolean(java.lang.String columnName,
boolean x)
JDBC 2.0 Update a column with a boolean value. |
void |
updateByte(int columnIndex,
byte x)
JDBC 2.0 Update a column with a byte value. |
void |
updateByte(java.lang.String columnName,
byte x)
JDBC 2.0 Update a column with a byte value. |
void |
updateBytes(int columnIndex,
byte[] x)
JDBC 2.0 Update a column with a byte array value. |
void |
updateBytes(java.lang.String columnName,
byte[] x)
JDBC 2.0 Update a column with a byte array value. |
void |
updateCharacterStream(int columnIndex,
java.io.Reader x,
int length)
JDBC 2.0 Update a column with a character stream value. |
void |
updateCharacterStream(java.lang.String columnName,
java.io.Reader reader,
int length)
JDBC 2.0 Update a column with a character stream value. |
void |
updateClob(int columnIndex,
java.sql.Clob x)
Updates the designated column with a java.sql.Clob value.
|
void |
updateClob(java.lang.String columnName,
java.sql.Clob x)
Updates the designated column with a java.sql.Clob value.
|
void |
updateDate(int columnIndex,
java.sql.Date x)
JDBC 2.0 Update a column with a Date value. |
void |
updateDate(java.lang.String columnName,
java.sql.Date x)
JDBC 2.0 Update a column with a Date value. |
void |
updateDouble(int columnIndex,
double x)
JDBC 2.0 Update a column with a Double value. |
void |
updateDouble(java.lang.String columnName,
double x)
JDBC 2.0 Update a column with a double value. |
void |
updateFloat(int columnIndex,
float x)
JDBC 2.0 Update a column with a float value. |
void |
updateFloat(java.lang.String columnName,
float x)
JDBC 2.0 Update a column with a float value. |
void |
updateInt(int columnIndex,
int x)
JDBC 2.0 Update a column with an integer value. |
void |
updateInt(java.lang.String columnName,
int x)
JDBC 2.0 Update a column with an integer value. |
void |
updateLong(int columnIndex,
long x)
JDBC 2.0 Update a column with a long value. |
void |
updateLong(java.lang.String columnName,
long x)
JDBC 2.0 Update a column with a long value. |
void |
updateNull(int columnIndex)
JDBC 2.0 Give a nullable column a null value. |
void |
updateNull(java.lang.String columnName)
JDBC 2.0 Update a column with a null value. |
void |
updateObject(int columnIndex,
java.lang.Object x)
JDBC 2.0 Update a column with an Object value. |
void |
updateObject(int columnIndex,
java.lang.Object x,
int scale)
JDBC 2.0 Update a column with an Object value. |
void |
updateObject(java.lang.String columnName,
java.lang.Object x)
JDBC 2.0 Update a column with an Object value. |
void |
updateObject(java.lang.String columnName,
java.lang.Object x,
int scale)
JDBC 2.0 Update a column with an Object value. |
void |
updateRef(int columnIndex,
java.sql.Ref x)
Updates the designated column with a java.sql.Ref value. |
void |
updateRef(java.lang.String columnName,
java.sql.Ref x)
Updates the designated column with a java.sql.Ref value. |
void |
updateRow()
JDBC 2.0 Update the underlying database with the new contents of the current row. |
void |
updateShort(int columnIndex,
short x)
JDBC 2.0 Update a column with a short value. |
void |
updateShort(java.lang.String columnName,
short x)
JDBC 2.0 Update a column with a short value. |
void |
updateString(int columnIndex,
java.lang.String x)
JDBC 2.0 Update a column with a String value. |
void |
updateString(java.lang.String columnName,
java.lang.String x)
JDBC 2.0 Update a column with a String value. |
void |
updateTime(int columnIndex,
java.sql.Time x)
JDBC 2.0 Update a column with a Time value. |
void |
updateTime(java.lang.String columnName,
java.sql.Time x)
JDBC 2.0 Update a column with a Time value. |
void |
updateTimestamp(int columnIndex,
java.sql.Timestamp x)
JDBC 2.0 Update a column with a Timestamp value. |
void |
updateTimestamp(java.lang.String columnName,
java.sql.Timestamp x)
JDBC 2.0 Update a column with a Timestamp value. |
boolean |
wasNull()
A column may have the value of SQL NULL; wasNull() reports whether the last column read had this special value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private static final long serialVersionUID
protected int currentRow
protected int nbOfRows
protected int nbOfColumns
protected java.util.ArrayList data
private boolean hasMoreData
protected int fetchDirection
protected int fetchSize
private java.lang.String cursorName
protected Field[] fields
private SQLDataSerialization.Serializer[] serializers
protected boolean wasNullFlag
protected transient java.util.Hashtable columnNameToIndex
protected transient java.util.Hashtable fullColumnNameToIndex
protected int resultSetType
protected int resultSetConcurrency
protected java.sql.SQLWarning warnings
protected transient Statement owningStatement
private final Connection connection
private boolean isClosed
private transient java.sql.PreparedStatement deleteStatement
private transient java.sql.PreparedStatement insertStatement
private transient java.sql.PreparedStatement refreshStatement
private transient java.sql.PreparedStatement updateStatement
private transient boolean inserting
private transient boolean updating
private transient java.lang.Object[] tempRow
private transient java.lang.String[] primaryKeyColumns
private static final java.lang.String UPDATEABLE_MESSAGE
| Constructor Detail |
public DriverResultSet(Field[] fields,
java.util.ArrayList resultData)
throws java.lang.IllegalArgumentException
DriverResultSet from a non-null ArrayList of
rows. Allowed only on the controller side. We could use a resultset factory
instead in order to be more cleanly isolated from the controller.
fields - an array of Field objects (basically, the
ResultSet meta data)resultData - ArrayList of Object[] rows.
java.lang.IllegalArgumentException - if resultData argument is null
public DriverResultSet(Field[] fields,
java.util.ArrayList resultData,
boolean crsHasMoreData,
java.lang.String cursorName)
throws java.lang.IllegalArgumentException
DriverResultSet object from information we get
back from a ControllerResultSet. Allowed only on the controller side.
fields - an array of Field objects (basically, the
ResultSet meta data)resultData - ArrayList of the actual data. Cannot be null.crsHasMoreData - true if remote ControllerResultSet has more data to
fetchcursorName - cursor name for a streamable ResultSet
java.lang.IllegalArgumentException - if resultData argument is null
public DriverResultSet(Connection conn)
throws java.io.IOException,
ProtocolException
DriverResultSet object, deserializing it from
an input stream. Has to mirror the serialization method below.
conn - the connection we read from and belong to
java.io.IOException - if a network problem occurs
ProtocolException - if a protocol error occurs| Method Detail |
public boolean next()
throws java.sql.SQLException
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
next in interface java.sql.ResultSettrue if the new current is valid; false
if there are no more rows
java.sql.SQLException - if a database access error occurs
public boolean prev()
throws java.sql.SQLException
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 is valid; false
if there are no more rows
java.sql.SQLException - if a database access error occurs
public boolean isBeforeFirst()
throws java.sql.SQLException
Determine if the cursor is before the first row in the result set.
isBeforeFirst in interface java.sql.ResultSettrue if before the first row, false
otherwise. Returns false when the result set
contains no rows.
java.sql.SQLException - if a database-access error occurs.
public boolean isAfterLast()
throws java.sql.SQLException
Determine if the cursor is after the last row in the result set.
isAfterLast in interface java.sql.ResultSettrue if after the last row, false
otherwise. Returns false when the result set
contains no rows.
java.sql.SQLException - if a database-access error occurs.
public boolean isFirst()
throws java.sql.SQLException
Determine if the cursor is on the first row of the result set.
isFirst in interface java.sql.ResultSettrue if on the first row, false
otherwise.
java.sql.SQLException - if a database-access error occurs.
public boolean isLast()
throws java.sql.SQLException
Determine if the cursor is on the last row of the result set. Note: Calling isLast() may be expensive since 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.
isLast in interface java.sql.ResultSettrue if on the last row, false
otherwise.
java.sql.SQLException - if a database-access error occurs.
public void beforeFirst()
throws java.sql.SQLException
Moves to the front of the result set, just before the first row. Has no effect if the result set contains no rows.
beforeFirst in interface java.sql.ResultSetjava.sql.SQLException - if a database-access error occurs, or result set
type is TYPE_FORWARD_ONLY
public void afterLast()
throws java.sql.SQLException
Moves to the end of the result set, just after the last row. Has no effect if the result set contains no rows.
afterLast in interface java.sql.ResultSetjava.sql.SQLException - if a database-access error occurs, or result set
type is TYPE_FORWARD_ONLY.
public boolean first()
throws java.sql.SQLException
Moves to the first row in the result set.
first in interface java.sql.ResultSettrue if on a valid row, false if no rows in the
result set.
java.sql.SQLException - if a database-access error occurs, or result set
type is TYPE_FORWARD_ONLY.
public boolean last()
throws java.sql.SQLException
Moves to the last row in the result set.
last in interface java.sql.ResultSettrue if on a valid row, false if no rows in the
result set.
java.sql.SQLException - if a database-access error occurs, or result set
type is TYPE_FORWARD_ONLY.
public int getRow()
throws java.sql.SQLException
Determine the current row number. The first row is number 1, the second number 2, etc.
getRow in interface java.sql.ResultSetjava.sql.SQLException - if a database-access error occurs.
public boolean absolute(int row)
throws java.sql.SQLException
Move to an absolute row number in the result set.
If row is positive, moves to an absolute row with respect to the beginning of the result set. The first row is row 1, the second is row 2, etc.
If row is negative, moves to an absolute row position with respect to the end of result set. For example, calling absolute(-1) positions the cursor on the last row, absolute(-2) indicates the next-to-last row, etc.
An attempt to position the cursor beyond the first/last row in the result set, leaves the cursor before/after the first/last row, respectively.
Note: Calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last().
absolute in interface java.sql.ResultSetrow - the row to move to
true if on the result set, false if off.
java.sql.SQLException - if a database-access error occurs, or row is 0, or
result set type is TYPE_FORWARD_ONLY.
public boolean relative(int rows)
throws java.sql.SQLException
Moves 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 relative(1) is different than calling next() since is makes sense to call next() when there is no current row, for example, when the cursor is positioned before the first row or after the last row of the result set.
relative in interface java.sql.ResultSetrows - the number of rows
true if on a row, false otherwise.
java.sql.SQLException - if a database-access error occurs, or there is no
current row, or result set type is TYPE_FORWARD_ONLY.
public boolean previous()
throws java.sql.SQLException
Moves to the previous row in the result set.
Note: previous() is not the same as relative(-1) since it makes sense to call previous() when there is no current row.
previous in interface java.sql.ResultSettrue if on a valid row, false if off the result set.
java.sql.SQLException - if a database-access error occurs, or result set
type is TYPE_FORWAR_DONLY.
public void setFetchDirection(int direction)
throws java.sql.SQLException
setFetchDirection in interface java.sql.ResultSetdirection - the fetch direction
java.sql.SQLException - if a database-access error occurs, or the result
set type is TYPE_FORWARD_ONLY and direction is not
FETCH_FORWARD. MM.MySQL actually ignores this, because it has
the whole result set anyway, so the direction is immaterial.
public int getFetchDirection()
throws java.sql.SQLException
getFetchDirection in interface java.sql.ResultSetjava.sql.SQLException - if a database-access error occurs
public void setFetchSize(int rows)
throws java.sql.SQLException
setFetchSize in interface java.sql.ResultSetrows - the number of rows to fetch
java.sql.SQLException - if a database-access error occurs, or the condition
0 <= rows <= statement.getMaxRows() is not satisfied.
Currently ignored by this driver.
public int getFetchSize()
throws java.sql.SQLException
getFetchSize in interface java.sql.ResultSetjava.sql.SQLException - if a database-access error occurs
public java.lang.String getString(int columnIndex)
throws java.sql.SQLException
getString in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2...
java.sql.SQLException - if a database access error occurs
public boolean getBoolean(int columnIndex)
throws java.sql.SQLException
getBoolean in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2...
java.sql.SQLException - if a database access error occurs
public short getShort(int columnIndex)
throws java.sql.SQLException
getShort in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2,...
java.sql.SQLException - if a database access error occurs
public int getInt(int columnIndex)
throws java.sql.SQLException
getInt in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2,...
java.sql.SQLException - if a database access error occurs
public long getLong(int columnIndex)
throws java.sql.SQLException
getLong in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2,...
java.sql.SQLException - if a database access error occurs
public float getFloat(int columnIndex)
throws java.sql.SQLException
getFloat in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2,...
java.sql.SQLException - if a database access error occurs
public double getDouble(int columnIndex)
throws java.sql.SQLException
getDouble in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2,...
java.sql.SQLException - if a database access error occurs
public java.math.BigDecimal getBigDecimal(int columnIndex,
int scale)
throws java.sql.SQLException
getBigDecimal in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2...scale - the number of digits to the right of the decimal
java.sql.SQLException - if a database access error occurs
public byte[] getBytes(int columnIndex)
throws java.sql.SQLException
Be warned If the blob is huge, then you may run out of memory.
getBytes in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2, ...
java.sql.SQLException - if a database access error occurs
public java.sql.Date getDate(int columnIndex)
throws java.sql.SQLException
getDate in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2...
java.sql.SQLException - if a database access error occurs
public java.sql.Time getTime(int columnIndex)
throws java.sql.SQLException
getTime in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2...
java.sql.SQLException - if a database access error occurs
public java.sql.Timestamp getTimestamp(int columnIndex)
throws java.sql.SQLException
getTimestamp in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2...
java.sql.SQLException - if a database access error occurs
public java.io.InputStream getAsciiStream(int columnIndex)
throws java.sql.SQLException
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.
getAsciiStream in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2, ...
java.sql.SQLException - if a database access error occursgetBinaryStream(int)
public java.io.InputStream getUnicodeStream(int columnIndex)
throws java.sql.SQLException
getUnicodeStream in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2...
java.sql.SQLException - if a database access error occursgetAsciiStream(int),
getBinaryStream(int)
public java.io.InputStream getBinaryStream(int columnIndex)
throws java.sql.SQLException
getBinaryStream in interface java.sql.ResultSetcolumnIndex - the first column is 1, the second is 2...
java.sql.SQLException - if a database access error occursgetAsciiStream(int),
getUnicodeStream(int)
public java.lang.String getString(java.lang.String columnName)
throws java.sql.SQLException