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

Function pqGetInt

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

* pqGetInt * read a 2 or 4 byte integer and convert from network byte order * to local byte order */

Source from the content-addressed store, hash-verified

221 * to local byte order
222 */
223int
224pqGetInt(int *result, size_t bytes, PGconn *conn)
225{
226 uint16 tmp2;
227 uint32 tmp4;
228
229 switch (bytes)
230 {
231 case 2:
232 if (conn->inCursor + 2 > conn->inEnd)
233 return EOF;
234 memcpy(&tmp2, conn->inBuffer + conn->inCursor, 2);
235 conn->inCursor += 2;
236 *result = (int) pg_ntoh16(tmp2);
237 break;
238 case 4:
239 if (conn->inCursor + 4 > conn->inEnd)
240 return EOF;
241 memcpy(&tmp4, conn->inBuffer + conn->inCursor, 4);
242 conn->inCursor += 4;
243 *result = (int) pg_ntoh32(tmp4);
244 break;
245 default:
246 pqInternalNotice(&conn->noticeHooks,
247 "integer of size %lu not supported by pqGetInt",
248 (unsigned long) bytes);
249 return EOF;
250 }
251
252 return 0;
253}
254
255int64
256pqGetInt64(int64 *result, PGconn *conn)

Callers 10

HandleExtendProtocolFunction · 0.85
PQconnectPollFunction · 0.85
pqParseInput3Function · 0.85
getRowDescriptionsFunction · 0.85
getParamDescriptionsFunction · 0.85
getAnotherTupleFunction · 0.85
getNotifyFunction · 0.85
getCopyStartFunction · 0.85
getCopyDataMessageFunction · 0.85
pqFunctionCall3Function · 0.85

Calls 1

pqInternalNoticeFunction · 0.85

Tested by

no test coverage detected