Commit c8e58e0c authored by Jerry Clarke's avatar Jerry Clarke
Browse files

adding MySQL support

parent 444906e5
......@@ -54,6 +54,10 @@ SET( XdmfMpiSource
XdmfDsmCommMpi
)
SET( XdmfMySQLSource
XdmfValuesMySQL
)
SET( XdmfPythonSource
XdmfPython
)
......@@ -111,6 +115,7 @@ IF(XDMF_REGENERATE_WRAPPERS)
ENDIF(SWIG_EXECUTABLE)
ENDIF(XDMF_REGENERATE_WRAPPERS)
OPTION(XDMF_REGENERATE_YACCLEX
"Regenerate XdmfExprYacc.cxx and XdmfExprLex.cxx" OFF)
MARK_AS_ADVANCED(XDMF_REGENERATE_YACCLEX)
......@@ -168,6 +173,7 @@ IF(XDMF_REGENERATE_YACCLEX)
ENDIF(XDMF_REGENERATE_YACCLEX)
IF (VTK_USE_MPI)
# Needed for mpich 2
ADD_DEFINITIONS("-DMPICH_IGNORE_CXX_SEEK")
......@@ -269,6 +275,28 @@ IF(NOT WIN32)
ENDIF(NOT WIN32)
SET(XdmfSources ${XdmfFormatSource} ${XdmfExtraSource} ${XdmfModelSource})
OPTION(XDMF_USE_MYSQL
"Build Support for MySQL DataItems" OFF)
MARK_AS_ADVANCED(XDMF_USE_MYSQL)
IF(XDMF_USE_MYSQL)
FIND_PATH(MYSQL_INCLUDE_PATH
mysql.h
/usr/include
/usr/include/mysql
/usr/local/include
/usr/local/include/mysql)
FIND_LIBRARY(MYSQL_CLIENT_LIBRARY
mysqlclient
/usr/lib
/usr/lib/mysql
/usr/local/lib
/usr/local/lib/mysql)
SET(XdmfSources ${XdmfSources} ${XdmfMySQLSource})
ADD_DEFINITIONS("-DXDMF_USE_MYSQL")
INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_PATH})
ENDIF(XDMF_USE_MYSQL)
## MPI ###
IF(XDMF_BUILD_MPI)
SET(XdmfSources ${XdmfSources} ${XdmfMpiSource})
......@@ -284,6 +312,12 @@ ENDIF(VTK_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
ADD_LIBRARY(Xdmf ${LIBTYPE} ${XdmfSources})
IF(XDMF_USE_MYSQL)
ADD_DEFINITIONS("-DXDMF_USE_MYSQL")
INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_PATH})
TARGET_LINK_LIBRARIES(Xdmf ${MYSQL_CLIENT_LIBRARY} )
ENDIF(XDMF_USE_MYSQL)
IF(XDMF_BUILD_MPI)
IF(MPI_EXTRA_LIBRARY)
TARGET_LINK_LIBRARIES(Xdmf ${MPI_EXTRA_LIBRARY})
......
......@@ -31,6 +31,9 @@
// Supported Xdmf Formats
#include "XdmfValuesXML.h"
#include "XdmfValuesHDF.h"
#ifdef XDMF_USE_MYSQL
#include "XdmfValuesMySQL.h"
#endif
#include <libxml/tree.h>
......@@ -208,6 +211,8 @@ XdmfInt32 XdmfDataItem::UpdateInformationUniform(){
this->SetFormat(XDMF_FORMAT_HDF);
} else if(XDMF_WORD_CMP(Value, "XML")){
this->SetFormat(XDMF_FORMAT_XML);
} else if(XDMF_WORD_CMP(Value, "MYSQL")){
this->SetFormat(XDMF_FORMAT_MYSQL);
}else if(Value){
XdmfErrorMessage("Unsupported DataItem Format :" << Value);
return(XDMF_FAIL);
......@@ -484,6 +489,18 @@ XdmfInt32 XdmfDataItem::Update(){
return(XDMF_FAIL);
}
break;
case XDMF_FORMAT_MYSQL :
this->Values->SetDebug(this->GetDebug());
#ifdef XDMF_USE_MYSQL
if(!((XdmfValuesMySQL *)this->Values)->Read(this->Array)){
XdmfErrorMessage("Reading Values Failed");
return(XDMF_FAIL);
}
#else
XdmfErrorMessage("XdmfValuesMySQL not enabled in this Xdmf");
return(XDMF_FAIL);
#endif
break;
default :
XdmfErrorMessage("Unsupported Data Format");
return(XDMF_FAIL);
......@@ -616,6 +633,14 @@ XdmfDataItem::CheckValues(XdmfInt32 aFormat){
case XDMF_FORMAT_XML :
this->Values = (XdmfValues *)new XdmfValuesXML();
break;
case XDMF_FORMAT_MYSQL :
#ifdef XDMF_USE_MYSQL
this->Values = (XdmfValues *)new XdmfValuesMySQL();
#else
XdmfErrorMessage("MySQL not supported in this Xdmf");
return(XDMF_FAIL);
#endif
break;
default :
XdmfErrorMessage("Unsupported Data Format");
return(XDMF_FAIL);
......
......@@ -33,6 +33,7 @@ class XdmfValues;
#define XDMF_FORMAT_XML 0
#define XDMF_FORMAT_HDF 1
#define XDMF_FORMAT_MYSQL 2
// Organizations
#define XDMF_ITEM_UNIFORM 0x00
......
Supports Markdown
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