Record Class StatementResult
java.lang.Object
java.lang.Record
com.pyranid.StatementResult
- Record Components:
rowsReturned- rows returned through a result set, ornullif unavailablerowsAffected- rows affected by a DML/update operation, ornullif unavailable
@ThreadSafe
public record StatementResult(@Nullable Long rowsReturned, @Nullable Long rowsAffected)
extends Record
Statement row-count information observed by Pyranid.
rowsReturned counts rows materialized through a JDBC ResultSet. rowsAffected counts
rows changed by a JDBC update-count operation. Some statements have neither value, and some database features can
logically have both even if Pyranid can only observe one of them through the current JDBC execution path.
- Since:
- 4.2.0
- Author:
- Mark Allen
-
Constructor Summary
ConstructorsConstructorDescriptionStatementResult(@Nullable Long rowsReturned, @Nullable Long rowsAffected) Creates an instance of aStatementResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull StatementResultempty()A singleton result for statements with no row-count information.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static @NonNull StatementResultofRowsAffected(@NonNull Long rowsAffected) Creates a result with affected-row information.static @NonNull StatementResultofRowsReturned(@NonNull Long rowsReturned) Creates a result with returned-row information.@Nullable LongReturns the value of therowsAffectedrecord component.@Nullable LongReturns the value of therowsReturnedrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
StatementResult
Creates an instance of aStatementResultrecord class.- Parameters:
rowsReturned- the value for therowsReturnedrecord componentrowsAffected- the value for therowsAffectedrecord component
-
-
Method Details
-
empty
A singleton result for statements with no row-count information.- Returns:
- an empty result
-
ofRowsReturned
Creates a result with returned-row information.- Parameters:
rowsReturned- returned-row count- Returns:
- a statement result
-
ofRowsAffected
Creates a result with affected-row information.- Parameters:
rowsAffected- affected-row count- Returns:
- a statement result
-
toString
-
hashCode
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
rowsReturned
Returns the value of therowsReturnedrecord component.- Returns:
- the value of the
rowsReturnedrecord component
-
rowsAffected
Returns the value of therowsAffectedrecord component.- Returns:
- the value of the
rowsAffectedrecord component
-