From 5972b56a6d43aceb89e5242b6c323743eba9c71e Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sat, 2 Mar 2013 17:58:18 +0100 Subject: - 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 --- storage/connect/libdoc.cpp | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'storage/connect/libdoc.cpp') 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 /******************************************************************/ -- cgit v1.2.1