mariadb/storage/connect/domdoc.h
Olivier Bertrand 3e36eb230b Fix gcc compiler warnings reported by Sergei
modified:   storage/connect/array.cpp
  modified:   storage/connect/array.h
  modified:   storage/connect/blkfil.cpp
  modified:   storage/connect/blkfil.h
  modified:   storage/connect/block.h
  modified:   storage/connect/colblk.cpp
  modified:   storage/connect/colblk.h
  modified:   storage/connect/csort.h
  modified:   storage/connect/filamvct.cpp
  modified:   storage/connect/filter.cpp
  modified:   storage/connect/filter.h
  modified:   storage/connect/global.h
  modified:   storage/connect/json.h
  modified:   storage/connect/plgdbsem.h
  modified:   storage/connect/plgdbutl.cpp
  modified:   storage/connect/tabcol.cpp
  modified:   storage/connect/tabcol.h
  modified:   storage/connect/tabdos.cpp
  modified:   storage/connect/tabdos.h
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/table.cpp
  modified:   storage/connect/tabodbc.cpp
  modified:   storage/connect/tabodbc.h
  modified:   storage/connect/tabsys.h
  modified:   storage/connect/tabxml.h
  modified:   storage/connect/value.cpp
  modified:   storage/connect/value.h
  modified:   storage/connect/xindex.cpp
  modified:   storage/connect/xindex.h
  modified:   storage/connect/xobject.cpp
  modified:   storage/connect/xobject.h
  modified:   storage/connect/xtable.h

Set values as nullable when retrieving catalog info
  modified:   storage/connect/jdbconn.cpp
  modified:   storage/connect/mysql-test/connect/r/odbc_oracle.result
  modified:   storage/connect/odbconn.cpp

Change format of Jpath
  modified:   storage/connect/json.cpp
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/mysql-test/connect/r/json.result
  modified:   storage/connect/mysql-test/connect/r/json_udf.result
  modified:   storage/connect/mysql-test/connect/r/json_udf_bin.result
  modified:   storage/connect/mysql-test/connect/r/zip.result
  modified:   storage/connect/mysql-test/connect/t/json.test
  modified:   storage/connect/mysql-test/connect/t/json_udf.test
  modified:   storage/connect/mysql-test/connect/t/json_udf_bin.test
  modified:   storage/connect/mysql-test/connect/t/zip.test
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/tabjson.h
  modified:   storage/connect/tabmgo.cpp

Change null representation from ??? to <null>
  modified:   storage/connect/json.cpp

Change the name of UDF that are equal to a native JSON function name
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/jsonudf.h
  modified:   storage/connect/mysql-test/connect/t/json_udf.inc
  modified:   storage/connect/mysql-test/connect/t/json_udf2.inc

Fix bug in making JSON project info
  modified:   storage/connect/mongofam.cpp

Fix COMPUTE when one argument is null
  modified:   storage/connect/value.cpp

Value is null only when nullable
  modified:   storage/connect/value.h
2017-05-23 19:35:50 +02:00

146 lines
5.3 KiB
C++

/******************************************************************/
/* Declaration of XML document processing using MS DOM */
/* Author: Olivier Bertrand 2007 - 2012 */
/******************************************************************/
#include "plgxml.h"
typedef class DOMDOC *PDOMDOC;
typedef class DOMNODE *PDOMNODE;
typedef class DOMATTR *PDOMATTR;
typedef class DOMNODELIST *PDOMLIST;
/******************************************************************/
/* XML block. Must have the same layout than FBLOCK up to Type. */
/******************************************************************/
typedef struct _xblock { /* Loaded XML file block */
struct _xblock *Next;
LPCSTR Fname; /* Point on file name */
size_t Length; /* Used to tell if read mode */
short Count; /* Nb of times file is used */
short Type; /* TYPE_FB_XML */
int Retcode; /* Return code from Load */
MSXML2::IXMLDOMDocumentPtr Docp;/* Document interface pointer */
} XBLOCK, *PXBLOCK;
/******************************************************************/
/* Declaration of DOM document. */
/******************************************************************/
class DOMDOC : public XMLDOCUMENT {
friend class DOMNODE;
public:
// Constructor
DOMDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp);
// Properties
virtual short GetDocType(void) {return TYPE_FB_XML;}
virtual void *GetDocPtr(void) {return Docp;}
virtual void SetNofree(bool b) {} // Only libxml2
// Methods
virtual bool Initialize(PGLOBAL g, PCSZ entry, bool zipped);
virtual bool ParseFile(PGLOBAL g, char *fn);
virtual bool NewDoc(PGLOBAL g, PCSZ ver);
virtual void AddComment(PGLOBAL g, char *com);
virtual PXNODE GetRoot(PGLOBAL g);
virtual PXNODE NewRoot(PGLOBAL g, char *name);
virtual PXNODE NewPnode(PGLOBAL g, char *name);
virtual PXATTR NewPattr(PGLOBAL g);
virtual PXLIST NewPlist(PGLOBAL g);
virtual int DumpDoc(PGLOBAL g, char *ofn);
virtual void CloseDoc(PGLOBAL g, PFBLOCK xp);
virtual PFBLOCK LinkXblock(PGLOBAL g, MODE m, int rc, char *fn);
protected:
// Members
MSXML2::IXMLDOMDocumentPtr Docp;
MSXML2::IXMLDOMNodeListPtr Nlist;
HRESULT Hr;
}; // end of class DOMDOC
/******************************************************************/
/* Declaration of DOM XML node. */
/******************************************************************/
class DOMNODE : public XMLNODE {
friend class DOMDOC;
friend class DOMNODELIST;
public:
// Properties
virtual char *GetName(PGLOBAL g);
virtual int GetType(void) {return Nodep->nodeType;}
virtual PXNODE GetNext(PGLOBAL g);
virtual PXNODE GetChild(PGLOBAL g);
// Methods
virtual RCODE GetContent(PGLOBAL g, char *buf, int len);
virtual bool SetContent(PGLOBAL g, char *txtp, int len);
virtual PXNODE Clone(PGLOBAL g, PXNODE np);
virtual PXLIST GetChildElements(PGLOBAL g, char *xp, PXLIST lp);
virtual PXLIST SelectNodes(PGLOBAL g, char *xp, PXLIST lp);
virtual PXNODE SelectSingleNode(PGLOBAL g, char *xp, PXNODE np);
virtual PXATTR GetAttribute(PGLOBAL g, char *name, PXATTR ap);
virtual PXNODE AddChildNode(PGLOBAL g, PCSZ name, PXNODE np);
virtual PXATTR AddProperty(PGLOBAL g, char *name, PXATTR ap);
virtual void AddText(PGLOBAL g, PCSZ txtp);
virtual void DeleteChild(PGLOBAL g, PXNODE dnp);
protected:
// Constructor
DOMNODE(PXDOC dp, MSXML2::IXMLDOMNodePtr np);
// Members
MSXML2::IXMLDOMDocumentPtr Docp;
MSXML2::IXMLDOMNodePtr Nodep;
char Name[64];
WCHAR *Ws;
int Len;
bool Zip;
}; // end of class DOMNODE
/******************************************************************/
/* Declaration of DOM XML node list. */
/******************************************************************/
class DOMNODELIST : public XMLNODELIST {
friend class DOMDOC;
friend class DOMNODE;
public:
// Methods
virtual int GetLength(void) {return Listp->length;}
virtual PXNODE GetItem(PGLOBAL g, int n, PXNODE np);
virtual bool DropItem(PGLOBAL g, int n);
protected:
// Constructor
DOMNODELIST(PXDOC dp, MSXML2::IXMLDOMNodeListPtr lp);
// Members
MSXML2::IXMLDOMNodeListPtr Listp;
}; // end of class DOMNODELIST
/******************************************************************/
/* Declaration of DOM XML attribute. */
/******************************************************************/
class DOMATTR : public XMLATTRIBUTE {
friend class DOMDOC;
friend class DOMNODE;
public:
// Properties
virtual char *GetName(PGLOBAL g);
virtual PXATTR GetNext(PGLOBAL);
// Methods
virtual RCODE GetText(PGLOBAL g, char *bufp, int len);
virtual bool SetText(PGLOBAL g, char *txtp, int len);
protected:
// Constructor
DOMATTR(PXDOC dp, MSXML2::IXMLDOMAttributePtr ap,
MSXML2::IXMLDOMNamedNodeMapPtr nmp = NULL);
// Members
MSXML2::IXMLDOMAttributePtr Atrp;
MSXML2::IXMLDOMNamedNodeMapPtr Nmp;
char Name[64];
WCHAR *Ws;
int Len;
long K;
}; // end of class DOMATTR