1
0
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:
Olivier Bertrand
2017-10-15 16:13:23 +02:00
parent bf34e9db7b
commit bcfb5b2de9
35 changed files with 323 additions and 397 deletions

View File

@@ -22,17 +22,10 @@
#include "filter.h"
#include "cmgoconn.h"
bool CMgoConn::IsInit = false;
bool IsNum(PSZ s);
// Required to initialize libmongoc's internals
void mongo_init(bool init)
{
if (init)
mongoc_init();
else
mongoc_cleanup();
} // end of mongo_init
bool MakeSelector(PGLOBAL g, PFIL fp, PSTRG s);
/* --------------------------- Class INCOL --------------------------- */
@@ -139,11 +132,36 @@ CMgoConn::CMgoConn(PGLOBAL g, PCPARM pcg)
m_Connected = false;
} // end of CMgoConn standard constructor
/***********************************************************************/
/* Required to initialize libmongoc's internals. */
/***********************************************************************/
void CMgoConn::mongo_init(bool init)
{
if (init)
mongoc_init();
else if (IsInit)
mongoc_cleanup();
IsInit = init;
} // end of mongo_init
/***********************************************************************/
/* Connect to the MongoDB server and get the collection. */
/***********************************************************************/
bool CMgoConn::Connect(PGLOBAL g)
{
if (!IsInit)
#if defined(__WIN__)
__try {
mongo_init(true);
} __except (EXCEPTION_EXECUTE_HANDLER) {
strcpy(g->Message, "Cannot load MongoDB C driver");
return true;
} // end try/except
#else // !__WIN__
mongo_init(true);
#endif // !__WIN__
Uri = mongoc_uri_new(Pcg->Uristr);
if (!Uri) {
@@ -240,12 +258,13 @@ int CMgoConn::CollSize(PGLOBAL g)
/***********************************************************************/
bool CMgoConn::MakeCursor(PGLOBAL g)
{
const char *p;
bool id, b = false, all = false;
PCSZ options = Pcg->Options;
PTDB tp = Pcg->Tdbp;
PCOL cp;
PSTRG s = NULL;
const char *p;
bool id, b = false, all = false;
PCSZ options = Pcg->Options;
PTDB tp = Pcg->Tdbp;
PCOL cp;
PSTRG s = NULL;
PFIL filp = tp->GetFilter();
id = (tp->GetMode() != MODE_READ);
@@ -274,10 +293,10 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
s = new(g) STRING(g, 1023, (PSZ)options);
if (tp->GetFilter()) {
if (filp) {
s->Append(",{\"$match\":");
if (tp->GetFilter()->MakeSelector(g, s)) {
if (MakeSelector(g, filp, s)) {
strcpy(g->Message, "Failed making selector");
return true;
} else
@@ -330,15 +349,15 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
} // endif error
} else {
if (Pcg->Filter || tp->GetFilter()) {
if (Pcg->Filter || filp) {
if (trace) {
if (Pcg->Filter)
htrc("Filter: %s\n", Pcg->Filter);
if (tp->GetFilter()) {
if (filp) {
char buf[512];
tp->GetFilter()->Prints(g, buf, 511);
filp->Prints(g, buf, 511);
htrc("To_Filter: %s\n", buf);
} // endif To_Filter
@@ -346,11 +365,11 @@ bool CMgoConn::MakeCursor(PGLOBAL g)
s = new(g) STRING(g, 1023, (PSZ)Pcg->Filter);
if (tp->GetFilter()) {
if (filp) {
if (Pcg->Filter)
s->Append(',');
if (tp->GetFilter()->MakeSelector(g, s)) {
if (MakeSelector(g, filp, s)) {
strcpy(g->Message, "Failed making selector");
return NULL;
} // endif Selector