mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- New distribution enabling or disabling the MONGO table type
modified: storage/connect/CMakeLists.txt modified: storage/connect/ha_connect.cc modified: storage/connect/mycat.cc - Extend SRCDEF parameter processing to MYSQL modified: storage/connect/tabext.cpp modified: storage/connect/tabext.h modified: storage/connect/tabmysql.cpp - Typo modified: storage/connect/mysql-test/connect/std_data/Mongo2.jar modified: storage/connect/mysql-test/connect/std_data/Mongo3.jar
This commit is contained in:
@@ -245,7 +245,7 @@ int main() {
|
||||
ENDIF(CONNECT_WITH_ODBC)
|
||||
|
||||
#
|
||||
# JDBC and MongoDB Java Driver
|
||||
# JDBC with MongoDB Java Driver included and enabled
|
||||
#
|
||||
OPTION(CONNECT_WITH_MONGO "Compile CONNECT storage engine with MONGO support" ON)
|
||||
OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON)
|
||||
@@ -264,13 +264,6 @@ IF(CONNECT_WITH_JDBC)
|
||||
JdbcInterface.java ApacheInterface.java MariadbInterface.java
|
||||
MysqlInterface.java OracleInterface.java PostgresqlInterface.java
|
||||
JavaWrappers.jar)
|
||||
# TODO: Find how to compile and install the java wrapper classes
|
||||
# Find required libraries and include directories
|
||||
SET (JAVA_SOURCES JdbcInterface.java)
|
||||
add_jar(JdbcInterface ${JAVA_SOURCES})
|
||||
install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
|
||||
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
|
||||
add_definitions(-DJDBC_SUPPORT)
|
||||
IF(CONNECT_WITH_MONGO)
|
||||
SET(CONNECT_SOURCES ${CONNECT_SOURCES}
|
||||
@@ -348,4 +341,33 @@ MYSQL_ADD_PLUGIN(connect ${CONNECT_SOURCES}
|
||||
LINK_LIBRARIES ${ZLIB_LIBRARY} ${XML_LIBRARY} ${ICONV_LIBRARY}
|
||||
${ODBC_LIBRARY} ${JDBC_LIBRARY} ${IPHLPAPI_LIBRARY})
|
||||
|
||||
IF(NOT TARGET connect)
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
# Install some extra files that belong to connect engine
|
||||
IF(WIN32)
|
||||
# install ha_connect.lib
|
||||
GET_TARGET_PROPERTY(CONNECT_LOCATION connect LOCATION)
|
||||
STRING(REPLACE "dll" "lib" CONNECT_LIB ${CONNECT_LOCATION})
|
||||
IF(CMAKE_CONFIGURATION_TYPES)
|
||||
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
|
||||
CONNECT_LIB ${CONNECT_LIB})
|
||||
ENDIF()
|
||||
INSTALL(FILES ${CONNECT_LIB}
|
||||
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(CONNECT_WITH_JDBC AND JAVA_FOUND AND JNI_FOUND)
|
||||
# TODO: Find how to compile and install the java wrapper classes
|
||||
# Find required libraries and include directories
|
||||
SET (JAVA_SOURCES JdbcInterface.java)
|
||||
add_jar(JdbcInterface ${JAVA_SOURCES})
|
||||
INSTALL(FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
|
||||
${CMAKE_CURRENT_BINARY_DIR}/JdbcInterface.jar
|
||||
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
||||
|
@@ -171,9 +171,9 @@
|
||||
#define JSONMAX 10 // JSON Default max grp size
|
||||
|
||||
extern "C" {
|
||||
char version[]= "Version 1.06.0001 April 17, 2017";
|
||||
char version[]= "Version 1.06.0003 August 28, 2017";
|
||||
#if defined(__WIN__)
|
||||
char compver[]= "Version 1.06.0001 " __DATE__ " " __TIME__;
|
||||
char compver[]= "Version 1.06.0003 " __DATE__ " " __TIME__;
|
||||
char slash= '\\';
|
||||
#else // !__WIN__
|
||||
char slash= '/';
|
||||
@@ -182,7 +182,10 @@ extern "C" {
|
||||
|
||||
#if defined(NEW_MAR)
|
||||
#define stored_in_db stored_in_db()
|
||||
#endif // NEW_MAR)
|
||||
#define MONGO_ENABLED 1
|
||||
#else // !NEW_MAR
|
||||
#define MONGO_ENABLED 0
|
||||
#endif // !NEW_MAR)
|
||||
|
||||
#if defined(XMAP)
|
||||
my_bool xmap= false;
|
||||
@@ -359,6 +362,13 @@ static MYSQL_THDVAR_STR(java_wrapper,
|
||||
NULL, NULL, "wrappers/JdbcInterface");
|
||||
#endif // JDBC_SUPPORT
|
||||
|
||||
#if defined(MONGO_SUPPORT)
|
||||
// Enabling MONGO table type
|
||||
static MYSQL_THDVAR_BOOL(enable_mongo, PLUGIN_VAR_RQCMDARG,
|
||||
"Enabling the MongoDB access",
|
||||
NULL, NULL, MONGO_ENABLED);
|
||||
#endif // MONGO_SUPPORT
|
||||
|
||||
#if defined(XMSG) || defined(NEWMSG)
|
||||
const char *language_names[]=
|
||||
{
|
||||
@@ -419,6 +429,10 @@ char *GetJavaWrapper(void)
|
||||
{return connect_hton ? THDVAR(current_thd, java_wrapper) : (char*)"wrappers/JdbcInterface";}
|
||||
#endif // JDBC_SUPPORT
|
||||
|
||||
#if defined(MONGO_SUPPORT)
|
||||
bool MongoEnabled(void) { return THDVAR(current_thd, enable_mongo); }
|
||||
#endif // MONGO_SUPPORT
|
||||
|
||||
extern "C" const char *msglang(void)
|
||||
{
|
||||
#if defined(FRENCH)
|
||||
@@ -7176,7 +7190,10 @@ static struct st_mysql_sys_var* connect_system_variables[]= {
|
||||
MYSQL_SYSVAR(class_path),
|
||||
MYSQL_SYSVAR(java_wrapper),
|
||||
#endif // JDBC_SUPPORT
|
||||
NULL
|
||||
#if defined(MONGO_SUPPORT)
|
||||
MYSQL_SYSVAR(enable_mongo),
|
||||
#endif // MONGO_SUPPORT
|
||||
NULL
|
||||
};
|
||||
|
||||
maria_declare_plugin(connect)
|
||||
@@ -7185,14 +7202,14 @@ maria_declare_plugin(connect)
|
||||
&connect_storage_engine,
|
||||
"CONNECT",
|
||||
"Olivier Bertrand",
|
||||
"Management of External Data (SQL/MED), including many file formats",
|
||||
"Management of External Data (SQL/NOSQL/MED), including many file formats",
|
||||
PLUGIN_LICENSE_GPL,
|
||||
connect_init_func, /* Plugin Init */
|
||||
connect_done_func, /* Plugin Deinit */
|
||||
0x0106, /* version number (1.05) */
|
||||
NULL, /* status variables */
|
||||
connect_system_variables, /* system variables */
|
||||
"1.06.0001", /* string version */
|
||||
MariaDB_PLUGIN_MATURITY_BETA /* maturity */
|
||||
"1.06.0003", /* string version */
|
||||
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
|
||||
}
|
||||
maria_declare_plugin_end;
|
||||
|
@@ -111,6 +111,9 @@
|
||||
extern "C" HINSTANCE s_hModule; // Saved module handle
|
||||
#endif // !__WIN__
|
||||
|
||||
#if defined(MONGO_SUPPORT)
|
||||
bool MongoEnabled(void);
|
||||
#endif // MONGO_SUPPORT
|
||||
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
|
||||
|
||||
/***********************************************************************/
|
||||
@@ -558,7 +561,13 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
|
||||
case TAB_VIR: tdp= new(g) VIRDEF; break;
|
||||
case TAB_JSON: tdp= new(g) JSONDEF; break;
|
||||
#if defined(MONGO_SUPPORT)
|
||||
case TAB_MONGO: tdp = new(g) MGODEF; break;
|
||||
case TAB_MONGO:
|
||||
if (MongoEnabled())
|
||||
tdp = new(g) MGODEF;
|
||||
else
|
||||
strcpy(g->Message, "MONGO type not enabled");
|
||||
|
||||
break;
|
||||
#endif // MONGO_SUPPORT
|
||||
#if defined(ZIP_SUPPORT)
|
||||
case TAB_ZIP: tdp= new(g) ZIPDEF; break;
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -279,21 +279,13 @@ int TDBEXT::Decode(PCSZ txt, char *buf, size_t n)
|
||||
} // end of Decode
|
||||
|
||||
/***********************************************************************/
|
||||
/* MakeSQL: make the SQL statement use with remote connection. */
|
||||
/* TODO: when implementing remote filtering, column only used in */
|
||||
/* local filter should be removed from column list. */
|
||||
/* MakeSrcdef: make the SQL statement from SRDEF option. */
|
||||
/***********************************************************************/
|
||||
bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt)
|
||||
bool TDBEXT::MakeSrcdef(PGLOBAL g)
|
||||
{
|
||||
PCSZ schmp = NULL;
|
||||
char *catp = NULL, buf[NAM_LEN * 3];
|
||||
int len;
|
||||
bool first = true;
|
||||
PTABLE tablep = To_Table;
|
||||
PCOL colp;
|
||||
char *catp = strstr(Srcdef, "%s");
|
||||
|
||||
if (Srcdef) {
|
||||
if ((catp = strstr(Srcdef, "%s"))) {
|
||||
if (catp) {
|
||||
char *fil1, *fil2;
|
||||
PCSZ ph = ((EXTDEF*)To_Def)->Phpos;
|
||||
|
||||
@@ -331,7 +323,24 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt)
|
||||
Query = new(g)STRING(g, 0, Srcdef);
|
||||
|
||||
return false;
|
||||
} // endif Srcdef
|
||||
} // end of MakeSrcdef
|
||||
|
||||
/***********************************************************************/
|
||||
/* MakeSQL: make the SQL statement use with remote connection. */
|
||||
/* TODO: when implementing remote filtering, column only used in */
|
||||
/* local filter should be removed from column list. */
|
||||
/***********************************************************************/
|
||||
bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt)
|
||||
{
|
||||
PCSZ schmp = NULL;
|
||||
char *catp = NULL, buf[NAM_LEN * 3];
|
||||
int len;
|
||||
bool first = true;
|
||||
PTABLE tablep = To_Table;
|
||||
PCOL colp;
|
||||
|
||||
if (Srcdef)
|
||||
return MakeSrcdef(g);
|
||||
|
||||
// Allocate the string used to contain the Query
|
||||
Query = new(g)STRING(g, 1023, "SELECT ");
|
||||
|
@@ -126,6 +126,7 @@ public:
|
||||
|
||||
protected:
|
||||
// Internal functions
|
||||
virtual bool MakeSrcdef(PGLOBAL g);
|
||||
virtual bool MakeSQL(PGLOBAL g, bool cnt);
|
||||
//virtual bool MakeInsert(PGLOBAL g);
|
||||
virtual bool MakeCommand(PGLOBAL g);
|
||||
|
@@ -513,18 +513,8 @@ bool TDBMYSQL::MakeSelect(PGLOBAL g, bool mx)
|
||||
if (Query)
|
||||
return false; // already done
|
||||
|
||||
if (Srcdef) {
|
||||
if (strstr(Srcdef, "%s")) {
|
||||
char *fil;
|
||||
|
||||
fil = (To_CondFil) ? To_CondFil->Body : PlugDup(g, "1=1");
|
||||
Query = new(g)STRING(g, strlen(Srcdef) + strlen(fil));
|
||||
Query->SetLength(sprintf(Query->GetStr(), Srcdef, fil));
|
||||
} else
|
||||
Query = new(g)STRING(g, 0, Srcdef);
|
||||
|
||||
return false;
|
||||
} // endif Srcdef
|
||||
if (Srcdef)
|
||||
return MakeSrcdef(g);
|
||||
|
||||
// Allocate the string used to contain Query
|
||||
Query = new(g) STRING(g, 1023, "SELECT ");
|
||||
|
Reference in New Issue
Block a user