Oracle8i JDBC Developer's Guide and Reference Release 3 (8.1.7) Part Number A83724-01 |
Library | Service | Contents | Index

## Summary of New Methods for Result Set Enhancements

This section summarizes all the new connection, result set, statement, and database meta data methods added for JDBC 2.0 result set enhancements. These methods are more fully discussed throughout this chapter.

### Modified Connection Methods

Following is an alphabetical summary of modified connection methods that allow you to specify result set and concurrency types when you create statement objects.

- `Statement createStatement
  (int resultSetType, int resultSetConcurrency)`

  This method now allows you to specify result set type and concurrency type when you create a generic `Statement` object.

- `CallableStatement prepareCall
  (String sql, int resultSetType, int resultSetConcurrency)`

  This method now allows you to specify result set type and concurrency type when you create a `PreparedStatement` object.

- `PreparedStatement prepareStatement
  (String sql, int resultSetType, int resultSetConcurrency)`

  This method now allows you to specify result set type and concurrency type when you create a `CallableStatement` object.

### New Result Set Methods

Following is an alphabetical summary of new result set methods for JDBC 2.0 result set enhancements.

- `boolean absolute(int row) throws SQLException`

  Move to an absolute row position in the result set.

- `void afterLast() throws SQLException`

  Move to after the last row in the result set (you will not be at a valid current row after this call).

- `void beforeFirst() throws SQLException`

  Move to before the first row in the result set (you will not be at a valid current row after this call).

- `void cancelRowUpdates() throws SQLException`

  Cancel an `UPDATE` operation on the current row. (Call this after the `updateXXX()` calls but before the `updateRow()` call.)

- `void deleteRow() throws SQLException`

  Delete the current row.

- `boolean first() throws SQLException`

  Move to the first row in the result set.

- `int getConcurrency() throws SQLException`

  Returns an `int` value for the concurrency type used for the query (either `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`).

- `int getFetchSize() throws SQLException`

  Check the fetch size to determine how many rows are fetched in each database round trip (also available in statement objects).

- `int getRow() throws SQLException`

  Returns the row number of the current row. Returns 0 if there is no valid current row.

- `int getType() throws SQLException`

  Returns an `int` value for the result set type used for the query (either `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_SENSITIVE`, or `ResultSet.TYPE_SCROLL_INSENSITIVE`).

- `void insertRow() throws SQLException`

  Write a result set `INSERT` operation to the database. Call this after calling `updateXXX()` methods to set the data values.

- `boolean isAfterLast() throws SQLException`

  Returns `true` if the position is after the last row.

- `boolean isBeforeFirst() throws SQLException`

  Returns `true` if the position is before the first row.

- `boolean isFirst() throws SQLException`

  Returns `true` if the position is at the first row.

- `boolean isLast() throws SQLException`

  Returns `true` if the position is at the last row.

- `boolean last() throws SQLException`

  Move to the last row in the result set.

- `void moveToCurrentRow() throws SQLException`

  Move from the insert-row staging area back to what had been the current row prior to the `moveToInsertRow()` call.

- `void moveToInsertRow() throws SQLException`

  Move to the insert-row staging area to set up a row to be inserted.

- `boolean next() throws SQLException`

  Iterate forward through the result set.

- `boolean previous() throws SQLException`

  Iterate backward through the result set.

- `void refreshRow() throws SQLException`

  Refetch the database rows corresponding to the current window in the result set, to update the data. This method is called implicitly for scroll-sensitive result sets.

- `boolean relative(int row) throws SQLException`

  Move to a relative row position, either forward or backward from the current row.

- `void setFetchSize(int rows) throws SQLException`

  Set the fetch size to determine how many rows are fetched in each database round trip when refetching (also available in statement objects).

- `void updateRow() throws SQLException`

  Write an `UPDATE` operation to the database after using `updateXXX()` methods to update the data values.

- `void updateXXX() throws SQLException`

  Set or update data values in a row to be updated or inserted. There is an `updateXXX()` method for each datatype. After calling all the appropriate `updateXXX()` methods for the columns to be updated or inserted, call `updateRow()` for an `UPDATE` operation or `insertRow()` for an `INSERT` operation.

### New Statement Methods

Following is an alphabetical summary of new statement methods for JDBC 2.0 result set enhancements. These methods are available in generic statement, prepared statement, and callable statement objects.

- `int getFetchSize() throws SQLException`

  Check the fetch size to determine how many rows are fetched in each database round trip when executing a query (also available in result set objects).

- `void setFetchSize(int rows) throws SQLException`

  Set the fetch size to determine how many rows are fetched in each database round trip when executing a query (also available in result set objects).

- `void setResultSetCache(OracleResultSetCache cache)
  throws SQLException`

  Use your own client-side cache implementation for scrollable result sets. Create your own class that implements the `OracleResultSetCache` interface, then use the `setResultSetCache()` method to input an instance of this class to the statement object that will create the result set.

- `int getResultSetType() throws SQLException`

  Check the result set type of result sets produced by this statement object (which was specified when the statement object was created).

- `int getResultSetConcurrency() throws SQLException`

  Check the concurrency type of result sets produced by this statement object (which was specified when the statement object was created).

### New Database Meta Data Methods

Following is an alphabetical summary of new database meta data methods for JDBC 2.0 result set enhancements.

- `boolean ownDeletesAreVisible(int) throws SQLException`

  Returns `true` if, in this JDBC implementation, the specified result set type can see the effect of its own internal `DELETE` operations.

- `boolean ownUpdatesAreVisible(int) throws SQLException`

  Returns `true` if, in this JDBC implementation, the specified result set type can see the effect of its own internal `UPDATE` operations.

- `boolean ownInsertsAreVisible(int) throws SQLException`

  Returns `true` if, in this JDBC implementation, the specified result set type can see the effect of its own internal `INSERT` operations.

- `boolean othersDeletesAreVisible(int) throws SQLException`

  Returns `true` if, in this JDBC implementation, the specified result set type can see the effect of an external `DELETE` operation in the database.

- `boolean othersUpdatesAreVisible(int) throws SQLException`

  Returns `true` if, in this JDBC implementation, the specified result set type can see the effect of an external `UPDATE` operation in the database.

- `boolean othersInsertsAreVisible(int) throws SQLException`

  Returns `true` if, in this JDBC implementation, the specified result set type can see the effect of an external `INSERT` operation in the database.

- `boolean deletesAreDetected(int) throws SQLException`

  Returns `true` if, in this JDBC implementation, the specified result set type can detect when an external `DELETE` operation occurs in the database. This method always returns `false` in Oracle8i release 8.1.6 and higher.

- `boolean updatesAreDetected(int) throws SQLException`

  Returns `true` if, in this JDBC implementation, the specified result set type can detect when an external `UPDATE` operation occurs in the database. This method always returns `false` in Oracle8i release 8.1.6 and higher.

- `boolean insertsAreDetected(int) throws SQLException`

  Returns `true` if, in this JDBC implementation, the specified result set type can detect when an external `INSERT` operation occurs in the database. This method always returns `false` in Oracle8i release 8.1.6 and higher.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index