mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fix some XML table type bugs:
- in DOMNODELIST::DropItem if (Listp == NULL || Listp->length <= n) return true; is wrong, should be: if (Listp == NULL || Listp->length < n) return true; - Crash in discovery with libxml2 in XMLColumns because: if (!tdp->Usedom) // nl was destroyed vp->nl = vp->pn->GetChildElements(g); is executed with vp->pn uninitialized. Fixed by adding: vp->pn = node; line 264. -In discovery with libxml2 some columns are not found. Because list was not recovered properly, nodes being modified and not reallocated. Fixed lines 214 and 277. modified: storage/connect/domdoc.cpp modified: storage/connect/tabxml.cpp Add support for zipped table files modified: storage/connect/domdoc.cpp modified: storage/connect/domdoc.h modified: storage/connect/filamap.cpp modified: storage/connect/filamap.h modified: storage/connect/filamzip.cpp modified: storage/connect/filamzip.h modified: storage/connect/ha_connect.cc modified: storage/connect/libdoc.cpp modified: storage/connect/plgdbutl.cpp modified: storage/connect/plgxml.cpp modified: storage/connect/plgxml.h modified: storage/connect/tabdos.cpp modified: storage/connect/tabdos.h modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/tabxml.cpp
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/******************************************************************/
|
||||
/* Implementation of XML document processing using libxml2 */
|
||||
/* Author: Olivier Bertrand 2007-2015 */
|
||||
/* Author: Olivier Bertrand 2007-2016 */
|
||||
/******************************************************************/
|
||||
#include "my_global.h"
|
||||
#include <string.h>
|
||||
@@ -68,8 +68,8 @@ class LIBXMLDOC : public XMLDOCUMENT {
|
||||
virtual void SetNofree(bool b) {Nofreelist = b;}
|
||||
|
||||
// Methods
|
||||
virtual bool Initialize(PGLOBAL g);
|
||||
virtual bool ParseFile(char *fn);
|
||||
virtual bool Initialize(PGLOBAL g, char *entry, bool zipped);
|
||||
virtual bool ParseFile(PGLOBAL g, char *fn);
|
||||
virtual bool NewDoc(PGLOBAL g, char *ver);
|
||||
virtual void AddComment(PGLOBAL g, char *com);
|
||||
virtual PXNODE GetRoot(PGLOBAL g);
|
||||
@@ -373,22 +373,33 @@ LIBXMLDOC::LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
|
||||
/******************************************************************/
|
||||
/* Initialize XML parser and check library compatibility. */
|
||||
/******************************************************************/
|
||||
bool LIBXMLDOC::Initialize(PGLOBAL g)
|
||||
{
|
||||
bool LIBXMLDOC::Initialize(PGLOBAL g, char *entry, bool zipped)
|
||||
{
|
||||
if (zipped && InitZip(g, entry))
|
||||
return true;
|
||||
|
||||
int n = xmlKeepBlanksDefault(1);
|
||||
return MakeNSlist(g);
|
||||
} // end of Initialize
|
||||
} // end of Initialize
|
||||
|
||||
/******************************************************************/
|
||||
/* Parse the XML file and construct node tree in memory. */
|
||||
/******************************************************************/
|
||||
bool LIBXMLDOC::ParseFile(char *fn)
|
||||
bool LIBXMLDOC::ParseFile(PGLOBAL g, char *fn)
|
||||
{
|
||||
if (trace)
|
||||
htrc("ParseFile\n");
|
||||
|
||||
if ((Docp = xmlParseFile(fn))) {
|
||||
if (Docp->encoding)
|
||||
if (zip) {
|
||||
// Parse an in memory document
|
||||
char *xdoc = GetMemDoc(g, fn);
|
||||
|
||||
Docp = (xdoc) ? xmlParseDoc((const xmlChar *)xdoc) : NULL;
|
||||
} else
|
||||
Docp = xmlParseFile(fn);
|
||||
|
||||
if (Docp) {
|
||||
if (Docp->encoding)
|
||||
Encoding = (char*)Docp->encoding;
|
||||
|
||||
return false;
|
||||
@@ -609,6 +620,7 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
|
||||
} // endif xp
|
||||
|
||||
CloseXML2File(g, xp, false);
|
||||
CloseZip();
|
||||
} // end of Close
|
||||
|
||||
/******************************************************************/
|
||||
|
Reference in New Issue
Block a user