MCPcopy Create free account
hub / github.com/apache/cloudberry / pqTraceOutputMessage

Function pqTraceOutputMessage

src/interfaces/libpq/fe-trace.c:528–687  ·  view source on GitHub ↗

* Print the given message to the trace output stream. */

Source from the content-addressed store, hash-verified

526 * Print the given message to the trace output stream.
527 */
528void
529pqTraceOutputMessage(PGconn *conn, const char *message, bool toServer)
530{
531 char id;
532 int length;
533 char *prefix = toServer ? "F" : "B";
534 int logCursor = 0;
535 bool regress;
536
537 if ((conn->traceFlags & PQTRACE_SUPPRESS_TIMESTAMPS) == 0)
538 {
539 char timestr[128];
540
541 pqTraceFormatTimestamp(timestr, sizeof(timestr));
542 fprintf(conn->Pfdebug, "%s\t", timestr);
543 }
544 regress = (conn->traceFlags & PQTRACE_REGRESS_MODE) != 0;
545
546 id = message[logCursor++];
547
548 memcpy(&length, message + logCursor, 4);
549 length = (int) pg_ntoh32(length);
550 logCursor += 4;
551
552 /*
553 * In regress mode, suppress the length of ErrorResponse and
554 * NoticeResponse. The F (file name), L (line number) and R (routine
555 * name) fields can change as server code is modified, and if their
556 * lengths differ from the originals, that would break tests.
557 */
558 if (regress && !toServer && (id == 'E' || id == 'N'))
559 fprintf(conn->Pfdebug, "%s\tNN\t", prefix);
560 else
561 fprintf(conn->Pfdebug, "%s\t%d\t", prefix, length);
562
563 switch (id)
564 {
565 case '1':
566 fprintf(conn->Pfdebug, "ParseComplete");
567 /* No message content */
568 break;
569 case '2':
570 fprintf(conn->Pfdebug, "BindComplete");
571 /* No message content */
572 break;
573 case '3':
574 fprintf(conn->Pfdebug, "CloseComplete");
575 /* No message content */
576 break;
577 case 'A': /* Notification Response */
578 pqTraceOutputA(conn->Pfdebug, message, &logCursor, regress);
579 break;
580 case 'B': /* Bind */
581 pqTraceOutputB(conn->Pfdebug, message, &logCursor);
582 break;
583 case 'c':
584 fprintf(conn->Pfdebug, "CopyDone");
585 /* No message content */

Callers 4

pqPutMsgEndNoAutoFlushFunction · 0.85
pqParseInput3Function · 0.85
getCopyDataMessageFunction · 0.85
pqFunctionCall3Function · 0.85

Calls 15

pqTraceFormatTimestampFunction · 0.85
pqTraceOutputAFunction · 0.85
pqTraceOutputBFunction · 0.85
pqTraceOutputCFunction · 0.85
pqTraceOutputDFunction · 0.85
pqTraceOutputEFunction · 0.85
pqTraceOutputfFunction · 0.85
pqTraceOutputFFunction · 0.85
pqTraceOutputGFunction · 0.85
pqTraceOutputHFunction · 0.85
pqTraceOutputKFunction · 0.85
pqTraceOutputNRFunction · 0.85

Tested by

no test coverage detected