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 ResultBuilderaddUpdatedRows(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 ResultBuilderaddUpdatedRows(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 ResultBuilderCreates aResultBuilderfor a batch UPDATE result.static ResultBuilderdeletedRows(int[] deleteCounts) Creates aResultBuilderfor a batch DELETE result.static ResultBuilderdeletedRows(long deleteCount) Creates aResultBuilderfor a DELETE result.static ResultBuilderdeletedRows(long[] deleteCounts) Creates aResultBuilderfor a batch DELETE result.abstract ResultBuilderSpecifies the sourceCdsEntityof this result.abstract ResultBuilderinlineCount(long inlineCount) Specifies the inline count of a query result.static ResultBuilderinsertedRows(List<? extends Map<String, ?>> rows) Creates aResultBuilderfor an INSERT or UPSERT result.abstract Resultresult()Create aResultfrom thisResultBuilderabstract longrowCount()Returns the number of result rowsprotected abstract ResultBuilderrowCount(long[] rowCounts) protected ResultBuilderprotected abstract ResultBuilderabstract ResultBuilderrowType(CdsStructuredType rowType) Specifies theCdsStructuredTypethat represents the row type of this result.static ResultBuilderselectedRows(List<? extends Map<String, ?>> rows) Creates aResultBuilderto represent a query result.static ResultBuilderupdatedRows(long updateCount, Map<String, ?> updateData) Creates aResultBuilderfor a searched UPDATE, updating multiple rows with the same data.
-
Constructor Details
-
ResultBuilder
public ResultBuilder()
-
-
Method Details
-
selectedRows
Creates aResultBuilderto represent a query result.- Parameters:
rows- the result rows- Returns:
- the result builder
-
insertedRows
Creates aResultBuilderfor an INSERT or UPSERT result.- Parameters:
rows- the rows in- or upserted- Returns:
- the result builder
-
updatedRows
Creates aResultBuilderfor 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 aResultBuilderfor a batch UPDATE result. The results of the individual UPDATE statements have to be added usingaddUpdatedRows(long, Map).- Returns:
- the result builder
-
deletedRows
Creates aResultBuilderfor a DELETE result.- Parameters:
deleteCount- the number of rows that were deleted- Returns:
- the result builder
-
deletedRows
Creates aResultBuilderfor 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 aResultBuilderfor 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 sourceCdsEntityof this result.- Parameters:
entity- the source entity- Returns:
- this
ResultBuilder
-
rowType
Specifies theCdsStructuredTypethat 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 aResultfrom thisResultBuilder- Returns:
- the result
-
rowCount
public abstract long rowCount()Returns the number of result rows- Returns:
- the number of result rows
-
rows
-
rows
-
rowCount
-