* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.443 2008/04/03 13:25:02 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.444 2008/04/04 08:33:15 mha Exp $
*
*--------------------------------------------------------------------
*/
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 const char *assign_xmloption(const char *newval, bool doit, GucSource source);
static const char *show_archive_command(void);
static bool assign_tcp_keepalives_idle(int newval, bool doit, GucSource source);
static bool assign_tcp_keepalives_interval(int newval, bool doit, GucSource source);
};
#endif
+static const struct config_enum_entry xmlbinary_options[] = {
+ {"base64", XMLBINARY_BASE64},
+ {"hex", XMLBINARY_HEX},
+ {NULL, 0}
+};
+
+static const struct config_enum_entry xmloption_options[] = {
+ {"content", XMLOPTION_CONTENT},
+ {"document", XMLOPTION_DOCUMENT},
+ {NULL, 0}
+};
/*
* GUC option variables that are exported from this module
static char *XactIsoLevel_string;
static char *data_directory;
static char *custom_variable_classes;
-static char *xmlbinary_string;
-static char *xmloption_string;
static int max_function_args;
static int max_index_keys;
static int max_identifier_length;
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
- },
-
- {
- {"xmloption", PGC_USERSET, CLIENT_CONN_STATEMENT,
- gettext_noop("Sets whether XML data in implicit parsing and serialization "
- "operations is to be considered as documents or content fragments."),
- gettext_noop("Valid values are DOCUMENT and CONTENT.")
- },
- &xmloption_string,
- "content", assign_xmloption, NULL
- },
-
{
{"default_text_search_config", PGC_USERSET, CLIENT_CONN_LOCALE,
gettext_noop("Sets default text search configuration."),
assign_session_replication_role, 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,
+ XMLBINARY_BASE64, xmlbinary_options, NULL, NULL
+ },
+
+ {
+ {"xmloption", PGC_USERSET, CLIENT_CONN_STATEMENT,
+ gettext_noop("Sets whether XML data in implicit parsing and serialization "
+ "operations is to be considered as documents or content fragments."),
+ gettext_noop("Valid values are DOCUMENT and CONTENT.")
+ },
+ &xmloption,
+ XMLOPTION_CONTENT, xmloption_options, NULL, NULL
+ },
+
/* End-of-list marker */
{
}
}
-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 const char *
-assign_xmloption(const char *newval, bool doit, GucSource source)
-{
- XmlOptionType xo;
-
- if (pg_strcasecmp(newval, "document") == 0)
- xo = XMLOPTION_DOCUMENT;
- else if (pg_strcasecmp(newval, "content") == 0)
- xo = XMLOPTION_CONTENT;
- else
- return NULL; /* reject */
-
- if (doit)
- xmloption = xo;
-
- return newval;
-}
-
static const char *
show_archive_command(void)
{