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