Commit 8ff3eb41 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix MDEV-21450

  Failed compile when XML table type is not supported.
  Was because XMLDEF was unconditionally called from REST table.
  modified:   storage/connect/tabrest.cpp

- Make cmake less verbose
  modified:   storage/connect/CMakeLists.txt

- Hide Switch_to_definer_security_ctx not defined for 10.1 and 10.0
  modified:   storage/connect/ha_connect.cc
parent b1c8bf46
...@@ -318,7 +318,7 @@ ENDIF(CONNECT_WITH_MONGO) ...@@ -318,7 +318,7 @@ ENDIF(CONNECT_WITH_MONGO)
OPTION(CONNECT_WITH_REST "Compile CONNECT storage engine with REST support" ON) OPTION(CONNECT_WITH_REST "Compile CONNECT storage engine with REST support" ON)
IF(CONNECT_WITH_REST) IF(CONNECT_WITH_REST)
MESSAGE(STATUS "=====> REST support is ON") # MESSAGE(STATUS "=====> REST support is ON")
SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp tabrest.h) SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp tabrest.h)
add_definitions(-DREST_SUPPORT) add_definitions(-DREST_SUPPORT)
FIND_PACKAGE(cpprestsdk QUIET) FIND_PACKAGE(cpprestsdk QUIET)
...@@ -338,7 +338,7 @@ IF(CONNECT_WITH_REST) ...@@ -338,7 +338,7 @@ IF(CONNECT_WITH_REST)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} restget.cpp) SET(CONNECT_SOURCES ${CONNECT_SOURCES} restget.cpp)
add_definitions(-DREST_SOURCE) add_definitions(-DREST_SOURCE)
# ENDIF() # ENDIF()
ELSE(NOT cpprestsdk_FOUND) # ELSE(NOT cpprestsdk_FOUND)
# MESSAGE(STATUS "=====> cpprestsdk package not found") # MESSAGE(STATUS "=====> cpprestsdk package not found")
ENDIF (cpprestsdk_FOUND) ENDIF (cpprestsdk_FOUND)
ENDIF(CONNECT_WITH_REST) ENDIF(CONNECT_WITH_REST)
......
...@@ -4509,7 +4509,9 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick) ...@@ -4509,7 +4509,9 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, char *dbn, bool quick)
case TAB_OEM: case TAB_OEM:
if (table && table->pos_in_table_list) // if SELECT if (table && table->pos_in_table_list) // if SELECT
{ {
#if MYSQL_VERSION_ID > 100200
Switch_to_definer_security_ctx backup_ctx(thd, table->pos_in_table_list); Switch_to_definer_security_ctx backup_ctx(thd, table->pos_in_table_list);
#endif // VERSION_ID > 100200
return check_global_access(thd, FILE_ACL); return check_global_access(thd, FILE_ACL);
} }
else else
......
...@@ -35,7 +35,9 @@ ...@@ -35,7 +35,9 @@
#include "filamtxt.h" #include "filamtxt.h"
#include "tabdos.h" #include "tabdos.h"
#include "plgxml.h" #include "plgxml.h"
#if defined(XML_SUPPORT)
#include "tabxml.h" #include "tabxml.h"
#endif // XML_SUPPORT
#include "tabjson.h" #include "tabjson.h"
#include "tabfmt.h" #include "tabfmt.h"
#include "tabrest.h" #include "tabrest.h"
...@@ -171,12 +173,14 @@ PQRYRES __stdcall ColREST(PGLOBAL g, PTOS tp, char *tab, char *db, bool info) ...@@ -171,12 +173,14 @@ PQRYRES __stdcall ColREST(PGLOBAL g, PTOS tp, char *tab, char *db, bool info)
// Retrieve the file from the web and copy it locally // Retrieve the file from the web and copy it locally
if (http && grf(g->Message, trace(515), http, uri, filename)) { if (http && grf(g->Message, trace(515), http, uri, filename)) {
// sprintf(g->Message, "Failed to get file at %s", http); // sprintf(g->Message, "Failed to get file at %s", http);
} else if (!stricmp(ftype, "XML")) } else if (!stricmp(ftype, "JSON"))
qrp = XMLColumns(g, db, tab, tp, info);
else if (!stricmp(ftype, "JSON"))
qrp = JSONColumns(g, db, NULL, tp, info); qrp = JSONColumns(g, db, NULL, tp, info);
else if (!stricmp(ftype, "CSV")) else if (!stricmp(ftype, "CSV"))
qrp = CSVColumns(g, NULL, tp, info); qrp = CSVColumns(g, NULL, tp, info);
#if defined(XML_SUPPORT)
else if (!stricmp(ftype, "XML"))
qrp = XMLColumns(g, db, tab, tp, info);
#endif // XML_SUPPORT
else else
sprintf(g->Message, "Usupported file type %s", ftype); sprintf(g->Message, "Usupported file type %s", ftype);
...@@ -210,7 +214,9 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -210,7 +214,9 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
htrc("ftype = %s am = %s\n", ftype, SVP(am)); htrc("ftype = %s am = %s\n", ftype, SVP(am));
n = (!stricmp(ftype, "JSON")) ? 1 n = (!stricmp(ftype, "JSON")) ? 1
#if defined(XML_SUPPORT)
: (!stricmp(ftype, "XML")) ? 2 : (!stricmp(ftype, "XML")) ? 2
#endif // XML_SUPPORT
: (!stricmp(ftype, "CSV")) ? 3 : 0; : (!stricmp(ftype, "CSV")) ? 3 : 0;
if (n == 0) { if (n == 0) {
...@@ -238,7 +244,9 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -238,7 +244,9 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return true; return true;
else switch (n) { else switch (n) {
case 1: Tdp = new (g) JSONDEF; break; case 1: Tdp = new (g) JSONDEF; break;
#if defined(XML_SUPPORT)
case 2: Tdp = new (g) XMLDEF; break; case 2: Tdp = new (g) XMLDEF; break;
#endif // XML_SUPPORT
case 3: Tdp = new (g) CSVDEF; break; case 3: Tdp = new (g) CSVDEF; break;
default: Tdp = NULL; default: Tdp = NULL;
} // endswitch n } // endswitch n
......
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