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

Function pqGets_internal

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

* pqGets[_append]: * get a null-terminated string from the connection, * and store it in an expansible PQExpBuffer. * If we run out of memory, all of the string is still read, * but the excess characters are silently discarded. */

Source from the content-addressed store, hash-verified

114 * but the excess characters are silently discarded.
115 */
116static int
117pqGets_internal(PQExpBuffer buf, PGconn *conn, bool resetbuffer)
118{
119 /* Copy conn data to locals for faster search loop */
120 char *inBuffer = conn->inBuffer;
121 int inCursor = conn->inCursor;
122 int inEnd = conn->inEnd;
123 int slen;
124
125 while (inCursor < inEnd && inBuffer[inCursor])
126 inCursor++;
127
128 if (inCursor >= inEnd)
129 return EOF;
130
131 slen = inCursor - conn->inCursor;
132
133 if (resetbuffer)
134 resetPQExpBuffer(buf);
135
136 appendBinaryPQExpBuffer(buf, inBuffer + conn->inCursor, slen);
137
138 conn->inCursor = ++inCursor;
139
140 return 0;
141}
142
143int
144pqGets(PQExpBuffer buf, PGconn *conn)

Callers 2

pqGetsFunction · 0.85
pqGets_appendFunction · 0.85

Calls 2

resetPQExpBufferFunction · 0.85
appendBinaryPQExpBufferFunction · 0.85

Tested by

no test coverage detected