mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Create src/fe_utils/, and move stuff into there from pg_dump's dumputils.
Per discussion, we want to create a static library and put the stuff into it that until now has been shared across src/bin/ directories by ad-hoc methods like symlinking a source file. This commit creates the library and populates it with a couple of files that contain the widely-useful portions of pg_dump's dumputils.c file. dumputils.c survives, because it has some stuff that didn't seem appropriate for fe_utils, but it's significantly smaller and is no longer referenced from any other directory. Follow-on patches will move more stuff into fe_utils. The Mkvcbuild.pm hacking here is just a best guess; we'll see how the buildfarm likes it.
This commit is contained in:
51
src/include/fe_utils/string_utils.h
Normal file
51
src/include/fe_utils/string_utils.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* String-processing utility routines for frontend code
|
||||
*
|
||||
* Assorted utility functions that are useful in constructing SQL queries
|
||||
* and interpreting backend output.
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/fe_utils/string_utils.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef STRING_UTILS_H
|
||||
#define STRING_UTILS_H
|
||||
|
||||
#include "libpq-fe.h"
|
||||
#include "pqexpbuffer.h"
|
||||
|
||||
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
|
||||
|
||||
/* Global variables controlling behavior of fmtId() and fmtQualifiedId() */
|
||||
extern int quote_all_identifiers;
|
||||
extern PQExpBuffer (*getLocalPQExpBuffer) (void);
|
||||
|
||||
/* Functions */
|
||||
extern const char *fmtId(const char *identifier);
|
||||
extern const char *fmtQualifiedId(int remoteVersion,
|
||||
const char *schema, const char *id);
|
||||
|
||||
extern void appendStringLiteral(PQExpBuffer buf, const char *str,
|
||||
int encoding, bool std_strings);
|
||||
extern void appendStringLiteralConn(PQExpBuffer buf, const char *str,
|
||||
PGconn *conn);
|
||||
extern void appendStringLiteralDQ(PQExpBuffer buf, const char *str,
|
||||
const char *dqprefix);
|
||||
extern void appendByteaLiteral(PQExpBuffer buf,
|
||||
const unsigned char *str, size_t length,
|
||||
bool std_strings);
|
||||
|
||||
extern bool parsePGArray(const char *atext, char ***itemarray, int *nitems);
|
||||
|
||||
extern bool processSQLNamePattern(PGconn *conn, PQExpBuffer buf,
|
||||
const char *pattern,
|
||||
bool have_where, bool force_escape,
|
||||
const char *schemavar, const char *namevar,
|
||||
const char *altnamevar, const char *visibilityrule);
|
||||
|
||||
#endif /* STRING_UTILS_H */
|
Reference in New Issue
Block a user