mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Update version number
modified: storage/connect/ha_connect.cc - Include MONGO in all Java enabled distributions Mongo will be enabled only for 10.2 and 10.3 modified: storage/connect/CMakeLists.txt - Change JDBC_SUPPORT to JAVA_SUPPORT which also replaces MONGO_SUPPORT MONGO_SUPPORT is now just used to enable the MONGO table type modified: storage/connect/filter.cpp modified: storage/connect/ha_connect.cc modified: storage/connect/ha_connect.h modified: storage/connect/mongo.cpp modified: storage/connect/mycat.cc modified: storage/connect/plgdbutl.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/tabjson.h - Move MakeSelector function from FILTER to mongo.cpp modified: storage/connect/filter.cpp modified: storage/connect/filter.h modified: storage/connect/cmgoconn.cpp modified: storage/connect/jmgoconn.cpp modified: storage/connect/mongo.cpp - Do mongo_init only on first use of the MongoDB C Driver This will permit to delay load the mongo lib on Windows modified: storage/connect/cmgoconn.cpp modified: storage/connect/cmgoconn.h modified: storage/connect/ha_connect.cc - Replace NEW_VAR by a test on MYSQL_VERSION_ID modified: storage/connect/ha_connect.cc - Suppress enable_mongo session variable modified: storage/connect/ha_connect.cc modified: storage/connect/mycat.cc - Make some function headers identical in .h and .cc file (replacing const char* by PCSZ) modified: storage/connect/ha_connect.cc modified: storage/connect/ha_connect.h - Change a parameter type from uchar* to const uchar* (for ScanRecord and CheckRecord) modified: storage/connect/ha_connect.cc modified: storage/connect/ha_connect.h - Changes on LIKE and NOT LIKE does not fix a bug yet modified: storage/connect/ha_connect.cc - Suppress PIVOT_SUPPORT (PIVOT type is unconditionnal) modified: storage/connect/ha_connect.cc modified: storage/connect/mycat.cc - Change the strz function from inline to static modified: storage/connect/ha_connect.cc modified: storage/connect/ha_connect.h - export the JavaConn class and the MgoColumns and IsNum functions modified: storage/connect/javaconn.h modified: storage/connect/json.h modified: storage/connect/mongo.h - Fix MDEV-13924 modified: storage/connect/jdbconn.cpp - Make a temporary fix for the compiler bug in CalculateArray modified: storage/connect/jsonudf.cpp modified: storage/connect/tabjson.cpp - Typo modified: storage/connect/jdbccat.h modified: storage/connect/reldef.h modified: storage/connect/tabext.h modified: storage/connect/tabjmg.cpp modified: storage/connect/tabxml.h modified: storage/connect/valblk.h modified: storage/connect/value.h modified: storage/connect/xtable.h - Fix a bug in MONGO tests by changing 'MONGO' to $TYPE modified: storage/connect/mysql-test/connect/t/mongo_test.inc - Record test results to reflect all changes modified: storage/connect/mysql-test/connect/r/json_java_2.result modified: storage/connect/mysql-test/connect/r/json_java_3.result modified: storage/connect/mysql-test/connect/r/json_mongo_c.result modified: storage/connect/mysql-test/connect/r/mongo_c.result modified: storage/connect/mysql-test/connect/r/mongo_java_2.result modified: storage/connect/mysql-test/connect/r/mongo_java_3.result
This commit is contained in:
@@ -18,12 +18,13 @@
|
||||
#include "plgdbsem.h"
|
||||
#include "xtable.h"
|
||||
#include "tabext.h"
|
||||
#include "filter.h"
|
||||
#if defined(CMGO_SUPPORT)
|
||||
#include "tabcmg.h"
|
||||
#endif // MONGO_SUPPORT
|
||||
#if defined(JDBC_SUPPORT)
|
||||
#endif // CMGO_SUPPORT
|
||||
#if defined(JAVA_SUPPORT)
|
||||
#include "tabjmg.h"
|
||||
#endif // JDBC_SUPPORT
|
||||
#endif // JAVA_SUPPORT
|
||||
#include "resource.h"
|
||||
|
||||
/***********************************************************************/
|
||||
@@ -34,6 +35,86 @@
|
||||
|
||||
bool IsNum(PSZ s);
|
||||
|
||||
/***********************************************************************/
|
||||
/* Make selector json representation for Mongo tables. */
|
||||
/***********************************************************************/
|
||||
bool MakeSelector(PGLOBAL g, PFIL fp, PSTRG s)
|
||||
{
|
||||
OPVAL opc = fp->GetOpc();
|
||||
|
||||
s->Append('{');
|
||||
|
||||
if (opc == OP_AND || opc == OP_OR) {
|
||||
if (fp->GetArgType(0) != TYPE_FILTER || fp->GetArgType(1) != TYPE_FILTER)
|
||||
return true;
|
||||
|
||||
s->Append("\"$");
|
||||
s->Append(opc == OP_AND ? "and" : "or");
|
||||
s->Append("\":[");
|
||||
|
||||
if (MakeSelector(g, (PFIL)fp->Arg(0), s))
|
||||
return true;
|
||||
|
||||
s->Append(',');
|
||||
|
||||
if (MakeSelector(g, (PFIL)fp->Arg(1), s))
|
||||
return true;
|
||||
|
||||
s->Append(']');
|
||||
} else {
|
||||
if (fp->GetArgType(0) != TYPE_COLBLK)
|
||||
return true;
|
||||
|
||||
s->Append('"');
|
||||
s->Append(((PCOL)fp->Arg(0))->GetJpath(g, false));
|
||||
s->Append("\":{\"$");
|
||||
|
||||
switch (opc) {
|
||||
case OP_EQ:
|
||||
s->Append("eq");
|
||||
break;
|
||||
case OP_NE:
|
||||
s->Append("ne");
|
||||
break;
|
||||
case OP_GT:
|
||||
s->Append("gt");
|
||||
break;
|
||||
case OP_GE:
|
||||
s->Append("gte");
|
||||
break;
|
||||
case OP_LT:
|
||||
s->Append("lt");
|
||||
break;
|
||||
case OP_LE:
|
||||
s->Append("lte");
|
||||
break;
|
||||
case OP_NULL:
|
||||
case OP_LIKE:
|
||||
case OP_EXIST:
|
||||
default:
|
||||
return true;
|
||||
} // endswitch Opc
|
||||
|
||||
s->Append("\":");
|
||||
|
||||
if (fp->GetArgType(1) == TYPE_COLBLK) {
|
||||
s->Append("\"$");
|
||||
s->Append(((PEXTCOL)fp->Arg(1))->GetJpath(g, false));
|
||||
s->Append('"');
|
||||
} else {
|
||||
char buf[501];
|
||||
|
||||
fp->Arg(1)->Prints(g, buf, 500);
|
||||
s->Append(buf);
|
||||
} // endif Type
|
||||
|
||||
s->Append('}');
|
||||
} // endif opc
|
||||
|
||||
s->Append('}');
|
||||
return false;
|
||||
} // end of MakeSelector
|
||||
|
||||
/***********************************************************************/
|
||||
/* MGOColumns: construct the result blocks containing the description */
|
||||
/* of all the columns of a document contained inside MongoDB. */
|
||||
@@ -72,7 +153,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info)
|
||||
goto err;
|
||||
#endif
|
||||
} else if (drv && toupper(*drv) == 'J') {
|
||||
#if defined(JDBC_SUPPORT)
|
||||
#if defined(JAVA_SUPPORT)
|
||||
cmgd = new(g) JMGDISC(g, (int*)length);
|
||||
#else
|
||||
sprintf(g->Message, "Mongo %s Driver not available", "Java");
|
||||
@@ -181,7 +262,7 @@ int MGODISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt)
|
||||
/* Open the MongoDB collection. */
|
||||
/*********************************************************************/
|
||||
tdp = new(g) MGODEF;
|
||||
tdp->Uri = uri;
|
||||
tdp->Uri = (uri && *uri) ? uri : "mongodb://localhost:27017";
|
||||
tdp->Driver = drv;
|
||||
tdp->Tabname = GetStringTableOption(g, topt, "Name", NULL);
|
||||
tdp->Tabname = GetStringTableOption(g, topt, "Tabname", tdp->Tabname);
|
||||
@@ -346,7 +427,7 @@ PTDB MGODEF::GetTable(PGLOBAL g, MODE m)
|
||||
return NULL;
|
||||
#endif
|
||||
} else if (Driver && toupper(*Driver) == 'J') {
|
||||
#if defined(JDBC_SUPPORT)
|
||||
#if defined(JAVA_SUPPORT)
|
||||
if (Catfunc == FNC_COL)
|
||||
return new(g) TDBJGL(this);
|
||||
else
|
||||
|
Reference in New Issue
Block a user