---------------- * EndCommand - clean up the destination at end of command * ---------------- */
| 168 | * ---------------- |
| 169 | */ |
| 170 | void |
| 171 | EndCommand(const QueryCompletion *qc, CommandDest dest, bool force_undecorated_output) |
| 172 | { |
| 173 | char completionTag[COMPLETION_TAG_BUFSIZE]; |
| 174 | CommandTag tag; |
| 175 | const char *tagname; |
| 176 | |
| 177 | switch (dest) |
| 178 | { |
| 179 | case DestRemote: |
| 180 | case DestRemoteExecute: |
| 181 | case DestRemoteSimple: |
| 182 | |
| 183 | /* |
| 184 | * We assume the tagname is plain ASCII and therefore requires no |
| 185 | * encoding conversion. |
| 186 | * |
| 187 | * We no longer display LastOid, but to preserve the wire |
| 188 | * protocol, we write InvalidOid where the LastOid used to be |
| 189 | * written. |
| 190 | * |
| 191 | * All cases where LastOid was written also write nprocessed |
| 192 | * count, so just Assert that rather than having an extra test. |
| 193 | */ |
| 194 | tag = qc->commandTag; |
| 195 | tagname = GetCommandTagName(tag); |
| 196 | |
| 197 | if (command_tag_display_rowcount(tag) && !force_undecorated_output) |
| 198 | snprintf(completionTag, COMPLETION_TAG_BUFSIZE, |
| 199 | tag == CMDTAG_INSERT ? |
| 200 | "%s 0 " UINT64_FORMAT : "%s " UINT64_FORMAT, |
| 201 | tagname, qc->nprocessed); |
| 202 | else |
| 203 | snprintf(completionTag, COMPLETION_TAG_BUFSIZE, "%s", tagname); |
| 204 | pq_putmessage('C', completionTag, strlen(completionTag) + 1); |
| 205 | |
| 206 | case DestNone: |
| 207 | case DestDebug: |
| 208 | case DestSPI: |
| 209 | case DestTuplestore: |
| 210 | case DestIntoRel: |
| 211 | case DestCopyOut: |
| 212 | case DestSQLFunction: |
| 213 | case DestTransientRel: |
| 214 | case DestTupleQueue: |
| 215 | case DestPersistentstore: |
| 216 | break; |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | /* ---------------- |
| 221 | * EndReplicationCommand - stripped down version of EndCommand |
no test coverage detected