summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/CMakeLists.txt59
-rw-r--r--storage/connect/cmgoconn.cpp65
-rw-r--r--storage/connect/cmgoconn.h2
-rw-r--r--storage/connect/csort.cpp16
-rw-r--r--storage/connect/domdoc.cpp3
-rw-r--r--storage/connect/filamap.cpp12
-rw-r--r--storage/connect/filamgz.cpp8
-rw-r--r--storage/connect/filamtxt.cpp11
-rw-r--r--storage/connect/filamzip.cpp4
-rw-r--r--storage/connect/filter.cpp85
-rw-r--r--storage/connect/filter.h3
-rw-r--r--storage/connect/fmdlex.c24
-rw-r--r--storage/connect/ha_connect.cc128
-rw-r--r--storage/connect/ha_connect.h6
-rw-r--r--storage/connect/javaconn.cpp5
-rw-r--r--storage/connect/javaconn.h4
-rw-r--r--storage/connect/jdbccat.h2
-rw-r--r--storage/connect/jdbconn.cpp2
-rw-r--r--storage/connect/jmgoconn.cpp21
-rw-r--r--storage/connect/json.h3
-rw-r--r--storage/connect/jsonudf.cpp29
-rw-r--r--storage/connect/macutil.cpp4
-rw-r--r--storage/connect/mongo.cpp98
-rw-r--r--storage/connect/mongo.h2
-rw-r--r--storage/connect/mycat.cc36
-rw-r--r--storage/connect/myconn.cpp2
-rw-r--r--storage/connect/mysql-test/connect/r/json_java_2.result4
-rw-r--r--storage/connect/mysql-test/connect/r/json_java_3.result4
-rw-r--r--storage/connect/mysql-test/connect/r/json_mongo_c.result4
-rw-r--r--storage/connect/mysql-test/connect/r/mongo_c.result4
-rw-r--r--storage/connect/mysql-test/connect/r/mongo_java_2.result4
-rw-r--r--storage/connect/mysql-test/connect/r/mongo_java_3.result4
-rw-r--r--storage/connect/mysql-test/connect/r/odbc_firebird.result71
-rw-r--r--storage/connect/mysql-test/connect/t/mongo_test.inc6
-rw-r--r--storage/connect/odbconn.cpp2
-rw-r--r--storage/connect/plgdbutl.cpp15
-rw-r--r--storage/connect/plugutil.cpp2
-rw-r--r--storage/connect/rcmsg.c7
-rw-r--r--storage/connect/rcmsg.h2
-rw-r--r--storage/connect/reldef.h4
-rw-r--r--storage/connect/tabfmt.cpp6
-rw-r--r--storage/connect/tabjmg.cpp15
-rw-r--r--storage/connect/tabjson.cpp84
-rw-r--r--storage/connect/tabjson.h22
-rw-r--r--storage/connect/tabmac.cpp4
-rw-r--r--storage/connect/tabmul.cpp4
-rw-r--r--storage/connect/tabtbl.cpp2
-rw-r--r--storage/connect/tabutil.cpp4
-rw-r--r--storage/connect/tabxml.h2
-rw-r--r--storage/connect/valblk.h2
-rw-r--r--storage/connect/value.cpp69
-rw-r--r--storage/connect/value.h2
-rw-r--r--storage/connect/xobject.cpp4
-rw-r--r--storage/connect/xtable.h2
54 files changed, 465 insertions, 524 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index dc1f61d0d26..2cf6c0528c0 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -38,41 +38,24 @@ 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 )
#
# OS specific C flags, definitions and source files.
#
IF(UNIX)
- if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
- # Bar: -Wfatal-errors removed (does not present in gcc on solaris10)
- if(WITH_WARNINGS)
- add_definitions(-Wall -Wextra -Wmissing-declarations)
- #message(STATUS "CONNECT: GCC: All warnings enabled")
- else()
- add_definitions(-Wall -Wmissing-declarations)
- add_definitions(-Wno-write-strings)
- add_definitions(-Wno-unused-variable)
- # Bar: -Wno-unused-but-set-variables commented (does not present on sol10)
- # add_definitions(-Wno-unused-but-set-variable)
- add_definitions(-Wno-unused-value)
- add_definitions(-Wno-unused-function)
- add_definitions(-Wno-parentheses)
- #add_definitions(-Wno-missing-declarations)
- # Bar: -Wno-int-to-pointer-cast commended (does not present in gcc on sol10)
- # add_definitions(-Wno-int-to-pointer-cast)
- # Bar: -Wno-narrowing commented (does not present in gcc on solaris10)
- # add_definitions(-Wno-narrowing)
-
-# This switch is for pure C only:
-# add_definitions(-Wno-implicit-function-declaration)
-# These switches are for C++ only
-# add_definitions(-Wno-reorder)
-
- #message(STATUS "CONNECT: GCC: Some warnings disabled")
- endif(WITH_WARNINGS)
- endif()
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wall -Wmissing-declarations")
+ if(NOT WITH_WARNINGS)
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-function")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-variable")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-value")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-parentheses")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-misleading-indentation")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-format-truncation")
+ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
+ endif(NOT WITH_WARNINGS)
add_definitions( -DUNIX -DLINUX -DUBUNTU )
@@ -245,7 +228,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 +243,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 +295,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)
diff --git a/storage/connect/cmgoconn.cpp b/storage/connect/cmgoconn.cpp
index fdd59040257..44fac56137f 100644
--- a/storage/connect/cmgoconn.cpp
+++ b/storage/connect/cmgoconn.cpp
@@ -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 --------------------------- */
@@ -140,10 +133,35 @@ CMgoConn::CMgoConn(PGLOBAL g, PCPARM pcg)
} // 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
diff --git a/storage/connect/cmgoconn.h b/storage/connect/cmgoconn.h
index f5cefea3442..b1216ac576c 100644
--- a/storage/connect/cmgoconn.h
+++ b/storage/connect/cmgoconn.h
@@ -93,6 +93,7 @@ public:
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 @@ protected:
PINCOL Fpc; // To insert INCOL classes
PFBLOCK fp;
bool m_Connected;
+ static bool IsInit;
}; // end of class CMgoConn
diff --git a/storage/connect/csort.cpp b/storage/connect/csort.cpp
index 13f325d8f3f..670131b8fd2 100644
--- a/storage/connect/csort.cpp
+++ b/storage/connect/csort.cpp
@@ -351,7 +351,7 @@ void CSORT::Qstx(int *base, int *max)
zlo = zhi = cnm = 0; // Avoid warning message
- lo = max - base; // Number of elements as longs
+ lo = (int)(max - base); // Number of elements as longs
if (Dup)
cnm = Cmpnum(lo);
@@ -472,7 +472,7 @@ void CSORT::Qstx(int *base, int *max)
i = him + 1;
if (Pof)
- Pof[him - Pex] = Pof[mid - Pex] = i - j;
+ Pof[him - Pex] = Pof[mid - Pex] = (int)(i - j);
/*******************************************************************/
/* Look at sizes of the two partitions, do the smaller one first */
@@ -481,8 +481,8 @@ void CSORT::Qstx(int *base, int *max)
/* But only repeat (recursively or by branching) if the partition */
/* is of at least size THRESH. */
/*******************************************************************/
- lo = j - base;
- hi = max - i;
+ lo = (int)(j - base);
+ hi = (int)(max - i);
if (Dup) { // Update progress information
zlo = Cmpnum(lo);
@@ -726,7 +726,7 @@ void CSORT::Qstc(int *base, int *max)
zlo = zhi = cnm = 0; // Avoid warning message
- lo = max - base; // Number of elements as longs
+ lo = (int)(max - base); // Number of elements as longs
if (Dup)
cnm = Cmpnum(lo);
@@ -853,7 +853,7 @@ void CSORT::Qstc(int *base, int *max)
/* the offset array values indicating break point and block size. */
/*******************************************************************/
if (Pof)
- Pof[lt - Pex] = Pof[(jj - 1) - Pex] = jj - lt;
+ Pof[lt - Pex] = Pof[(jj - 1) - Pex] = (int)(jj - lt);
/*******************************************************************/
/* Look at sizes of the two partitions, do the smaller one first */
@@ -862,8 +862,8 @@ void CSORT::Qstc(int *base, int *max)
/* But only repeat (recursively or by branching) if the partition */
/* is of at least size THRESH. */
/*******************************************************************/
- lo = lt - base;
- hi = gt - Swix;
+ lo = (int)(lt - base);
+ hi = (int)(gt - Swix);
if (Dup) { // Update progress information
zlo = Cmpnum(lo);
diff --git a/storage/connect/domdoc.cpp b/storage/connect/domdoc.cpp
index e24e10835c1..ba8eb829abd 100644
--- a/storage/connect/domdoc.cpp
+++ b/storage/connect/domdoc.cpp
@@ -13,6 +13,7 @@
#elif defined(MSX4)
#import "msxml4.dll" //Causes error C2872: DOMNodeType: ambiguous symbol ??
#elif defined(MSX6)
+#pragma warning(suppress : 4192)
#import "msxml6.dll" //Causes error C2872: DOMNodeType: ambiguous symbol ??
#else // MSX4
#error MSX? is not defined
@@ -540,7 +541,7 @@ PXNODE DOMNODE::AddChildNode(PGLOBAL g, PCSZ name, PXNODE np)
// If name has the format m[n] only m is taken as node name
if ((p = strchr(name, '[')))
- pn = BufAlloc(g, name, p - name);
+ pn = BufAlloc(g, name, (int)(p - name));
else
pn = name;
diff --git a/storage/connect/filamap.cpp b/storage/connect/filamap.cpp
index 84dff422db7..67481136d81 100644
--- a/storage/connect/filamap.cpp
+++ b/storage/connect/filamap.cpp
@@ -247,7 +247,7 @@ int MAPFAM::GetRowID(void)
/***********************************************************************/
int MAPFAM::GetPos(void)
{
- return Fpos - Memory;
+ return (int)(Fpos - Memory);
} // end of GetPos
/***********************************************************************/
@@ -255,7 +255,7 @@ int MAPFAM::GetPos(void)
/***********************************************************************/
int MAPFAM::GetNextPos(void)
{
- return Mempos - Memory;
+ return (int)(Mempos - Memory);
} // end of GetNextPos
/***********************************************************************/
@@ -368,7 +368,7 @@ int MAPFAM::ReadBuffer(PGLOBAL g)
} // endif Mempos
// Set caller line buffer
- len = (Mempos - Fpos) - n;
+ len = (int)(Mempos - Fpos) - n;
// Don't rely on ENDING setting
if (len > 0 && *(Mempos - 2) == '\r')
@@ -428,7 +428,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/* not required here, just setting of future Spos and Tpos. */
/*******************************************************************/
Tpos = Spos = Fpos;
- } else if ((n = Fpos - Spos) > 0) {
+ } else if ((n = (int)(Fpos - Spos)) > 0) {
/*******************************************************************/
/* Non consecutive line to delete. Move intermediate lines. */
/*******************************************************************/
@@ -461,7 +461,7 @@ int MAPFAM::DeleteRecords(PGLOBAL g, int irc)
/*****************************************************************/
/* Remove extra records. */
/*****************************************************************/
- n = Tpos - Memory;
+ n = (int)(Tpos - Memory);
#if defined(__WIN__)
DWORD drc = SetFilePointer(fp->Handle, n, NULL, FILE_BEGIN);
@@ -627,7 +627,7 @@ int MBKFAM::ReadBuffer(PGLOBAL g)
break;
// Set caller line buffer
- len = (Mempos - Fpos) - Ending;
+ len = (int)(Mempos - Fpos) - Ending;
memcpy(Tdbp->GetLine(), Fpos, len);
Tdbp->GetLine()[len] = '\0';
return RC_OK;
diff --git a/storage/connect/filamgz.cpp b/storage/connect/filamgz.cpp
index df366ef15f9..3078935e8a4 100644
--- a/storage/connect/filamgz.cpp
+++ b/storage/connect/filamgz.cpp
@@ -537,7 +537,7 @@ int ZBKFAM::ReadBuffer(PGLOBAL g)
while (*NxtLine++ != '\n') ;
// Set caller line buffer
- n = NxtLine - CurLine - Ending;
+ n = (int)(NxtLine - CurLine - Ending);
memcpy(Tdbp->GetLine(), CurLine, n);
Tdbp->GetLine()[n] = '\0';
return RC_OK;
@@ -588,7 +588,7 @@ int ZBKFAM::ReadBuffer(PGLOBAL g)
for (NxtLine = CurLine; *NxtLine++ != '\n';) ;
// Set caller line buffer
- n = NxtLine - CurLine - Ending;
+ n = (int)(NxtLine - CurLine - Ending);
memcpy(Tdbp->GetLine(), CurLine, n);
Tdbp->GetLine()[n] = '\0';
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
@@ -1087,7 +1087,7 @@ bool ZLBFAM::SetPos(PGLOBAL g, int pos __attribute__((unused)))
/***********************************************************************/
int ZLBFAM::ReadBuffer(PGLOBAL g)
{
- int n;
+ size_t n;
void *rdbuf;
/*********************************************************************/
@@ -1299,7 +1299,7 @@ int ZLBFAM::WriteBuffer(PGLOBAL g)
else
NxtLine = CurLine + Lrecl;
- BlkLen = NxtLine - To_Buf;
+ BlkLen = (int)(NxtLine - To_Buf);
if (WriteCompressedBuffer(g)) {
Closing = TRUE; // To tell CloseDB about a Write error
diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp
index c456ee9e9b7..0f5069bae33 100644
--- a/storage/connect/filamtxt.cpp
+++ b/storage/connect/filamtxt.cpp
@@ -1351,7 +1351,7 @@ int BLKFAM::GetPos(void)
/***********************************************************************/
int BLKFAM::GetNextPos(void)
{
- return Fpos + NxtLine - CurLine;
+ return (int)(Fpos + NxtLine - CurLine);
} // end of GetNextPos
/***********************************************************************/
@@ -1396,7 +1396,8 @@ int BLKFAM::SkipRecord(PGLOBAL, bool header)
/***********************************************************************/
int BLKFAM::ReadBuffer(PGLOBAL g)
{
- int i, n, rc = RC_OK;
+ int i, rc = RC_OK;
+ size_t n;
/*********************************************************************/
/* Sequential reading when Placed is not true. */
@@ -1458,7 +1459,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
// Read the entire next block
n = fread(To_Buf, 1, (size_t)BlkLen, Stream);
- if (n == BlkLen) {
+ if ((size_t) n == (size_t) BlkLen) {
// ReadBlks++;
num_read++;
Rbuf = (CurBlk == Block - 1) ? Last : Nrec;
@@ -1497,7 +1498,7 @@ int BLKFAM::ReadBuffer(PGLOBAL g)
fin:
// Store the current record file position for Delete and Update
- Fpos = BlkPos[CurBlk] + CurLine - To_Buf;
+ Fpos = (int)(BlkPos[CurBlk] + CurLine - To_Buf);
return rc;
} // end of ReadBuffer
@@ -1524,7 +1525,7 @@ int BLKFAM::WriteBuffer(PGLOBAL g)
// Now start the writing process.
NxtLine = CurLine + strlen(CurLine);
- BlkLen = NxtLine - To_Buf;
+ BlkLen = (int)(NxtLine - To_Buf);
if (fwrite(To_Buf, 1, BlkLen, Stream) != (size_t)BlkLen) {
sprintf(g->Message, MSG(FWRITE_ERROR), strerror(errno));
diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp
index dfd9343af76..f94362a3d87 100644
--- a/storage/connect/filamzip.cpp
+++ b/storage/connect/filamzip.cpp
@@ -748,7 +748,7 @@ UNZFAM::UNZFAM(PUNZFAM txfp) : MAPFAM(txfp)
/***********************************************************************/
int UNZFAM::GetFileLength(PGLOBAL g)
{
- int len = (zutp && zutp->entryopen) ? Top - Memory
+ int len = (zutp && zutp->entryopen) ? (int)(Top - Memory)
: TXTFAM::GetFileLength(g) * 3;
if (trace)
@@ -1088,7 +1088,7 @@ int ZIPFAM::WriteBuffer(PGLOBAL g)
// Prepare to write the new line
strcat(strcpy(To_Buf, Tdbp->GetLine()), (Bin) ? CrLf : "\n");
- len = strchr(To_Buf, '\n') - To_Buf + 1;
+ len = (int)(strchr(To_Buf, '\n') - To_Buf + 1);
return zutp->writeEntry(g, To_Buf, len);
} // end of WriteBuffer
diff --git a/storage/connect/filter.cpp b/storage/connect/filter.cpp
index bb3be629ea4..76380f12ad6 100644
--- a/storage/connect/filter.cpp
+++ b/storage/connect/filter.cpp
@@ -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. */
/*********************************************************************/
diff --git a/storage/connect/filter.h b/storage/connect/filter.h
index 11b77aec132..c6ab8fddd35 100644
--- a/storage/connect/filter.h
+++ b/storage/connect/filter.h
@@ -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);
diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c
index ef4f7bfc65a..729b1b883c1 100644
--- a/storage/connect/fmdlex.c
+++ b/storage/connect/fmdlex.c
@@ -283,7 +283,7 @@ static void yy_fatal_error YY_PROTO(( const char msg[] ));
*/
#define YY_DO_BEFORE_ACTION \
yytext_ptr = yy_bp; \
- yyleng = yy_cp - yy_bp; \
+ yyleng = (int)(yy_cp - yy_bp); \
yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yy_c_buf_p = yy_cp;
@@ -417,10 +417,10 @@ static PDTP pp;
static void MakeParm(int n);
static void MakeMMDD(int n);
static void MakeAMPM(int n);
-static void MakeIn(char *);
-static void MakeOut(char *);
-static void Quotin(char *);
-static void Quotout(char *);
+static void MakeIn(const char *);
+static void MakeOut(const char *);
+static void Quotin(const char *);
+static void Quotout(const char *);
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -695,7 +695,7 @@ case YY_STATE_EOF(dqt):
case YY_END_OF_BUFFER:
{
/* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1;
+ int yy_amount_of_matched_text = (int)(yy_cp - yytext_ptr - 1);
/* Undo the effects of YY_DO_BEFORE_ACTION. */
*yy_cp = yy_hold_char;
@@ -862,7 +862,7 @@ static int yy_get_next_buffer()
/* Try to read more data. */
/* First move last chars to start of buffer. */
- number_to_move = yy_c_buf_p - yytext_ptr;
+ number_to_move = (int)(yy_c_buf_p - yytext_ptr);
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
@@ -888,7 +888,7 @@ static int yy_get_next_buffer()
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = yy_current_buffer;
- int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf;
+ int yy_c_buf_p_offset = (int)(yy_c_buf_p - b->yy_ch_buf);
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
@@ -1492,7 +1492,7 @@ void MakeAMPM(int n)
} /* end of MakeAMPM */
-void MakeIn(char *text)
+void MakeIn(const char *text)
{
if (!pp->InFmt)
return;
@@ -1500,14 +1500,14 @@ void MakeIn(char *text)
strncat(pp->InFmt, text, (pp->Outsize - 1) - strlen(pp->InFmt));
} /* end of MakeIn */
-void MakeOut(char *text)
+void MakeOut(const char *text)
{
if (!pp->OutFmt) return;
strncat(pp->OutFmt, text, (pp->Outsize - 1) - strlen(pp->OutFmt));
} /* end of MakeOut */
-void Quotin(char *text)
+void Quotin(const char *text)
{
if (!pp->InFmt)
return;
@@ -1516,7 +1516,7 @@ void Quotin(char *text)
pp->InFmt[strlen(pp->InFmt)-1] = '\0';
} /* end of Quotin */
-void Quotout(char *text)
+void Quotout(const char *text)
{
if (!pp->OutFmt)
return;
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 39506eae533..51fcf87470c 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -130,10 +130,13 @@
#if defined(ODBC_SUPPORT)
#include "odbccat.h"
#endif // ODBC_SUPPORT
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
#include "tabjdbc.h"
#include "jdbconn.h"
-#endif // JDBC_SUPPORT
+#endif // JAVA_SUPPORT
+#if defined(CMGO_SUPPORT)
+#include "cmgoconn.h"
+#endif // CMGO_SUPPORT
#include "tabmysql.h"
#include "filamdbf.h"
#include "tabxcl.h"
@@ -172,18 +175,18 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
- char version[]= "Version 1.06.0004 September 03, 2017";
+ char version[]= "Version 1.06.0005 October 14, 2017";
#if defined(__WIN__)
- char compver[]= "Version 1.06.0004 " __DATE__ " " __TIME__;
+ char compver[]= "Version 1.06.0005 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !__WIN__
char slash= '/';
#endif // !__WIN__
} // extern "C"
-#if defined(NEW_MAR)
+#if MYSQL_VERSION_ID > 100200
#define stored_in_db stored_in_db()
-#endif // NEW_MAR)
+#endif // MYSQL_VERSION_ID
#if defined(XMAP)
my_bool xmap= false;
@@ -197,10 +200,10 @@ extern "C" {
} // extern "C"
#endif // XMSG
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
char *JvmPath;
char *ClassPath;
-#endif // JDBC_SUPPORT
+#endif // JAVA_SUPPORT
pthread_mutex_t parmut;
pthread_mutex_t usrmut;
@@ -213,9 +216,9 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
PQRYRES VirColumns(PGLOBAL g, bool info);
PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info);
PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info);
-#if defined(MONGO_SUPPORT)
+#if defined(JAVA_SUPPORT)
PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ url, PTOS topt, bool info);
-#endif // MONGO_SUPPORT
+#endif // JAVA_SUPPORT
int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v);
void PushWarning(PGLOBAL g, THD *thd, int level);
bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, PCSZ host, PCSZ db,
@@ -223,7 +226,7 @@ bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, PCSZ host, PCSZ db,
bool ZipLoadFile(PGLOBAL, PCSZ, PCSZ, PCSZ, bool, bool);
bool ExactInfo(void);
#if defined(CMGO_SUPPORT)
-void mongo_init(bool);
+//void mongo_init(bool);
#endif // CMGO_SUPPORT
USETEMP UseTemp(void);
int GetConvSize(void);
@@ -235,6 +238,8 @@ uint GetWorkSize(void);
void SetWorkSize(uint);
extern "C" const char *msglang(void);
+static char *strz(PGLOBAL g, LEX_STRING &ls);
+
static void PopUser(PCONNECT xp);
static PCONNECT GetUser(THD *thd, PCONNECT xp);
static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp);
@@ -351,21 +356,21 @@ static MYSQL_THDVAR_UINT(json_grp_size,
"max number of rows for JSON aggregate functions.",
NULL, NULL, JSONMAX, 1, INT_MAX, 1);
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
// Default java wrapper to use with JDBC tables
static MYSQL_THDVAR_STR(java_wrapper,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
"Java wrapper class name",
// check_java_wrapper, update_java_wrapper,
NULL, NULL, "wrappers/JdbcInterface");
-#endif // JDBC_SUPPORT
+#endif // JAVA_SUPPORT
-#if defined(MONGO_SUPPORT)
+#if 0 // This is apparently not acceptable for a plugin
// Enabling MONGO table type
static MYSQL_THDVAR_BOOL(enable_mongo, PLUGIN_VAR_RQCMDARG,
"Enabling the MongoDB access",
NULL, NULL, MONGO_ENABLED);
-#endif // MONGO_SUPPORT
+#endif // 0
#if defined(XMSG) || defined(NEWMSG)
const char *language_names[]=
@@ -422,14 +427,14 @@ extern "C" const char *msglang(void)
} // end of msglang
#else // !XMSG && !NEWMSG
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
char *GetJavaWrapper(void)
{return connect_hton ? THDVAR(current_thd, java_wrapper) : (char*)"wrappers/JdbcInterface";}
-#endif // JDBC_SUPPORT
+#endif // JAVA_SUPPORT
-#if defined(MONGO_SUPPORT)
-bool MongoEnabled(void) { return THDVAR(current_thd, enable_mongo); }
-#endif // MONGO_SUPPORT
+#if defined(JAVA_SUPPORT)
+//bool MongoEnabled(void) { return THDVAR(current_thd, enable_mongo); }
+#endif // JAVA_SUPPORT
extern "C" const char *msglang(void)
{
@@ -706,7 +711,7 @@ static int connect_init_func(void *p)
XmlInitParserLib();
#endif // LIBXML2_SUPPORT
-#if defined(CMGO_SUPPORT)
+#if 0 //defined(CMGO_SUPPORT)
mongo_init(true);
#endif // CMGO_SUPPORT
@@ -727,9 +732,9 @@ static int connect_init_func(void *p)
DTVAL::SetTimeShift(); // Initialize time zone shift once for all
BINCOL::SetEndian(); // Initialize host endian setting
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
JAVAConn::SetJVM();
-#endif // JDBC_SUPPORT
+#endif // JAVA_SUPPORT
DBUG_RETURN(0);
} // end of connect_init_func
@@ -749,12 +754,12 @@ static int connect_done_func(void *)
#endif // LIBXML2_SUPPORT
#if defined(CMGO_SUPPORT)
- mongo_init(false);
+ CMgoConn::mongo_init(false);
#endif // CMGO_SUPPORT
-#ifdef JDBC_SUPPORT
+#ifdef JAVA_SUPPORT
JAVAConn::ResetJVM();
-#endif // JDBC_SUPPORT
+#endif // JAVA_SUPPORT
#if !defined(__WIN__)
PROFILE_End();
@@ -1759,7 +1764,7 @@ bool ha_connect::IsPartitioned(void)
} // end of IsPartitioned
-const char *ha_connect::GetDBName(const char* name)
+PCSZ ha_connect::GetDBName(PCSZ name)
{
return (name) ? name : table->s->db.str;
} // end of GetDBName
@@ -1822,7 +1827,7 @@ void ha_connect::AddColName(char *cp, Field *fp)
/***********************************************************************/
/* This function sets the current database path. */
/***********************************************************************/
-bool ha_connect::SetDataPath(PGLOBAL g, const char *path)
+bool ha_connect::SetDataPath(PGLOBAL g, PCSZ path)
{
return (!(datapath= SetPath(g, path)));
} // end of SetDataPath
@@ -2518,7 +2523,7 @@ const char *ha_connect::GetValStr(OPVAL vop, bool neg)
val= (neg) ? " IS NOT NULL" : " IS NULL";
break;
case OP_LIKE:
- val= " LIKE ";
+ val= (neg) ? " NOT LIKE " : " LIKE ";
break;
case OP_XX:
val= (neg) ? " NOT BETWEEN " : " BETWEEN ";
@@ -2887,7 +2892,10 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
case Item_func::LE_FUNC: vop= OP_LE; break;
case Item_func::GE_FUNC: vop= OP_GE; break;
case Item_func::GT_FUNC: vop= OP_GT; break;
- case Item_func::LIKE_FUNC: vop= OP_LIKE; break;
+ case Item_func::LIKE_FUNC:
+ vop= OP_LIKE;
+ neg = ((Item_func_opt_neg *)condf)->negated;
+ break;
case Item_func::ISNOTNULL_FUNC:
neg = true;
// fall through
@@ -4418,8 +4426,8 @@ bool ha_connect::IsSameIndex(PIXDEF xp1, PIXDEF xp2)
return b;
} // end of IsSameIndex
-MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
- MODE newmode, bool *chk, bool *cras)
+MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
+ MODE newmode, bool *chk, bool *cras)
{
#if defined(DEVELOPMENT)
if (true) {
@@ -5387,13 +5395,11 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
bool cnc= false;
int cto= -1, qto= -1;
#endif // ODBC_SUPPORT
-#if defined(JDBC_SUPPORT) || defined(MONGO_SUPPORT)
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
PJPARM sjp= NULL;
-#endif // JDBC_SUPPORT
PCSZ driver= NULL;
char *url= NULL;
-#endif // JDBC_SUPPORT || MONGO_SUPPORT
+#endif // JAVA_SUPPORT
uint tm, fnc= FNC_NO, supfnc= (FNC_NO | FNC_COL);
bool bif, ok= false, dbf= false;
TABTYPE ttp= TAB_UNDEF;
@@ -5454,9 +5460,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
if ((ucnc= GetListOption(g, "UseDSN", topt->oplist)))
cnc= (!*ucnc || *ucnc == 'y' || *ucnc == 'Y' || atoi(ucnc) != 0);
#endif
-#if defined(JDBC_SUPPORT) || defined(MONGO_SUPPORT)
+#if defined(JAVA_SUPPORT)
driver= GetListOption(g, "Driver", topt->oplist, NULL);
-#endif // JDBC_SUPPORT || MONGO_SUPPORT
+#endif // JAVA_SUPPORT
#if defined(PROMPT_OK)
cop= atoi(GetListOption(g, "checkdsn", topt->oplist, "0"));
#endif // PROMPT_OK
@@ -5543,7 +5549,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
supfnc |= (FNC_TABLE | FNC_DSN | FNC_DRIVER);
break;
#endif // ODBC_SUPPORT
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
case TAB_JDBC:
if (fnc & FNC_DRIVER) {
ok = true;
@@ -5577,7 +5583,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
supfnc |= (FNC_DRIVER | FNC_TABLE);
break;
-#endif // JDBC_SUPPORT
+#endif // JAVA_SUPPORT
case TAB_DBF:
dbf = true;
// fall through
@@ -5634,10 +5640,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
ok = true;
break;
#endif // __WIN__
-#if defined(PIVOT_SUPPORT)
case TAB_PIVOT:
supfnc = FNC_NO;
-#endif // PIVOT_SUPPORT
case TAB_PRX:
case TAB_TBL:
case TAB_XCL:
@@ -5668,14 +5672,14 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
ok = true;
break;
-#if defined(MONGO_SUPPORT)
+#if defined(JAVA_SUPPORT)
case TAB_MONGO:
if (!topt->tabname)
topt->tabname = tab;
ok = true;
break;
-#endif // MONGO_SUPPORT
+#endif // JAVA_SUPPORT
case TAB_VIR:
ok = true;
break;
@@ -5748,7 +5752,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
break;
#endif // ODBC_SUPPORT
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
case TAB_JDBC:
switch (fnc) {
case FNC_NO:
@@ -5777,7 +5781,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
} // endswitch info
break;
-#endif // JDBC_SUPPORT
+#endif // JAVA_SUPPORT
case TAB_MYSQL:
qrp = MyColumns(g, thd, host, db, user, pwd, tab,
NULL, port, fnc == FNC_COL);
@@ -5807,25 +5811,21 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
} // endif OcrColumns
break;
-#if defined(PIVOT_SUPPORT)
case TAB_PIVOT:
qrp = PivotColumns(g, tab, src, pic, fcl, skc, host, db, user, pwd, port);
break;
-#endif // PIVOT_SUPPORT
case TAB_VIR:
qrp = VirColumns(g, fnc == FNC_COL);
break;
case TAB_JSON:
qrp = JSONColumns(g, db, dsn, topt, fnc == FNC_COL);
break;
-#if defined(MONGO_SUPPORT)
+#if defined(JAVA_SUPPORT)
case TAB_MONGO:
- if (!(url = strz(g, create_info->connect_string)) || !*url)
- url = "mongodb://localhost:27017";
-
+ url = strz(g, create_info->connect_string);
qrp = MGOColumns(g, db, url, topt, fnc == FNC_COL);
break;
-#endif // MONGO_SUPPORT
+#endif // JAVA_SUPPORT
#if defined(LIBXML2_SUPPORT) || defined(DOMDOC_SUPPORT)
case TAB_XML:
qrp = XMLColumns(g, (char*)db, tab, topt, fnc == FNC_COL);
@@ -5950,7 +5950,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
break;
case FLD_SCHEM:
-#if defined(ODBC_SUPPORT) || defined(JDBC_SUPPORT)
+#if defined(ODBC_SUPPORT) || defined(JAVA_SUPPORT)
if ((ttp == TAB_ODBC || ttp == TAB_JDBC) && crp->Kdata) {
if (schem && stricmp(schem, crp->Kdata->GetCharValue(i))) {
sprintf(g->Message,
@@ -5961,7 +5961,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
schem = crp->Kdata->GetCharValue(i);
} // endif ttp
-#endif // ODBC_SUPPORT || JDBC_SUPPORT
+#endif // ODBC_SUPPORT || JAVA_SUPPORT
default:
break; // Ignore
} // endswitch Fld
@@ -6009,7 +6009,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
} else
#endif // ODBC_SUPPORT
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
if (ttp == TAB_JDBC) {
int plgtyp;
@@ -7152,7 +7152,7 @@ static MYSQL_SYSVAR_STR(errmsg_dir_path, msg_path,
"../../../../storage/connect/"); // for testing
#endif // XMSG
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
static MYSQL_SYSVAR_STR(jvm_path, JvmPath,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
"Path to the directory where is the JVM lib",
@@ -7164,7 +7164,7 @@ static MYSQL_SYSVAR_STR(class_path, ClassPath,
"Java class path",
// check_class_path, update_class_path,
NULL, NULL, NULL);
-#endif // JDBC_SUPPORT
+#endif // JAVA_SUPPORT
static struct st_mysql_sys_var* connect_system_variables[]= {
@@ -7185,14 +7185,14 @@ static struct st_mysql_sys_var* connect_system_variables[]= {
#endif // XMSG
MYSQL_SYSVAR(json_null),
MYSQL_SYSVAR(json_grp_size),
-#if defined(JDBC_SUPPORT)
+#if defined(JAVA_SUPPORT)
MYSQL_SYSVAR(jvm_path),
MYSQL_SYSVAR(class_path),
MYSQL_SYSVAR(java_wrapper),
-#endif // JDBC_SUPPORT
-#if defined(MONGO_SUPPORT)
- MYSQL_SYSVAR(enable_mongo),
-#endif // MONGO_SUPPORT
+#endif // JAVA_SUPPORT
+#if defined(JAVA_SUPPORT)
+//MYSQL_SYSVAR(enable_mongo),
+#endif // JAVA_SUPPORT
NULL
};
@@ -7209,7 +7209,7 @@ maria_declare_plugin(connect)
0x0106, /* version number (1.05) */
NULL, /* status variables */
connect_system_variables, /* system variables */
- "1.06.0004", /* string version */
+ "1.06.0005", /* string version */
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
}
maria_declare_plugin_end;
diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h
index c3d458094a2..f0fa9b70513 100644
--- a/storage/connect/ha_connect.h
+++ b/storage/connect/ha_connect.h
@@ -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. */
/****************************************************************************/
@@ -213,7 +211,7 @@ public:
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 @@ public:
/** @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
diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp
index 3ba99ed89f8..90f834ef9a7 100644
--- a/storage/connect/javaconn.cpp
+++ b/storage/connect/javaconn.cpp
@@ -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.
diff --git a/storage/connect/javaconn.h b/storage/connect/javaconn.h
index 5d82570365b..54b7c4e92b7 100644
--- a/storage/connect/javaconn.h
+++ b/storage/connect/javaconn.h
@@ -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:
diff --git a/storage/connect/jdbccat.h b/storage/connect/jdbccat.h
index 1210aff77d8..d137164b53a 100644
--- a/storage/connect/jdbccat.h
+++ b/storage/connect/jdbccat.h
@@ -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
diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp
index 9746a66e6c8..01c19f5b19f 100644
--- a/storage/connect/jdbconn.cpp
+++ b/storage/connect/jdbconn.cpp
@@ -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
diff --git a/storage/connect/jmgoconn.cpp b/storage/connect/jmgoconn.cpp
index 97e09b55669..6b70696be74 100644
--- a/storage/connect/jmgoconn.cpp
+++ b/storage/connect/jmgoconn.cpp
@@ -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
diff --git a/storage/connect/json.h b/storage/connect/json.h
index fd6c029df99..addbd13676f 100644
--- a/storage/connect/json.h
+++ b/storage/connect/json.h
@@ -43,7 +43,6 @@ typedef struct {
int len;
} STRG, *PSG;
-bool IsNum(PSZ s);
char *NextChr(PSZ s, char sep);
char *GetJsonNull(void);
@@ -57,8 +56,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. */
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index 2733479a4e6..a79fd0a7124 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -499,28 +499,23 @@ 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;
+ 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 op=%d\n", ars, op);
- 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 nv=%d\n", i, nv);
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) {
if (jvrp->IsNull()) {
@@ -532,6 +527,10 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
} else
jvp = jvrp;
+ if (trace)
+ htrc("jvp=%s null=%d\n",
+ jvp->GetString(g), jvp->IsNull() ? 1 : 0);
+
if (!nv++) {
SetJsonValue(g, vp, jvp, n);
continue;
@@ -564,6 +563,13 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
if (err)
vp->Reset();
+ if (trace) {
+ char buf(32);
+
+ htrc("vp='%s' err=%d\n",
+ vp->GetCharString(&buf), err ? 1 : 0);
+ } // endif trace
+
} // endif Zero
} // endif jvrp
@@ -581,7 +587,6 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
} // endif Op
-//Tjp->NextSame = nextsame;
return vp;
} // end of CalculateArray
@@ -1512,7 +1517,7 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n,
if (!(g->Sarea = PlugAllocMem(g, ml))) {
char errmsg[MAX_STR];
- sprintf(errmsg, MSG(WORK_AREA), g->Message);
+ snprintf(errmsg, sizeof(errmsg)-1, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
g->Sarea_Size = 0;
return true;
diff --git a/storage/connect/macutil.cpp b/storage/connect/macutil.cpp
index b9600bdac2e..f95f3adcc6e 100644
--- a/storage/connect/macutil.cpp
+++ b/storage/connect/macutil.cpp
@@ -230,13 +230,13 @@ bool MACINFO::GetOneInfo(PGLOBAL g, int flag, void *v, int lv)
case 11: // Description
if ((p = strstr(Curp->Description, " - Packet Scheduler Miniport"))) {
strncpy(buf, Curp->Description, p - Curp->Description);
- i = p - Curp->Description;
+ i = (int)(p - Curp->Description);
strncpy(buf, Curp->Description, i);
buf[i] = 0;
p = buf;
} else if ((p = strstr(Curp->Description,
" - Miniport d'ordonnancement de paquets"))) {
- i = p - Curp->Description;
+ i = (int)(p - Curp->Description);
strncpy(buf, Curp->Description, i);
buf[i] = 0;
p = buf;
diff --git a/storage/connect/mongo.cpp b/storage/connect/mongo.cpp
index 12f2f428112..088dc2d29d1 100644
--- a/storage/connect/mongo.cpp
+++ b/storage/connect/mongo.cpp
@@ -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"
/***********************************************************************/
@@ -32,9 +33,90 @@
#define MAXCOL 200 /* Default max column nb in result */
#define TYPE_UNKNOWN 12 /* Must be greater than other types */
+bool MakeSelector(PGLOBAL g, PFIL fp, PSTRG s);
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. */
/***********************************************************************/
@@ -49,7 +131,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info)
int i, n = 0;
PCSZ drv;
PBCOL bcp;
- MGODISC *cmgd;
+ MGODISC *cmgd = NULL;
PQRYRES qrp;
PCOLRES crp;
@@ -72,7 +154,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");
@@ -142,7 +224,7 @@ skipit:
return qrp;
err:
- if (cmgd->tmgp)
+ if (cmgd && cmgd->tmgp)
cmgd->tmgp->CloseDB(g);
return NULL;
@@ -181,7 +263,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 +428,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
diff --git a/storage/connect/mongo.h b/storage/connect/mongo.h
index af69226ea8b..97c391a217f 100644
--- a/storage/connect/mongo.h
+++ b/storage/connect/mongo.h
@@ -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);
diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc
index 20082dcc43e..95af2eeee92 100644
--- a/storage/connect/mycat.cc
+++ b/storage/connect/mycat.cc
@@ -79,22 +79,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
@@ -107,9 +105,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);
/***********************************************************************/
@@ -140,8 +138,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
@@ -155,17 +154,12 @@ 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
@@ -538,9 +532,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;
@@ -551,17 +545,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
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp
index 08bb24e14df..28e6f076e77 100644
--- a/storage/connect/myconn.cpp
+++ b/storage/connect/myconn.cpp
@@ -248,7 +248,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
while (true) {
p2 = strchr(p1, '\'');
- len = MY_MAX(len, p2 - p1);
+ len = MY_MAX(len, (int)(p2 - p1));
if (*++p2 != ',') break;
p1 = p2 + 2;
} // endwhile
diff --git a/storage/connect/mysql-test/connect/r/json_java_2.result b/storage/connect/mysql-test/connect/r/json_java_2.result
index 96c58221b24..966330248e5 100644
--- a/storage/connect/mysql-test/connect/r/json_java_2.result
+++ b/storage/connect/mysql-test/connect/r/json_java_2.result
@@ -1,5 +1,4 @@
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;
diff --git a/storage/connect/mysql-test/connect/r/json_java_3.result b/storage/connect/mysql-test/connect/r/json_java_3.result
index 09901452975..f8e9e161475 100644
--- a/storage/connect/mysql-test/connect/r/json_java_3.result
+++ b/storage/connect/mysql-test/connect/r/json_java_3.result
@@ -1,5 +1,4 @@
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;
diff --git a/storage/connect/mysql-test/connect/r/json_mongo_c.result b/storage/connect/mysql-test/connect/r/json_mongo_c.result
index afcad8d2ea2..8adc006a51b 100644
--- a/storage/connect/mysql-test/connect/r/json_mongo_c.result
+++ b/storage/connect/mysql-test/connect/r/json_mongo_c.result
@@ -1,4 +1,3 @@
-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;
diff --git a/storage/connect/mysql-test/connect/r/mongo_c.result b/storage/connect/mysql-test/connect/r/mongo_c.result
index f90f3a94b44..c7aadcf1165 100644
--- a/storage/connect/mysql-test/connect/r/mongo_c.result
+++ b/storage/connect/mysql-test/connect/r/mongo_c.result
@@ -1,4 +1,3 @@
-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;
diff --git a/storage/connect/mysql-test/connect/r/mongo_java_2.result b/storage/connect/mysql-test/connect/r/mongo_java_2.result
index 02b8ae09d34..8c58a9eceea 100644
--- a/storage/connect/mysql-test/connect/r/mongo_java_2.result
+++ b/storage/connect/mysql-test/connect/r/mongo_java_2.result
@@ -1,5 +1,4 @@
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;
diff --git a/storage/connect/mysql-test/connect/r/mongo_java_3.result b/storage/connect/mysql-test/connect/r/mongo_java_3.result
index c4387bfa5b1..1dd3048b49b 100644
--- a/storage/connect/mysql-test/connect/r/mongo_java_3.result
+++ b/storage/connect/mysql-test/connect/r/mongo_java_3.result
@@ -1,5 +1,4 @@
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;
diff --git a/storage/connect/mysql-test/connect/r/odbc_firebird.result b/storage/connect/mysql-test/connect/r/odbc_firebird.result
index b0c2582abeb..3c4cd84fffc 100644
--- a/storage/connect/mysql-test/connect/r/odbc_firebird.result
+++ b/storage/connect/mysql-test/connect/r/odbc_firebird.result
@@ -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
diff --git a/storage/connect/mysql-test/connect/t/mongo_test.inc b/storage/connect/mysql-test/connect/t/mongo_test.inc
index c728b85fd2f..dfc223e9074 100644
--- a/storage/connect/mysql-test/connect/t/mongo_test.inc
+++ b/storage/connect/mysql-test/connect/t/mongo_test.inc
@@ -1,4 +1,4 @@
-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;
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index 70a0a6a1450..3b0cb562672 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -2427,7 +2427,7 @@ int ODBConn::GetCatInfo(CATPARM *cap)
else if (vlen[n] == SQL_NULL_DATA)
pval[n]->SetNull(true);
else if (crp->Type == TYPE_STRING/* && vlen[n] != SQL_NULL_DATA*/)
- pval[n]->SetValue_char(pbuf[n], vlen[n]);
+ pval[n]->SetValue_char(pbuf[n], (int)vlen[n]);
else
pval[n]->SetNull(false);
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index 25da3162516..5602861df59 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -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. */
@@ -540,7 +541,7 @@ bool EvalLikePattern(LPCSTR sp, LPCSTR tp)
{
LPSTR p;
char c;
- int n;
+ ssize_t n;
bool b, t = false;
if (trace)
@@ -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
diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp
index dbf90fb5599..0367aacd050 100644
--- a/storage/connect/plugutil.cpp
+++ b/storage/connect/plugutil.cpp
@@ -162,7 +162,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
/*******************************************************************/
if (worksize && !(g->Sarea = PlugAllocMem(g, worksize))) {
char errmsg[MAX_STR];
- sprintf(errmsg, MSG(WORK_AREA), g->Message);
+ snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
g->Sarea_Size = 0;
} else
diff --git a/storage/connect/rcmsg.c b/storage/connect/rcmsg.c
index 75759e03314..895f8f5862b 100644
--- a/storage/connect/rcmsg.c
+++ b/storage/connect/rcmsg.c
@@ -27,9 +27,9 @@
char *msglang(void);
-char *GetMsgid(int id)
+const char *GetMsgid(int id)
{
- char *p = NULL;
+ const char *p = NULL;
// This conditional until a real fix is found for MDEV-7304
#if defined(FRENCH)
@@ -55,7 +55,8 @@ char *GetMsgid(int id)
int GetRcString(int id, char *buf, int bufsize)
{
- char *p = NULL, msg[32];
+ const char *p = NULL;
+ char msg[32];
if (!(p = GetMsgid(id))) {
sprintf(msg, "ID=%d unknown", id);
diff --git a/storage/connect/rcmsg.h b/storage/connect/rcmsg.h
index b22e77f5175..499ca3b2dd4 100644
--- a/storage/connect/rcmsg.h
+++ b/storage/connect/rcmsg.h
@@ -5,7 +5,7 @@
extern "C" {
#endif
-char *GetMsgid(int id);
+const char *GetMsgid(int id);
int GetRcString(int id, char *buf, int bufsize);
#ifdef __cplusplus
diff --git a/storage/connect/reldef.h b/storage/connect/reldef.h
index 84ae2a491f0..f8256a59b3d 100644
--- a/storage/connect/reldef.h
+++ b/storage/connect/reldef.h
@@ -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 @@ public:
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 */
diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp
index 516601a5eb4..f616f24d16b 100644
--- a/storage/connect/tabfmt.cpp
+++ b/storage/connect/tabfmt.cpp
@@ -934,7 +934,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g)
if (p) {
//len = p++ - p2;
- len = p - p2 - 1;;
+ len = (int)(p - p2 - 1);
// if (Sep != ' ')
// for (; *p == ' '; p++) ; // Skip blanks
@@ -978,7 +978,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g)
return RC_NF;
} else if ((p = strchr(p2, Sep)))
- len = p - p2;
+ len = (int)(p - p2);
else if (i == Fields - 1)
len = strlen(p2);
else if (Accept && Maxerr == 0) {
@@ -996,7 +996,7 @@ int TDBCSV::ReadBuffer(PGLOBAL g)
} else
len = 0;
- Offset[i] = p2 - To_Line;
+ Offset[i] = (int)(p2 - To_Line);
if (Mode != MODE_UPDATE)
Fldlen[i] = len;
diff --git a/storage/connect/tabjmg.cpp b/storage/connect/tabjmg.cpp
index 50efd727604..ba3e1c3e7c0 100644
--- a/storage/connect/tabjmg.cpp
+++ b/storage/connect/tabjmg.cpp
@@ -73,9 +73,10 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt,
int ncol, int k)
{
const char *key;
- char colname[65];
- char fmt[129];
- bool rc = true;
+ char colname[65];
+ char fmt[129];
+ bool rc = true;
+ size_t z;
jint *n = nullptr;
jstring jkey;
jobject jres;
@@ -105,14 +106,16 @@ bool JMGDISC::ColDesc(PGLOBAL g, jobject obj, char *pcn, char *pfmt,
if (pcn) {
strncpy(colname, pcn, 64);
colname[64] = 0;
- strncat(strncat(colname, "_", 65), key, 65);
+ z = 65 - strlen(colname);
+ strncat(strncat(colname, "_", z), key, z - 1);
} else
strcpy(colname, key);
if (pfmt) {
strncpy(fmt, pfmt, 128);
fmt[128] = 0;
- strncat(strncat(fmt, ".", 129), key, 129);
+ z = 129 - strlen(fmt);
+ strncat(strncat(fmt, ".", z), key, z - 1);
} else
strcpy(fmt, key);
@@ -178,7 +181,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;
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index 401441520da..8778b7d4b47 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -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,18 @@ 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 op=%d nextsame=%d\n",
+ ars, op, nextsame);
-//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 nv=%d\n", i, nv);
+
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) do {
if (jvrp->IsNull()) {
jvrp->Value = AllocateValue(g, GetJsonNull(), TYPE_STRING);
@@ -1617,13 +1612,16 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
} else
jvp = jvrp;
- if (!nv++) {
+ if (trace)
+ htrc("jvp=%s null=%d\n",
+ jvp->GetString(g), jvp->IsNull() ? 1 : 0);
+
+ if (!nv++) {
SetJsonValue(g, vp, jvp, n);
continue;
} else
SetJsonValue(g, MulVal, jvp, n);
-
-// if (!MulVal->IsZero()) {
+
if (!MulVal->IsNull()) {
switch (op) {
case OP_CNC:
@@ -1634,7 +1632,7 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
val[0] = MulVal;
err = vp->Compute(g, val, 1, op);
- break;
+ break;
// case OP_NUM:
case OP_SEP:
val[0] = Nodes[n].Valp;
@@ -1650,7 +1648,15 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
if (err)
vp->Reset();
- } // endif Null
+ if (trace) {
+ char buf(32);
+
+ htrc("vp='%s' err=%d\n",
+ vp->GetCharString(&buf), err ? 1 : 0);
+
+ } // endif trace
+
+ } // endif Null
} while (Tjp->NextSame > nextsame);
diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h
index 00e2f4614e7..17583cba333 100644
--- a/storage/connect/tabjson.h
+++ b/storage/connect/tabjson.h
@@ -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 @@ public:
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 @@ public:
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 @@ public:
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);
diff --git a/storage/connect/tabmac.cpp b/storage/connect/tabmac.cpp
index a28b5d7108c..8260ab65391 100644
--- a/storage/connect/tabmac.cpp
+++ b/storage/connect/tabmac.cpp
@@ -367,13 +367,13 @@ void MACCOL::ReadColumn(PGLOBAL g)
case 11: // Description
if ((p = strstr(adp->Description, " - Packet Scheduler Miniport"))) {
strncpy(buf, adp->Description, p - adp->Description);
- i = p - adp->Description;
+ i = (int)(p - adp->Description);
strncpy(buf, adp->Description, i);
buf[i] = 0;
p = buf;
} else if ((p = strstr(adp->Description,
" - Miniport d'ordonnancement de paquets"))) {
- i = p - adp->Description;
+ i = (int)(p - adp->Description);
strncpy(buf, adp->Description, i);
buf[i] = 0;
p = buf;
diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp
index 5c41f9094ac..0967afca6cd 100644
--- a/storage/connect/tabmul.cpp
+++ b/storage/connect/tabmul.cpp
@@ -203,12 +203,12 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
// Data files can be imported from Windows (having CRLF)
if (*p == '\n' || *p == '\r') {
// is this enough for Unix ???
- *p--; // Eliminate ending CR or LF character
+ p--; // Eliminate ending CR or LF character
if (p >= filename)
// is this enough for Unix ???
if (*p == '\n' || *p == '\r')
- *p--; // Eliminate ending CR or LF character
+ p--; // Eliminate ending CR or LF character
} // endif p
diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp
index 6e4a038ec92..0c56b3e6614 100644
--- a/storage/connect/tabtbl.cpp
+++ b/storage/connect/tabtbl.cpp
@@ -650,7 +650,7 @@ bool TDBTBM::IsLocal(PTABLE tbp)
return ((!stricmp(tdbp->Host, "localhost") ||
!strcmp(tdbp->Host, "127.0.0.1")) &&
- tdbp->Port == GetDefaultPort());
+ tdbp->Port == (int)GetDefaultPort());
} // end of IsLocal
/***********************************************************************/
diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp
index e17e092661f..948ea24aa6b 100644
--- a/storage/connect/tabutil.cpp
+++ b/storage/connect/tabutil.cpp
@@ -120,7 +120,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
FLD_REM, FLD_NO, FLD_CHARSET};
unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 0, 32, 32};
PCSZ fmt;
- char *pn, *tn, *fld, *colname, v; //, *chset;
+ char *pn, *tn, *fld, *colname, v; // *chset
int i, n, ncol = sizeof(buftyp) / sizeof(int);
int prec, len, type, scale;
int zconv = GetConvSize();
@@ -185,7 +185,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
colname = (char *)fp->field_name.str;
crp->Kdata->SetValue(colname, i);
-// chset = (char *)fp->charset()->name;
+// chset = (char *)fp->charset()->name;
// v = (!strcmp(chset, "binary")) ? 'B' : 0;
v = 0;
diff --git a/storage/connect/tabxml.h b/storage/connect/tabxml.h
index 813f62dde52..f55b7d98de7 100644
--- a/storage/connect/tabxml.h
+++ b/storage/connect/tabxml.h
@@ -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. */
/***********************************************************************/
diff --git a/storage/connect/valblk.h b/storage/connect/valblk.h
index a3d7bf30fcf..ad970105868 100644
--- a/storage/connect/valblk.h
+++ b/storage/connect/valblk.h
@@ -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);
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index a80da808548..bf56197ac56 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -1374,7 +1374,7 @@ bool TYPVAL<PSZ>::SetValue_char(const char *cp, int n)
} else if (cp != Strp) {
const char *p = cp + n - 1;
- for (p; p >= cp; p--, n--)
+ for (; p >= cp; p--, n--)
if (*p && *p != ' ')
break;
@@ -1656,39 +1656,48 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
char *p[2], val[2][32];
int i;
- for (i = 0; i < np; i++)
- p[i] = vp[i]->IsNull() ? NULL : vp[i]->GetCharString(val[i]);
+ if (trace)
+ htrc("Compute: np=%d op=%d\n", np, op);
- if (p[i-1]) {
- switch (op) {
- case OP_CNC:
- assert(np == 1 || np == 2);
+ for (i = 0; i < np; i++)
+ if (!vp[i]->IsNull()) {
+ p[i] = vp[i]->GetCharString(val[i]);
- if (np == 2)
- SetValue_psz(p[0]);
+ if (trace)
+ htrc("p[%d]=%s\n", i, p[i]);
- if ((i = Len - (signed)strlen(Strp)) > 0)
- strncat(Strp, p[np - 1], i);
+ } else
+ return false;
- break;
- case OP_MIN:
- assert(np == 2);
- SetValue_psz((strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
- break;
- case OP_MAX:
- assert(np == 2);
- SetValue_psz((strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
- break;
- default:
- // sprintf(g->Message, MSG(BAD_EXP_OPER), op);
- strcpy(g->Message, "Function not supported");
- return true;
- } // endswitch op
+ switch (op) {
+ case OP_CNC:
+ assert(np == 1 || np == 2);
- Null = false;
- } // endif p[i]
+ if (np == 2)
+ SetValue_psz(p[0]);
- Null = false;
+ if ((i = Len - (signed)strlen(Strp)) > 0)
+ strncat(Strp, p[np - 1], i);
+
+ if (trace)
+ htrc("Strp=%s\n", Strp);
+
+ break;
+ case OP_MIN:
+ assert(np == 2);
+ SetValue_psz((strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
+ break;
+ case OP_MAX:
+ assert(np == 2);
+ SetValue_psz((strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
+ break;
+ default:
+ // sprintf(g->Message, MSG(BAD_EXP_OPER), op);
+ strcpy(g->Message, "Function not supported");
+ return true;
+ } // endswitch op
+
+ Null = false;
return false;
} // end of Compute
@@ -1738,7 +1747,7 @@ DECVAL::DECVAL(PSZ s) : TYPVAL<PSZ>(s)
if (s) {
char *p = strchr(Strp, '.');
- Prec = (p) ? Len - (p - Strp) : 0;
+ Prec = (p) ? (int)(Len - (p - Strp)) : 0;
} // endif s
Type = TYPE_DECIM;
@@ -2647,7 +2656,7 @@ bool DTVAL::SetValue_char(const char *p, int n)
// Trim trailing blanks
for (p2 = p + n -1; p < p2 && *p2 == ' '; p2--);
- if ((rc = (n = p2 - p + 1) > Len))
+ if ((rc = (n = (int)(p2 - p + 1)) > Len))
n = Len;
memcpy(Sdate, p, n);
diff --git a/storage/connect/value.h b/storage/connect/value.h
index f771d33dc52..6613e25100a 100644
--- a/storage/connect/value.h
+++ b/storage/connect/value.h
@@ -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);}
diff --git a/storage/connect/xobject.cpp b/storage/connect/xobject.cpp
index 85af3779701..c595ce5d6c4 100644
--- a/storage/connect/xobject.cpp
+++ b/storage/connect/xobject.cpp
@@ -204,7 +204,7 @@ STRING::STRING(PGLOBAL g, uint n, PCSZ str)
*Strp = 0;
Next = GetNext();
- Size = Next - Strp;
+ Size = (int)(Next - Strp);
Trc = false;
} else {
// This should normally never happen
@@ -239,7 +239,7 @@ char *STRING::Realloc(uint len)
p = Strp;
Next = GetNext();
- Size = Next - p;
+ Size = (int)(Next - p);
return p;
} // end of Realloc
diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h
index ebef7a2549a..bc9265e0223 100644
--- a/storage/connect/xtable.h
+++ b/storage/connect/xtable.h
@@ -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;