mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Add FBLOCK when opening ODBC, JSON and MONGO tables.
This to have automatic closing in case of thrown error. modified: storage/connect/cmgoconn.cpp modified: storage/connect/cmgoconn.h modified: storage/connect/filamzip.cpp modified: storage/connect/javaconn.cpp modified: storage/connect/javaconn.h modified: storage/connect/odbconn.cpp modified: storage/connect/odbconn.h modified: storage/connect/plgdbsem.h modified: storage/connect/plgdbutl.cpp - Fix INCOL bug when inserting several lines to MONGO tables modified: storage/connect/cmgoconn.cpp modified: storage/connect/tabcmg.cpp modified: storage/connect/tabjmg.cpp - MONGO_SUPPORT is set for both MongoDB drivers CMGO_SUPPORT is set only when the C driver is available modified: storage/connect/CMakeLists.txt modified: storage/connect/filter.h modified: storage/connect/filter.h modified: storage/connect/ha_connect.cc modified: storage/connect/mongo.cpp modified: storage/connect/mycat.cc modified: storage/connect/tabjson.cpp modified: storage/connect/tabjson.h - Separate enums JCATINFO and modified: storage/connect/javaconn.h modified: storage/connect/jdbconn.cpp - Fix crash when executing JDBC catfunc=driver modified: storage/connect/jdbconn.cpp - Report an error when the Mongo driver if explicitly specified and not supported. modified: storage/connect/mongo.cpp - Fix bug causing catalog JSON tables to fail modified: storage/connect/tabjson.cpp - Protect by mutex the Ready variable of the TBLTBM table type modified: storage/connect/tabtbl.cpp - Put testing of Thread TBL tables in a separate test With added case and modified old case that could avoid the test to fail. modified: storage/connect/mysql-test/connect/r/tbl.result modified: storage/connect/mysql-test/connect/t/tbl.test new file: storage/connect/mysql-test/connect/r/tbl_thread.result new file: storage/connect/mysql-test/connect/t/tbl_thread.test - jmongo3.test no more exists deleted: storage/connect/mysql-test/connect/t/jmongo3.test - Add new tests for the MONGO feature (disabled) modified: storage/connect/mysql-test/connect/disabled.def new file: storage/connect/mysql-test/connect/r/json_java_2.result new file: storage/connect/mysql-test/connect/r/json_java_3.result new file: storage/connect/mysql-test/connect/r/json_mongo_c.result new file: storage/connect/mysql-test/connect/r/mongo_c.result new file: storage/connect/mysql-test/connect/r/mongo_java_2.result new file: storage/connect/mysql-test/connect/r/mongo_java_3.result new file: storage/connect/mysql-test/connect/std_data/Mongo2.jar new file: storage/connect/mysql-test/connect/std_data/cities.json new file: storage/connect/mysql-test/connect/t/json_java_2.test new file: storage/connect/mysql-test/connect/t/json_java_3.test new file: storage/connect/mysql-test/connect/t/json_mongo_c.test new file: storage/connect/mysql-test/connect/t/mongo.inc new file: storage/connect/mysql-test/connect/t/mongo_c.test new file: storage/connect/mysql-test/connect/t/mongo_java_2.test new file: storage/connect/mysql-test/connect/t/mongo_java_3.test new file: storage/connect/mysql-test/connect/t/mongo_test.inc
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
#if defined(JDBC_SUPPORT)
|
||||
#include "jmgfam.h"
|
||||
#endif // JDBC_SUPPORT
|
||||
#if defined(MONGO_SUPPORT)
|
||||
#if defined(CMGO_SUPPORT)
|
||||
#include "cmgfam.h"
|
||||
#endif // MONGO_SUPPORT
|
||||
#include "tabmul.h"
|
||||
@@ -129,8 +129,8 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
|
||||
#endif // ZIP_SUPPORT
|
||||
tdp->Fn = GetStringTableOption(g, topt, "Filename", NULL);
|
||||
|
||||
if (!(tdp->Database = SetPath(g, db)))
|
||||
return NULL;
|
||||
//if (!(tdp->Database = SetPath(g, db)))
|
||||
// return NULL;
|
||||
|
||||
tdp->Objname = GetStringTableOption(g, topt, "Object", NULL);
|
||||
tdp->Base = GetIntegerTableOption(g, topt, "Base", 0) ? 1 : 0;
|
||||
@@ -148,22 +148,23 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
|
||||
tdp->Fn, tdp->Objname, tdp->Pretty, lvl);
|
||||
|
||||
if (tdp->Uri) {
|
||||
#if defined(MONGO_SUPPORT) || defined(JDBC_SUPPORT)
|
||||
#if defined(MONGO_SUPPORT)
|
||||
tdp->Collname = GetStringTableOption(g, topt, "Name", NULL);
|
||||
tdp->Collname = GetStringTableOption(g, topt, "Tabname", tdp->Collname);
|
||||
tdp->Schema = GetStringTableOption(g, topt, "Dbname", "test");
|
||||
tdp->Options = (PSZ)GetStringTableOption(g, topt, "Colist", "all");
|
||||
tdp->Pipe = GetBooleanTableOption(g, topt, "Pipeline", false);
|
||||
tdp->Driver = (PSZ)GetStringTableOption(g, topt, "Driver", NULL);
|
||||
tdp->Version = GetIntegerTableOption(g, topt, "Version", 3);
|
||||
#if defined(JDBC_SUPPORT)
|
||||
tdp->Wrapname = (PSZ)GetStringTableOption(g, topt, "Wrapper",
|
||||
(tdp->Version == 2) ? "Mongo2Interface" : "Mongo3Interface");
|
||||
#endif // JDBC_SUPPORT
|
||||
tdp->Pretty = 0;
|
||||
#else // !MONGO_SUPPORT || JDBC_SUPPORT
|
||||
#else // !MONGO_SUPPORT
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO");
|
||||
return NULL;
|
||||
#endif // !MONGO_SUPPORT || JDBC_SUPPORT
|
||||
#endif // !MONGO_SUPPORT
|
||||
} // endif Uri
|
||||
|
||||
if (tdp->Pretty == 2) {
|
||||
@@ -199,21 +200,32 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
|
||||
return NULL;
|
||||
#endif // !ZIP_SUPPORT
|
||||
} else if (tdp->Uri) {
|
||||
#if defined(MONGO_SUPPORT) || defined(JDBC_SUPPORT)
|
||||
#if !defined(JDBC_SUPPORT)
|
||||
tjnp = new(g) TDBJSN(tdp, new(g) CMGFAM(tdp));
|
||||
#elif !defined(MONGO_SUPPORT)
|
||||
tjnp = new(g) TDBJSN(tdp, new(g) JMGFAM(tdp));
|
||||
#else
|
||||
if (tdp->Driver && toupper(*tdp->Driver) == 'C')
|
||||
#if defined(MONGO_SUPPORT)
|
||||
if (tdp->Driver && toupper(*tdp->Driver) == 'C') {
|
||||
#if defined(CMGO_SUPPORT)
|
||||
tjnp = new(g) TDBJSN(tdp, new(g) CMGFAM(tdp));
|
||||
else
|
||||
#else
|
||||
sprintf(g->Message, "Mongo %s Driver not available", "C");
|
||||
return NULL;
|
||||
#endif
|
||||
} else if (tdp->Driver && toupper(*tdp->Driver) == 'J') {
|
||||
#if defined(JDBC_SUPPORT)
|
||||
tjnp = new(g) TDBJSN(tdp, new(g) JMGFAM(tdp));
|
||||
#else
|
||||
sprintf(g->Message, "Mongo %s Driver not available", "Java");
|
||||
return NULL;
|
||||
#endif
|
||||
} else { // Driver not specified
|
||||
#if defined(CMGO_SUPPORT)
|
||||
tjnp = new(g) TDBJSN(tdp, new(g) CMGFAM(tdp));
|
||||
#else
|
||||
tjnp = new(g) TDBJSN(tdp, new(g) JMGFAM(tdp));
|
||||
#endif
|
||||
#else // !MONGO_SUPPORT && !JDBC_SUPPORT
|
||||
sprintf(g->Message, "No MongoDB support");
|
||||
} // endif Driver
|
||||
#else
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO");
|
||||
return NULL;
|
||||
#endif // MONGO_SUPPORT || JDBC_SUPPORT
|
||||
#endif // MONGO_SUPPORT
|
||||
} else
|
||||
tjnp = new(g) TDBJSN(tdp, new(g) DOSFAM(tdp));
|
||||
|
||||
@@ -484,16 +496,16 @@ JSONDEF::JSONDEF(void)
|
||||
Base = 0;
|
||||
Strict = false;
|
||||
Sep = '.';
|
||||
#if defined(MONGO_SUPPORT) || defined(JDBC_SUPPORT)
|
||||
#if defined(MONGO_SUPPORT)
|
||||
Uri = NULL;
|
||||
Collname = Schema = Options = Filter = NULL;
|
||||
Pipe = false;
|
||||
Driver = NULL;
|
||||
Version = 0;
|
||||
#endif // MONGO_SUPPORT
|
||||
#if defined(JDBC_SUPPORT)
|
||||
Wrapname = NULL;
|
||||
#endif // JDBC_SUPPORT
|
||||
#endif // !MONGO_SUPPORT && !JDBC_SUPPORT
|
||||
} // end of JSONDEF constructor
|
||||
|
||||
/***********************************************************************/
|
||||
@@ -510,7 +522,7 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
|
||||
Sep = *GetStringCatInfo(g, "Separator", ".");
|
||||
|
||||
if (Uri = GetStringCatInfo(g, "Connect", NULL)) {
|
||||
#if defined(MONGO_SUPPORT) || defined(JDBC_SUPPORT)
|
||||
#if defined(MONGO_SUPPORT)
|
||||
Collname = GetStringCatInfo(g, "Name",
|
||||
(Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
|
||||
Collname = GetStringCatInfo(g, "Tabname", Collname);
|
||||
@@ -527,10 +539,10 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
|
||||
else
|
||||
Wrapname = GetStringCatInfo(g, "Wrapper", "Mongo3Interface");
|
||||
#endif // JDBC_SUPPORT
|
||||
#else // !MONGO_SUPPORT && !JDBC_SUPPORT
|
||||
#else // !MONGO_SUPPORT
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO");
|
||||
return true;
|
||||
#endif // !MONGO_SUPPORT && !JDBC_SUPPORT
|
||||
#endif // !MONGO_SUPPORT
|
||||
} // endif Uri
|
||||
|
||||
return DOSDEF::DefineAM(g, (Uri ? "XMGO" : "DOS"), poff);
|
||||
@@ -556,18 +568,32 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
|
||||
(m == MODE_UPDATE || m == MODE_DELETE));
|
||||
|
||||
if (Uri) {
|
||||
#if defined(MONGO_SUPPORT) || defined(JDBC_SUPPORT)
|
||||
#if !defined(JDBC_SUPPORT)
|
||||
#if defined(MONGO_SUPPORT)
|
||||
if (Driver && toupper(*Driver) == 'C') {
|
||||
#if defined(CMGO_SUPPORT)
|
||||
txfp = new(g) CMGFAM(this);
|
||||
#elif !defined(MONGO_SUPPORT)
|
||||
txfp = new(g) JMGFAM(this);
|
||||
#else
|
||||
if (Driver && toupper(*Driver) == 'C')
|
||||
sprintf(g->Message, "Mongo %s Driver not available", "C");
|
||||
return NULL;
|
||||
#endif
|
||||
} else if (Driver && toupper(*Driver) == 'J') {
|
||||
#if defined(JDBC_SUPPORT)
|
||||
txfp = new(g) JMGFAM(this);
|
||||
#else
|
||||
sprintf(g->Message, "Mongo %s Driver not available", "Java");
|
||||
return NULL;
|
||||
#endif
|
||||
} else { // Driver not specified
|
||||
#if defined(CMGO_SUPPORT)
|
||||
txfp = new(g) CMGFAM(this);
|
||||
else
|
||||
#else
|
||||
txfp = new(g) JMGFAM(this);
|
||||
#endif
|
||||
#endif // MONGO_SUPPORT || JDBC_SUPPORT
|
||||
} // endif Driver
|
||||
#else
|
||||
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO");
|
||||
return NULL;
|
||||
#endif // MONGO_SUPPORT
|
||||
} else if (Zipped) {
|
||||
#if defined(ZIP_SUPPORT)
|
||||
if (m == MODE_READ || m == MODE_ANY || m == MODE_ALTER) {
|
||||
@@ -2250,7 +2276,11 @@ void TDBJSON::CloseDB(PGLOBAL g)
|
||||
TDBJCL::TDBJCL(PJDEF tdp) : TDBCAT(tdp)
|
||||
{
|
||||
Topt = tdp->GetTopt();
|
||||
Db = tdp->GetDB();
|
||||
#if defined(MONGO_SUPPORT)
|
||||
Db = tdp->Schema;
|
||||
#else
|
||||
Db = NULL;
|
||||
#endif
|
||||
Dsn = tdp->Uri;
|
||||
} // end of TDBJCL constructor
|
||||
|
||||
|
Reference in New Issue
Block a user