This type is used to wrap unified results of DDL and DML query executions. JDBC execution results can be summarised to two properties:
-
Statement.getUpdateCount()
: The number of affected rows -
Statement.getResultSet()
: The result set
See MockDataProvider.execute(MockExecuteContext)
for more details
- Author:
- Lukas Eder
- See Also:
MockDataProvider
-
Field Summary
Modifier and TypeFieldDescriptionResult<?>
The result data associated with this execution result.The exception associated with this execution result.int
The number of affected rows for this execution result. -
Constructor Summary
ConstructorDescriptionCreate a newMockResult
.MockResult(int rows)
Create a newMockResult
.MockResult(int rows, Result<?> data)
Create a newMockResult
.MockResult(SQLException exception)
MockResult(Record data)
Create a newMockResult
. -
Method Summary
-
Field Details
-
rows
public final int rowsThe number of affected rows for this execution result.This number corresponds to the value of
Statement.getUpdateCount()
. The following values are possible:- Positive numbers: the number of affected rows by a given query execution
- 0: no rows were affected by a given query execution
- -1: the row count is not applicable
-
data
The result data associated with this execution result.This object describes the result data (including meta data).
If the given query execution did not provide any results (as in
Note, that this can also be used to provide a result for
), this may beStatement.execute(String)
== falsenull
. This is not the same as producing an empty result, which can only be modelled by an emptyResult
, containing column information but no rows.Statement.getGeneratedKeys()
-
exception
The exception associated with this execution result.If present, the current result produces an exception.
-
-
Constructor Details
-
MockResult
public MockResult()Create a newMockResult
.This is a convenience constructor calling
MockResult(-1, null)
.- See Also:
MockDataProvider for details
-
MockResult
public MockResult(int rows)Create a newMockResult
.This is a convenience constructor calling
MockResult(rows, null)
.- See Also:
MockDataProvider for details
-
MockResult
Create a newMockResult
.This is a convenience constructor creating a
MockResult
with exactly one record.- Parameters:
data
- The single record in this result. Record instances can be obtained from queries, instantiated from generated record classes, or created usingDSLContext.newRecord(org.jooq.Field...)
and other overloads.- See Also:
MockDataProvider for details
-
MockResult
Create a newMockResult
.- Parameters:
rows
- The number of affected rowsdata
- The result data. Result instances can be obtained from queries, or created usingDSLContext.newResult(org.jooq.Field...)
and other overloads.- See Also:
MockDataProvider for details
-
MockResult
-
-
Method Details