java.lang.Object
java.lang.Record
org.firebirdsql.jdbc.FetchConfig
- Record Components:
fetchSize- the fetch size (value0orUSE_DEFAULT_FETCH_SIZEmeans use default)maxRows- the maximum number of rows (value0orNO_MAX_ROWSmeans no maximum)direction- the fetch direction (one ofResultSet.FETCH_FORWARD,ResultSet.FETCH_REVERSE, orResultSet.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
FieldsModifier and TypeFieldDescriptionstatic final intValue ofmaxRows()which means "no maximum/all rows".static final intValue offetchSize()which means "use default value". -
Constructor Summary
ConstructorsConstructorDescriptionFetchConfig(int fetchSize, int maxRows, int direction, ResultSetBehavior resultSetBehavior) Creates an instance of aFetchConfigrecord class.FetchConfig(ResultSetBehavior resultSetBehavior) Fetch configuration with specifiedresultSetBehavior, default (0) forfetchSizeandmaxRows, anddirectionResultSet.FETCH_FORWARD. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thedirectionrecord component.final booleanIndicates whether some other object is "equal to" this one.intReturns the value of thefetchSizerecord component.intfetchSizeOr(int defaultFetchSize) ReturnsfetchSize, ordefaultFetchSizeiffetchSize == USE_DEFAULT_FETCH_SIZE.final inthashCode()Returns a hash code value for this object.intmaxRows()Returns the value of themaxRowsrecord component.Returns the value of theresultSetBehaviorrecord component.final StringtoString()Returns a string representation of this record class.withDirection(int direction) Returns aFetchConfigwith the specifieddirectionand the current values of this object forfetchSize,maxRows, andresultSetBehavior.withFetchSize(int fetchSize) Returns aFetchConfigwith the specifiedfetchSizeand the current values of this object formaxRows,direction, andresultSetBehavior.withMaxRows(int maxRows) Returns aFetchConfigwith the specifiedmaxRowsand the current values of this object forfetchSize,direction, andresultSetBehavior.Returns aFetchConfigwith theresultSetBehaviorset to read-only, and the current values of this object forfetchSize,maxRows, anddirection.
-
Field Details
-
USE_DEFAULT_FETCH_SIZE
public static final int USE_DEFAULT_FETCH_SIZEValue offetchSize()which means "use default value".This class does not know the actual default fetch size; that is considered an implementation detail of
FBFetcheror its implementations.- See Also:
-
NO_MAX_ROWS
public static final int NO_MAX_ROWSValue ofmaxRows()which means "no maximum/all rows".- See Also:
-
-
Constructor Details
-
FetchConfig
Creates an instance of aFetchConfigrecord class.- Parameters:
fetchSize- the value for thefetchSizerecord componentmaxRows- the value for themaxRowsrecord componentdirection- the value for thedirectionrecord componentresultSetBehavior- the value for theresultSetBehaviorrecord component
-
FetchConfig
Fetch configuration with specifiedresultSetBehavior, default (0) forfetchSizeandmaxRows, anddirectionResultSet.FETCH_FORWARD.- Parameters:
resultSetBehavior- result set behavior
-
-
Method Details
-
fetchSizeOr
public int fetchSizeOr(int defaultFetchSize) ReturnsfetchSize, ordefaultFetchSizeiffetchSize == USE_DEFAULT_FETCH_SIZE.- Parameters:
defaultFetchSize- default fetch size- Returns:
- fetch size or the default fetch size
-
withFetchSize
Returns aFetchConfigwith the specifiedfetchSizeand the current values of this object formaxRows,direction, andresultSetBehavior.- Parameters:
fetchSize- fetch size, must be>= 0(0orUSE_DEFAULT_FETCH_SIZEmeans use default fetch size)- Returns:
- fetch config object
- Throws:
SQLException- iffetchSizeis negative
-
withMaxRows
Returns aFetchConfigwith the specifiedmaxRowsand the current values of this object forfetchSize,direction, andresultSetBehavior.- Parameters:
maxRows- max rows, must be>= 0(0orNO_MAX_ROWSmeans no maximum)- Returns:
- fetch config object
- Throws:
SQLException- ifmaxRowsis negative
-
withDirection
Returns aFetchConfigwith the specifieddirectionand the current values of this object forfetchSize,maxRows, andresultSetBehavior.- Parameters:
direction- fetch direction (one ofResultSet.FETCH_FORWARD,ResultSet.FETCH_REVERSE, orResultSet.FETCH_UNKNOWN)- Returns:
- fetch config object
- Throws:
SQLException- ifdirectionis not one ofResultSet.FETCH_FORWARD,ResultSet.FETCH_REVERSE, orResultSet.FETCH_UNKNOWN
-
withReadOnly
Returns aFetchConfigwith theresultSetBehaviorset to read-only, and the current values of this object forfetchSize,maxRows, anddirection.- Returns:
- fetch config object
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
fetchSize
public int fetchSize()Returns the value of thefetchSizerecord component.- Returns:
- the value of the
fetchSizerecord component
-
maxRows
public int maxRows()Returns the value of themaxRowsrecord component.- Returns:
- the value of the
maxRowsrecord component
-
direction
public int direction()Returns the value of thedirectionrecord component.- Returns:
- the value of the
directionrecord component
-
resultSetBehavior
Returns the value of theresultSetBehaviorrecord component.- Returns:
- the value of the
resultSetBehaviorrecord component
-