PostgreSQL Source Code: src/backend/utils/adt/char.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
17
18#include <limits.h>
19
21#include "utils/fmgrprotos.h"
23
24#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
25#define TOOCTAL(c) ((c) + '0')
26#define FROMOCTAL(c) ((unsigned char) (c) - '0')
27
28
29
30
31
32
33
34
35
36
37
38
39
42{
44
45 if (strlen(ch) == 4 && ch[0] == '\\' &&
50
52}
53
54
55
56
57
58
59
60
61
62
65{
67 char *result = (char *) palloc(5);
68
70 {
71 result[0] = '\\';
72 result[1] = TOOCTAL(((unsigned char) ch) >> 6);
73 result[2] = TOOCTAL((((unsigned char) ch) >> 3) & 07);
74 result[3] = TOOCTAL(((unsigned char) ch) & 07);
75 result[4] = '\0';
76 }
77 else
78 {
79
80 result[0] = ch;
81 result[1] = '\0';
82 }
84}
85
86
87
88
89
90
91
92
100
101
102
103
114
115
116
117
118
119
120
121
122
123
124
125
134
143
152
161
170
179
180
188
191{
193
197 errmsg("\"char\" out of range")));
198
200}
201
202
205{
208 char result;
209
210
211
212
213
220 result = ch[0];
221 else
222 result = '\0';
223
225}
226
229{
232
233
234
235
236
238 {
240 (VARDATA(result))[0] = '\\';
244 }
245 else if (arg1 != '\0')
246 {
249 }
250 else
252
254}
#define IS_HIGHBIT_SET(ch)
Datum charge(PG_FUNCTION_ARGS)
Datum charle(PG_FUNCTION_ARGS)
Datum chareq(PG_FUNCTION_ARGS)
Datum charrecv(PG_FUNCTION_ARGS)
Datum chargt(PG_FUNCTION_ARGS)
Datum chartoi4(PG_FUNCTION_ARGS)
Datum text_char(PG_FUNCTION_ARGS)
Datum charne(PG_FUNCTION_ARGS)
Datum charin(PG_FUNCTION_ARGS)
Datum charsend(PG_FUNCTION_ARGS)
Datum charlt(PG_FUNCTION_ARGS)
Datum charout(PG_FUNCTION_ARGS)
Datum char_text(PG_FUNCTION_ARGS)
Datum i4tochar(PG_FUNCTION_ARGS)
int errcode(int sqlerrcode)
#define ereport(elevel,...)
#define PG_GETARG_TEXT_PP(n)
#define PG_RETURN_BYTEA_P(x)
#define PG_GETARG_CHAR(n)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_CSTRING(x)
#define PG_GETARG_CSTRING(n)
#define PG_RETURN_CHAR(x)
#define PG_RETURN_TEXT_P(x)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
#define PG_RETURN_BOOL(x)
static char buf[DEFAULT_XLOG_SEG_SIZE]
void pq_begintypsend(StringInfo buf)
int pq_getmsgbyte(StringInfo msg)
bytea * pq_endtypsend(StringInfo buf)
static void pq_sendbyte(StringInfo buf, uint8 byt)
struct StringInfoData * StringInfo
static Size VARSIZE_ANY_EXHDR(const void *PTR)
static char * VARDATA(const void *PTR)
static char * VARDATA_ANY(const void *PTR)
static void SET_VARSIZE(void *PTR, Size len)