Package com.sap.cds
Class ResultBuilder
java.lang.Object
com.sap.cds.ResultBuilder
Builder class to programmatically create a
Result
to represent the
result of queries, insert, update and delete operations.-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ResultBuilder
addUpdatedRows
(long[] updateCounts, List<? extends Map<String, ?>> updateData) Adds multiple update results to this result builder that represent the result of the UPDATE operations of a batch.abstract ResultBuilder
addUpdatedRows
(long updateCount, Map<String, ?> updateData) Adds an update result to this result builder that represents the result of a single UPDATE operation of a batch.static ResultBuilder
Creates aResultBuilder
for a batch UPDATE result.static ResultBuilder
deletedRows
(int[] deleteCounts) Creates aResultBuilder
for a batch DELETE result.static ResultBuilder
deletedRows
(long deleteCount) Creates aResultBuilder
for a DELETE result.static ResultBuilder
deletedRows
(long[] deleteCounts) Creates aResultBuilder
for a batch DELETE result.abstract ResultBuilder
Specifies the sourceCdsEntity
of this result.abstract ResultBuilder
inlineCount
(long inlineCount) Specifies the inline count of a query result.static ResultBuilder
insertedRows
(List<? extends Map<String, ?>> rows) Creates aResultBuilder
for an INSERT or UPSERT result.abstract Result
result()
Create aResult
from thisResultBuilder
abstract long
rowCount()
Returns the number of result rowsprotected abstract ResultBuilder
rowCount
(long[] rowCounts) protected ResultBuilder
protected abstract ResultBuilder
abstract ResultBuilder
rowType
(CdsStructuredType rowType) Specifies theCdsStructuredType
that represents the row type of this result.static ResultBuilder
selectedRows
(List<? extends Map<String, ?>> rows) Creates aResultBuilder
to represent a query result.static ResultBuilder
updatedRows
(long updateCount, Map<String, ?> updateData) Creates aResultBuilder
for a searched UPDATE, updating multiple rows with the same data.
-
Constructor Details
-
ResultBuilder
public ResultBuilder()
-
-
Method Details
-
selectedRows
Creates aResultBuilder
to represent a query result.- Parameters:
rows
- the result rows- Returns:
- the result builder
-
insertedRows
Creates aResultBuilder
for an INSERT or UPSERT result.- Parameters:
rows
- the rows in- or upserted- Returns:
- the result builder
-
updatedRows
Creates aResultBuilder
for a searched UPDATE, updating multiple rows with the same data.- Parameters:
updateCount
- the number of rows that were updatedupdateData
- the update data- Returns:
- the result builder
-
batchUpdate
Creates aResultBuilder
for a batch UPDATE result. The results of the individual UPDATE statements have to be added usingaddUpdatedRows(long, Map)
.- Returns:
- the result builder
-
deletedRows
Creates aResultBuilder
for a DELETE result.- Parameters:
deleteCount
- the number of rows that were deleted- Returns:
- the result builder
-
deletedRows
Creates aResultBuilder
for a batch DELETE result.- Parameters:
deleteCounts
- the number of rows deleted by the individual DELETE operations of the batch- Returns:
- the result builder
-
deletedRows
Creates aResultBuilder
for a batch DELETE result.- Parameters:
deleteCounts
- the number of rows deleted by the individual DELETE operations of the batch- Returns:
- the result builder
-
entity
Specifies the sourceCdsEntity
of this result.- Parameters:
entity
- the source entity- Returns:
- this
ResultBuilder
-
rowType
Specifies theCdsStructuredType
that represents the row type of this result.- Parameters:
rowType
- the row type- Returns:
- this
ResultBuilder
-
inlineCount
Specifies the inline count of a query result.- Parameters:
inlineCount
- the inline count- Returns:
- this
ResultBuilder
-
addUpdatedRows
Adds an update result to this result builder that represents the result of a single UPDATE operation of a batch.- Parameters:
updateCount
- the number of rows that were updatedupdateData
- the update data- Returns:
- this
ResultBuilder
-
addUpdatedRows
public abstract ResultBuilder addUpdatedRows(long[] updateCounts, List<? extends Map<String, ?>> updateData) Adds multiple update results to this result builder that represent the result of the UPDATE operations of a batch.- Parameters:
updateCounts
- the number of rows that were updated per line of the batchupdateData
- the update data- Returns:
- this
ResultBuilder
-
result
Create aResult
from thisResultBuilder
- Returns:
- the result
-
rowCount
public abstract long rowCount()Returns the number of result rows- Returns:
- the number of result rows
-
rows
-
rows
-
rowCount
-