Record Class FetchConfig

java.lang.Object
java.lang.Record
org.firebirdsql.jdbc.FetchConfig
Record Components:
fetchSize - the fetch size (value 0 or USE_DEFAULT_FETCH_SIZE means use default)
maxRows - the maximum number of rows (value 0 or NO_MAX_ROWS means no maximum)
direction - the fetch direction (one of ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN)
resultSetBehavior - result set behavior

@InternalApi public record FetchConfig(int fetchSize, int maxRows, int direction, ResultSetBehavior resultSetBehavior) extends Record
Fetch configuration values.

This class is internal API of Jaybird. Future versions may radically change, move, or make inaccessible this type.

The withXXX methods may return the same object if the new value is equal to the current value.

Since:
6
Author:
Mark Rotteveel
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Value of maxRows() which means "no maximum/all rows".
    static final int
    Value of fetchSize() which means "use default value".
  • Constructor Summary

    Constructors
    Constructor
    Description
    FetchConfig(int fetchSize, int maxRows, int direction, ResultSetBehavior resultSetBehavior)
    Creates an instance of a FetchConfig record class.
    FetchConfig(ResultSetBehavior resultSetBehavior)
    Fetch configuration with specified resultSetBehavior, default (0) for fetchSize and maxRows, and direction ResultSet.FETCH_FORWARD.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the direction record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the fetchSize record component.
    int
    fetchSizeOr(int defaultFetchSize)
    Returns fetchSize, or defaultFetchSize if fetchSize == USE_DEFAULT_FETCH_SIZE.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the maxRows record component.
    Returns the value of the resultSetBehavior record component.
    final String
    Returns a string representation of this record class.
    withDirection(int direction)
    Returns a FetchConfig with the specified direction and the current values of this object for fetchSize, maxRows, and resultSetBehavior.
    withFetchSize(int fetchSize)
    Returns a FetchConfig with the specified fetchSize and the current values of this object for maxRows, direction, and resultSetBehavior.
    withMaxRows(int maxRows)
    Returns a FetchConfig with the specified maxRows and the current values of this object for fetchSize, direction, and resultSetBehavior.
    Returns a FetchConfig with the resultSetBehavior set to read-only, and the current values of this object for fetchSize, maxRows, and direction.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • USE_DEFAULT_FETCH_SIZE

      public static final int USE_DEFAULT_FETCH_SIZE
      Value of fetchSize() which means "use default value".

      This class does not know the actual default fetch size; that is considered an implementation detail of FBFetcher or its implementations.

      See Also:
    • NO_MAX_ROWS

      public static final int NO_MAX_ROWS
      Value of maxRows() which means "no maximum/all rows".
      See Also:
  • Constructor Details

    • FetchConfig

      public FetchConfig(int fetchSize, int maxRows, int direction, ResultSetBehavior resultSetBehavior)
      Creates an instance of a FetchConfig record class.
      Parameters:
      fetchSize - the value for the fetchSize record component
      maxRows - the value for the maxRows record component
      direction - the value for the direction record component
      resultSetBehavior - the value for the resultSetBehavior record component
    • FetchConfig

      public FetchConfig(ResultSetBehavior resultSetBehavior)
      Fetch configuration with specified resultSetBehavior, default (0) for fetchSize and maxRows, and direction ResultSet.FETCH_FORWARD.
      Parameters:
      resultSetBehavior - result set behavior
  • Method Details

    • fetchSizeOr

      public int fetchSizeOr(int defaultFetchSize)
      Returns fetchSize, or defaultFetchSize if fetchSize == USE_DEFAULT_FETCH_SIZE.
      Parameters:
      defaultFetchSize - default fetch size
      Returns:
      fetch size or the default fetch size
    • withFetchSize

      public FetchConfig withFetchSize(int fetchSize) throws SQLException
      Returns a FetchConfig with the specified fetchSize and the current values of this object for maxRows, direction, and resultSetBehavior.
      Parameters:
      fetchSize - fetch size, must be >= 0 (0 or USE_DEFAULT_FETCH_SIZE means use default fetch size)
      Returns:
      fetch config object
      Throws:
      SQLException - if fetchSize is negative
    • withMaxRows

      public FetchConfig withMaxRows(int maxRows) throws SQLException
      Returns a FetchConfig with the specified maxRows and the current values of this object for fetchSize, direction, and resultSetBehavior.
      Parameters:
      maxRows - max rows, must be >= 0 (0 or NO_MAX_ROWS means no maximum)
      Returns:
      fetch config object
      Throws:
      SQLException - if maxRows is negative
    • withDirection

      public FetchConfig withDirection(int direction) throws SQLException
      Returns a FetchConfig with the specified direction and the current values of this object for fetchSize, maxRows, and resultSetBehavior.
      Parameters:
      direction - fetch direction (one of ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN)
      Returns:
      fetch config object
      Throws:
      SQLException - if direction is not one of ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN
    • withReadOnly

      public FetchConfig withReadOnly()
      Returns a FetchConfig with the resultSetBehavior set to read-only, and the current values of this object for fetchSize, maxRows, and direction.
      Returns:
      fetch config object
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • fetchSize

      public int fetchSize()
      Returns the value of the fetchSize record component.
      Returns:
      the value of the fetchSize record component
    • maxRows

      public int maxRows()
      Returns the value of the maxRows record component.
      Returns:
      the value of the maxRows record component
    • direction

      public int direction()
      Returns the value of the direction record component.
      Returns:
      the value of the direction record component
    • resultSetBehavior

      public ResultSetBehavior resultSetBehavior()
      Returns the value of the resultSetBehavior record component.
      Returns:
      the value of the resultSetBehavior record component