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