Module org.firebirdsql.jaybird
Package org.firebirdsql.jdbc

# Class ResultSetBehavior

java.lang.Object
org.firebirdsql.jdbc.ResultSetBehavior

@InternalApi public final class ResultSetBehavior extends Object
Aggregate type for result set behavior and logic for deriving supported combinations of type, concurrency and holdability.

Since:
  6
Author:
  Mark Rotteveel

## Method Summary

Modifier and Type
Method
Description
`int`
`concurrency()`
Result set concurrency.
`int`
`holdability()`
Result set holdability.
`boolean`
`isCloseCursorsAtCommit()`
Result set is closed at commit.
`boolean`
`isForwardOnly()`
Forward-only result set.
`boolean`
`isHoldCursorsOverCommit()`
Result set is held (remains open) over commit.
`boolean`
`isInsensitive()`
Result set is insensitive to changes in the data source.
`boolean`
`isReadOnly()`
Read-only result set.
`boolean`
`isScrollable()`
Scrollable result set.
`boolean`
`isSensitive()`
Result set is sensitive to changes in the data source.
`boolean`
`isUpdatable()`
Updatable result set.
`static ResultSetBehavior`
`of()`
Obtain the default result set behavior (`ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.CONCUR_READ_ONLY`, and `ResultSet.CLOSE_CURSORS_AT_COMMIT`).
`static ResultSetBehavior`
`of(int type, int concurrency, int holdability)`
Returns a — possibly cached — result set behavior for the type, concurrency and holdability.
`static ResultSetBehavior`
`of(int type, int concurrency, int holdability, Consumer<SQLWarning> warningConsumer)`
Returns a — possibly cached — result set behavior for the type, concurrency and holdability.
`int`
`type()`
Result set type.
`ResultSetBehavior`
`withReadOnly()`
Return a — possibly cached — result set behaviour with concurrency changed to `ResultSet.CONCUR_READ_ONLY`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### type

public int type()
Result set type.

NOTE: The current implementation will never return `ResultSet.TYPE_SCROLL_SENSITIVE`, because it is always downgraded to `ResultSet.TYPE_SCROLL_INSENSITIVE` in `of(int, int, int, Consumer)`.

Returns:
  result set type; one of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE` or `ResultSet.TYPE_SCROLL_SENSITIVE`
See Also:
  - `isForwardOnly()`
  - `isScrollable()`
  - `isInsensitive()`
  - `isSensitive()`

### isForwardOnly

public boolean isForwardOnly()
Forward-only result set.

Returns:
  `true` if the result set is forward-only (`ResultSet.TYPE_FORWARD_ONLY`)
See Also:
  - `isScrollable()`
  - `type()`

### isScrollable

public boolean isScrollable()
Scrollable result set.

Returns:
  `true` if the result set is scrollable (`ResultSet.TYPE_SCROLL_INSENSITIVE` or `ResultSet.TYPE_SCROLL_SENSITIVE`)
See Also:
  - `isForwardOnly()`
  - `type()`

### isInsensitive

public boolean isInsensitive()
Result set is insensitive to changes in the data source.

Returns:
  `true` if the result set is insensitive to changes (`ResultSet.TYPE_FORWARD_ONLY` or `ResultSet.TYPE_SCROLL_INSENSITIVE`)
See Also:
  - `isSensitive()`
  - `type()`

### isSensitive

public boolean isSensitive()
Result set is sensitive to changes in the data source.

NOTE: In the current implementation, this always returns `false`.

Returns:
  `true` if the result is sensitive to changes (`ResultSet.TYPE_SCROLL_SENSITIVE`)
See Also:
  - `isInsensitive()`
  - `type()`

### concurrency

public int concurrency()
Result set concurrency.

Returns:
  result set concurrency; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`
See Also:
  - `isReadOnly()`
  - `isUpdatable()`

### isReadOnly

public boolean isReadOnly()
Read-only result set.

Returns:
  `true` if the result set is read-only (`ResultSet.CONCUR_READ_ONLY`)
See Also:
  - `isUpdatable()`
  - `concurrency()`

### isUpdatable

public boolean isUpdatable()
Updatable result set.

Returns:
  `true` if the result set is updatable (`ResultSet.CONCUR_UPDATABLE`)
See Also:
  - `isReadOnly()`
  - `concurrency()`

### holdability

public int holdability()
Result set holdability.

Returns:
  result set holdability; one of `ResultSet.CLOSE_CURSORS_AT_COMMIT` or `ResultSet.HOLD_CURSORS_OVER_COMMIT`
See Also:
  - `isCloseCursorsAtCommit()`
  - `isHoldCursorsOverCommit()`

### isCloseCursorsAtCommit

public boolean isCloseCursorsAtCommit()
Result set is closed at commit.

Returns:
  `true` if result set is closed at commit (`ResultSet.CLOSE_CURSORS_AT_COMMIT`)
See Also:
  - `isHoldCursorsOverCommit()`
  - `holdability()`

### isHoldCursorsOverCommit

public boolean isHoldCursorsOverCommit()
Result set is held (remains open) over commit.

Returns:
  `true` if result is held over commit (`ResultSet.HOLD_CURSORS_OVER_COMMIT`)
See Also:
  - `isCloseCursorsAtCommit()`
  - `holdability()`

### withReadOnly

public ResultSetBehavior withReadOnly()
Return a — possibly cached — result set behaviour with concurrency changed to `ResultSet.CONCUR_READ_ONLY`.

Type and holdability may be upgraded or downgraded if required if the new combination would not be supported. In the current implementation, this doesn't actually happen, and type and concurrency are preserved.

Returns:
  read-only result set behaviour

### of

public static ResultSetBehavior of(int type, int concurrency, int holdability) throws SQLException
Returns a — possibly cached — result set behavior for the type, concurrency and holdability.

Unsupported, but valid, combinations may result in upgrading or downgrading the type, concurrency and/or holdability. In the current implementation this only happens for type.

Parameters:
  `type` - result set type; one of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE` or `ResultSet.TYPE_SCROLL_SENSITIVE`
  `concurrency` - result set concurrency; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`
  `holdability` - result set holdability; one of `ResultSet.CLOSE_CURSORS_AT_COMMIT` or `ResultSet.HOLD_CURSORS_OVER_COMMIT`
Returns:
  derived result set behavior
Throws:
  `SQLException` - for invalid values of `type`, `concurrency` or `holdability` (i.e. not defined by JDBC)
See Also:
  - `of(int, int, int, Consumer)`

### of

public static ResultSetBehavior of(int type, int concurrency, int holdability, Consumer<SQLWarning> warningConsumer) throws SQLException
Returns a — possibly cached — result set behavior for the type, concurrency and holdability.

Unsupported, but valid, combinations may result in upgrading or downgrading the type, concurrency and/or holdability. In the current implementation this only happens for type.

Parameters:
  `type` - result set type; one of `ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.TYPE_SCROLL_INSENSITIVE` or `ResultSet.TYPE_SCROLL_SENSITIVE`
  `concurrency` - result set concurrency; one of `ResultSet.CONCUR_READ_ONLY` or `ResultSet.CONCUR_UPDATABLE`
  `holdability` - result set holdability; one of `ResultSet.CLOSE_CURSORS_AT_COMMIT` or `ResultSet.HOLD_CURSORS_OVER_COMMIT`
  `warningConsumer` - consumer for reporting a warning when the type, concurrency or holdability is upgraded or downgraded
Returns:
  derived result set behavior
Throws:
  `SQLException` - for invalid values of `type`, `concurrency` or `holdability` (i.e. not defined by JDBC)
See Also:
  - `of(int, int, int, Consumer)`

### of

public static ResultSetBehavior of()
Obtain the default result set behavior (`ResultSet.TYPE_FORWARD_ONLY`, `ResultSet.CONCUR_READ_ONLY`, and `ResultSet.CLOSE_CURSORS_AT_COMMIT`).

Returns:
  default result set behaviour