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

Function pqPutInt

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

* pqPutInt * write an integer of 2 or 4 bytes, converting from host byte order * to network byte order. */

Source from the content-addressed store, hash-verified

294 * to network byte order.
295 */
296int
297pqPutInt(int value, size_t bytes, PGconn *conn)
298{
299 uint16 tmp2;
300 uint32 tmp4;
301
302 switch (bytes)
303 {
304 case 2:
305 tmp2 = pg_hton16((uint16) value);
306 if (pqPutMsgBytes((const char *) &tmp2, 2, conn))
307 return EOF;
308 break;
309 case 4:
310 tmp4 = pg_hton32((uint32) value);
311 if (pqPutMsgBytes((const char *) &tmp4, 4, conn))
312 return EOF;
313 break;
314 default:
315 pqInternalNotice(&conn->noticeHooks,
316 "integer of size %lu not supported by pqPutInt",
317 (unsigned long) bytes);
318 return EOF;
319 }
320
321 return 0;
322}
323
324/*
325 * Make sure conn's output buffer can hold bytes_needed bytes (caller must

Callers 6

send_sequence_responseFunction · 0.85
pg_SASL_initFunction · 0.85
pqFunctionCall3Function · 0.85
PQsendQueryInternalFunction · 0.85
PQsendPrepareFunction · 0.85
PQsendQueryGutsFunction · 0.85

Calls 2

pqPutMsgBytesFunction · 0.85
pqInternalNoticeFunction · 0.85

Tested by

no test coverage detected