diff options
Diffstat (limited to 'storage/connect')
-rw-r--r-- | storage/connect/CMakeLists.txt | 36 | ||||
-rw-r--r-- | storage/connect/connect.h | 2 | ||||
-rw-r--r-- | storage/connect/ha_connect.cc | 68 | ||||
-rw-r--r-- | storage/connect/ha_connect.h | 2 | ||||
-rw-r--r-- | storage/connect/jsonudf.cpp | 4 | ||||
-rw-r--r-- | storage/connect/mysql-test/connect/r/jdbc_postgresql.result | 2 |
6 files changed, 77 insertions, 37 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index e66247edc68..0bb1576a0fa 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -310,6 +310,34 @@ IF(CONNECT_WITH_MONGO) ENDIF(libmongoc-1.0_FOUND) ENDIF(CONNECT_WITH_MONGO) +# +# REST +# + +OPTION(CONNECT_WITH_REST "Compile CONNECT storage engine with REST support" ON) + +IF(CONNECT_WITH_REST) + MESSAGE(STATUS "=====> REST support is ON") + FIND_PACKAGE(cpprestsdk) + IF (cpprestsdk_FOUND) + MESSAGE(STATUS "=====> cpprestsdk found") + IF(UNIX) +# INCLUDE_DIRECTORIES(${CPPRESTSDK_INCLUDE_DIR}) +# If needed edit next line to set the path to libcpprest.so + SET(REST_LIBRARY -lcpprest) + MESSAGE (STATUS ${REST_LIBRARY}) + ELSE(NOT UNIX) +# Next line sets debug compile mode matching cpprest_2_10d.dll +# when it was binary installed (can be change later in Visual Studio) +# Comment it out if not needed depending on your cpprestsdk installation. + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") + ENDIF(UNIX) + SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp restget.cpp tabrest.h) + add_definitions(-DREST_SUPPORT) + ELSE(NOT cpprestsdk_FOUND) + MESSAGE(STATUS "=====> cpprestsdk package not found") + ENDIF (cpprestsdk_FOUND) +ENDIF(CONNECT_WITH_REST) # # REST @@ -365,6 +393,14 @@ IF(NOT TARGET connect) RETURN() ENDIF() +# Don't link with bundled zlib and systel libxml2 at the same time. +# System libxml2 uses system zlib, might conflict with the bundled one. +IF (XML_LIBRARY AND BUILD_BUNDLED_ZLIB) + GET_PROPERTY(INCS TARGET connect PROPERTY INCLUDE_DIRECTORIES) + LIST(REMOVE_ITEM INCS ${ZLIB_INCLUDE_DIR}) + SET_PROPERTY(TARGET connect PROPERTY INCLUDE_DIRECTORIES ${INCS}) +ENDIF() + IF(WIN32) IF (libmongoc-1.0_FOUND) SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS diff --git a/storage/connect/connect.h b/storage/connect/connect.h index 3a60cd40160..cf0373ba635 100644 --- a/storage/connect/connect.h +++ b/storage/connect/connect.h @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /**************** Cnt H Declares Source Code File (.H) *****************/ /* Name: CONNECT.H Version 2.4 */ diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 05d15b41728..a7bfcd2149b 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /** @file ha_connect.cc @@ -170,7 +170,7 @@ #define JSONMAX 10 // JSON Default max grp size extern "C" { - char version[]= "Version 1.06.0010 June 01, 2019"; + char version[]= "Version 1.06.0010 August 22, 2019"; #if defined(__WIN__) char compver[]= "Version 1.06.0010 " __DATE__ " " __TIME__; char slash= '\\'; @@ -257,7 +257,7 @@ char *GetJavaWrapper(void); uint GetWorkSize(void); void SetWorkSize(uint); extern "C" const char *msglang(void); - +static char *strz(PGLOBAL g, LEX_CSTRING &ls); static void PopUser(PCONNECT xp); static PCONNECT GetUser(THD *thd, PCONNECT xp); static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp); @@ -1240,10 +1240,10 @@ PCSZ GetStringTableOption(PGLOBAL g, PTOS options, PCSZ opname, PCSZ sdef) opval= options->filter; else if (!stricmp(opname, "Data_charset")) opval= options->data_charset; - else if (!stricmp(opname, "Http") || !stricmp(opname, "URL")) - opval = options->http; - else if (!stricmp(opname, "Uri")) - opval = options->uri; + else if (!stricmp(opname, "Http") || !stricmp(opname, "URL")) + opval= options->http; + else if (!stricmp(opname, "Uri")) + opval= options->uri; if (!opval && options->oplist) opval= GetListOption(g, opname, options->oplist); @@ -5551,8 +5551,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd, String sql(buf, sizeof(buf), system_charset_info); sql.copy(STRING_WITH_LEN("CREATE TABLE whatever ("), system_charset_info); - user = host = pwd = tbl = src = col = ocl = pic = fcl = skc = rnk = zfn = NULL; - dsn = url = NULL; + user= host= pwd= tbl= src= col= ocl= pic= fcl= skc= rnk= zfn= NULL; + dsn= url= NULL; // Get the useful create options ttp= GetTypeID(topt->type); @@ -5603,7 +5603,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, #if defined(ZIP_SUPPORT) zfn= GetListOption(g, "Zipfile", topt->oplist, NULL); #endif // ZIP_SUPPORT - } else { + } else { host= "localhost"; user= ((ttp == TAB_ODBC || ttp == TAB_JDBC) ? NULL : "root"); } // endif option_list @@ -5705,17 +5705,17 @@ static int connect_assisted_discovery(handlerton *, THD* thd, PJDBCDEF jdef= new(g) JDBCDEF(); jdef->SetName(create_info->alias.str); - sjp = (PJPARM)PlugSubAlloc(g, NULL, sizeof(JDBCPARM)); - sjp->Driver = driver; - // sjp->Properties = prop; - sjp->Fsize = 0; - sjp->Scrollable = false; - - if ((rc = jdef->ParseURL(g, url, false)) == RC_OK) { - sjp->Url = url; - sjp->User = (char*)user; - sjp->Pwd = (char*)pwd; - ok = true; + sjp= (PJPARM)PlugSubAlloc(g, NULL, sizeof(JDBCPARM)); + sjp->Driver= driver; + // sjp->Properties= prop; + sjp->Fsize= 0; + sjp->Scrollable= false; + + if ((rc= jdef->ParseURL(g, url, false)) == RC_OK) { + sjp->Url= url; + sjp->User= (char*)user; + sjp->Pwd= (char*)pwd; + ok= true; } else if (rc == RC_NF) { if (jdef->GetTabname()) tab= (char*)jdef->GetTabname(); @@ -5825,11 +5825,11 @@ static int connect_assisted_discovery(handlerton *, THD* thd, break; #endif // JAVA_SUPPORT #if defined(REST_SUPPORT) - case TAB_REST: - if (!topt->http) - sprintf(g->Message, "Missing %s HTTP address", topt->type); - else - ok = true; + case TAB_REST: + if (!topt->http) + sprintf(g->Message, "Missing %s HTTP address", topt->type); + else + ok= true; break; #endif // REST_SUPPORT @@ -5986,11 +5986,11 @@ static int connect_assisted_discovery(handlerton *, THD* thd, break; #endif // LIBXML2_SUPPORT || DOMDOC_SUPPORT #if defined(REST_SUPPORT) - case TAB_REST: - qrp = RESTColumns(g, topt, tab, (char *)db, fnc == FNC_COL); - break; + case TAB_REST: + qrp= RESTColumns(g, topt, tab, (char *)db, fnc == FNC_COL); + break; #endif // REST_SUPPORT - case TAB_OEM: + case TAB_OEM: qrp= OEMColumns(g, topt, tab, (char*)db, fnc == FNC_COL); break; default: @@ -6300,7 +6300,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, TABTYPE type; TABLE *st= table; // Probably unuseful THD *thd= ha_thd(); - LEX_CSTRING cnc = table_arg->s->connect_string; + LEX_CSTRING cnc= table_arg->s->connect_string; #if defined(WITH_PARTITION_STORAGE_ENGINE) partition_info *part_info= table_arg->part_info; #else // !WITH_PARTITION_STORAGE_ENGINE @@ -6711,6 +6711,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, #if defined(ZIP_SUPPORT) if (options->zipped) { +#if defined(ZIP_SUPPORT) // Check whether the zip entry must be made from a file PCSZ fn= GetListOption(g, "Load", options->oplist, NULL); @@ -6737,7 +6738,10 @@ int ha_connect::create(const char *name, TABLE *table_arg, } // endif LoadFile } // endif fn - +#else // !ZIP_SUPPORT + my_message(ER_UNKNOWN_ERROR, "Option ZIP not supported", MYF(0)); + DBUG_RETURN(HA_ERR_INTERNAL_ERROR); +#endif // !ZIP_SUPPORT } // endif zipped #endif // ZIP_SUPPORT diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index 3e4474d140e..3727dc193c2 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /** @file ha_connect.h Author Olivier Bertrand diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index d5bd1215e77..dad86d51040 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -1686,7 +1686,7 @@ static PCSZ MakeKey(PGLOBAL g, UDF_ARGS *args, int i) } // endif *s if (n < 1) - return (PCSZ) "Key"; + return (PCSZ) "Key"; if (!b) { if ((p = (PSZ)PlgDBSubAlloc(g, NULL, n + 1))) { @@ -1700,7 +1700,7 @@ static PCSZ MakeKey(PGLOBAL g, UDF_ARGS *args, int i) } // endif s - return (char*) s; + return s; } // endif count return (PCSZ) "Key"; diff --git a/storage/connect/mysql-test/connect/r/jdbc_postgresql.result b/storage/connect/mysql-test/connect/r/jdbc_postgresql.result index 07cc3c465ea..bec1dc8725b 100644 --- a/storage/connect/mysql-test/connect/r/jdbc_postgresql.result +++ b/storage/connect/mysql-test/connect/r/jdbc_postgresql.result @@ -1,4 +1,4 @@ -SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar'; +SET GLOBAL connect_class_path='C:/MariaDB-10.0/MariaDB/storage/connect/mysql-test/connect/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar'; CREATE TABLE t2 ( command varchar(128) not null, number int(5) not null flag=1, |