summaryrefslogtreecommitdiff
path: root/storage/connect/libdoc.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2013-03-02 17:58:18 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2013-03-02 17:58:18 +0100
commit5972b56a6d43aceb89e5242b6c323743eba9c71e (patch)
tree9cb05cd22e464d31e8d3d0d42f890b9d18f68c08 /storage/connect/libdoc.cpp
parent8c8fe2f3a62191d0d3e835242c08c23906478099 (diff)
downloadmariadb-git-5972b56a6d43aceb89e5242b6c323743eba9c71e.tar.gz
- Fix conversion bug for MS-DOM XML tables. The node content was written
and read as if the table DATA_CHARSET was ANSI instead of UTF-8. Warning are now provided when the read content of a node is truncated. modified: storage/connect/domdoc.cpp storage/connect/domdoc.h storage/connect/libdoc.cpp storage/connect/libdoc.h storage/connect/plgxml.h storage/connect/tabxml.cpp - Conditional compilation of pre_create depending on the MARIADB setting. modified: storage/connect/ha_connect.cc storage/connect/ha_connect.h
Diffstat (limited to 'storage/connect/libdoc.cpp')
-rw-r--r--storage/connect/libdoc.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp
index e094f935c80..95b98931680 100644
--- a/storage/connect/libdoc.cpp
+++ b/storage/connect/libdoc.cpp
@@ -463,8 +463,10 @@ PXNODE XML2NODE::GetChild(PGLOBAL g)
/******************************************************************/
/* Return the content of a node and subnodes. */
/******************************************************************/
-char *XML2NODE::GetText(char *buf, int len)
+RCODE XML2NODE::GetContent(PGLOBAL g, char *buf, int len)
{
+ RCODE rc = RC_OK;
+
if (Content)
xmlFree(Content);
@@ -474,18 +476,24 @@ char *XML2NODE::GetText(char *buf, int len)
bool b = false;
// Copy content eliminating extra characters
- for (; *p1 && (p2 - buf) < len; p1++)
- if (strchr(extra, *p1)) {
- if (b) {
- // This to have one blank between sub-nodes
- *p2++ = ' ';
- b = false;
- } // endif b
+ for (; *p1; p1++)
+ if ((p2 - buf) < len) {
+ if (strchr(extra, *p1)) {
+ if (b) {
+ // This to have one blank between sub-nodes
+ *p2++ = ' ';
+ b = false;
+ } // endif b
+
+ } else {
+ *p2++ = *p1;
+ b = true;
+ } // endif p1
} else {
- *p2++ = *p1;
- b = true;
- } // endif p1
+ sprintf(g->Message, "Truncated %s content", Nodep->name);
+ rc = RC_INFO;
+ } // endif len
*p2 = 0;
@@ -497,7 +505,7 @@ char *XML2NODE::GetText(char *buf, int len)
} else
*buf = '\0';
- return buf;
+ return rc;
} // end of GetText
/******************************************************************/