MCPcopy Create free account
hub / github.com/documentdb/documentdb / UpdateResultInBatch

Function UpdateResultInBatch

pg_documentdb/src/commands/update.c:1092–1114  ·  view source on GitHub ↗

* Updates the result of a single update into the outer batchResult * for the multi-update scenario. */

Source from the content-addressed store, hash-verified

1090 * for the multi-update scenario.
1091 */
1092inline static void
1093UpdateResultInBatch(BatchUpdateResult *batchResult, UpdateResult *updateResult,
1094 MemoryContext context, int updateIndex)
1095{
1096 batchResult->rowsMatched += updateResult->rowsMatched;
1097 batchResult->rowsModified += updateResult->rowsModified;
1098
1099 if (updateResult->performedUpsert)
1100 {
1101 Assert(updateResult->upsertedObjectId != NULL);
1102
1103 batchResult->rowsMatched += 1;
1104
1105 MemoryContext currentContext = MemoryContextSwitchTo(context);
1106 UpsertResult *upsertResult = palloc0(sizeof(UpsertResult));
1107 upsertResult->index = updateIndex;
1108 upsertResult->objectId =
1109 CopyPgbsonIntoMemoryContext(updateResult->upsertedObjectId, context);
1110
1111 batchResult->upserted = lappend(batchResult->upserted, upsertResult);
1112 MemoryContextSwitchTo(currentContext);
1113 }
1114}
1115
1116
1117/*

Callers 3

DoMultiUpdateFunction · 0.85
DoSingleUpdateWithSubTxnFunction · 0.85
DoSingleUpdateFunction · 0.85

Calls 1

Tested by

no test coverage detected