Commit dde8622c authored by Alexander Barkov's avatar Alexander Barkov

More XML related definitions are now more friendly:

- LIBXML2_SUPPORT is defined if LibXml2 is found
- DOMDOC_SUPPORT  is defined if msxml is found
- XML_SUPPORT is defined if either of them are found

NOXML2 was removed

modified:
  storage/connect/CMakeLists.txt
  storage/connect/global.h
  storage/connect/ha_connect.cc
  storage/connect/plgdbutl.cpp
  storage/connect/plgxml.cpp
parent 733ab86c
......@@ -82,8 +82,8 @@ IF(CONNECT_WITH_LIBXML2)
IF (LIBXML2_FOUND)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
SET(XML_LIBRARY ${LIBXML2_LIBRARIES})
SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabxml.cpp plgxml.cpp libdoc.cpp)
add_definitions(-DXML_SUPPORT)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} libdoc.cpp)
add_definitions(-DLIBXML2_SUPPORT)
ENDIF(LIBXML2_FOUND)
ENDIF(CONNECT_WITH_LIBXML2)
......@@ -102,18 +102,22 @@ IF(WIN32)
IF(MSXML_LIBRARY MATCHES .*msxml6[.].*)
add_definitions(-DMSX6 -DDOMDOC_SUPPORT)
message(STATUS "MSXML library version: msxml6")
SET(MSXML_FOUND 1)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} domdoc.cpp)
ELSEIF(MSXML_LIBRARY MATCHES .*msxml4[.].*)
add_definitions(-DMSX4 -DDOMDOC_SUPPORT)
message("MSXML library version: msxml4")
SET(MSXML_FOUND 1)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} domdoc.cpp)
ELSEIF(MSXML_LIBRARY MATCHES .*msxml3[.].*)
message("MSXML library version: msxml3")
add_definitions(-DMSX3 -DDOMDOC_SUPPORT)
SET(MSXML_FOUND 1)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} domdoc.cpp)
ELSEIF(MSXML_LIBRARY MATCHES .*msxml2[.].*)
message("MSXML library version: msxml2")
add_definitions(-DMXS2 -DDOMDOC_SUPPORT)
SET(MSXML_FOUND 1)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} domdoc.cpp)
ELSE()
message(STATUS "msxml? library not found")
......@@ -121,6 +125,9 @@ IF(WIN32)
ENDIF(CONNECT_WITH_MSXML)
ENDIF(WIN32)
IF(LIBXML2_FOUND OR MSXML_FOUND)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabxml.cpp plgxml.cpp)
ENDIF()
#
# MySQL
......
......@@ -19,6 +19,10 @@
#define DllExport
#endif // !WIN32
#if defined(DOMDOC_SUPPORT) || defined(LIBXML2_SUPPORT)
#define XML_SUPPORT 1
#endif
#if defined(XMSG)
// Definition used to read messages from message file.
#include "msgid.h"
......
......@@ -146,10 +146,10 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all);
bool CntInfo(PGLOBAL g, PTDB tdbp, PXF info);
int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
bool *incl, key_part_map *kmap);
#if defined(XML_SUPPORT) && !defined(NOXML2)
#ifdef LIBXML2_SUPPORT
void XmlInitParserLib(void);
void XmlCleanupParserLib(void);
#endif // XML_SUPPORT && !NOXML2)
#endif // LIBXML2_SUPPORT
/****************************************************************************/
/* Functions called externally by pre_parser. */
......@@ -3692,14 +3692,14 @@ bool APIENTRY DllMain(HINSTANCE hInst, ULONG ulReason, PCONTEXT pctx)
printf("version=%s\n", version);
trace= xtrace;
} // endif xtrace
#if defined(XML_SUPPORT) && !defined(NOXML2)
#ifdef LIBXML2_SUPPORT
XmlInitParserLib();
#endif // XML_SUPPORT && !NOXML2)
#endif // LIBXML2_SUPPORT
break;
case DLL_PROCESS_DETACH:
#if defined(XML_SUPPORT) && !defined(NOXML2)
#ifdef LIBXML2_SUPPORT
XmlCleanupParserLib();
#endif // XML_SUPPORT && !NOXML2)
#endif // LIBXML2_SUPPORT
break;
case DLL_THREAD_ATTACH:
break;
......@@ -3732,9 +3732,9 @@ void __attribute__((constructor)) init()
trace= xtrace;
} // endif xtrace
#if defined(XML_SUPPORT) && !defined(NOXML2)
#ifdef LIBXML2_SUPPORT
XmlInitParserLib();
#endif // XML_SUPPORT && !NOXML2)
#endif // LIBXML2_SUPPORT
} // end of init
/**************************************************************************/
......@@ -3742,9 +3742,9 @@ void __attribute__((constructor)) init()
/**************************************************************************/
void __attribute__((destructor)) fini()
{
#if defined(XML_SUPPORT) && !defined(NOXML2)
#ifdef LIBXML2_SUPPORT
XmlCleanupParserLib();
#endif // XML_SUPPORT && !NOXML2)
#endif // LIBXML2_SUPPORT
} // end of fini
#endif // !WIN32
......@@ -119,14 +119,14 @@ MBLOCK Nmblk = {NULL, false, 0, false, NULL}; // Used to init MBLOCK's
bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool);
bool EvalLikePattern(LPCSTR, LPCSTR);
void PlugConvertConstant(PGLOBAL, void* &, short&);
#if defined(XML_SUPPORT)
#if defined(WIN32) && defined(DOMDOC_SUPPORT)
#ifdef DOMDOC_SUPPORT
void CloseXMLFile(PGLOBAL, PFBLOCK, bool);
#endif // WIN32
#if !defined(NOXML2)
#endif // DOMDOC_SUPPORT
#ifdef LIBXML2_SUPPORT
void CloseXML2File(PGLOBAL, PFBLOCK, bool);
#endif // !NOXML2
#endif // XML_SUPPORT
#endif // LIBXML2_SUPPORT
/**************************************************************************/
/* Utility for external callers (such as XDB) */
......@@ -808,18 +808,16 @@ int PlugCloseFile(PGLOBAL g, PFBLOCK fp, bool all)
fp->Mode = MODE_ANY;
fp->Count = 0;
break;
#if defined(XML_SUPPORT)
#if defined(WIN32) && defined(DOMDOC_SUPPORT)
#ifdef defined(DOMDOC_SUPPORT)
case TYPE_FB_XML:
CloseXMLFile(g, fp, all);
break;
#endif // WIN32
#if !defined(NOXML2)
#endif // DOMDOC_SUPPORT
#ifdef LIBXML2_SUPPORT
case TYPE_FB_XML2:
CloseXML2File(g, fp, all);
break;
#endif // !NOXML2
#endif // XML_SUPPORT
#endif // LIBXML2_SUPPORT
default:
rc = RC_FX;
} // endswitch Type
......
......@@ -17,14 +17,14 @@ PXDOC GetDomDoc(PGLOBAL g, char *nsl, char *nsdf,
} // end of GetDomDoc
#endif // !DOMDOC_SUPPORT
#if defined(NOXML2)
#ifndef LIBXML2_SUPPORT
PXDOC GetLibxmlDoc(PGLOBAL g, char *nsl, char *nsdf,
char *enc, PFBLOCK fp)
{
strcpy(g->Message, "libxml2 not supported");
return NULL;
} // end of GetLibxmlDoc
#endif // NOXML2
#endif // LIBXML2_SUPPORT
/******************************************************************/
/* XMLDOCUMENT constructor. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment