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

Function pqPutMsgStart

src/interfaces/libpq/fe-misc.c:501–530  ·  view source on GitHub ↗

* pqPutMsgStart: begin construction of a message to the server * * msg_type is the message type byte, or 0 for a message without type byte * (only startup messages have no type byte) * * Returns 0 on success, EOF on error * * The idea here is that we construct the message in conn->outBuffer, * beginning just past any data already in outBuffer (ie, at * outBuffer+outCount). We enlarge the

Source from the content-addressed store, hash-verified

499 * the data collected so far.
500 */
501int
502pqPutMsgStart(char msg_type, PGconn *conn)
503{
504 int lenPos;
505 int endPos;
506
507 /* allow room for message type byte */
508 if (msg_type)
509 endPos = conn->outCount + 1;
510 else
511 endPos = conn->outCount;
512
513 /* do we want a length word? */
514 lenPos = endPos;
515 /* allow room for message length */
516 endPos += 4;
517
518 /* make sure there is room for message header */
519 if (pqCheckOutBufferSpace(endPos, conn))
520 return EOF;
521 /* okay, save the message type byte if any */
522 if (msg_type)
523 conn->outBuffer[conn->outCount] = msg_type;
524 /* set up the message pointers */
525 conn->outMsgStart = lenPos;
526 conn->outMsgEnd = endPos;
527 /* length word, if needed, will be filled in by pqPutMsgEnd */
528
529 return 0;
530}
531
532/*
533 * pqPutMsgBytes: add bytes to a partially-constructed message

Callers 14

send_sequence_responseFunction · 0.85
pg_SASL_initFunction · 0.85
sendTerminateConnFunction · 0.85
pqPacketSendFunction · 0.85
pqEndcopy3Function · 0.85
pqFunctionCall3Function · 0.85
PQsendQueryInternalFunction · 0.85
PQsendPrepareFunction · 0.85
PQsendQueryGutsFunction · 0.85
PQsendDescribeFunction · 0.85
PQputCopyDataFunction · 0.85
PQputCopyEndFunction · 0.85

Calls 1

pqCheckOutBufferSpaceFunction · 0.85

Tested by

no test coverage detected