Commit 8b357953 authored by Peter Eisentraut's avatar Peter Eisentraut

Use XML output escaping also in XMLFOREST.

parent 92dffbd0
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.205 2007/01/10 20:33:54 petere Exp $ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.206 2007/01/12 21:47:26 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2692,11 +2692,10 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext, ...@@ -2692,11 +2692,10 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
value = ExecEvalExpr(e, econtext, &isnull, NULL); value = ExecEvalExpr(e, econtext, &isnull, NULL);
if (!isnull) if (!isnull)
{ {
str = OutputFunctionCall(&xmlExpr->named_outfuncs[i],
value);
appendStringInfo(&buf, "<%s>%s</%s>", appendStringInfo(&buf, "<%s>%s</%s>",
argname, str, argname); argname,
pfree(str); map_sql_value_to_xml_value(value, exprType((Node *) e->expr)),
argname);
*isNull = false; *isNull = false;
} }
i++; i++;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.15 2007/01/12 16:29:24 petere Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.16 2007/01/12 21:47:26 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -70,8 +70,6 @@ static void xml_ereport_by_code(int level, int sqlcode, ...@@ -70,8 +70,6 @@ static void xml_ereport_by_code(int level, int sqlcode,
static xmlChar *xml_text2xmlChar(text *in); static xmlChar *xml_text2xmlChar(text *in);
static xmlDocPtr xml_parse(text *data, bool is_document, bool preserve_whitespace); static xmlDocPtr xml_parse(text *data, bool is_document, bool preserve_whitespace);
static char *map_sql_value_to_xml_value(Datum value, Oid type);
#endif /* USE_LIBXML */ #endif /* USE_LIBXML */
#define NO_XML_SUPPORT() \ #define NO_XML_SUPPORT() \
...@@ -1260,11 +1258,10 @@ map_xml_name_to_sql_identifier(char *name) ...@@ -1260,11 +1258,10 @@ map_xml_name_to_sql_identifier(char *name)
} }
#ifdef USE_LIBXML
/* /*
* Map SQL value to XML value; see SQL/XML:2003 section 9.16. * Map SQL value to XML value; see SQL/XML:2003 section 9.16.
*/ */
static char * char *
map_sql_value_to_xml_value(Datum value, Oid type) map_sql_value_to_xml_value(Datum value, Oid type)
{ {
StringInfoData buf; StringInfoData buf;
...@@ -1341,4 +1338,3 @@ map_sql_value_to_xml_value(Datum value, Oid type) ...@@ -1341,4 +1338,3 @@ map_sql_value_to_xml_value(Datum value, Oid type)
return buf.data; return buf.data;
} }
#endif /* USE_LIBXML */
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.8 2007/01/10 20:33:54 petere Exp $ * $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.9 2007/01/12 21:47:27 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -40,5 +40,6 @@ extern xmltype *xmlroot(xmltype *data, text *version, int standalone); ...@@ -40,5 +40,6 @@ extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped); extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped);
extern char *map_xml_name_to_sql_identifier(char *name); extern char *map_xml_name_to_sql_identifier(char *name);
extern char *map_sql_value_to_xml_value(Datum value, Oid type);
#endif /* XML_H */ #endif /* XML_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment