java.lang.Object
java.lang.Record
org.firebirdsql.jdbc.FetchConfig
- Record Components:
fetchSize
- the fetch size (value0
orUSE_DEFAULT_FETCH_SIZE
means use default)maxRows
- the maximum number of rows (value0
orNO_MAX_ROWS
means 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 int
Value ofmaxRows()
which means "no maximum/all rows".static final int
Value offetchSize()
which means "use default value". -
Constructor Summary
ConstructorsConstructorDescriptionFetchConfig
(int fetchSize, int maxRows, int direction, ResultSetBehavior resultSetBehavior) Creates an instance of aFetchConfig
record class.FetchConfig
(ResultSetBehavior resultSetBehavior) Fetch configuration with specifiedresultSetBehavior
, default (0
) forfetchSize
andmaxRows
, anddirection
ResultSet.FETCH_FORWARD
. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the value of thedirection
record component.final boolean
Indicates whether some other object is "equal to" this one.int
Returns the value of thefetchSize
record component.int
fetchSizeOr
(int defaultFetchSize) ReturnsfetchSize
, ordefaultFetchSize
iffetchSize == USE_DEFAULT_FETCH_SIZE
.final int
hashCode()
Returns a hash code value for this object.int
maxRows()
Returns the value of themaxRows
record component.Returns the value of theresultSetBehavior
record component.final String
toString()
Returns a string representation of this record class.withDirection
(int direction) Returns aFetchConfig
with the specifieddirection
and the current values of this object forfetchSize
,maxRows
, andresultSetBehavior
.withFetchSize
(int fetchSize) Returns aFetchConfig
with the specifiedfetchSize
and the current values of this object formaxRows
,direction
, andresultSetBehavior
.withMaxRows
(int maxRows) Returns aFetchConfig
with the specifiedmaxRows
and the current values of this object forfetchSize
,direction
, andresultSetBehavior
.Returns aFetchConfig
with theresultSetBehavior
set 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
FBFetcher
or 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 aFetchConfig
record class.- Parameters:
fetchSize
- the value for thefetchSize
record componentmaxRows
- the value for themaxRows
record componentdirection
- the value for thedirection
record componentresultSetBehavior
- the value for theresultSetBehavior
record component
-
FetchConfig
Fetch configuration with specifiedresultSetBehavior
, default (0
) forfetchSize
andmaxRows
, anddirection
ResultSet.FETCH_FORWARD
.- Parameters:
resultSetBehavior
- result set behavior
-
-
Method Details
-
fetchSizeOr
public int fetchSizeOr(int defaultFetchSize) ReturnsfetchSize
, ordefaultFetchSize
iffetchSize == USE_DEFAULT_FETCH_SIZE
.- Parameters:
defaultFetchSize
- default fetch size- Returns:
- fetch size or the default fetch size
-
withFetchSize
Returns aFetchConfig
with the specifiedfetchSize
and the current values of this object formaxRows
,direction
, andresultSetBehavior
.- Parameters:
fetchSize
- fetch size, must be>= 0
(0
orUSE_DEFAULT_FETCH_SIZE
means use default fetch size)- Returns:
- fetch config object
- Throws:
SQLException
- iffetchSize
is negative
-
withMaxRows
Returns aFetchConfig
with the specifiedmaxRows
and the current values of this object forfetchSize
,direction
, andresultSetBehavior
.- Parameters:
maxRows
- max rows, must be>= 0
(0
orNO_MAX_ROWS
means no maximum)- Returns:
- fetch config object
- Throws:
SQLException
- ifmaxRows
is negative
-
withDirection
Returns aFetchConfig
with the specifieddirection
and 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
- ifdirection
is not one ofResultSet.FETCH_FORWARD
,ResultSet.FETCH_REVERSE
, orResultSet.FETCH_UNKNOWN
-
withReadOnly
Returns aFetchConfig
with theresultSetBehavior
set 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 thefetchSize
record component.- Returns:
- the value of the
fetchSize
record component
-
maxRows
public int maxRows()Returns the value of themaxRows
record component.- Returns:
- the value of the
maxRows
record component
-
direction
public int direction()Returns the value of thedirection
record component.- Returns:
- the value of the
direction
record component
-
resultSetBehavior
Returns the value of theresultSetBehavior
record component.- Returns:
- the value of the
resultSetBehavior
record component
-