IResultSet Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A table of data representing a database result set, which is usually generated by executing a statement that queries the database.
[Android.Runtime.Register("java/sql/ResultSet", "", "Java.Sql.IResultSetInvoker")]
public interface IResultSet : IDisposable, Java.Interop.IJavaPeerable, Java.Sql.IWrapper
[<Android.Runtime.Register("java/sql/ResultSet", "", "Java.Sql.IResultSetInvoker")>]
type IResultSet = interface
interface IWrapper
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Derived
- Attributes
- Implements
Remarks
A table of data representing a database result set, which is usually generated by executing a statement that queries the database.
A ResultSet
object 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, and because it returns false
when there are no more rows in the ResultSet
object, it can be used in a while
loop to iterate through the result set.
A default ResultSet
object is not updatable and has a cursor that moves forward only. Thus, you can iterate through it only once and only from the first row to the last row. It is possible to produce ResultSet
objects that are scrollable and/or updatable. The following code fragment, in which con
is a valid Connection
object, illustrates how to make a result set that is scrollable and insensitive to updates by others, and that is updatable. See ResultSet
fields for other options.
Statement stmt = con.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
// rs will be scrollable, will not show changes made by others,
// and will be updatable
The ResultSet
interface provides getter methods (getBoolean
, getLong
, and so on) for retrieving column values from the current row. Values can be retrieved 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, result set columns within each row should be read in left-to-right order, and each column should be read only once.
For the getter methods, a JDBC driver attempts to convert the underlying data to the Java type specified in the getter method and returns a suitable Java value. The JDBC specification has a table showing the allowable mappings from SQL types to Java types that can be used by the ResultSet
getter methods.
Column names used as input to getter methods are case insensitive. When a getter method is called with a column name and several columns have the same name, 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 that generated the result set. For columns that are NOT explicitly named in the query, it is best to use column numbers. If column names are used, the programmer should take care to guarantee that they uniquely refer to the intended columns, which can be assured with the SQL AS clause.
A set of updater methods were added to this interface in the JDBC 2.0 API (Java<sup><font size=-2>TM</font></sup> 2 SDK, Standard Edition, version 1.2). The comments regarding parameters to the getter methods also apply to parameters to the updater methods.
The updater methods may be used in two ways: <ol> <LI>to update a column value in the current row. In a scrollable ResultSet
object, the cursor can be moved backwards and forwards, to an absolute position, or to a position relative to the current row. The following code fragment updates the NAME
column in the fifth row of the ResultSet
object rs
and then uses the method updateRow
to update the data source table from which rs
was derived.
rs.absolute(5); // moves the cursor to the fifth row of rs
rs.updateString("NAME", "AINSWORTH"); // updates the
// <code>NAME</code> column of row 5 to be <code>AINSWORTH</code>
rs.updateRow(); // updates the row in the data source
<LI>to insert column values into the insert row. An updatable ResultSet
object has a special row associated with it that serves as a staging area for building a row to be inserted. The following code fragment moves the cursor to the insert row, builds a three-column row, and inserts it into rs
and into the data source table using the method insertRow
.
rs.moveToInsertRow(); // moves cursor to the insert row
rs.updateString(1, "AINSWORTH"); // updates the
// first column of the insert row to be <code>AINSWORTH</code>
rs.updateInt(2,35); // updates the second column to be <code>35</code>
rs.updateBoolean(3, true); // updates the third column to <code>true</code>
rs.insertRow();
rs.moveToCurrentRow();
</ol>
A ResultSet
object is automatically closed when the Statement
object that generated it 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
object's columns are provided by the ResultSetMetaData
object returned by the ResultSet.getMetaData
method.
Java documentation for java.sql.ResultSet
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Fields
CloseCursorsAtCommit |
The constant indicating that open |
ConcurReadOnly |
The constant indicating the concurrency mode for a
|
ConcurUpdatable |
The constant indicating the concurrency mode for a
|
FetchForward |
The constant indicating that the rows in a result set will be processed in a forward direction; first-to-last. |
FetchReverse |
The constant indicating that the rows in a result set will be processed in a reverse direction; last-to-first. |
FetchUnknown |
The constant indicating that the order in which rows in a result set will be processed is unknown. |
HoldCursorsOverCommit |
The constant indicating that open |
TypeForwardOnly |
The constant indicating the type for a |
TypeScrollInsensitive |
The constant indicating the type for a |
TypeScrollSensitive |
The constant indicating the type for a |
Properties
Concurrency |
Gets the concurrency mode of this |
CursorName |
Gets the name of the SQL cursor of this |
FetchDirection |
Gets the direction in which rows are fetched for this |
FetchSize |
Gets the fetch size (in number of rows) for this |
Handle |
Gets the JNI value of the underlying Android object. (Inherited from IJavaObject) |
Holdability |
Returns the holdability of this result set: HoldCursorsOverCommit or CloseCursorsAtCommit. |
IsAfterLast |
Gets if the cursor is after the last row of the |
IsBeforeFirst |
Gets if the cursor is before the first row of the |
IsClosed |
Returns true if this result set has been closed, false otherwise. |
IsFirst |
Gets if the cursor is on the first row of the |
IsLast |
Gets if the cursor is on the last row of the |
JniIdentityHashCode |
Returns the value of |
JniManagedPeerState |
State of the managed peer. (Inherited from IJavaPeerable) |
JniPeerMembers |
Member access and invocation support. (Inherited from IJavaPeerable) |
MetaData |
Gets the metadata for this |
PeerReference |
Returns a JniObjectReference of the wrapped Java object instance. (Inherited from IJavaPeerable) |
Row |
Gets the number of the current row in the |
Statement |
Gets the statement that produced this |
Type |
Gets the type of the |
Warnings |
Gets the first warning generated by calls on this |
Methods
Absolute(Int32) |
Moves the cursor to the given row number in
this |
AfterLast() |
Moves the cursor to the end of
this |
BeforeFirst() |
Moves the cursor to the front of
this |
CancelRowUpdates() |
Cancels the updates made to the current row in this
|
ClearWarnings() |
Clears all warnings reported on this |
Close() |
Releases this |
DeleteRow() |
Deletes the current row from this |
Disposed() |
Called when the instance has been disposed. (Inherited from IJavaPeerable) |
DisposeUnlessReferenced() |
If there are no outstanding references to this instance, then
calls |
Finalized() |
Called when the instance has been finalized. (Inherited from IJavaPeerable) |
FindColumn(String) |
Maps the given |
First() |
Moves the cursor to the first row in
this |
GetArray(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetArray(String) |
Retrieves the value of the designated column in the current row
of this |
GetAsciiStream(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetAsciiStream(String) |
Retrieves the value of the designated column in the current row
of this |
GetBigDecimal(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetBigDecimal(Int32, Int32) |
Obsolete.
Retrieves the value of the designated column in the current row
of this |
GetBigDecimal(String) |
Retrieves the value of the designated column in the current row
of this |
GetBigDecimal(String, Int32) |
Obsolete.
Retrieves the value of the designated column in the current row
of this |
GetBinaryStream(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetBinaryStream(String) |
Retrieves the value of the designated column in the current row
of this |
GetBlob(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetBlob(String) |
Retrieves the value of the designated column in the current row
of this |
GetBoolean(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetBoolean(String) |
Retrieves the value of the designated column in the current row
of this |
GetByte(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetByte(String) |
Retrieves the value of the designated column in the current row
of this |
GetBytes(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetBytes(String) |
Retrieves the value of the designated column in the current row
of this |
GetCharacterStream(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetCharacterStream(String) |
Retrieves the value of the designated column in the current row
of this |
GetClob(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetClob(String) |
Retrieves the value of the designated column in the current row
of this |
GetDate(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetDate(Int32, Calendar) |
Retrieves the value of the designated column in the current row
of this |
GetDate(String) |
Retrieves the value of the designated column in the current row
of this |
GetDate(String, Calendar) |
Retrieves the value of the designated column in the current row
of this |
GetDouble(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetDouble(String) |
Retrieves the value of the designated column in the current row
of this |
GetFloat(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetFloat(String) |
Retrieves the value of the designated column in the current row
of this |
GetInt(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetInt(String) |
Retrieves the value of the designated column in the current row
of this |
GetLong(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetLong(String) |
Retrieves the value of the designated column in the current row
of this |
GetNCharacterStream(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetNCharacterStream(String) |
Retrieves the value of the designated column in the current row
of this |
GetNClob(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetNClob(String) |
Retrieves the value of the designated column in the current row
of this |
GetNString(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetNString(String) |
Retrieves the value of the designated column in the current row
of this |
GetObject(Int32) |
Gets the value of the designated column in the current row
of this |
GetObject(Int32, IDictionary<String,Class>) |
Retrieves the value of the designated column in the current row
of this |
GetObject(String) |
Gets the value of the designated column in the current row
of this |
GetObject(String, IDictionary<String,Class>) |
Retrieves the value of the designated column in the current row
of this |
GetRef(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetRef(String) |
Retrieves the value of the designated column in the current row
of this |
GetRowId(Int32) |
Retrieves the value of the designated column in the current row of this
|
GetRowId(String) |
Retrieves the value of the designated column in the current row of this
|
GetShort(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetShort(String) |
Retrieves the value of the designated column in the current row
of this |
GetSQLXML(Int32) |
Retrieves the value of the designated column in the current row of
this |
GetSQLXML(String) |
Retrieves the value of the designated column in the current row of
this |
GetString(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetString(String) |
Retrieves the value of the designated column in the current row
of this |
GetTime(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetTime(Int32, Calendar) |
Retrieves the value of the designated column in the current row
of this |
GetTime(String) |
Retrieves the value of the designated column in the current row
of this |
GetTime(String, Calendar) |
Retrieves the value of the designated column in the current row
of this |
GetTimestamp(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetTimestamp(Int32, Calendar) |
Retrieves the value of the designated column in the current row
of this |
GetTimestamp(String) |
Retrieves the value of the designated column in the current row
of this |
GetTimestamp(String, Calendar) |
Retrieves the value of the designated column in the current row
of this |
GetUnicodeStream(Int32) |
Obsolete.
Retrieves the value of the designated column in the current row
of this |
GetUnicodeStream(String) |
Obsolete.
Retrieves the value of the designated column in the current row
of this |
GetURL(Int32) |
Retrieves the value of the designated column in the current row
of this |
GetURL(String) |
Retrieves the value of the designated column in the current row
of this |
InsertRow() |
Inserts the contents of the insert row into this
|
IsWrapperFor(Class) |
Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does. (Inherited from IWrapper) |
Last() |
Moves the cursor to the last row in
this |
MoveToCurrentRow() |
Moves the cursor to the remembered cursor position, usually the current row. |
MoveToInsertRow() |
Moves the cursor to the insert row. |
Next() |
Moves the cursor froward one row from its current position. |
Previous() |
Moves the cursor to the previous row in this
|
RefreshRow() |
Refreshes the current row with its most recent value in the database. |
Relative(Int32) |
Moves the cursor a relative number of rows, either positive or negative. |
RowDeleted() |
Retrieves whether a row has been deleted. |
RowInserted() |
Retrieves whether the current row has had an insertion. |
RowUpdated() |
Retrieves whether the current row has been updated. |
SetJniIdentityHashCode(Int32) |
Set the value returned by |
SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from IJavaPeerable) |
SetPeerReference(JniObjectReference) |
Set the value returned by |
UnregisterFromRuntime() |
Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations. (Inherited from IJavaPeerable) |
Unwrap(Class) |
Returns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy. (Inherited from IWrapper) |
UpdateArray(Int32, IArray) |
Updates the designated column with a |
UpdateArray(String, IArray) |
Updates the designated column with a |
UpdateAsciiStream(Int32, Stream) |
Updates the designated column with an ascii stream value. |
UpdateAsciiStream(Int32, Stream, Int32) |
Updates the designated column with an ascii stream value, which will have the specified number of bytes. |
UpdateAsciiStream(Int32, Stream, Int64) |
Updates the designated column with an ascii stream value, which will have the specified number of bytes. |
UpdateAsciiStream(String, Stream) |
Updates the designated column with an ascii stream value. |
UpdateAsciiStream(String, Stream, Int32) |
Updates the designated column with an ascii stream value, which will have the specified number of bytes. |
UpdateAsciiStream(String, Stream, Int64) |
Updates the designated column with an ascii stream value, which will have the specified number of bytes. |
UpdateBigDecimal(Int32, BigDecimal) |
Updates the designated column with a |
UpdateBigDecimal(String, BigDecimal) |
Updates the designated column with a |
UpdateBinaryStream(Int32, Stream) |
Updates the designated column with a binary stream value. |
UpdateBinaryStream(Int32, Stream, Int32) |
Updates the designated column with a binary stream value, which will have the specified number of bytes. |
UpdateBinaryStream(Int32, Stream, Int64) |
Updates the designated column with a binary stream value, which will have the specified number of bytes. |
UpdateBinaryStream(String, Stream) |
Updates the designated column with a binary stream value. |
UpdateBinaryStream(String, Stream, Int32) |
Updates the designated column with a binary stream value, which will have the specified number of bytes. |
UpdateBinaryStream(String, Stream, Int64) |
Updates the designated column with a binary stream value, which will have the specified number of bytes. |
UpdateBlob(Int32, IBlob) |
Updates the designated column with a |
UpdateBlob(Int32, Stream) |
Updates the designated column using the given input stream. |
UpdateBlob(Int32, Stream, Int64) |
Updates the designated column using the given input stream, which will have the specified number of bytes. |
UpdateBlob(String, IBlob) |
Updates the designated column with a |
UpdateBlob(String, Stream) |
Updates the designated column using the given input stream. |
UpdateBlob(String, Stream, Int64) |
Updates the designated column using the given input stream, which will have the specified number of bytes. |
UpdateBoolean(Int32, Boolean) |
Updates the designated column with a |
UpdateBoolean(String, Boolean) |
Updates the designated column with a |
UpdateByte(Int32, SByte) |
Updates the designated column with a |
UpdateByte(String, SByte) |
Updates the designated column with a |
UpdateBytes(Int32, Byte[]) |
Updates the designated column with a |
UpdateBytes(String, Byte[]) |
Updates the designated column with a byte array value. |
UpdateCharacterStream(Int32, Reader) |
Updates the designated column with a character stream value. |
UpdateCharacterStream(Int32, Reader, Int32) |
Updates the designated column with a character stream value, which will have the specified number of bytes. |
UpdateCharacterStream(Int32, Reader, Int64) |
Updates the designated column with a character stream value, which will have the specified number of bytes. |
UpdateCharacterStream(String, Reader) |
Updates the designated column with a character stream value. |
UpdateCharacterStream(String, Reader, Int32) |
Updates the designated column with a character stream value, which will have the specified number of bytes. |
UpdateCharacterStream(String, Reader, Int64) |
Updates the designated column with a character stream value, which will have the specified number of bytes. |
UpdateClob(Int32, IClob) |
Updates the designated column with a |
UpdateClob(Int32, Reader) |
Updates the designated column using the given |
UpdateClob(Int32, Reader, Int64) |
Updates the designated column using the given |
UpdateClob(String, IClob) |
Updates the designated column with a |
UpdateClob(String, Reader) |
Updates the designated column using the given |
UpdateClob(String, Reader, Int64) |
Updates the designated column using the given |
UpdateDate(Int32, Date) |
Updates the designated column with a |
UpdateDate(String, Date) |
Updates the designated column with a |
UpdateDouble(Int32, Double) |
Updates the designated column with a |
UpdateDouble(String, Double) |
Updates the designated column with a |
UpdateFloat(Int32, Single) |
Updates the designated column with a |
UpdateFloat(String, Single) |
Updates the designated column with a |
UpdateInt(Int32, Int32) |
Updates the designated column with an |
UpdateInt(String, Int32) |
Updates the designated column with an |
UpdateLong(Int32, Int64) |
Updates the designated column with a |
UpdateLong(String, Int64) |
Updates the designated column with a |
UpdateNCharacterStream(Int32, Reader) |
Updates the designated column with a character stream value. |
UpdateNCharacterStream(Int32, Reader, Int64) |
Updates the designated column with a character stream value, which will have the specified number of bytes. |
UpdateNCharacterStream(String, Reader) |
Updates the designated column with a character stream value. |
UpdateNCharacterStream(String, Reader, Int64) |
Updates the designated column with a character stream value, which will have the specified number of bytes. |
UpdateNClob(Int32, INClob) |
Updates the designated column with a |
UpdateNClob(Int32, Reader) |
Updates the designated column using the given
|
UpdateNClob(Int32, Reader, Int64) |
Updates the designated column using the given |
UpdateNClob(String, INClob) |
Updates the designated column with a |
UpdateNClob(String, Reader) |
Updates the designated column using the given |
UpdateNClob(String, Reader, Int64) |
Updates the designated column using the given |
UpdateNString(Int32, String) |
Updates the designated column with a |
UpdateNString(String, String) |
Updates the designated column with a |
UpdateNull(Int32) |
Updates the designated column with a |
UpdateNull(String) |
Updates the designated column with a |
UpdateObject(Int32, Object) |
Updates the designated column with an |
UpdateObject(Int32, Object, Int32) |
Updates the designated column with an |
UpdateObject(String, Object) |
Updates the designated column with an |
UpdateObject(String, Object, Int32) |
Updates the designated column with an |
UpdateRef(Int32, IRef) |
Updates the designated column with a |
UpdateRef(String, IRef) |
Updates the designated column with a |
UpdateRow() |
Updates the underlying database with the new contents of the
current row of this |
UpdateRowId(Int32, IRowId) |
Updates the designated column with a |
UpdateRowId(String, IRowId) |
Updates the designated column with a |
UpdateShort(Int32, Int16) |
Updates the designated column with a |
UpdateShort(String, Int16) |
Updates the designated column with a |
UpdateSQLXML(Int32, ISQLXML) |
Updates the designated column with a |
UpdateSQLXML(String, ISQLXML) |
Updates the designated column with a |
UpdateString(Int32, String) |
Updates the designated column with a |
UpdateString(String, String) |
Updates the designated column with a |
UpdateTime(Int32, Time) |
Updates the designated column with a |
UpdateTime(String, Time) |
Updates the designated column with a |
UpdateTimestamp(Int32, Timestamp) |
Updates the designated column with a |
UpdateTimestamp(String, Timestamp) |
Updates the designated column with a |
WasNull() |
Reports whether
the last column read had a value of SQL |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |