summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-01-20 16:10:30 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2020-01-20 16:10:30 +0100
commitd07664498be9c71c01c7df9f2fb1d18c7060b2e3 (patch)
treec986d07b63d8c4d1633f1f778da89bd4824474a3 /storage
parent90d39f2f91346a848f48c9308b5e4bb4e5c8a36d (diff)
parent8ff3eb417c0aa4b8d09e2b0296b2e66c0c530380 (diff)
downloadmariadb-git-d07664498be9c71c01c7df9f2fb1d18c7060b2e3.tar.gz
Merge remote-tracking branch 'connect/10.2' into 10.2
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/ha_connect.cc6
-rw-r--r--storage/connect/reldef.cpp12
-rw-r--r--storage/connect/restget.cpp2
-rw-r--r--storage/connect/tabrest.cpp36
-rw-r--r--storage/connect/tabrest.h4
5 files changed, 39 insertions, 21 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index cc9e7d1b55c..105ebf0545b 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -2966,10 +2966,12 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
case Item_func::LE_FUNC: vop= OP_LE; break;
case Item_func::GE_FUNC: vop= OP_GE; break;
case Item_func::GT_FUNC: vop= OP_GT; break;
+#if MYSQL_VERSION_ID > 100200
case Item_func::LIKE_FUNC:
vop = OP_LIKE;
neg= ((Item_func_like*)condf)->negated;
break;
+#endif // VERSION_ID > 100200
case Item_func::ISNOTNULL_FUNC:
neg= true;
// fall through
@@ -4507,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
diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp
index ffe5f77661d..2d3c6a6aacd 100644
--- a/storage/connect/reldef.cpp
+++ b/storage/connect/reldef.cpp
@@ -20,7 +20,7 @@
#if defined(__WIN__)
#include <sqlext.h>
#else
-#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
+//#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
#include "osutil.h"
//#include "sqlext.h"
#endif
@@ -324,11 +324,11 @@ RECFM TABDEF::GetTableFormat(const char* type)
{
RECFM recfm = Recfm;
- if (recfm == RECFM_DFLT) {
+ if (Catfunc != FNC_NO)
+ recfm = RECFM_NAF;
+ else if (recfm == RECFM_DFLT)
// Default format depends on the table type
- TABTYPE tc = (Catfunc == FNC_NO) ? GetTypeID(type) : TAB_PRX;
-
- switch (tc) {
+ switch (GetTypeID(type)) {
case TAB_DOS: recfm = RECFM_VAR; break;
case TAB_CSV: recfm = RECFM_CSV; break;
case TAB_FMT: recfm = RECFM_FMT; break;
@@ -341,8 +341,6 @@ RECFM TABDEF::GetTableFormat(const char* type)
default: recfm = RECFM_NAF; break;
} // endswitch type
- } // endif recfm
-
return recfm;
} // end of GetTableFormat
diff --git a/storage/connect/restget.cpp b/storage/connect/restget.cpp
index d85ec6ae693..29dae230780 100644
--- a/storage/connect/restget.cpp
+++ b/storage/connect/restget.cpp
@@ -13,6 +13,8 @@ using namespace concurrency::streams; // Asynchronous streams
typedef const char* PCSZ;
+extern "C" int restGetFile(char* m, bool xt, PCSZ http, PCSZ uri, PCSZ fn);
+
/***********************************************************************/
/* Make a local copy of the requested file. */
/***********************************************************************/
diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp
index f9acbc28ddc..9c6b724973f 100644
--- a/storage/connect/tabrest.cpp
+++ b/storage/connect/tabrest.cpp
@@ -1,5 +1,5 @@
-/*************** Rest C++ Program Source Code File (.CPP) **************/
-/* PROGRAM NAME: Rest Version 1.6 */
+/************** tabrest C++ Program Source Code File (.CPP) ************/
+/* PROGRAM NAME: tabrest Version 1.7 */
/* (C) Copyright to the author Olivier BERTRAND 2018 - 2019 */
/* This program is the REST Web API support for MariaDB. */
/* When compiled without MARIADB defined, it is the EOM module code. */
@@ -9,13 +9,18 @@
/* Definitions needed by the included files. */
/***********************************************************************/
#if defined(MARIADB)
-#include <my_global.h> // All MariaDB stuff
+#include <my_global.h> // All MariaDB stuff
#else // !MARIADB OEM module
#include "mini-global.h"
#define _MAX_PATH 260
-#if !defined(__WIN__)
+#if !defined(REST_SOURCE)
+#if defined(__WIN__) || defined(_WINDOWS)
+#include <windows.h>
+#else // !__WIN__
#define __stdcall
+#include <dlfcn.h> // dlopen(), dlclose(), dlsym() ...
#endif // !__WIN__
+#endif // !REST_SOURCE
#define _OS_H_INCLUDED // Prevent os.h to be called
#endif // !MARIADB
@@ -23,7 +28,6 @@
/* Include application header files: */
/* global.h is header containing all global declarations. */
/* plgdbsem.h is header containing the DB application declarations. */
-/* (x)table.h is header containing the TDBASE declarations. */
/***********************************************************************/
#include "global.h"
#include "plgdbsem.h"
@@ -31,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"
@@ -73,11 +79,11 @@ XGETREST GetRestFunction(PGLOBAL g)
if (getRestFnc)
return getRestFnc;
-#if !defined(REST_SOURCE)
+#if !defined(MARIADB) || !defined(REST_SOURCE)
if (trace(515))
htrc("Looking for GetRest library\n");
-#if defined(__WIN__)
+#if defined(__WIN__) || defined(_WINDOWS)
HANDLE Hdll;
const char* soname = "GetRest.dll"; // Module name
@@ -167,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;
@@ -206,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) {
@@ -234,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
diff --git a/storage/connect/tabrest.h b/storage/connect/tabrest.h
index d945c97e5f1..9cf2d10a6b8 100644
--- a/storage/connect/tabrest.h
+++ b/storage/connect/tabrest.h
@@ -18,7 +18,9 @@ typedef int(__stdcall* XGETREST) (char*, bool, PCSZ, PCSZ, PCSZ);
/* Functions used by REST. */
/***********************************************************************/
XGETREST GetRestFunction(PGLOBAL g);
-int restGetFile(char* m, bool x, PCSZ http, PCSZ uri, PCSZ fn);
+#if defined(REST_SOURCE)
+extern "C" int restGetFile(char* m, bool xt, PCSZ http, PCSZ uri, PCSZ fn);
+#endif // REST_SOURCE
#if defined(MARIADB)
PQRYRES RESTColumns(PGLOBAL g, PTOS tp, char* tab, char* db, bool info);
#endif // !MARIADB