Java.Sql.ResultSet Class
An interface for an object which represents a database table entry, returned as the result of the query to the database.

See Also: ResultSet Members

Syntax

[Android.Runtime.Register("java/sql/ResultSet")]
public abstract class ResultSet

Remarks

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:

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).

[Android Documentation]

Requirements

Namespace: Java.Sql
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1