Unmark gen_random_uuid() function leakproof.
[pgsql.git] / src / include / fe_utils / string_utils.h
blobf150a7f7ef7d8d88ade4ccf45a99c64ccaf2b604
1 /*-------------------------------------------------------------------------
3 * String-processing utility routines for frontend code
5 * Utility functions that interpret backend output or quote strings for
6 * assorted contexts.
9 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
10 * Portions Copyright (c) 1994, Regents of the University of California
12 * src/include/fe_utils/string_utils.h
14 *-------------------------------------------------------------------------
16 #ifndef STRING_UTILS_H
17 #define STRING_UTILS_H
19 #include "libpq-fe.h"
20 #include "pqexpbuffer.h"
22 /* Global variables controlling behavior of fmtId() and fmtQualifiedId() */
23 extern PGDLLIMPORT int quote_all_identifiers;
24 extern PQExpBuffer (*getLocalPQExpBuffer) (void);
26 /* Functions */
27 extern const char *fmtId(const char *rawid);
28 extern const char *fmtQualifiedId(const char *schema, const char *id);
30 extern char *formatPGVersionNumber(int version_number, bool include_minor,
31 char *buf, size_t buflen);
33 extern void appendStringLiteral(PQExpBuffer buf, const char *str,
34 int encoding, bool std_strings);
35 extern void appendStringLiteralConn(PQExpBuffer buf, const char *str,
36 PGconn *conn);
37 extern void appendStringLiteralDQ(PQExpBuffer buf, const char *str,
38 const char *dqprefix);
39 extern void appendByteaLiteral(PQExpBuffer buf,
40 const unsigned char *str, size_t length,
41 bool std_strings);
43 extern void appendShellString(PQExpBuffer buf, const char *str);
44 extern bool appendShellStringNoError(PQExpBuffer buf, const char *str);
45 extern void appendConnStrVal(PQExpBuffer buf, const char *str);
46 extern void appendPsqlMetaConnect(PQExpBuffer buf, const char *dbname);
48 extern bool parsePGArray(const char *atext, char ***itemarray, int *nitems);
49 extern void appendPGArray(PQExpBuffer buffer, const char *value);
51 extern bool appendReloptionsArray(PQExpBuffer buffer, const char *reloptions,
52 const char *prefix, int encoding, bool std_strings);
54 extern bool processSQLNamePattern(PGconn *conn, PQExpBuffer buf,
55 const char *pattern,
56 bool have_where, bool force_escape,
57 const char *schemavar, const char *namevar,
58 const char *altnamevar, const char *visibilityrule,
59 PQExpBuffer dbnamebuf, int *dotcnt);
61 extern void patternToSQLRegex(int encoding, PQExpBuffer dbnamebuf,
62 PQExpBuffer schemabuf, PQExpBuffer namebuf,
63 const char *pattern, bool force_escape,
64 bool want_literal_dbname, int *dotcnt);
66 #endif /* STRING_UTILS_H */