PostgreSQL Source Code git master
Loading...
Searching...
No Matches
stringinfo_mb.h File Reference
#include "lib/stringinfo.h"
Include dependency graph for stringinfo_mb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void appendStringInfoStringQuoted (StringInfo str, const char *s, int maxlen)
 

Function Documentation

◆ appendStringInfoStringQuoted()

void appendStringInfoStringQuoted ( StringInfo  str,
const char s,
int  maxlen 
)
extern

Definition at line 34 of file stringinfo_mb.c.

35{
36 char *copy = NULL;
37 const char *chunk_search_start,
39 *chunk_end;
40 int slen;
41 bool ellipsis;
42
43 Assert(str != NULL);
44
45 slen = strlen(s);
46 if (maxlen >= 0 && maxlen < slen)
47 {
48 int finallen = pg_mbcliplen(s, slen, maxlen);
49
53
54 ellipsis = true;
55 }
56 else
57 {
60
61 ellipsis = false;
62 }
63
65
66 while ((chunk_end = strchr(chunk_search_start, '\'')) != NULL)
67 {
68 /* copy including the found delimiting ' */
72
73 /* in order to double it, include this ' into the next chunk as well */
76 }
77
78 /* copy the last chunk and terminate */
79 if (ellipsis)
81 else
83
84 if (copy)
85 pfree(copy);
86}
#define Assert(condition)
Definition c.h:873
const char * str
int pg_mbcliplen(const char *mbstr, int len, int limit)
Definition mbutils.c:1086
void pfree(void *pointer)
Definition mcxt.c:1616
char * pnstrdup(const char *in, Size len)
Definition mcxt.c:1792
static int fb(int x)
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition stringinfo.c:145
void appendBinaryStringInfoNT(StringInfo str, const void *data, int datalen)
Definition stringinfo.c:307
#define appendStringInfoCharMacro(str, ch)
Definition stringinfo.h:231

References appendBinaryStringInfoNT(), appendStringInfo(), appendStringInfoCharMacro, Assert, fb(), pfree(), pg_mbcliplen(), pnstrdup(), and str.

Referenced by bind_param_error_callback(), BuildParamLogString(), format_expr_params(), and format_preparedparamsdata().