aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/guc.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2007-01-19 16:58:46 +0000
committerPeter Eisentraut <peter_e@gmx.net>2007-01-19 16:58:46 +0000
commit4b48ad4fb2edf897b87d04467f8eaaaba82a258f (patch)
treeba5d42f78007a28afcb0f18adae57243c6559fb1 /src/backend/utils/misc/guc.c
parent5b4a08896bd6ee7d93f74c77f61d3518deda8fd5 (diff)
downloadpostgresql-4b48ad4fb2edf897b87d04467f8eaaaba82a258f.tar.gz
postgresql-4b48ad4fb2edf897b87d04467f8eaaaba82a258f.zip
Add support for converting binary values (i.e. bytea) into xml values,
with new GUC parameter "xmlbinary" that controls the output encoding, as per SQL/XML standard.
Diffstat (limited to 'src/backend/utils/misc/guc.c')
-rw-r--r--src/backend/utils/misc/guc.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index d04bacc58ee..7962c992acc 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.368 2007/01/16 18:26:02 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.369 2007/01/19 16:58:46 petere Exp $
*
*--------------------------------------------------------------------
*/
@@ -61,6 +61,7 @@
#include "utils/pg_locale.h"
#include "utils/ps_status.h"
#include "utils/tzparser.h"
+#include "utils/xml.h"
#ifndef PG_KRB_SRVTAB
#define PG_KRB_SRVTAB ""
@@ -142,6 +143,7 @@ static bool assign_transaction_read_only(bool newval, bool doit, GucSource sourc
static const char *assign_canonical_path(const char *newval, bool doit, GucSource source);
static const char *assign_backslash_quote(const char *newval, bool doit, GucSource source);
static const char *assign_timezone_abbreviations(const char *newval, bool doit, GucSource source);
+static const char *assign_xmlbinary(const char *newval, bool doit, GucSource source);
static bool assign_tcp_keepalives_idle(int newval, bool doit, GucSource source);
static bool assign_tcp_keepalives_interval(int newval, bool doit, GucSource source);
@@ -229,6 +231,7 @@ static char *timezone_abbreviations_string;
static char *XactIsoLevel_string;
static char *data_directory;
static char *custom_variable_classes;
+static char *xmlbinary_string;
static int max_function_args;
static int max_index_keys;
static int max_identifier_length;
@@ -2279,6 +2282,15 @@ static struct config_string ConfigureNamesString[] =
NULL, assign_canonical_path, NULL
},
+ {
+ {"xmlbinary", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Sets how binary values are to be encoded in XML."),
+ gettext_noop("Valid values are BASE64 and HEX.")
+ },
+ &xmlbinary_string,
+ "base64", assign_xmlbinary, NULL
+ },
+
/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, NULL, NULL, NULL
@@ -6475,6 +6487,24 @@ pg_timezone_abbrev_initialize(void)
}
}
+static const char *
+assign_xmlbinary(const char *newval, bool doit, GucSource source)
+{
+ XmlBinaryType xb;
+
+ if (pg_strcasecmp(newval, "base64") == 0)
+ xb = XMLBINARY_BASE64;
+ else if (pg_strcasecmp(newval, "hex") == 0)
+ xb = XMLBINARY_HEX;
+ else
+ return NULL; /* reject */
+
+ if (doit)
+ xmlbinary = xb;
+
+ return newval;
+}
+
static bool
assign_tcp_keepalives_idle(int newval, bool doit, GucSource source)
{