Header And Logo

PostgreSQL
| The world's most advanced open source database.

dumputils.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * Utility routines for SQL dumping
00004  *  Basically this is stuff that is useful in both pg_dump and pg_dumpall.
00005  *  Lately it's also being used by psql and bin/scripts/ ...
00006  *
00007  *
00008  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00009  * Portions Copyright (c) 1994, Regents of the University of California
00010  *
00011  * src/bin/pg_dump/dumputils.h
00012  *
00013  *-------------------------------------------------------------------------
00014  */
00015 
00016 #ifndef DUMPUTILS_H
00017 #define DUMPUTILS_H
00018 
00019 #include "libpq-fe.h"
00020 #include "pqexpbuffer.h"
00021 
00022 typedef struct SimpleStringListCell
00023 {
00024     struct SimpleStringListCell *next;
00025     char        val[1];         /* VARIABLE LENGTH FIELD */
00026 } SimpleStringListCell;
00027 
00028 typedef struct SimpleStringList
00029 {
00030     SimpleStringListCell *head;
00031     SimpleStringListCell *tail;
00032 } SimpleStringList;
00033 
00034 
00035 extern int  quote_all_identifiers;
00036 extern PQExpBuffer (*getLocalPQExpBuffer) (void);
00037 
00038 extern const char *fmtId(const char *identifier);
00039 extern const char *fmtQualifiedId(int remoteVersion,
00040                const char *schema, const char *id);
00041 extern void appendStringLiteral(PQExpBuffer buf, const char *str,
00042                     int encoding, bool std_strings);
00043 extern void appendStringLiteralConn(PQExpBuffer buf, const char *str,
00044                         PGconn *conn);
00045 extern void appendStringLiteralDQ(PQExpBuffer buf, const char *str,
00046                       const char *dqprefix);
00047 extern void appendByteaLiteral(PQExpBuffer buf,
00048                    const unsigned char *str, size_t length,
00049                    bool std_strings);
00050 extern bool parsePGArray(const char *atext, char ***itemarray, int *nitems);
00051 extern bool buildACLCommands(const char *name, const char *subname,
00052                  const char *type, const char *acls, const char *owner,
00053                  const char *prefix, int remoteVersion,
00054                  PQExpBuffer sql);
00055 extern bool buildDefaultACLCommands(const char *type, const char *nspname,
00056                         const char *acls, const char *owner,
00057                         int remoteVersion,
00058                         PQExpBuffer sql);
00059 extern bool processSQLNamePattern(PGconn *conn, PQExpBuffer buf,
00060                       const char *pattern,
00061                       bool have_where, bool force_escape,
00062                       const char *schemavar, const char *namevar,
00063                       const char *altnamevar, const char *visibilityrule);
00064 extern void buildShSecLabelQuery(PGconn *conn, const char *catalog_name,
00065                      uint32 objectId, PQExpBuffer sql);
00066 extern void emitShSecLabels(PGconn *conn, PGresult *res,
00067                 PQExpBuffer buffer, const char *target, const char *objname);
00068 extern void set_dump_section(const char *arg, int *dumpSections);
00069 
00070 extern void simple_string_list_append(SimpleStringList *list, const char *val);
00071 extern bool simple_string_list_member(SimpleStringList *list, const char *val);
00072 
00073 #endif   /* DUMPUTILS_H */