summaryrefslogtreecommitdiff
path: root/storage/connect/mycat.cc
diff options
context:
space:
mode:
authorKentoku SHIBA <kentokushiba@gmail.com>2021-04-28 16:45:50 +0900
committerGitHub <noreply@github.com>2021-04-28 16:45:50 +0900
commit977115add60f0f9d6258e5ebcb512a1c97492691 (patch)
tree6c5dff26ceecebc6607a180b98b8711b88dd25f7 /storage/connect/mycat.cc
parentb5d4964d1e56f91a0f129e72e850ed6220c52002 (diff)
parent4cd92143eae9b397589e5b449d1a85c43b3e4f6b (diff)
downloadmariadb-git-977115add60f0f9d6258e5ebcb512a1c97492691.tar.gz
Merge branch '10.4' into bb-10.4-MDEV-22265bb-10.4-MDEV-22265
Diffstat (limited to 'storage/connect/mycat.cc')
-rw-r--r--storage/connect/mycat.cc52
1 files changed, 41 insertions, 11 deletions
diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc
index f8b3dc03aa5..e3fa00e119f 100644
--- a/storage/connect/mycat.cc
+++ b/storage/connect/mycat.cc
@@ -16,9 +16,9 @@
/*************** Mycat CC Program Source Code File (.CC) ***************/
/* PROGRAM NAME: MYCAT */
/* ------------- */
-/* Version 1.7 */
+/* Version 1.8 */
/* */
-/* Author: Olivier Bertrand 2012 - 2019 */
+/* Author: Olivier Bertrand 2012 - 2020 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -82,7 +82,11 @@
#endif // JAVA_SUPPORT
#include "tabpivot.h"
#include "tabvir.h"
+#if defined(BSON_SUPPORT)
+#include "tabbson.h"
+#else
#include "tabjson.h"
+#endif // BSON_SUPPORT
#include "ha_connect.h"
#if defined(XML_SUPPORT)
#include "tabxml.h"
@@ -107,6 +111,9 @@ extern "C" HINSTANCE s_hModule; // Saved module handle
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
bool MongoEnabled(void);
#endif // JAVA_SUPPORT || CMGO_SUPPORT
+#if defined(BSON_SUPPORT)
+bool Force_Bson(void);
+#endif // BSON_SUPPORT
/***********************************************************************/
/* Get the plugin directory. */
@@ -130,25 +137,25 @@ TABTYPE GetTypeID(const char *type)
: (!stricmp(type, "DBF")) ? TAB_DBF
#if defined(XML_SUPPORT)
: (!stricmp(type, "XML")) ? TAB_XML
-#endif
+#endif // XML_SUPPORT
: (!stricmp(type, "INI")) ? TAB_INI
: (!stricmp(type, "VEC")) ? TAB_VEC
#if defined(ODBC_SUPPORT)
: (!stricmp(type, "ODBC")) ? TAB_ODBC
-#endif
+#endif // ODBC_SUPPORT
#if defined(JAVA_SUPPORT)
: (!stricmp(type, "JDBC")) ? TAB_JDBC
-#endif
+#endif // JAVA_SUPPORT
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
: (!stricmp(type, "MONGO") && MongoEnabled()) ? TAB_MONGO
-#endif
+#endif // JAVA_SUPPORT || CMGO_SUPPORT
: (!stricmp(type, "MYSQL")) ? TAB_MYSQL
: (!stricmp(type, "MYPRX")) ? TAB_MYSQL
: (!stricmp(type, "DIR")) ? TAB_DIR
#if defined(__WIN__)
: (!stricmp(type, "MAC")) ? TAB_MAC
: (!stricmp(type, "WMI")) ? TAB_WMI
-#endif
+#endif // __WIN__
: (!stricmp(type, "TBL")) ? TAB_TBL
: (!stricmp(type, "XCOL")) ? TAB_XCL
: (!stricmp(type, "OCCUR")) ? TAB_OCCUR
@@ -157,9 +164,12 @@ TABTYPE GetTypeID(const char *type)
: (!stricmp(type, "PIVOT")) ? TAB_PIVOT
: (!stricmp(type, "VIR")) ? TAB_VIR
: (!stricmp(type, "JSON")) ? TAB_JSON
+#if defined(BSON_SUPPORT)
+ : (!stricmp(type, "BSON")) ? TAB_BSON
+#endif // BSON_SUPPORT
#if defined(ZIP_SUPPORT)
: (!stricmp(type, "ZIP")) ? TAB_ZIP
-#endif
+#endif // ZIP_SUPPORT
: (!stricmp(type, "OEM")) ? TAB_OEM : TAB_NIY;
} // end of GetTypeID
@@ -181,6 +191,9 @@ bool IsFileType(TABTYPE type)
case TAB_INI:
case TAB_VEC:
case TAB_JSON:
+#if defined(BSON_SUPPORT)
+ case TAB_BSON:
+#endif // BSON_SUPPORT
case TAB_REST:
// case TAB_ZIP:
isfile= true;
@@ -276,6 +289,9 @@ bool IsTypeIndexable(TABTYPE type)
case TAB_VEC:
case TAB_DBF:
case TAB_JSON:
+#if defined(BSON_SUPPORT)
+ case TAB_BSON:
+#endif // BSON_SUPPORT
idx= true;
break;
default:
@@ -302,6 +318,9 @@ int GetIndexType(TABTYPE type)
case TAB_VEC:
case TAB_DBF:
case TAB_JSON:
+#if defined(BSON_SUPPORT)
+ case TAB_BSON:
+#endif // BSON_SUPPORT
xtyp= 1;
break;
case TAB_MYSQL:
@@ -445,7 +464,7 @@ PTABDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
case TAB_XML: tdp= new(g) XMLDEF; break;
#endif // XML_SUPPORT
#if defined(VCT_SUPPORT)
- case TAB_VEC: tdp = new(g) VCTDEF; break;
+ case TAB_VEC: tdp= new(g) VCTDEF; break;
#endif // VCT_SUPPORT
#if defined(ODBC_SUPPORT)
case TAB_ODBC: tdp= new(g) ODBCDEF; break;
@@ -465,9 +484,20 @@ PTABDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
case TAB_MYSQL: tdp= new(g) MYSQLDEF; break;
case TAB_PIVOT: tdp= new(g) PIVOTDEF; break;
case TAB_VIR: tdp= new(g) VIRDEF; break;
- case TAB_JSON: tdp= new(g) JSONDEF; break;
+ case TAB_JSON:
+#if defined(BSON_SUPPORT)
+ if (Force_Bson())
+ tdp= new(g) BSONDEF;
+ else
+#endif // BSON_SUPPORT
+ tdp= new(g) JSONDEF;
+
+ break;
+#if defined(BSON_SUPPORT)
+ case TAB_BSON: tdp= new(g) BSONDEF; break;
+#endif // BSON_SUPPORT
#if defined(ZIP_SUPPORT)
- case TAB_ZIP: tdp = new(g) ZIPDEF; break;
+ case TAB_ZIP: tdp= new(g) ZIPDEF; break;
#endif // ZIP_SUPPORT
#if defined(REST_SUPPORT)
case TAB_REST: tdp= new (g) RESTDEF; break;