Commit bcfb5b2d authored by Olivier Bertrand's avatar Olivier Bertrand

- 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
parent bf34e9db
......@@ -38,7 +38,7 @@ user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
# Definitions that are shared for all OSes
#
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
add_definitions( -DNEW_MAR -DHUGE_SUPPORT -DGZ_SUPPORT -DPIVOT_SUPPORT )
add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT )
#
......@@ -245,7 +245,7 @@ int main() {
ENDIF(CONNECT_WITH_ODBC)
#
# JDBC with MongoDB Java Driver included but disabled
# JDBC with MongoDB Java Driver included but disabled if without MONGO
#
OPTION(CONNECT_WITH_MONGO "Compile CONNECT storage engine with MONGO support" ON)
OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON)
......@@ -260,17 +260,16 @@ IF(CONNECT_WITH_JDBC)
# SET(JDBC_LIBRARY ${JAVA_JVM_LIBRARY}) will be dynamically linked
SET(CONNECT_SOURCES ${CONNECT_SOURCES}
javaconn.cpp jdbconn.cpp tabjdbc.cpp
jmgfam.cpp jmgoconn.cpp mongo.cpp tabjmg.cpp
jdbccat.h javaconn.h jdbconn.h tabjdbc.h
jmgfam.h jmgoconn.h mongo.h tabjmg.h
JdbcInterface.java ApacheInterface.java MariadbInterface.java
MysqlInterface.java OracleInterface.java PostgresqlInterface.java
Mongo2Interface.java Mongo3Interface.java
JavaWrappers.jar)
add_definitions(-DJDBC_SUPPORT)
add_definitions(-DJAVA_SUPPORT)
IF(CONNECT_WITH_MONGO)
SET(CONNECT_SOURCES ${CONNECT_SOURCES}
jmgfam.cpp jmgoconn.cpp mongo.cpp tabjmg.cpp
jmgfam.h jmgoconn.h mongo.h tabjmg.h
Mongo2Interface.java Mongo3Interface.java)
add_definitions(-DMONGO_SUPPORT -DMONGO_ENABLED=0)
add_definitions(-DMONGO_SUPPORT)
ENDIF()
ELSE()
SET(JDBC_LIBRARY "")
......@@ -313,10 +312,7 @@ IF(CONNECT_WITH_MONGO)
add_definitions(-DCMGO_SUPPORT)
IF (NOT JAVA_FOUND AND JNI_FOUND)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} mongo.cpp mongo.h)
add_definitions(-DMONGO_SUPPORT -DMONGO_ENABLED=1)
ELSE ()
remove_definitions(-DMONGO_ENABLED=0)
add_definitions(-DMONGO_ENABLED=1)
add_definitions(-DMONGO_SUPPORT)
ENDIF (NOT JAVA_FOUND AND JNI_FOUND)
ENDIF(libmongoc-1.0_FOUND)
ENDIF(CONNECT_WITH_MONGO)
......
......@@ -22,17 +22,10 @@
#include "filter.h"
#include "cmgoconn.h"
bool IsNum(PSZ s);
// Required to initialize libmongoc's internals
void mongo_init(bool init)
{
if (init)
mongoc_init();
else
mongoc_cleanup();
bool CMgoConn::IsInit = false;
} // end of mongo_init
bool IsNum(PSZ s);
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
......
......@@ -93,6 +93,7 @@ class CMgoConn : public BLOCK {
PSZ Mini(PGLOBAL g, PCOL colp, const bson_t *bson, bool b);
void GetColumnValue(PGLOBAL g, PCOL colp);
bool AddValue(PGLOBAL g, PCOL colp, bson_t *doc, char *key, bool upd);
static void mongo_init(bool init);
protected:
// Members
......@@ -112,4 +113,5 @@ class CMgoConn : public BLOCK {
PINCOL Fpc; // To insert INCOL classes
PFBLOCK fp;
bool m_Connected;
static bool IsInit;
}; // end of class CMgoConn
......@@ -10,7 +10,7 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include "my_global.h"
#include "sql_class.h"
//#include "sql_class.h"
//#include "sql_time.h"
#if defined(__WIN__)
......@@ -35,9 +35,6 @@
#include "array.h"
#include "filter.h"
#include "xindex.h"
#if defined(MONGO_SUPPORT) || defined(JDBC_SUPPORT)
#include "tabext.h"
#endif // MONGO_SUPPORT || JDBC_SUPPORT
/***********************************************************************/
/* Utility routines. */
......@@ -1406,86 +1403,6 @@ PFIL FILTER::Copy(PTABS t)
} // end of Copy
#endif // 0
#if defined(MONGO_SUPPORT)
/***********************************************************************/
/* Make selector json representation for Mongo tables. */
/***********************************************************************/
bool FILTER::MakeSelector(PGLOBAL g, PSTRG s)
{
s->Append('{');
if (Opc == OP_AND || Opc == OP_OR) {
if (GetArgType(0) != TYPE_FILTER || GetArgType(1) != TYPE_FILTER)
return true;
s->Append("\"$");
s->Append(Opc == OP_AND ? "and" : "or");
s->Append("\":[");
if (((PFIL)Arg(0))->MakeSelector(g, s))
return true;
s->Append(',');
if (((PFIL)Arg(1))->MakeSelector(g, s))
return true;
s->Append(']');
} else {
if (GetArgType(0) != TYPE_COLBLK)
return true;
s->Append('"');
s->Append(((PCOL)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 (GetArgType(1) == TYPE_COLBLK) {
s->Append("\"$");
s->Append(((PEXTCOL)Arg(1))->GetJpath(g, false));
s->Append('"');
} else {
char buf[501];
Arg(1)->Prints(g, buf, 500);
s->Append(buf);
} // endif Type
s->Append('}');
} // endif Opc
s->Append('}');
return false;
} // end of MakeSelector
#endif // MONGO_SUPPORT
/*********************************************************************/
/* Make file output of FILTER contents. */
/*********************************************************************/
......
......@@ -61,9 +61,6 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */
//virtual PXOB CheckSubQuery(PGLOBAL, PSQL);
//virtual bool CheckLocal(PTDB);
//virtual int CheckSpcCol(PTDB tdbp, int n);
#if defined(MONGO_SUPPORT)
bool MakeSelector(PGLOBAL g, PSTRG s);
#endif // MONGO_SUPPORT
virtual void Printf(PGLOBAL g, FILE *f, uint n);
virtual void Prints(PGLOBAL g, char *ps, uint z);
// PFIL Linearize(bool nosep);
......
This diff is collapsed.
......@@ -32,8 +32,6 @@
/****************************************************************************/
#include "mycat.h"
static char *strz(PGLOBAL g, LEX_STRING &ls);
/****************************************************************************/
/* Structures used to pass info between CONNECT and ha_connect. */
/****************************************************************************/
......@@ -207,13 +205,13 @@ class ha_connect: public handler
bool IsOpened(void);
int CloseTable(PGLOBAL g);
int MakeRecord(char *buf);
int ScanRecord(PGLOBAL g, uchar *buf);
int CheckRecord(PGLOBAL g, const uchar *oldbuf, uchar *newbuf);
int ScanRecord(PGLOBAL g, const uchar *buf);
int CheckRecord(PGLOBAL g, const uchar *oldbuf, const uchar *newbuf);
int ReadIndexed(uchar *buf, OPVAL op, const key_range *kr= NULL);
bool IsIndexed(Field *fp);
bool MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL op, char q,
const key_range *kr);
inline char *Strz(LEX_STRING &ls);
//inline char *Strz(LEX_STRING &ls);
key_range start_key;
......@@ -231,7 +229,7 @@ class ha_connect: public handler
/** @brief
The file extensions.
*/
const char **bas_ext() const;
//const char **bas_ext() const;
/**
Check if a storage engine supports a particular alter table in-place
......
......@@ -17,7 +17,7 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include <my_global.h>
#include <m_string.h>
//#include <m_string.h>
#if defined(__WIN__)
#include <direct.h> // for getcwd
#if defined(__BORLANDC__)
......@@ -57,6 +57,7 @@ extern "C" HINSTANCE s_hModule; // Saved module handle
extern char *JvmPath; // The connect_jvm_path global variable value
extern char *ClassPath; // The connect_class_path global variable value
char *GetPluginDir(void);
char *GetJavaWrapper(void); // The connect_java_wrapper variable value
/***********************************************************************/
......@@ -453,7 +454,7 @@ bool JAVAConn::Open(PGLOBAL g)
vm_args.options = options;
vm_args.ignoreUnrecognized = false; // invalid options make the JVM init fail
//=============== load and initialize Java VM and JNI interface =============
//=============== load and initialize Java VM and JNI interface =============
rc = CreateJavaVM(&jvm, (void**)&env, &vm_args); // YES !!
delete options; // we then no longer need the initialisation options.
......
......@@ -54,12 +54,12 @@ typedef jint(JNICALL *GETJVM) (JavaVM **, jsize, jsize *);
typedef jint(JNICALL *GETDEF) (void *);
#endif // _DEBUG
class JAVAConn;
//class JAVAConn;
/***********************************************************************/
/* JAVAConn class. */
/***********************************************************************/
class JAVAConn : public BLOCK {
class DllExport JAVAConn : public BLOCK {
friend class TDBJMG;
friend class JMGDISC;
private:
......
......@@ -6,7 +6,7 @@
#define DEFAULT_QUERY_TIMEOUT -1 // means do not set
typedef struct jdbc_parms {
int CheckSize(int rows);
int CheckSize(int rows);
PCSZ Driver; // JDBC driver
PCSZ Url; // Driver URL
PCSZ User; // User connect info
......
......@@ -654,7 +654,7 @@ bool JDBConn::Connect(PJPARM sop)
if (gmID(g, typid, "ColumnType", "(ILjava/lang/String;)I"))
return true;
else
m_Opened = true;
m_Connected = true;
return false;
} // end of Connect
......
......@@ -25,6 +25,7 @@
#define nullptr 0
bool IsNum(PSZ s);
bool MakeSelector(PGLOBAL g, PFIL fp, PSTRG s);
/* --------------------------- Class JNCOL --------------------------- */
......@@ -123,12 +124,13 @@ void JMgoConn::AddJars(PSTRG jpop, char sep)
#if defined(DEVELOPMENT)
if (m_Version == 2) {
jpop->Append(sep);
jpop->Append("C:/Eclipse/workspace/MongoWrap2/bin");
// jpop->Append("C:/Eclipse/workspace/MongoWrap2/bin");
jpop->Append(sep);
jpop->Append("C:/mongo-java-driver/mongo-java-driver-2.13.3.jar");
} else {
jpop->Append(sep);
jpop->Append("C:/Eclipse/workspace/MongoWrap3/bin");
// jpop->Append("C:/Eclipse/workspace/MongoWrap3/bin");
// jpop->Append("C:/Program Files/MariaDB 10.1/lib/plugin/JavaWrappers.jar");
jpop->Append(sep);
jpop->Append("C:/mongo-java-driver/mongo-java-driver-3.4.2.jar");
} // endif m_Version
......@@ -238,6 +240,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
PSZ jp;
PCSZ op = NULL, sf = NULL, Options = options;
PSTRG s = NULL;
PFIL filp = tdbp->GetFilter();
if (Options && !stricmp(Options, "all")) {
Options = NULL;
......@@ -264,10 +267,10 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
s = new(g) STRING(g, 1023, (PSZ)Options);
if (tdbp->GetFilter()) {
if (filp) {
s->Append(",{\"$match\":");
if (tdbp->GetFilter()->MakeSelector(g, s)) {
if (MakeSelector(g, filp, s)) {
strcpy(g->Message, "Failed making selector");
return NULL;
} else
......@@ -314,15 +317,15 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
return AggregateCollection(p);
} else {
if (filter || tdbp->GetFilter()) {
if (filter || filp) {
if (trace) {
if (filter)
htrc("Filter: %s\n", filter);
if (tdbp->GetFilter()) {
if (filp) {
char buf[512];
tdbp->GetFilter()->Prints(g, buf, 511);
filp->Prints(g, buf, 511);
htrc("To_Filter: %s\n", buf);
} // endif To_Filter
......@@ -331,11 +334,11 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
s = new(g) STRING(g, 1023, (PSZ)filter);
len = s->GetLength();
if (tdbp->GetFilter()) {
if (filp) {
if (filter)
s->Append(',');
if (tdbp->GetFilter()->MakeSelector(g, s)) {
if (MakeSelector(g, filp, s)) {
strcpy(g->Message, "Failed making selector");
return NULL;
} // endif Selector
......
......@@ -53,8 +53,8 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty);
bool SerializeArray(JOUT *js, PJAR jarp, bool b);
bool SerializeObject(JOUT *js, PJOB jobp);
bool SerializeValue(JOUT *js, PJVAL jvp);
bool IsNum(PSZ s);
char *NextChr(PSZ s, char sep);
DllExport bool IsNum(PSZ s);
/***********************************************************************/
/* Class JOUT. Used by Serialize. */
......
......@@ -497,28 +497,26 @@ PVAL JSNX::ExpandArray(PGLOBAL g, PJAR arp, int n)
/*********************************************************************************/
PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
{
//int i, ars, nv = 0, nextsame = Tjp->NextSame;
int i, nv = 0, nextsame = 0;
my_bool err;
int i, ars = arp->size(), nv = 0, nextsame = 0;
bool err;
OPVAL op = Nodes[n].Op;
PVAL val[2], vp = Nodes[n].Valp;
PJVAL jvrp, jvp;
JVALUE jval;
vp->Reset();
//ars = arp->size();
if (trace)
htrc("CalculateArray size=%d\n", arp->size());
// htrc("CalculateArray size=%d\n", ars);
htrc("CalculateArray size=%d\n", ars);
else // This is temporary until we find a better way to fix the compiler
htrc(""); // bug sometime causing the next loop to be executed only once.
for (i = 0; i < arp->size(); i++) {
//for (i = 0; i < ars; i++) { because compiler bug
for (i = 0; i < ars; i++) {
jvrp = arp->GetValue(i);
if (trace)
htrc("Value %s null=%d nv=%d\n",
jvrp->GetString(g), jvrp->IsNull() ? 1 : 0, nv);
htrc("i=%d Value %s null=%d nv=%d\n",
i, jvrp->GetString(g), jvrp->IsNull() ? 1 : 0, nv);
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) {
if (jvrp->IsNull()) {
......
......@@ -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
......
......@@ -63,7 +63,7 @@ class DllExport MGODEF : public EXTDEF { /* Table description */
friend class TDBJGL;
friend class CMGFAM;
friend class MGODISC;
friend PQRYRES MGOColumns(PGLOBAL, PCSZ, PCSZ, PTOS, bool);
friend DllExport PQRYRES MGOColumns(PGLOBAL, PCSZ, PCSZ, PTOS, bool);
public:
// Constructor
MGODEF(void);
......
......@@ -83,22 +83,20 @@
#define NODBC
#include "tabodbc.h"
#endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT)
#if defined(JAVA_SUPPORT)
#define NJDBC
#include "tabjdbc.h"
#endif // JDBC_SUPPORT
#if defined(PIVOT_SUPPORT)
#endif // JAVA_SUPPORT
#include "tabpivot.h"
#endif // PIVOT_SUPPORT
#include "tabvir.h"
#include "tabjson.h"
#include "ha_connect.h"
#if defined(XML_SUPPORT)
#include "tabxml.h"
#endif // XML_SUPPORT
#if defined(MONGO_SUPPORT)
#if defined(JAVA_SUPPORT)
#include "mongo.h"
#endif // MONGO_SUPPORT
#endif // JAVA_SUPPORT
#if defined(ZIP_SUPPORT)
#include "tabzip.h"
#endif // ZIP_SUPPORT
......@@ -111,9 +109,9 @@
extern "C" HINSTANCE s_hModule; // Saved module handle
#endif // !__WIN__
#if defined(MONGO_SUPPORT)
bool MongoEnabled(void);
#endif // MONGO_SUPPORT
#if defined(JAVA_SUPPORT)
//bool MongoEnabled(void);
#endif // JAVA_SUPPORT
PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
/***********************************************************************/
......@@ -144,8 +142,9 @@ TABTYPE GetTypeID(const char *type)
#if defined(ODBC_SUPPORT)
: (!stricmp(type, "ODBC")) ? TAB_ODBC
#endif
#if defined(JDBC_SUPPORT)
#if defined(JAVA_SUPPORT)
: (!stricmp(type, "JDBC")) ? TAB_JDBC
: (!stricmp(type, "MONGO")) ? TAB_MONGO
#endif
: (!stricmp(type, "MYSQL")) ? TAB_MYSQL
: (!stricmp(type, "MYPRX")) ? TAB_MYSQL
......@@ -159,16 +158,11 @@ TABTYPE GetTypeID(const char *type)
: (!stricmp(type, "OCCUR")) ? TAB_OCCUR
: (!stricmp(type, "CATLG")) ? TAB_PRX // Legacy
: (!stricmp(type, "PROXY")) ? TAB_PRX
#if defined(PIVOT_SUPPORT)
: (!stricmp(type, "PIVOT")) ? TAB_PIVOT
#endif
: (!stricmp(type, "VIR")) ? TAB_VIR
: (!stricmp(type, "JSON")) ? TAB_JSON
#if defined(ZIP_SUPPORT)
: (!stricmp(type, "ZIP")) ? TAB_ZIP
#endif
#if defined(MONGO_SUPPORT)
: (!stricmp(type, "MONGO")) ? TAB_MONGO
#endif
: (!stricmp(type, "OEM")) ? TAB_OEM : TAB_NIY;
} // end of GetTypeID
......@@ -542,9 +536,9 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
#if defined(ODBC_SUPPORT)
case TAB_ODBC: tdp= new(g) ODBCDEF; break;
#endif // ODBC_SUPPORT
#if defined(JDBC_SUPPORT)
#if defined(JAVA_SUPPORT)
case TAB_JDBC: tdp= new(g) JDBCDEF; break;
#endif // JDBC_SUPPORT
#endif // JAVA_SUPPORT
#if defined(__WIN__)
case TAB_MAC: tdp= new(g) MACDEF; break;
case TAB_WMI: tdp= new(g) WMIDEF; break;
......@@ -555,17 +549,15 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am)
case TAB_PRX: tdp= new(g) PRXDEF; break;
case TAB_OCCUR: tdp= new(g) OCCURDEF; break;
case TAB_MYSQL: tdp= new(g) MYSQLDEF; break;
#if defined(PIVOT_SUPPORT)
case TAB_PIVOT: tdp= new(g) PIVOTDEF; break;
#endif // PIVOT_SUPPORT
case TAB_VIR: tdp= new(g) VIRDEF; break;
case TAB_JSON: tdp= new(g) JSONDEF; break;
#if defined(MONGO_SUPPORT)
case TAB_MONGO:
if (MongoEnabled())
// if (MongoEnabled())
tdp = new(g) MGODEF;
else
strcpy(g->Message, "MONGO type not enabled");
// else
// strcpy(g->Message, "MONGO type not enabled");
break;
#endif // MONGO_SUPPORT
......
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -310,7 +309,7 @@ loc_0 double(12,6) NOT NULL `FIELD_FORMAT`='loc.0',
loc_1 char(12) NOT NULL `FIELD_FORMAT`='loc.1',
pop int(11) NOT NULL,
state char(2) NOT NULL)
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE='MONGO' TABNAME='cities'
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE=JSON TABNAME='cities'
OPTION_LIST='Driver=Java,Version=2' CONNECTION='mongodb://localhost:27017' LRECL=4096 DATA_CHARSET='utf8';
# Using SQL for grouping
SELECT state, sum(pop) AS totalPop FROM t1 GROUP BY state HAVING totalPop >= 10000000 ORDER BY totalPop DESC;
......@@ -382,4 +381,3 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -310,7 +309,7 @@ loc_0 double(12,6) NOT NULL `FIELD_FORMAT`='loc.0',
loc_1 char(12) NOT NULL `FIELD_FORMAT`='loc.1',
pop int(11) NOT NULL,
state char(2) NOT NULL)
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE='MONGO' TABNAME='cities'
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE=JSON TABNAME='cities'
OPTION_LIST='Driver=Java,Version=3' CONNECTION='mongodb://localhost:27017' LRECL=4096 DATA_CHARSET='utf8';
# Using SQL for grouping
SELECT state, sum(pop) AS totalPop FROM t1 GROUP BY state HAVING totalPop >= 10000000 ORDER BY totalPop DESC;
......@@ -382,4 +381,3 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -309,7 +308,7 @@ loc_0 double(12,6) NOT NULL `FIELD_FORMAT`='loc.0',
loc_1 char(12) NOT NULL `FIELD_FORMAT`='loc.1',
pop int(11) NOT NULL,
state char(2) NOT NULL)
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE='MONGO' TABNAME='cities'
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE=JSON TABNAME='cities'
OPTION_LIST='Driver=C,Version=0' CONNECTION='mongodb://localhost:27017' LRECL=1024 DATA_CHARSET='utf8';
# Using SQL for grouping
SELECT state, sum(pop) AS totalPop FROM t1 GROUP BY state HAVING totalPop >= 10000000 ORDER BY totalPop DESC;
......@@ -381,4 +380,3 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -305,7 +304,7 @@ loc_0 double(12,6) NOT NULL `FIELD_FORMAT`='loc.0',
loc_1 char(12) NOT NULL `FIELD_FORMAT`='loc.1',
pop int(11) NOT NULL,
state char(2) NOT NULL)
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE='MONGO' TABNAME='cities'
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE=MONGO TABNAME='cities'
OPTION_LIST='Driver=C,Version=0' DATA_CHARSET='utf8';
# Using SQL for grouping
SELECT state, sum(pop) AS totalPop FROM t1 GROUP BY state HAVING totalPop >= 10000000 ORDER BY totalPop DESC;
......@@ -377,4 +376,3 @@ planner 167 41.750000
postcard 23 5.750000
DROP TABLE t1;
true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -306,7 +305,7 @@ loc_0 double(12,6) NOT NULL `FIELD_FORMAT`='loc.0',
loc_1 char(12) NOT NULL `FIELD_FORMAT`='loc.1',
pop int(11) NOT NULL,
state char(2) NOT NULL)
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE='MONGO' TABNAME='cities'
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE=MONGO TABNAME='cities'
OPTION_LIST='Driver=Java,Version=2' DATA_CHARSET='utf8';
# Using SQL for grouping
SELECT state, sum(pop) AS totalPop FROM t1 GROUP BY state HAVING totalPop >= 10000000 ORDER BY totalPop DESC;
......@@ -378,4 +377,3 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
......@@ -306,7 +305,7 @@ loc_0 double(12,6) NOT NULL `FIELD_FORMAT`='loc.0',
loc_1 char(12) NOT NULL `FIELD_FORMAT`='loc.1',
pop int(11) NOT NULL,
state char(2) NOT NULL)
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE='MONGO' TABNAME='cities'
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE=MONGO TABNAME='cities'
OPTION_LIST='Driver=Java,Version=3' DATA_CHARSET='utf8';
# Using SQL for grouping
SELECT state, sum(pop) AS totalPop FROM t1 GROUP BY state HAVING totalPop >= 10000000 ORDER BY totalPop DESC;
......@@ -378,4 +377,3 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
......@@ -9,29 +9,13 @@ t1 CREATE TABLE `t1` (
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Sources'
SELECT * FROM t1;
Name Description
dBASE Files Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)
PLUGDB_DEBUG PLUGODBC_Driver
PLUGDB_ODBC PLUGODBC_Driver
SafeDB_ODBC SDB_ODBC_Driver
Firebird Firebird/InterBase(r) driver
ConnectEngineXLS Microsoft Excel Driver (*.xls)
Excel Files Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)
MariaODBC MySQL ODBC 5.2a Driver
MariaODBCbeta MariaDB ODBC 1.0 Driver
MyODBC MySQL ODBC 5.2a Driver
MS Access Database Microsoft Access Driver (*.mdb, *.accdb)
MS Access Db1 Microsoft Access Driver (*.mdb)
MySQL-ANSI MySQL ODBC 5.3 ANSI Driver
MySQL-Unicode MySQL ODBC 5.3 Unicode Driver
Xtreme Sample Database 2008 Microsoft Access Driver (*.mdb)
PlugDB test PLUGODBC_Driver
SQLite3 Datasource SQLite3 ODBC Driver
SQLite Datasource SQLite ODBC Driver
SQLite UTF-8 Datasource SQLite ODBC (UTF-8) Driver
ORACLE_TEST Oracle in XE
ConnectEnginePostgresql PostgreSQL ODBC Driver(ANSI)
SQLServer_Test SQL Server Native Client 11.0
Firebird Firebird/InterBase(r) driver
ConnectEngineOracle Oracle in XE
ConnectEngineSQLServer SQL Server
ConnectEngineSQLServer SQL Server Native Client 11.0
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Drivers;
SHOW CREATE TABLE t1;
......@@ -42,51 +26,12 @@ t1 CREATE TABLE `t1` (
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`='ODBC' `CATFUNC`='Drivers'
SELECT * FROM t1;
Description Attributes
SQL Server UsageCount=1;SQLLevel=1;FileUsage=0;DriverODBCVer=03.50;ConnectFunctions=YYY;APILevel=2;CPTimeout=60;
Microsoft ODBC for Oracle UsageCount=1;SQLLevel=1;FileUsage=0;DriverODBCVer=02.50;ConnectFunctions=YYY;APILevel=1;CPTimeout=120;
Microsoft Access Driver (*.mdb) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=2;FileExtns=*.mdb;SQLLevel=0;
Microsoft Access-Treiber (*.mdb) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=2;FileExtns=*.mdb;SQLLevel=0;
Driver do Microsoft Access (*.mdb) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=2;FileExtns=*.mdb;SQLLevel=0;
Microsoft dBase Driver (*.dbf) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.dbf,*.ndx,*.mdx;SQLLevel=0;
Microsoft dBase-Treiber (*.dbf) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.dbf,*.ndx,*.mdx;SQLLevel=0;
Driver do Microsoft dBase (*.dbf) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.dbf,*.ndx,*.mdx;SQLLevel=0;
Microsoft Excel Driver (*.xls) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.xls;SQLLevel=0;
Microsoft Excel-Treiber (*.xls) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.xls;SQLLevel=0;
Driver do Microsoft Excel(*.xls) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.xls;SQLLevel=0;
Microsoft Paradox Driver (*.db ) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.db;SQLLevel=0;
Microsoft Paradox-Treiber (*.db ) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.db;SQLLevel=0;
Driver do Microsoft Paradox (*.db ) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.db;SQLLevel=0;
Microsoft Text Driver (*.txt; *.csv) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.,*.asc,*.csv,*.tab,*.txt,*.csv;SQLLevel=0;
Microsoft Text-Treiber (*.txt; *.csv) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.,*.asc,*.csv,*.tab,*.txt,*.csv;SQLLevel=0;
Driver da Microsoft para arquivos texto (*.txt; *.csv) UsageCount=1;APILevel=1;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.,*.asc,*.csv,*.tab,*.txt,*.csv;SQLLevel=0;
Microsoft Visual FoxPro Driver UsageCount=1;APILevel=0;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.dbf,*.cdx,*.idx,*.fpt;SQLLevel=0;
Microsoft FoxPro VFP Driver (*.dbf) UsageCount=1;APILevel=0;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.dbf,*.cdx,*.idx,*.fpt;SQLLevel=0;
Microsoft dBase VFP Driver (*.dbf) UsageCount=1;APILevel=0;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.dbf,*.cdx,*.idx,*.fpt;SQLLevel=0;
Microsoft Visual FoxPro-Treiber UsageCount=1;APILevel=0;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.dbf,*.cdx,*.idx,*.fpt;SQLLevel=0;
Driver para o Microsoft Visual FoxPro UsageCount=1;APILevel=0;ConnectFunctions=YYN;DriverODBCVer=02.50;FileUsage=1;FileExtns=*.dbf,*.cdx,*.idx,*.fpt;SQLLevel=0;
SQL Native Client UsageCount=1;APILevel=2;ConnectFunctions=YYY;CPTimeout=60;DriverODBCVer=09.00;FileUsage=0;SQLLevel=1;
CR Sybase Wire Protocol ODBC Driver 6.0 UsageCount=1;APILevel=1;ConnectFunctions=YYY;DriverODBCVer=3.52;FileUsage=0;SQLLevel=0;CPTimeout=60;HelpRootDirectory=C:\Program Files\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\odbc\help;
CR SQL Server Native Wire Protocol ODBC Driver 6.0 UsageCount=1;APILevel=1;ConnectFunctions=YYY;DriverODBCVer=3.52;FileUsage=0;SQLLevel=1;CPTimeout=60;HelpRootDirectory=C:\Program Files\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\odbc\help;
CR SQL Server Classic Wire Protocol ODBC Driver 6.0 UsageCount=1;APILevel=1;ConnectFunctions=YYY;DriverODBCVer=3.52;FileUsage=0;SQLLevel=1;CPTimeout=60;HelpRootDirectory=C:\Program Files\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\odbc\help;
CR TextFile ODBC Driver 6.0 UsageCount=1;APILevel=1;ConnectFunctions=YYY;DriverODBCVer=3.52;FileUsage=1;FileExtns=*.*;SQLLevel=0;CPTimeout=60;HelpRootDirectory=C:\Program Files\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\odbc\help;
PLUGODBC_Driver UsageCount=1;
SDB_ODBC_Driver UsageCount=2;
Microsoft Access Text Driver (*.txt, *.csv) SQLLevel=0;FileExtns=*.txt, *.csv;FileUsage=2;DriverODBCVer=02.50;ConnectFunctions=YYN;APILevel=1;UsageCount=3;
Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx) SQLLevel=0;FileExtns=*.dbf, *.ndx, *.mdx;FileUsage=2;DriverODBCVer=02.50;ConnectFunctions=YYN;APILevel=1;UsageCount=3;
Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb) SQLLevel=0;FileExtns=*.xls,*.xlsx, *.xlsb;FileUsage=2;DriverODBCVer=02.50;ConnectFunctions=YYN;APILevel=1;UsageCount=3;
Microsoft Access Driver (*.mdb, *.accdb) SQLLevel=0;FileExtns=*.mdb,*.accdb;FileUsage=2;DriverODBCVer=02.50;ConnectFunctions=YYN;APILevel=1;UsageCount=3;
SQLite3 ODBC Driver UsageCount=1;
SQLite ODBC Driver UsageCount=1;
SQLite ODBC (UTF-8) Driver UsageCount=1;
SQL Server APILevel=2;ConnectFunctions=YYY;CPTimeout=60;DriverODBCVer=03.50;FileUsage=0;SQLLevel=1;UsageCount=1;
Oracle in XE ConnectionFunctions=YYY;DriverODBCVer=03.51;CPTimeout=60;FileUsage=0;APILevel=1;SQLLevel=1;
Oracle in instantclient_12_1 APILevel=1;ConnectionFunctions=YYY;CPTimeout=60;DriverODBCVer=03.51;FileUsage=0;SQLLevel=1;
PostgreSQL ODBC Driver(ANSI) APILevel=1;ConnectFunctions=YYN;DriverODBCVer=09.02.0100;FileUsage=0;SQLLevel=1;
PostgreSQL ODBC Driver(UNICODE) APILevel=1;ConnectFunctions=YYN;DriverODBCVer=09.02.0100;FileUsage=0;SQLLevel=1;
SQL Server Native Client 11.0 UsageCount=1;APILevel=2;ConnectFunctions=YYY;CPTimeout=60;DriverODBCVer=03.80;FileUsage=0;SQLLevel=1;
MariaDB ODBC 1.0 Driver UsageCount=1;
ODBC Driver 13 for SQL Server UsageCount=1;APILevel=2;ConnectFunctions=YYY;CPTimeout=60;DriverODBCVer=03.80;FileUsage=0;SQLLevel=1;
SQL Server Native Client RDA 11.0 UsageCount=1;APILevel=2;ConnectFunctions=YYY;CPTimeout=60;DriverODBCVer=03.80;FileUsage=0;SQLLevel=1;
Firebird/InterBase(r) driver UsageCount=1;FileExtns=*.fdb,*.gdb;APILevel=1;ConnectFunctions=YYY;FileUsage=0;DriverODBCVer=03.51;SQLLevel=1;
MySQL ODBC 5.3 ANSI Driver UsageCount=1;
MySQL ODBC 5.3 Unicode Driver UsageCount=1;
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CATFUNC=Tables CONNECTION='Not important';
SHOW CREATE TABLE t1;
......@@ -154,9 +99,9 @@ EMP_NO FIRST_NAME LAST_NAME PHONE_EXT HIRE_DATE DEPT_NO JOB_CODE JOB_GRADE JOB_C
113 Mary Page 845 1993-04-12 00:00:00 671 Eng 4 USA 48000.00 Page, Mary
114 Bill Parker 247 1993-06-01 00:00:00 623 Eng 5 USA 35000.00 Parker, Bill
118 Takashi Yamamoto 23 1993-07-01 00:00:00 115 SRep 4 Japan 7480000.00 Yamamoto, Takashi
121 Roberto Ferrari 1 1993-07-12 00:00:00 125 SRep 4 Italy 99000000.00 Ferrari, Roberto
121 Roberto Ferrari 1 1993-07-12 00:00:00 125 SRep 4 Italy 33000.00 Ferrari, Roberto
127 Michael Yanowski 492 1993-08-09 00:00:00 100 SRep 4 USA 44000.00 Yanowski, Michael
134 Jacques Glon NULL 1993-08-23 00:00:00 123 SRep 4 France 390500.00 Glon, Jacques
134 Jacques Glon NULL 1993-08-23 00:00:00 123 SRep 4 France 38500.00 Glon, Jacques
136 Scott Johnson 265 1993-09-13 00:00:00 623 Doc 3 USA 60000.00 Johnson, Scott
138 T.J. Green 218 1993-11-01 00:00:00 621 Eng 4 USA 36000.00 Green, T.J.
141 Pierre Osborne NULL 1994-01-03 00:00:00 121 SRep 4 Switzerland 110000.00 Osborne, Pierre
......
set connect_enable_mongo=1;
#set connect_enable_mongo=1;
--echo #
--echo # Test the MONGO table type
......@@ -156,7 +156,7 @@ eval CREATE TABLE t1 (
loc_1 char(12) NOT NULL `FIELD_FORMAT`='loc.1',
pop int(11) NOT NULL,
state char(2) NOT NULL)
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE='MONGO' TABNAME='cities'
ENGINE=CONNECT CONNECTION='mongodb://localhost:27017' TABLE_TYPE=$TYPE TABNAME='cities'
OPTION_LIST='Driver=$DRV,Version=$VERS' $CONN DATA_CHARSET='utf8';
--echo # Using SQL for grouping
SELECT state, sum(pop) AS totalPop FROM t1 GROUP BY state HAVING totalPop >= 10000000 ORDER BY totalPop DESC;
......@@ -204,4 +204,4 @@ SELECT * FROM t1;
DROP TABLE t1;
--exec $MONGO --eval "db.testcoll.drop()" --quiet
set connect_enable_mongo=0;
#set connect_enable_mongo=0;
......@@ -38,6 +38,7 @@
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include "my_global.h"
#include "my_pthread.h"
#if defined(__WIN__)
#include <io.h>
#include <fcntl.h>
......@@ -71,12 +72,12 @@
#ifdef ZIP_SUPPORT
#include "filamzip.h"
#endif // ZIP_SUPPORT
#ifdef JDBC_SUPPORT
#ifdef JAVA_SUPPORT
#include "javaconn.h"
#endif // JDBC_SUPPORT
#endif // JAVA_SUPPORT
#ifdef CMGO_SUPPORT
#include "cmgoconn.h"
#endif // MONGO_SUPPORT
#endif // JAVA_SUPPORT
/***********************************************************************/
/* DB static variables. */
......@@ -952,20 +953,20 @@ int PlugCloseFile(PGLOBAL g, PFBLOCK fp, bool all)
fp->File = NULL;
break;
#endif // ZIP_SUPPORT
#ifdef JDBC_SUPPORT
#ifdef JAVA_SUPPORT
case TYPE_FB_JAVA:
((JAVAConn*)fp->File)->Close();
fp->Count = 0;
fp->File = NULL;
break;
#endif // JDBC_SUPPORT
#endif // JAVA_SUPPORT
#ifdef CMGO_SUPPORT
case TYPE_FB_MONGO:
((CMgoConn*)fp->File)->Close();
fp->Count = 0;
fp->File = NULL;
break;
#endif // MONGO_SUPPORT
#endif // JAVA_SUPPORT
default:
rc = RC_FX;
} // endswitch Type
......
......@@ -11,7 +11,7 @@
#include "block.h"
#include "catalog.h"
#include "my_sys.h"
//#include "my_sys.h"
#include "mycat.h"
typedef class INDEXDEF *PIXDEF;
......@@ -114,7 +114,7 @@ class DllExport TABDEF : public RELDEF { /* Logical table descriptor */
int Sort; /* Table already sorted ??? */
int Multiple; /* 0: No 1: DIR 2: Section 3: filelist */
int Degree; /* Number of columns in the table */
int Pseudo; /* Bit: 1 ROWID }Ok, 2 FILEID Ok */
int Pseudo; /* Bit: 1 ROWID }Ok, 2 FILEID Ok */
bool Read_Only; /* true for read only tables */
const CHARSET_INFO *m_data_charset;
const char *csname; /* Table charset name */
......
......@@ -7,7 +7,7 @@
/***********************************************************************/
#ifndef __TABEXT_H
#define __TABEXTF_H
#define __TABEXT_H
#include "reldef.h"
......
......@@ -178,7 +178,7 @@ TDBJMG::TDBJMG(PMGODEF tdp) : TDBEXT(tdp)
Ops.User = NULL;
Ops.Pwd = NULL;
Ops.Scrollable = false;
Ops.Fsize = Ops.CheckSize(Rows);
Ops.Fsize = 0;
Fpos = -1;
N = 0;
Done = false;
......
......@@ -31,14 +31,12 @@
#if defined(ZIP_SUPPORT)
#include "filamzip.h"
#endif // ZIP_SUPPORT
#if defined(MONGO_SUPPORT)
#if defined(JDBC_SUPPORT)
#if defined(JAVA_SUPPORT)
#include "jmgfam.h"
#endif // JDBC_SUPPORT
#endif // JAVA_SUPPORT
#if defined(CMGO_SUPPORT)
#include "cmgfam.h"
#endif // CMGO_SUPPORT
#endif // MONGO_SUPPORT
#include "tabmul.h"
#include "checklvl.h"
#include "resource.h"
......@@ -149,7 +147,7 @@ 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)
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
tdp->Collname = GetStringTableOption(g, topt, "Name", NULL);
tdp->Collname = GetStringTableOption(g, topt, "Tabname", tdp->Collname);
tdp->Schema = GetStringTableOption(g, topt, "Dbname", "test");
......@@ -157,10 +155,8 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
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
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO");
......@@ -201,7 +197,6 @@ 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)
if (tdp->Driver && toupper(*tdp->Driver) == 'C') {
#if defined(CMGO_SUPPORT)
tjnp = new(g) TDBJSN(tdp, new(g) CMGFAM(tdp));
......@@ -210,7 +205,7 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
return NULL;
#endif
} else if (tdp->Driver && toupper(*tdp->Driver) == 'J') {
#if defined(JDBC_SUPPORT)
#if defined(JAVA_SUPPORT)
tjnp = new(g) TDBJSN(tdp, new(g) JMGFAM(tdp));
#else
sprintf(g->Message, "Mongo %s Driver not available", "Java");
......@@ -219,14 +214,14 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
} else { // Driver not specified
#if defined(CMGO_SUPPORT)
tjnp = new(g) TDBJSN(tdp, new(g) CMGFAM(tdp));
#else
#elif defined(JAVA_SUPPORT)
tjnp = new(g) TDBJSN(tdp, new(g) JMGFAM(tdp));
#else
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO");
return NULL;
#endif
} // endif Driver
#else
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO");
return NULL;
#endif // MONGO_SUPPORT
} else
tjnp = new(g) TDBJSN(tdp, new(g) DOSFAM(tdp));
......@@ -497,16 +492,12 @@ JSONDEF::JSONDEF(void)
Base = 0;
Strict = false;
Sep = '.';
#if defined(MONGO_SUPPORT)
Uri = NULL;
Collname = Options = Filter = NULL;
Pipe = false;
Driver = NULL;
Version = 0;
#if defined(JDBC_SUPPORT)
Wrapname = NULL;
#endif // JDBC_SUPPORT
#endif // MONGO_SUPPORT
} // end of JSONDEF constructor
/***********************************************************************/
......@@ -524,7 +515,7 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
Sep = *GetStringCatInfo(g, "Separator", ".");
if (Uri = GetStringCatInfo(g, "Connect", NULL)) {
#if defined(MONGO_SUPPORT)
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
Collname = GetStringCatInfo(g, "Name",
(Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
Collname = GetStringCatInfo(g, "Tabname", Collname);
......@@ -534,12 +525,12 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
Driver = GetStringCatInfo(g, "Driver", NULL);
Version = GetIntCatInfo("Version", 3);
Pretty = 0;
#if defined(JDBC_SUPPORT)
#if defined(JAVA_SUPPORT)
if (Version == 2)
Wrapname = GetStringCatInfo(g, "Wrapper", "Mongo2Interface");
else
Wrapname = GetStringCatInfo(g, "Wrapper", "Mongo3Interface");
#endif // JDBC_SUPPORT
#endif // JAVA_SUPPORT
#else // !MONGO_SUPPORT
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO");
return true;
......@@ -569,7 +560,6 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
(m == MODE_UPDATE || m == MODE_DELETE));
if (Uri) {
#if defined(MONGO_SUPPORT)
if (Driver && toupper(*Driver) == 'C') {
#if defined(CMGO_SUPPORT)
txfp = new(g) CMGFAM(this);
......@@ -578,7 +568,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
return NULL;
#endif
} else if (Driver && toupper(*Driver) == 'J') {
#if defined(JDBC_SUPPORT)
#if defined(JAVA_SUPPORT)
txfp = new(g) JMGFAM(this);
#else
sprintf(g->Message, "Mongo %s Driver not available", "Java");
......@@ -587,14 +577,14 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m)
} else { // Driver not specified
#if defined(CMGO_SUPPORT)
txfp = new(g) CMGFAM(this);
#else
#elif defined(JAVA_SUPPORT)
txfp = new(g) JMGFAM(this);
#endif
#else // !MONGO_SUPPORT
sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO");
return NULL;
#endif // !MONGO_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) {
......@@ -1591,8 +1581,7 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n)
/***********************************************************************/
PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
{
//int i, ars, nv = 0, nextsame = Tjp->NextSame;
int i, nv = 0, nextsame = Tjp->NextSame;
int i, ars, nv = 0, nextsame = Tjp->NextSame;
bool err;
OPVAL op = Nodes[n].Op;
PVAL val[2], vp = Nodes[n].Valp;
......@@ -1600,12 +1589,20 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
JVALUE jval;
vp->Reset();
//ars = MY_MIN(Tjp->Limit, arp->size());
ars = MY_MIN(Tjp->Limit, arp->size());
if (trace)
htrc("CalculateArray size=%d\n", ars);
else // This is temporary until we find a better way to fix the compiler
htrc(""); // bug sometime causing the next loop to be executed only once.
//for (i = 0; i < ars; i++) {
for (i = 0; i < arp->size(); i++) {
for (i = 0; i < ars; i++) {
jvrp = arp->GetValue(i);
if (trace)
htrc("i=%d Value %s null=%d nv=%d\n",
i, jvrp->GetString(g), jvrp->IsNull() ? 1 : 0, nv);
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) do {
if (jvrp->IsNull()) {
jvrp->Value = AllocateValue(g, GetJsonNull(), TYPE_STRING);
......@@ -1623,7 +1620,6 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
} else
SetJsonValue(g, MulVal, jvp, n);
// if (!MulVal->IsZero()) {
if (!MulVal->IsNull()) {
switch (op) {
case OP_CNC:
......
......@@ -36,14 +36,12 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */
friend class TDBJSON;
friend class TDBJSN;
friend class TDBJCL;
#if defined(MONGO_SUPPORT)
#if defined(CMGO_SUPPORT)
friend class CMGFAM;
#endif // CMGO_SUPPORT
#if defined(JDBC_SUPPORT)
#if defined(JAVA_SUPPORT)
friend class JMGFAM;
#endif // JDBC_SUPPORT
#endif // MONGO_SUPPORT
#endif // JAVA_SUPPORT
friend PQRYRES JSONColumns(PGLOBAL, PCSZ, PCSZ, PTOS, bool);
public:
// Constructor
......@@ -68,17 +66,13 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */
bool Strict; /* Strict syntax checking */
char Sep; /* The Jpath separator */
const char *Uri; /* MongoDB connection URI */
#if defined(MONGO_SUPPORT)
PCSZ Collname; /* External collection name */
PSZ Options; /* Colist ; Pipe */
PSZ Filter; /* Filter */
PSZ Driver; /* MongoDB Driver (C or JAVA) */
bool Pipe; /* True if Colist is a pipeline */
int Version; /* Driver version */
#if defined(JDBC_SUPPORT)
PSZ Wrapname; /* MongoDB java wrapper name */
#endif // JDBC_SUPPORT
#endif // MONGO_SUPPORT
}; // end of JSONDEF
/* -------------------------- TDBJSN class --------------------------- */
......@@ -90,14 +84,12 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */
class DllExport TDBJSN : public TDBDOS {
friend class JSONCOL;
friend class JSONDEF;
#if defined(MONGO_SUPPORT)
#if defined(CMGO_SUPPORT)
friend class CMGFAM;
#endif // CMGO_SUPPORT
#if defined(JDBC_SUPPORT)
#if defined(JAVA_SUPPORT)
friend class JMGFAM;
#endif // JDBC_SUPPORT
#endif // MONGO_SUPPORT
#endif // JAVA_SUPPORT
public:
// Constructor
TDBJSN(PJDEF tdp, PTXF txfp);
......@@ -162,14 +154,12 @@ class DllExport TDBJSN : public TDBDOS {
class DllExport JSONCOL : public DOSCOL {
friend class TDBJSN;
friend class TDBJSON;
#if defined(MONGO_SUPPORT)
#if defined(CMGO_SUPPORT)
friend class CMGFAM;
#endif // CMGO_SUPPORT
#if defined(JDBC_SUPPORT)
#if defined(JAVA_SUPPORT)
friend class JMGFAM;
#endif // JDBC_SUPPORT
#endif // MONGO_SUPPORT
#endif // JAVA_SUPPORT
public:
// Constructors
JSONCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i);
......
......@@ -53,6 +53,8 @@ class DllExport XMLDEF : public TABDEF { /* Logical table description */
}; // end of XMLDEF
#if defined(INCLUDE_TDBXML)
#include "m_ctype.h"
/***********************************************************************/
/* This is the class declaration for the simple XML tables. */
/***********************************************************************/
......
......@@ -40,7 +40,7 @@ class MBVALS : public BLOCK {
// Methods
void *GetMemp(void) {return Mblk.Memp;}
PVBLK Allocate(PGLOBAL g, int type, int len, int prec,
int n, bool sub = FALSE);
int n, bool sub = false);
bool ReAllocate(PGLOBAL g, int n);
void Free(void);
......
......@@ -102,7 +102,7 @@ class DllExport VALUE : public BLOCK {
virtual bool SetValue_pval(PVAL valp, bool chktype = false) = 0;
virtual bool SetValue_char(const char *p, int n) = 0;
virtual void SetValue_psz(PCSZ s) = 0;
virtual void SetValue_bool(bool) {assert(FALSE);}
virtual void SetValue_bool(bool) {assert(false);}
virtual int CompareValue(PVAL vp) = 0;
virtual BYTE TestValue(PVAL vp);
virtual void SetValue(char) {assert(false);}
......
......@@ -16,7 +16,7 @@
#include "assert.h"
#include "block.h"
#include "colblk.h"
#include "m_ctype.h"
//#include "m_ctype.h"
#include "reldef.h"
typedef class CMD *PCMD;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment