PostgreSQL Source Code  git master
pqformat.h File Reference
#include "lib/stringinfo.h"
#include "mb/pg_wchar.h"
#include "port/pg_bswap.h"
Include dependency graph for pqformat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void pq_beginmessage (StringInfo buf, char msgtype)
 
void pq_beginmessage_reuse (StringInfo buf, char msgtype)
 
void pq_endmessage (StringInfo buf)
 
void pq_endmessage_reuse (StringInfo buf)
 
void pq_sendbytes (StringInfo buf, const char *data, int datalen)
 
void pq_sendcountedtext (StringInfo buf, const char *str, int slen, bool countincludesself)
 
void pq_sendtext (StringInfo buf, const char *str, int slen)
 
void pq_sendstring (StringInfo buf, const char *str)
 
void pq_send_ascii_string (StringInfo buf, const char *str)
 
void pq_sendfloat4 (StringInfo buf, float4 f)
 
void pq_sendfloat8 (StringInfo buf, float8 f)
 
static void pq_writeint8 (StringInfoData *pg_restrict buf, uint8 i)
 
static void pq_writeint16 (StringInfoData *pg_restrict buf, uint16 i)
 
static void pq_writeint32 (StringInfoData *pg_restrict buf, uint32 i)
 
static void pq_writeint64 (StringInfoData *pg_restrict buf, uint64 i)
 
static void pq_writestring (StringInfoData *pg_restrict buf, const char *pg_restrict str)
 
static void pq_sendint8 (StringInfo buf, uint8 i)
 
static void pq_sendint16 (StringInfo buf, uint16 i)
 
static void pq_sendint32 (StringInfo buf, uint32 i)
 
static void pq_sendint64 (StringInfo buf, uint64 i)
 
static void pq_sendbyte (StringInfo buf, uint8 byt)
 
static void pq_sendint (StringInfo buf, uint32 i, int b)
 
void pq_begintypsend (StringInfo buf)
 
byteapq_endtypsend (StringInfo buf)
 
void pq_puttextmessage (char msgtype, const char *str)
 
void pq_putemptymessage (char msgtype)
 
int pq_getmsgbyte (StringInfo msg)
 
unsigned int pq_getmsgint (StringInfo msg, int b)
 
int64 pq_getmsgint64 (StringInfo msg)
 
float4 pq_getmsgfloat4 (StringInfo msg)
 
float8 pq_getmsgfloat8 (StringInfo msg)
 
const char * pq_getmsgbytes (StringInfo msg, int datalen)
 
void pq_copymsgbytes (StringInfo msg, char *buf, int datalen)
 
char * pq_getmsgtext (StringInfo msg, int rawbytes, int *nbytes)
 
const char * pq_getmsgstring (StringInfo msg)
 
const char * pq_getmsgrawstring (StringInfo msg)
 
void pq_getmsgend (StringInfo msg)
 

Function Documentation

◆ pq_beginmessage()

void pq_beginmessage ( StringInfo  buf,
char  msgtype 
)

Definition at line 88 of file pqformat.c.

89 {
91 
92  /*
93  * We stash the message type into the buffer's cursor field, expecting
94  * that the pq_sendXXX routines won't touch it. We could alternatively
95  * make it the first byte of the buffer contents, but this seems easier.
96  */
97  buf->cursor = msgtype;
98 }
static char * buf
Definition: pg_test_fsync.c:67
void initStringInfo(StringInfo str)
Definition: stringinfo.c:59

References buf, and initStringInfo().

Referenced by bbsink_copystream_archive_contents(), bbsink_copystream_begin_archive(), bbsink_copystream_begin_manifest(), bbsink_copystream_end_archive(), NotifyMyFrontEnd(), ParallelWorkerMain(), PostgresMain(), printsimple(), printsimple_startup(), ReadyForQuery(), ReceiveCopyBegin(), ReportGUCOption(), send_message_to_frontend(), sendAuthRequest(), SendCopyBegin(), SendCopyOutResponse(), SendFunctionResult(), SendNegotiateProtocolVersion(), SendTimeLineHistory(), StartLogicalReplication(), and StartReplication().

◆ pq_beginmessage_reuse()

void pq_beginmessage_reuse ( StringInfo  buf,
char  msgtype 
)

Definition at line 109 of file pqformat.c.

110 {
112 
113  /*
114  * We stash the message type into the buffer's cursor field, expecting
115  * that the pq_sendXXX routines won't touch it. We could alternatively
116  * make it the first byte of the buffer contents, but this seems easier.
117  */
118  buf->cursor = msgtype;
119 }
void resetStringInfo(StringInfo str)
Definition: stringinfo.c:75

References buf, and resetStringInfo().

Referenced by exec_describe_statement_message(), printtup(), and SendRowDescriptionMessage().

◆ pq_begintypsend()

◆ pq_copymsgbytes()

void pq_copymsgbytes ( StringInfo  msg,
char *  buf,
int  datalen 
)

Definition at line 531 of file pqformat.c.

532 {
533  if (datalen < 0 || datalen > (msg->len - msg->cursor))
534  ereport(ERROR,
535  (errcode(ERRCODE_PROTOCOL_VIOLATION),
536  errmsg("insufficient data left in message")));
537  memcpy(buf, &msg->data[msg->cursor], datalen);
538  msg->cursor += datalen;
539 }
int errcode(int sqlerrcode)
Definition: elog.c:858
int errmsg(const char *fmt,...)
Definition: elog.c:1069
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149

References buf, StringInfoData::cursor, StringInfoData::data, ereport, errcode(), errmsg(), ERROR, and StringInfoData::len.

Referenced by bit_recv(), bytearecv(), CopyGetData(), logicalrep_read_tuple(), pq_getmsgint(), pq_getmsgint64(), and varbit_recv().

◆ pq_endmessage()

void pq_endmessage ( StringInfo  buf)

Definition at line 299 of file pqformat.c.

300 {
301  /* msgtype was saved in cursor field */
302  (void) pq_putmessage(buf->cursor, buf->data, buf->len);
303  /* no need to complain about any failure, since pqcomm.c already did */
304  pfree(buf->data);
305  buf->data = NULL;
306 }
#define pq_putmessage(msgtype, s, len)
Definition: libpq.h:49
void pfree(void *pointer)
Definition: mcxt.c:1436

References buf, pfree(), and pq_putmessage.

Referenced by bbsink_copystream_archive_contents(), bbsink_copystream_begin_archive(), bbsink_copystream_begin_manifest(), bbsink_copystream_end_archive(), HandleParallelMessage(), NotifyMyFrontEnd(), ParallelWorkerMain(), PostgresMain(), printsimple(), printsimple_startup(), ReadyForQuery(), ReceiveCopyBegin(), ReportGUCOption(), send_message_to_frontend(), sendAuthRequest(), SendCopyBegin(), SendCopyOutResponse(), SendFunctionResult(), SendNegotiateProtocolVersion(), SendTimeLineHistory(), StartLogicalReplication(), and StartReplication().

◆ pq_endmessage_reuse()

void pq_endmessage_reuse ( StringInfo  buf)

Definition at line 317 of file pqformat.c.

318 {
319  /* msgtype was saved in cursor field */
320  (void) pq_putmessage(buf->cursor, buf->data, buf->len);
321 }

References buf, and pq_putmessage.

Referenced by exec_describe_statement_message(), printtup(), and SendRowDescriptionMessage().

◆ pq_endtypsend()

bytea* pq_endtypsend ( StringInfo  buf)

◆ pq_getmsgbyte()

◆ pq_getmsgbytes()

const char* pq_getmsgbytes ( StringInfo  msg,
int  datalen 
)

Definition at line 511 of file pqformat.c.

512 {
513  const char *result;
514 
515  if (datalen < 0 || datalen > (msg->len - msg->cursor))
516  ereport(ERROR,
517  (errcode(ERRCODE_PROTOCOL_VIOLATION),
518  errmsg("insufficient data left in message")));
519  result = &msg->data[msg->cursor];
520  msg->cursor += datalen;
521  return result;
522 }

References StringInfoData::cursor, StringInfoData::data, ereport, errcode(), errmsg(), ERROR, and StringInfoData::len.

Referenced by array_agg_array_deserialize(), array_agg_deserialize(), CheckSASLAuth(), exec_bind_message(), multirange_recv(), parse_fcall_arguments(), range_recv(), string_agg_deserialize(), uuid_recv(), and xml_recv().

◆ pq_getmsgend()

◆ pq_getmsgfloat4()

float4 pq_getmsgfloat4 ( StringInfo  msg)

Definition at line 472 of file pqformat.c.

473 {
474  union
475  {
476  float4 f;
477  uint32 i;
478  } swap;
479 
480  swap.i = pq_getmsgint(msg, 4);
481  return swap.f;
482 }
unsigned int uint32
Definition: c.h:490
float float4
Definition: c.h:613
int i
Definition: isn.c:73
unsigned int pq_getmsgint(StringInfo msg, int b)
Definition: pqformat.c:418

References i, and pq_getmsgint().

Referenced by float4recv().

◆ pq_getmsgfloat8()

float8 pq_getmsgfloat8 ( StringInfo  msg)

Definition at line 491 of file pqformat.c.

492 {
493  union
494  {
495  float8 f;
496  int64 i;
497  } swap;
498 
499  swap.i = pq_getmsgint64(msg);
500  return swap.f;
501 }
double float8
Definition: c.h:614
int64 pq_getmsgint64(StringInfo msg)
Definition: pqformat.c:456

References i, and pq_getmsgint64().

Referenced by box_recv(), circle_recv(), complex_recv(), cube_recv(), float8recv(), line_recv(), lseg_recv(), path_recv(), point_recv(), and poly_recv().

◆ pq_getmsgint()

unsigned int pq_getmsgint ( StringInfo  msg,
int  b 
)

Definition at line 418 of file pqformat.c.

419 {
420  unsigned int result;
421  unsigned char n8;
422  uint16 n16;
423  uint32 n32;
424 
425  switch (b)
426  {
427  case 1:
428  pq_copymsgbytes(msg, (char *) &n8, 1);
429  result = n8;
430  break;
431  case 2:
432  pq_copymsgbytes(msg, (char *) &n16, 2);
433  result = pg_ntoh16(n16);
434  break;
435  case 4:
436  pq_copymsgbytes(msg, (char *) &n32, 4);
437  result = pg_ntoh32(n32);
438  break;
439  default:
440  elog(ERROR, "unsupported integer size %d", b);
441  result = 0; /* keep compiler quiet */
442  break;
443  }
444  return result;
445 }
unsigned short uint16
Definition: c.h:489
int b
Definition: isn.c:70
#define pg_ntoh32(x)
Definition: pg_bswap.h:125
#define pg_ntoh16(x)
Definition: pg_bswap.h:124
void pq_copymsgbytes(StringInfo msg, char *buf, int datalen)
Definition: pqformat.c:531

References b, elog(), ERROR, pg_ntoh16, pg_ntoh32, and pq_copymsgbytes().

Referenced by array_agg_array_deserialize(), array_agg_deserialize(), array_recv(), bit_recv(), CheckSASLAuth(), cidrecv(), cube_recv(), date_recv(), exec_bind_message(), handle_streamed_transaction(), HandleFunctionRequest(), HandleParallelMessage(), hstore_recv(), int2recv(), int4recv(), interval_recv(), jsonb_recv(), jsonpath_recv(), logicalrep_read_attrs(), logicalrep_read_begin(), logicalrep_read_begin_prepare(), logicalrep_read_commit_prepared(), logicalrep_read_delete(), logicalrep_read_insert(), logicalrep_read_prepare_common(), logicalrep_read_rel(), logicalrep_read_rollback_prepared(), logicalrep_read_stream_abort(), logicalrep_read_stream_commit(), logicalrep_read_stream_start(), logicalrep_read_truncate(), logicalrep_read_tuple(), logicalrep_read_typ(), logicalrep_read_update(), lquery_recv(), ltree_recv(), ltxtq_recv(), multirange_recv(), numeric_avg_deserialize(), numeric_deserialize(), numeric_recv(), numericvar_deserialize(), oidrecv(), parse_fcall_arguments(), path_recv(), pg_snapshot_recv(), poly_recv(), PostgresMain(), pq_getmsgfloat4(), ProcessStandbyHSFeedbackMessage(), range_recv(), ReadArrayBinary(), record_recv(), string_agg_deserialize(), tidrecv(), timetz_recv(), tsqueryrecv(), tsvectorrecv(), varbit_recv(), and xidrecv().

◆ pq_getmsgint64()

◆ pq_getmsgrawstring()

const char* pq_getmsgrawstring ( StringInfo  msg)

Definition at line 611 of file pqformat.c.

612 {
613  char *str;
614  int slen;
615 
616  str = &msg->data[msg->cursor];
617 
618  /*
619  * It's safe to use strlen() here because a StringInfo is guaranteed to
620  * have a trailing null byte. But check we found a null inside the
621  * message.
622  */
623  slen = strlen(str);
624  if (msg->cursor + slen >= msg->len)
625  ereport(ERROR,
626  (errcode(ERRCODE_PROTOCOL_VIOLATION),
627  errmsg("invalid string in message")));
628  msg->cursor += slen + 1;
629 
630  return str;
631 }

References StringInfoData::cursor, StringInfoData::data, ereport, errcode(), errmsg(), ERROR, StringInfoData::len, and generate_unaccent_rules::str.

Referenced by CheckSASLAuth(), HandleParallelMessage(), and pq_parse_errornotice().

◆ pq_getmsgstring()

const char* pq_getmsgstring ( StringInfo  msg)

Definition at line 582 of file pqformat.c.

583 {
584  char *str;
585  int slen;
586 
587  str = &msg->data[msg->cursor];
588 
589  /*
590  * It's safe to use strlen() here because a StringInfo is guaranteed to
591  * have a trailing null byte. But check we found a null inside the
592  * message.
593  */
594  slen = strlen(str);
595  if (msg->cursor + slen >= msg->len)
596  ereport(ERROR,
597  (errcode(ERRCODE_PROTOCOL_VIOLATION),
598  errmsg("invalid string in message")));
599  msg->cursor += slen + 1;
600 
601  return pg_client_to_server(str, slen);
602 }
char * pg_client_to_server(const char *s, int len)
Definition: mbutils.c:661

References StringInfoData::cursor, StringInfoData::data, ereport, errcode(), errmsg(), ERROR, StringInfoData::len, pg_client_to_server(), and generate_unaccent_rules::str.

Referenced by CopyGetData(), exec_bind_message(), logicalrep_read_attrs(), logicalrep_read_begin_prepare(), logicalrep_read_commit_prepared(), logicalrep_read_namespace(), logicalrep_read_origin(), logicalrep_read_prepare_common(), logicalrep_read_rel(), logicalrep_read_rollback_prepared(), logicalrep_read_typ(), PostgresMain(), tsqueryrecv(), and tsvectorrecv().

◆ pq_getmsgtext()

char* pq_getmsgtext ( StringInfo  msg,
int  rawbytes,
int *  nbytes 
)

Definition at line 549 of file pqformat.c.

550 {
551  char *str;
552  char *p;
553 
554  if (rawbytes < 0 || rawbytes > (msg->len - msg->cursor))
555  ereport(ERROR,
556  (errcode(ERRCODE_PROTOCOL_VIOLATION),
557  errmsg("insufficient data left in message")));
558  str = &msg->data[msg->cursor];
559  msg->cursor += rawbytes;
560 
561  p = pg_client_to_server(str, rawbytes);
562  if (p != str) /* actual conversion has been done? */
563  *nbytes = strlen(p);
564  else
565  {
566  p = (char *) palloc(rawbytes + 1);
567  memcpy(p, str, rawbytes);
568  p[rawbytes] = '\0';
569  *nbytes = rawbytes;
570  }
571  return p;
572 }
void * palloc(Size size)
Definition: mcxt.c:1210

References StringInfoData::cursor, StringInfoData::data, ereport, errcode(), errmsg(), ERROR, StringInfoData::len, palloc(), pg_client_to_server(), and generate_unaccent_rules::str.

Referenced by bpcharrecv(), cstring_recv(), enum_recv(), hstore_recv(), json_recv(), jsonb_recv(), jsonpath_recv(), lquery_recv(), ltree_recv(), ltxtq_recv(), namerecv(), textrecv(), unknownrecv(), and varcharrecv().

◆ pq_putemptymessage()

void pq_putemptymessage ( char  msgtype)

◆ pq_puttextmessage()

void pq_puttextmessage ( char  msgtype,
const char *  str 
)

Definition at line 370 of file pqformat.c.

371 {
372  int slen = strlen(str);
373  char *p;
374 
375  p = pg_server_to_client(str, slen);
376  if (p != str) /* actual conversion has been done? */
377  {
378  (void) pq_putmessage(msgtype, p, strlen(p) + 1);
379  pfree(p);
380  return;
381  }
382  (void) pq_putmessage(msgtype, str, slen + 1);
383 }
char * pg_server_to_client(const char *s, int len)
Definition: mbutils.c:739

References pfree(), pg_server_to_client(), pq_putmessage, and generate_unaccent_rules::str.

Referenced by bbsink_copystream_begin_backup(), and SendXlogRecPtrResult().

◆ pq_send_ascii_string()

void pq_send_ascii_string ( StringInfo  buf,
const char *  str 
)

Definition at line 230 of file pqformat.c.

231 {
232  while (*str)
233  {
234  char ch = *str++;
235 
236  if (IS_HIGHBIT_SET(ch))
237  ch = '?';
239  }
240  appendStringInfoChar(buf, '\0');
241 }
#define IS_HIGHBIT_SET(ch)
Definition: c.h:1145
void appendStringInfoChar(StringInfo str, char ch)
Definition: stringinfo.c:188

References appendStringInfoChar(), appendStringInfoCharMacro, buf, IS_HIGHBIT_SET, and generate_unaccent_rules::str.

Referenced by err_sendstring().

◆ pq_sendbyte()

◆ pq_sendbytes()

void pq_sendbytes ( StringInfo  buf,
const char *  data,
int  datalen 
)

Definition at line 126 of file pqformat.c.

127 {
128  /* use variant that maintains a trailing null-byte, out of caution */
129  appendBinaryStringInfo(buf, data, datalen);
130 }
const void * data
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
Definition: stringinfo.c:227

References appendBinaryStringInfo(), buf, and data.

Referenced by array_agg_array_serialize(), array_agg_serialize(), array_send(), logicalrep_write_message(), logicalrep_write_tuple(), multirange_send(), printtup(), range_send(), record_send(), sendAuthRequest(), SendFunctionResult(), SendTimeLineHistory(), string_agg_serialize(), uuid_send(), and varbit_send().

◆ pq_sendcountedtext()

void pq_sendcountedtext ( StringInfo  buf,
const char *  str,
int  slen,
bool  countincludesself 
)

Definition at line 143 of file pqformat.c.

145 {
146  int extra = countincludesself ? 4 : 0;
147  char *p;
148 
149  p = pg_server_to_client(str, slen);
150  if (p != str) /* actual conversion has been done? */
151  {
152  slen = strlen(p);
153  pq_sendint32(buf, slen + extra);
154  appendBinaryStringInfoNT(buf, p, slen);
155  pfree(p);
156  }
157  else
158  {
159  pq_sendint32(buf, slen + extra);
161  }
162 }
static void pq_sendint32(StringInfo buf, uint32 i)
Definition: pqformat.h:145
void appendBinaryStringInfoNT(StringInfo str, const void *data, int datalen)
Definition: stringinfo.c:253

References appendBinaryStringInfoNT(), buf, pfree(), pg_server_to_client(), pq_sendint32(), and generate_unaccent_rules::str.

Referenced by logicalrep_write_tuple(), printsimple(), printtup(), and SendFunctionResult().

◆ pq_sendfloat4()

void pq_sendfloat4 ( StringInfo  buf,
float4  f 
)

Definition at line 255 of file pqformat.c.

256 {
257  union
258  {
259  float4 f;
260  uint32 i;
261  } swap;
262 
263  swap.f = f;
264  pq_sendint32(buf, swap.i);
265 }

References buf, i, and pq_sendint32().

Referenced by float4send().

◆ pq_sendfloat8()

void pq_sendfloat8 ( StringInfo  buf,
float8  f 
)

Definition at line 279 of file pqformat.c.

280 {
281  union
282  {
283  float8 f;
284  int64 i;
285  } swap;
286 
287  swap.f = f;
288  pq_sendint64(buf, swap.i);
289 }
static void pq_sendint64(StringInfo buf, uint64 i)
Definition: pqformat.h:153

References buf, i, and pq_sendint64().

Referenced by box_send(), circle_send(), complex_send(), cube_send(), float8send(), line_send(), lseg_send(), path_send(), point_send(), and poly_send().

◆ pq_sendint()

static void pq_sendint ( StringInfo  buf,
uint32  i,
int  b 
)
inlinestatic

Definition at line 172 of file pqformat.h.

173 {
174  switch (b)
175  {
176  case 1:
177  pq_sendint8(buf, (uint8) i);
178  break;
179  case 2:
180  pq_sendint16(buf, (uint16) i);
181  break;
182  case 4:
183  pq_sendint32(buf, (uint32) i);
184  break;
185  default:
186  elog(ERROR, "unsupported integer size %d", b);
187  break;
188  }
189 }
unsigned char uint8
Definition: c.h:488
static void pq_sendint16(StringInfo buf, uint16 i)
Definition: pqformat.h:137

References b, buf, elog(), ERROR, i, pq_sendint16(), pq_sendint32(), and pq_sendint8().

Referenced by logicalrep_write_tuple(), and string_agg_serialize().

◆ pq_sendint16()

◆ pq_sendint32()

static void pq_sendint32 ( StringInfo  buf,
uint32  i 
)
inlinestatic

Definition at line 145 of file pqformat.h.

146 {
147  enlargeStringInfo(buf, sizeof(uint32));
148  pq_writeint32(buf, i);
149 }
static void pq_writeint32(StringInfoData *pg_restrict buf, uint32 i)
Definition: pqformat.h:75

References buf, enlargeStringInfo(), i, and pq_writeint32().

Referenced by array_agg_array_serialize(), array_agg_serialize(), array_send(), cidsend(), cube_send(), date_send(), exec_describe_statement_message(), hstore_send(), int4send(), interval_send(), logicalrep_write_attrs(), logicalrep_write_begin(), logicalrep_write_begin_prepare(), logicalrep_write_commit_prepared(), logicalrep_write_delete(), logicalrep_write_insert(), logicalrep_write_message(), logicalrep_write_prepare_common(), logicalrep_write_rel(), logicalrep_write_rollback_prepared(), logicalrep_write_stream_abort(), logicalrep_write_stream_commit(), logicalrep_write_stream_start(), logicalrep_write_truncate(), logicalrep_write_typ(), logicalrep_write_update(), multirange_send(), NotifyMyFrontEnd(), numeric_avg_serialize(), numeric_serialize(), numericvar_serialize(), oidsend(), ParallelWorkerMain(), path_send(), pg_snapshot_send(), poly_send(), PostgresMain(), pq_sendcountedtext(), pq_sendfloat4(), pq_sendint(), printsimple(), printsimple_startup(), printtup(), range_send(), record_send(), sendAuthRequest(), SendFunctionResult(), SendNegotiateProtocolVersion(), SendTimeLineHistory(), tidsend(), timetz_send(), tsquerysend(), tsvectorsend(), varbit_send(), xidsend(), and XLogWalRcvSendHSFeedback().

◆ pq_sendint64()

◆ pq_sendint8()

static void pq_sendint8 ( StringInfo  buf,
uint8  i 
)
inlinestatic

Definition at line 129 of file pqformat.h.

130 {
131  enlargeStringInfo(buf, sizeof(uint8));
132  pq_writeint8(buf, i);
133 }
static void pq_writeint8(StringInfoData *pg_restrict buf, uint8 i)
Definition: pqformat.h:47

References buf, enlargeStringInfo(), i, and pq_writeint8().

Referenced by jsonb_send(), jsonpath_send(), logicalrep_write_message(), logicalrep_write_truncate(), lquery_send(), ltree_send(), ltxtq_send(), pq_sendbyte(), pq_sendint(), and tsquerysend().

◆ pq_sendstring()

◆ pq_sendtext()

void pq_sendtext ( StringInfo  buf,
const char *  str,
int  slen 
)

Definition at line 175 of file pqformat.c.

176 {
177  char *p;
178 
179  p = pg_server_to_client(str, slen);
180  if (p != str) /* actual conversion has been done? */
181  {
182  slen = strlen(p);
183  appendBinaryStringInfo(buf, p, slen);
184  pfree(p);
185  }
186  else
188 }

References appendBinaryStringInfo(), buf, pfree(), pg_server_to_client(), and generate_unaccent_rules::str.

Referenced by cstring_send(), enum_send(), hstore_send(), json_send(), jsonb_send(), jsonpath_send(), lquery_send(), ltree_send(), ltxtq_send(), namesend(), textsend(), tsvectorsend(), unknownsend(), and xml_send().

◆ pq_writeint16()

static void pq_writeint16 ( StringInfoData *pg_restrict  buf,
uint16  i 
)
inlinestatic

Definition at line 61 of file pqformat.h.

62 {
63  uint16 ni = pg_hton16(i);
64 
65  Assert(buf->len + (int) sizeof(uint16) <= buf->maxlen);
66  memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint16));
67  buf->len += sizeof(uint16);
68 }
#define pg_hton16(x)
Definition: pg_bswap.h:120

References Assert(), buf, i, and pg_hton16.

Referenced by pq_sendint16(), and SendRowDescriptionMessage().

◆ pq_writeint32()

static void pq_writeint32 ( StringInfoData *pg_restrict  buf,
uint32  i 
)
inlinestatic

Definition at line 75 of file pqformat.h.

76 {
77  uint32 ni = pg_hton32(i);
78 
79  Assert(buf->len + (int) sizeof(uint32) <= buf->maxlen);
80  memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint32));
81  buf->len += sizeof(uint32);
82 }
#define pg_hton32(x)
Definition: pg_bswap.h:121

References Assert(), buf, i, and pg_hton32.

Referenced by pq_sendint32(), and SendRowDescriptionMessage().

◆ pq_writeint64()

static void pq_writeint64 ( StringInfoData *pg_restrict  buf,
uint64  i 
)
inlinestatic

Definition at line 89 of file pqformat.h.

90 {
91  uint64 ni = pg_hton64(i);
92 
93  Assert(buf->len + (int) sizeof(uint64) <= buf->maxlen);
94  memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint64));
95  buf->len += sizeof(uint64);
96 }
#define pg_hton64(x)
Definition: pg_bswap.h:122

References Assert(), buf, i, and pg_hton64.

Referenced by pq_sendint64().

◆ pq_writeint8()

static void pq_writeint8 ( StringInfoData *pg_restrict  buf,
uint8  i 
)
inlinestatic

Definition at line 47 of file pqformat.h.

48 {
49  uint8 ni = i;
50 
51  Assert(buf->len + (int) sizeof(uint8) <= buf->maxlen);
52  memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(uint8));
53  buf->len += sizeof(uint8);
54 }

References Assert(), buf, and i.

Referenced by pq_sendint8().

◆ pq_writestring()

static void pq_writestring ( StringInfoData *pg_restrict  buf,
const char *pg_restrict  str 
)
inlinestatic

Definition at line 109 of file pqformat.h.

110 {
111  int slen = strlen(str);
112  char *p;
113 
114  p = pg_server_to_client(str, slen);
115  if (p != str) /* actual conversion has been done? */
116  slen = strlen(p);
117 
118  Assert(buf->len + slen + 1 <= buf->maxlen);
119 
120  memcpy(((char *pg_restrict) buf->data + buf->len), p, slen + 1);
121  buf->len += slen + 1;
122 
123  if (p != str)
124  pfree(p);
125 }

References Assert(), buf, pfree(), pg_server_to_client(), and generate_unaccent_rules::str.

Referenced by SendRowDescriptionMessage().