|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A ResultSet provides access to a table of data. A ResultSet object is usually generated by executing a Statement.
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 using either the index number of the column or 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 the 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 the column numbers. If column names are 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 is generated when that Statement is closed, re-executed, or 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.
Statement.executeQuery(java.lang.String)
,
Statement.getResultSet()
,
ResultSetMetaData
Field Summary |
---|
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 |
Method Summary | |
---|---|
void |
deleteAllSelectedRows()
Deletes all selected records. |
int |
getSelectionSize()
Get the number of records (object) in the result set. |
java.lang.Object |
getSelfObject()
Extract the current table row as a Java object. |
java.sql.Ref |
getSelfRef()
Get the OID of the current record (object) in the result set. |
java.sql.Ref |
insertObject(java.lang.Object obj)
Insert the new object into the table. |
void |
updateSelfObject(java.lang.Object obj)
Update the current row in the result set. |
Methods inherited from interface java.sql.ResultSet |
---|
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, close, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getInt, getInt, getLong, getLong, getMetaData, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getShort, getShort, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, next, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateShort, updateShort, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNull |
Method Detail |
---|
void deleteAllSelectedRows() throws java.sql.SQLException
java.sql.SQLException
- if a database access error occurs or if
called when on the insert row.int getSelectionSize()
java.lang.Object getSelfObject() throws java.sql.SQLException
java.sql.SQLException
java.sql.Ref getSelfRef()
ConsusRef
with the OID of the current objectjava.sql.Ref insertObject(java.lang.Object obj) throws java.sql.SQLException
obj
- inserted object
java.sql.SQLException
void updateSelfObject(java.lang.Object obj) throws java.sql.SQLException
obj
- new version of the object. Should be of the same type as
the original object
java.sql.SQLException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |