Skip to content

Commit

Permalink
Squashed commit of connect/10.0:
Browse files Browse the repository at this point in the history
Main additions:

commit 543c200
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Thu Jan 4 13:51:13 2018 +0100

    - Fix MDEV-9844, MDEV-10179, MDEV-14214
     This is done by removing the tbl table type THREAD option
     that causes a multiple of sporadic bugs.
     This may be temporary depending on whether a real fix is found.
      modified:   storage/connect/mysql-test/connect/disabled.def
      modified:   storage/connect/tabtbl.cpp
      modified:   storage/connect/tabtbl.h

commit 54bc4ea
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Fri Nov 3 16:21:56 2017 +0100

    - Fix MDEV-13925: Actually this fixes SELECT queries when
      the WHERE clause have single quote.
      modified:   storage/connect/ha_connect.cc

    - Use Windows VirtualAlloc and VirtualFree for the Sarea workspace
      modified:   storage/connect/global.h
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/jsonudf.cpp
      modified:   storage/connect/plgdbutl.cpp
      modified:   storage/connect/plugutil.cpp
      modified:   storage/connect/user_connect.cc

    - Change inihandl from c to c++.
      Because it now includes global.h that contains a bool function definition
      that make compile to fail on Linux.
      modified:   storage/connect/CMakeLists.txt
      removed:    storage/connect/inihandl.c
      added:      storage/connect/inihandl.cpp

    - Fix MDEV-13860 CONNECT engine does not build with JDBC without ODBC.
      By including Sergei's patch in connect_assisted_discovery.
      modified:   storage/connect/ha_connect.cc

commit c07064d
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Wed Oct 18 00:11:00 2017 +0200

    - Update version number
      modified:   storage/connect/ha_connect.cc

    - Include MONGO in all Java enabled distributions
      Mongo will be enabled only for 10.2 and 10.3
      modified:   storage/connect/CMakeLists.txt

    - Change JDBC_SUPPORT to JAVA_SUPPORT which also replaces MONGO_SUPPORT
      MONGO_SUPPORT is now just used to enable the MONGO table type
      modified:   storage/connect/filter.cpp
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h
      modified:   storage/connect/mongo.cpp
      modified:   storage/connect/mycat.cc
      modified:   storage/connect/plgdbutl.cpp
      modified:   storage/connect/tabjson.cpp
      modified:   storage/connect/tabjson.h

    - Move MakeSelector function from FILTER to mongo.cpp
      modified:   storage/connect/filter.cpp
      modified:   storage/connect/filter.h
      modified:   storage/connect/cmgoconn.cpp
      modified:   storage/connect/jmgoconn.cpp
      modified:   storage/connect/mongo.cpp

    - Do mongo_init only on first use of the MongoDB C Driver
      This will permit to delay load the mongo lib on Windows
      modified:   storage/connect/cmgoconn.cpp
      modified:   storage/connect/cmgoconn.h
      modified:   storage/connect/ha_connect.cc

    - Replace NEW_VAR by a test on MYSQL_VERSION_ID
      modified:   storage/connect/ha_connect.cc

    - Suppress enable_mongo session variable
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/mycat.cc

    - Make some function headers identical in .h and .cc file
      (replacing const char* by PCSZ)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h

    - Change a parameter type from uchar* to const uchar*
      (for ScanRecord and CheckRecord)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h

    - Changes on LIKE and NOT LIKE does not fix a bug yet
      modified:   storage/connect/ha_connect.cc

    - Suppress PIVOT_SUPPORT (PIVOT type is unconditionnal)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/mycat.cc

    - Change the strz function from inline to static
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h

    - export the JavaConn class and the MgoColumns and IsNum functions
      modified:   storage/connect/javaconn.h
      modified:   storage/connect/json.h
      modified:   storage/connect/mongo.h

    - Fix MDEV-13924
      modified:   storage/connect/jdbconn.cpp

    - Make a temporary fix for the compiler bug in CalculateArray
      modified:   storage/connect/jsonudf.cpp
      modified:   storage/connect/tabjson.cpp

    - Typo
      modified:   storage/connect/jdbccat.h
      modified:   storage/connect/reldef.h
      modified:   storage/connect/tabext.h
      modified:   storage/connect/tabjmg.cpp
      modified:   storage/connect/tabxml.h
      modified:   storage/connect/valblk.h
      modified:   storage/connect/value.h
      modified:   storage/connect/xtable.h

    - Fix a bug in MONGO tests by changing 'MONGO' to $TYPE
      modified:   storage/connect/mysql-test/connect/t/mongo_test.inc

    - Record test results to reflect all changes
      modified:   storage/connect/mysql-test/connect/r/json_java_2.result
      modified:   storage/connect/mysql-test/connect/r/json_java_3.result
      modified:   storage/connect/mysql-test/connect/r/json_mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_2.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_3.result

commit 3da90fd
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Wed Oct 11 12:21:56 2017 +0200

    Fix MDEV-13924 modified: storage/connect/jdbconn.cpp

commit 2566e67
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Mon Sep 11 16:38:41 2017 +0200

    Enable MONGO for the C driver. Modified: modified:   storage/connect/CMakeLists.txt

commit 27ae11d
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Tue Sep 5 19:52:04 2017 +0200

    - Update version number
      modified:   storage/connect/ha_connect.cc

    - Regard columns with binary charset as string (was binary)
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/tabmysql.cpp
      modified:   storage/connect/tabutil.cpp

    - Support length 0 for CHAR and VARCHAR
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/reldef.cpp
      modified:   storage/connect/value.cpp

    - Add ACCEPT option for void columns in discovery
      modified:   storage/connect/tabjson.cpp

    - Update some tests because of above change
      modified:   storage/connect/mysql-test/connect/r/json_java_2.result
      modified:   storage/connect/mysql-test/connect/r/json_java_3.result
      modified:   storage/connect/mysql-test/connect/r/json_mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_c.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_2.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_3.result
      modified:   storage/connect/mysql-test/connect/r/odbc_oracle.result
      modified:   storage/connect/mysql-test/connect/r/updelx.result
      modified:   storage/connect/mysql-test/connect/t/mongo_test.inc

commit f6ee6cd
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Sat Sep 2 16:06:10 2017 +0200

    - Fix MongoDB C Driver adding for CMAKE.
      Requires MongoDB C Driver version 1.7 now available
      modified:   storage/connect/CMakeLists.txt

    - Add more trace to tbl_thread.test (to debug failure)
      modified:   storage/connect/mysql-test/connect/r/tbl_thread.result
      modified:   storage/connect/mysql-test/connect/t/tbl_thread.test
  • Loading branch information
cvicentiu committed Jan 24, 2018
1 parent b20f821 commit 1e88e85
Show file tree
Hide file tree
Showing 11 changed files with 157 additions and 122 deletions.
4 changes: 2 additions & 2 deletions storage/connect/CMakeLists.txt
Expand Up @@ -78,7 +78,7 @@ IF(UNIX)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fexceptions -fPIC ")
get_property(inc_dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} inihandl.c)
SET(CONNECT_SOURCES ${CONNECT_SOURCES} inihandl.cpp)
SET(IPHLPAPI_LIBRARY "")
ELSE(NOT UNIX)
SET(CONNECT_SOURCES ${CONNECT_SOURCES}
Expand Down Expand Up @@ -245,7 +245,7 @@ int main() {
ENDIF(CONNECT_WITH_ODBC)

#
# JDBC with MongoDB Java Driver included but disabled
# JDBC with MongoDB Java Driver included but disabled if without MONGO
#
# OPTION(CONNECT_WITH_MONGO "Compile CONNECT storage engine with MONGO support" ON)
OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON)
Expand Down
3 changes: 2 additions & 1 deletion storage/connect/global.h
Expand Up @@ -217,7 +217,8 @@ DllExport int PlugExit(PGLOBAL); // Plug global termination
DllExport LPSTR PlugRemoveType(LPSTR, LPCSTR);
DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR prefix, LPCSTR name, LPCSTR dir);
DllExport BOOL PlugIsAbsolutePath(LPCSTR path);
DllExport void *PlugAllocMem(PGLOBAL, uint);
DllExport bool AllocSarea(PGLOBAL, uint);
DllExport void FreeSarea(PGLOBAL);
DllExport BOOL PlugSubSet(PGLOBAL, void *, uint);
DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t);
DllExport char *PlugDup(PGLOBAL g, const char *str);
Expand Down
55 changes: 34 additions & 21 deletions storage/connect/ha_connect.cc
Expand Up @@ -215,9 +215,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,
Expand Down Expand Up @@ -371,13 +371,6 @@ static MYSQL_THDVAR_BOOL(enable_mongo, PLUGIN_VAR_RQCMDARG,
NULL, NULL, MONGO_ENABLED);
#endif // 0

#if defined(MONGO_SUPPORT)
// Enabling MONGO table type
static MYSQL_THDVAR_BOOL(enable_mongo, PLUGIN_VAR_RQCMDARG,
"Enabling the MongoDB access",
NULL, NULL, MONGO_ENABLED);
#endif // MONGO_SUPPORT

#if defined(XMSG) || defined(NEWMSG)
const char *language_names[]=
{
Expand Down Expand Up @@ -442,10 +435,6 @@ char *GetJavaWrapper(void)
//bool MongoEnabled(void) { return THDVAR(current_thd, enable_mongo); }
#endif // JAVA_SUPPORT

#if defined(MONGO_SUPPORT)
bool MongoEnabled(void) { return THDVAR(current_thd, enable_mongo); }
#endif // MONGO_SUPPORT

extern "C" const char *msglang(void)
{
#if defined(FRENCH)
Expand Down Expand Up @@ -3020,7 +3009,9 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
return NULL;

if (!x) {
const char *p;
char *s = (ishav) ? havg : body;
uint j, k, n;

// Append the value to the filter
switch (args[i]->field_type()) {
Expand Down Expand Up @@ -3076,16 +3067,38 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond)
strcat(s, "'}");
break;
default:
strcat(s, "'");
strncat(s, res->ptr(), res->length());
strcat(s, "'");
} // endswitch field type
j = strlen(s);
s[j++] = '\'';
p = res->ptr();
n = res->length();

for (k = 0; k < n; k++) {
if (p[k] == '\'')
s[j++] = '\'';

s[j++] = p[k];
} // endfor k

s[j++] = '\'';
s[j] = 0;
} // endswitch field type

} else {
strcat(s, "'");
strncat(s, res->ptr(), res->length());
strcat(s, "'");
} // endif tty
j = strlen(s);
s[j++] = '\'';
p = res->ptr();
n = res->length();

for (k = 0; k < n; k++) {
if (p[k] == '\'')
s[j++] = '\'';

s[j++] = p[k];
} // endfor k

s[j++] = '\'';
s[j] = 0;
} // endif tty

break;
default:
Expand Down
35 changes: 18 additions & 17 deletions storage/connect/inihandl.c → storage/connect/inihandl.cpp
Expand Up @@ -37,7 +37,7 @@
// The types and variables used locally
//typedef int bool;
typedef unsigned int uint;
#define SVP(S) ((S) ? S : "<null>")
//#define SVP(S) ((S) ? S : "<null>")
#define _strlwr(P) strlwr(P) //OB: changed this line
#define MAX_PATHNAME_LEN 256
#define N_CACHED_PROFILES 10
Expand All @@ -61,8 +61,8 @@ void htrc(char const *fmt, ...)
} /* end of htrc */
#else // !TEST_MODULE
// Normal included functions
extern int trace;
void htrc(char const *fmt, ...);
//extern int trace;
//void htrc(char const *fmt, ...);
#endif // !TEST MODULE


Expand Down Expand Up @@ -112,10 +112,11 @@ static PROFILE *MRUProfile[N_CACHED_PROFILES] = {NULL};

//static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT("PROFILE_CritSect");

static const char hex[16] = "0123456789ABCDEF";
static const char hex[17] = "0123456789ABCDEF";

BOOL WritePrivateProfileString(LPCSTR section, LPCSTR entry,
LPCSTR string, LPCSTR filename );
LPCSTR string, LPCSTR filename);

/***********************************************************************
* PROFILE_CopyEntry
*
Expand Down Expand Up @@ -254,7 +255,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
PROFILESECTION* *next_section;
PROFILEKEY *key, *prev_key, **next_key;

first_section = malloc(sizeof(*section));
first_section = (PROFILESECTION*)malloc(sizeof(*section));

if (first_section == NULL)
return NULL;
Expand All @@ -281,7 +282,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
*p2 = '\0';
p++;

if (!(section = malloc(sizeof(*section) + strlen(p))))
if (!(section = (PROFILESECTION*)malloc(sizeof(*section) + strlen(p))))
break;

strcpy(section->name, p);
Expand Down Expand Up @@ -319,13 +320,13 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
} // endif p2

if (*p || !prev_key || *prev_key->name) {
if (!(key = malloc(sizeof(*key) + strlen(p))))
if (!(key = (PROFILEKEY*)malloc(sizeof(*key) + strlen(p))))
break;

strcpy(key->name, p);

if (p2) {
key->value = malloc(strlen(p2)+1);
key->value = (char*)malloc(strlen(p2)+1);
strcpy(key->value, p2);
} else
key->value = NULL;
Expand Down Expand Up @@ -452,7 +453,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
/* First time around */
if (!CurProfile)
for (i = 0; i < N_CACHED_PROFILES; i++) {
MRUProfile[i] = malloc(sizeof(PROFILE));
MRUProfile[i] = (PROFILE*)malloc(sizeof(PROFILE));

if (MRUProfile[i] == NULL)
break;
Expand Down Expand Up @@ -520,7 +521,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
// strcpy(newdos_name, filename);

// CurProfile->dos_name = newdos_name;
CurProfile->filename = malloc(strlen(filename) + 1);
CurProfile->filename = (char*)malloc(strlen(filename) + 1);
strcpy(CurProfile->filename, filename);

/* Try to open the profile file, first in $HOME/.wine */
Expand Down Expand Up @@ -783,7 +784,7 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
if (!create)
return NULL;

if (!(*key = malloc(sizeof(PROFILEKEY) + strlen(key_name))))
if (!(*key = (PROFILEKEY*)malloc(sizeof(PROFILEKEY) + strlen(key_name))))
return NULL;

strcpy((*key)->name, key_name);
Expand All @@ -798,15 +799,15 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
if (!create)
return NULL;

*section = malloc(sizeof(PROFILESECTION) + strlen(section_name));
*section = (PROFILESECTION*)malloc(sizeof(PROFILESECTION) + strlen(section_name));

if (*section == NULL)
return NULL;

strcpy((*section)->name, section_name);
(*section)->next = NULL;

if (!((*section)->key = malloc(sizeof(PROFILEKEY) + strlen(key_name)))) {
if (!((*section)->key = (tagPROFILEKEY*)malloc(sizeof(PROFILEKEY) + strlen(key_name)))) {
free(*section);
return NULL;
} // endif malloc
Expand Down Expand Up @@ -1052,7 +1053,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
} else if (trace > 1)
htrc(" creating key\n" );

key->value = malloc(strlen(value) + 1);
key->value = (char*)malloc(strlen(value) + 1);
strcpy(key->value, value);
CurProfile->changed = TRUE;
} // endelse
Expand Down Expand Up @@ -1125,7 +1126,7 @@ static int PROFILE_GetPrivateProfileString(LPCSTR section, LPCSTR entry,
if (*p == ' ') { /* ouch, contained trailing ' ' */
int len = p - (LPSTR)def_val;

pDefVal = malloc(len + 1);
pDefVal = (LPSTR)malloc(len + 1);
strncpy(pDefVal, def_val, len);
pDefVal[len] = '\0';
} // endif *p
Expand Down Expand Up @@ -1277,7 +1278,7 @@ BOOL WritePrivateProfileSection(LPCSTR section,
ret = TRUE;

while (*string) {
LPSTR buf = malloc(strlen(string) + 1);
LPSTR buf = (LPSTR)malloc(strlen(string) + 1);
strcpy(buf, string);

if ((p = strchr(buf, '='))) {
Expand Down
13 changes: 3 additions & 10 deletions storage/connect/jsonudf.cpp
Expand Up @@ -1505,23 +1505,16 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n,
ml += g->More;

if (ml > g->Sarea_Size) {
#if !defined(DEVELOPMENT)
if (trace)
#endif
htrc("Freeing Sarea at %p size=%d\n", g->Sarea, g->Sarea_Size);

free(g->Sarea);
FreeSarea(g);

if (!(g->Sarea = PlugAllocMem(g, ml))) {
if (AllocSarea(g, ml)) {
char errmsg[MAX_STR];

sprintf(errmsg, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
g->Sarea_Size = 0;
return true;
} // endif Alloc
} // endif SareaAlloc

g->Sarea_Size = ml;
g->Createas = 0;
g->Xchk = NULL;
initid->max_length = rl;
Expand Down
1 change: 1 addition & 0 deletions storage/connect/mysql-test/connect/disabled.def
Expand Up @@ -19,3 +19,4 @@ json_java_3 : Need MongoDB running and its Java Driver installed
mongo_c : Need MongoDB running and its C Driver installed
mongo_java_2 : Need MongoDB running and its Java Driver installed
mongo_java_3 : Need MongoDB running and its Java Driver installed
tbl_thread : Bug MDEV-9844,10179,14214 03/01/2018 OB Option THREAD removed
2 changes: 1 addition & 1 deletion storage/connect/plgdbutl.cpp
Expand Up @@ -334,7 +334,7 @@ PDBUSER PlgMakeUser(PGLOBAL g)
{
PDBUSER dbuserp;

if (!(dbuserp = (PDBUSER)PlugAllocMem(g, (uint)sizeof(DBUSERBLK)))) {
if (!(dbuserp = (PDBUSER)malloc(sizeof(DBUSERBLK)))) {
sprintf(g->Message, MSG(MALLOC_ERROR), "PlgMakeUser");
return NULL;
} // endif dbuserp
Expand Down

0 comments on commit 1e88e85

Please sign in to comment.