* Updates the result of a single update into the outer batchResult * for the multi-update scenario. */
| 1090 | * for the multi-update scenario. |
| 1091 | */ |
| 1092 | inline static void |
| 1093 | UpdateResultInBatch(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 | /* |
no test coverage detected