summaryrefslogtreecommitdiff
path: root/storage/connect/libdoc.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2013-02-20 01:30:37 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2013-02-20 01:30:37 +0100
commitc448839c4fd3d097d0d7271ce4752b28d6f6e1f5 (patch)
tree41a0bc55190848d71f649b1aee3133fbc388d992 /storage/connect/libdoc.cpp
parent2f48842a0fd61cfd3268293e64077bb7773dbea1 (diff)
downloadmariadb-git-c448839c4fd3d097d0d7271ce4752b28d6f6e1f5.tar.gz
- Fix crash on making an XML table with encoding=XXX
- Set parameters so libxml2 does not anymore add extra characters when retrieving several subnodes of a node. - Make a CONNECT file header (was PlugDB) modified: storage/connect/domdoc.cpp storage/connect/libdoc.cpp storage/connect/tabxml.cpp - Change the version number modified: storage/connect/ha_connect.cc - Begin eliminate use of libmysql functions in MYSQL table type Not finished yet modified: storage/connect/myconn.cpp storage/connect/myconn.h
Diffstat (limited to 'storage/connect/libdoc.cpp')
-rw-r--r--storage/connect/libdoc.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp
index d60cc49e94a..6b6e070917d 100644
--- a/storage/connect/libdoc.cpp
+++ b/storage/connect/libdoc.cpp
@@ -92,7 +92,7 @@ LIBXMLDOC::LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
/******************************************************************/
bool LIBXMLDOC::Initialize(PGLOBAL g)
{
-//int n = xmlKeepBlanksDefault(0);
+ int n = xmlKeepBlanksDefault(1);
return MakeNSlist(g);
} // end of Initialize
@@ -221,7 +221,7 @@ PXLIST LIBXMLDOC::NewPlist(PGLOBAL g)
/******************************************************************/
int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
{
- int rc;
+ int rc = 0;
FILE *of;
if (!(of= global_fopen(g, MSGID_CANNOT_OPEN, ofn, "w")))
@@ -229,7 +229,13 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
#if 1
// This function does not crash (
- rc = xmlSaveFormatFileEnc((const char *)ofn, Docp, Encoding, 0);
+ if (xmlSaveFormatFileEnc((const char *)ofn, Docp, Encoding, 0) < 0) {
+ xmlErrorPtr err = xmlGetLastError();
+
+ strcpy(g->Message, (err) ? err->message : "Error saving XML doc"
+ );
+ rc = -1;
+ } // endif Save
// rc = xmlDocDump(of, Docp);
#else // 0
// Until this function is fixed, do the job ourself
@@ -465,6 +471,7 @@ char *XML2NODE::GetText(char *buf, int len)
bool b = false;
int rc = ((PXDOC2)Doc)->Decode(Content, buf, len);
+#if 0
// Eliminate extra characters
for (p1 = p2 = buf; *p1; p1++)
if (strchr(" \t\r\n", *p1)) {
@@ -482,6 +489,7 @@ char *XML2NODE::GetText(char *buf, int len)
*(p2 - 1) = 0;
else
*p2 = 0;
+#endif // 0
if (trace)
htrc("GetText buf='%s' len=%d rc=%d\n", buf, len, rc);