summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/CMakeLists.txt4
-rw-r--r--storage/connect/fmdlex.c2
-rw-r--r--storage/connect/global.h3
-rw-r--r--storage/connect/ha_connect.cc55
-rw-r--r--storage/connect/inihandl.cpp (renamed from storage/connect/inihandl.c)35
-rw-r--r--storage/connect/jsonudf.cpp13
-rw-r--r--storage/connect/myconn.cpp5
-rw-r--r--storage/connect/mysql-test/connect/disabled.def1
-rw-r--r--storage/connect/plgdbutl.cpp2
-rw-r--r--storage/connect/plugutil.cpp73
-rw-r--r--storage/connect/tabtbl.cpp22
-rw-r--r--storage/connect/tabtbl.h50
-rw-r--r--storage/connect/user_connect.cc23
13 files changed, 162 insertions, 126 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index 69b2ef78316..e283da97c4b 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -61,7 +61,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}
@@ -228,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)
diff --git a/storage/connect/fmdlex.c b/storage/connect/fmdlex.c
index 64429d9b93e..a8d48a5d3b1 100644
--- a/storage/connect/fmdlex.c
+++ b/storage/connect/fmdlex.c
@@ -529,7 +529,7 @@ YY_DECL
pp->Num = 0;
if (pp->InFmt) {*pp->InFmt = '\0'; pp->InFmt[pp->Outsize -1] = '\0'; }
if (pp->OutFmt) {*pp->OutFmt = '\0'; pp->OutFmt[pp->Outsize -1] = '\0'; }
- pp->Curp = pp->Format;
+ pp->Curp = (char*) pp->Format;
yy_init = 1; /* This is a new input */
diff --git a/storage/connect/global.h b/storage/connect/global.h
index de7a9fb3c03..e4b00786efa 100644
--- a/storage/connect/global.h
+++ b/storage/connect/global.h
@@ -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);
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 787ec2affc1..5964b1d049f 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -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,
@@ -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[]=
{
@@ -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)
@@ -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()) {
@@ -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:
diff --git a/storage/connect/inihandl.c b/storage/connect/inihandl.cpp
index 0ce0eb9fa0d..96ae0a67a6b 100644
--- a/storage/connect/inihandl.c
+++ b/storage/connect/inihandl.cpp
@@ -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
@@ -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
@@ -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
*
@@ -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;
@@ -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);
@@ -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;
@@ -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;
@@ -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 */
@@ -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);
@@ -798,7 +799,7 @@ 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;
@@ -806,7 +807,7 @@ static PROFILEKEY *PROFILE_Find(PROFILESECTION* *section,
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
@@ -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
@@ -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
@@ -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, '='))) {
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index 504ea837fee..33af95a2bbc 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -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];
snprintf(errmsg, sizeof(errmsg)-1, 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;
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp
index 08bb24e14df..fe00f6a1eab 100644
--- a/storage/connect/myconn.cpp
+++ b/storage/connect/myconn.cpp
@@ -933,8 +933,9 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb)
crp->Prec = (crp->Type == TYPE_DOUBLE || crp->Type == TYPE_DECIM)
? fld->decimals : 0;
- crp->Length = MY_MAX(fld->length, fld->max_length);
- crp->Clen = GetTypeSize(crp->Type, crp->Length);
+ CHARSET_INFO *cs= get_charset(fld->charsetnr, MYF(0));
+ crp->Clen = GetTypeSize(crp->Type, fld->length);
+ crp->Length = fld->length / (cs ? cs->mbmaxlen : 1);
uns = (fld->flags & (UNSIGNED_FLAG | ZEROFILL_FLAG)) ? true : false;
if (!(crp->Kdata = AllocValBlock(g, NULL, crp->Type, m_Rows,
diff --git a/storage/connect/mysql-test/connect/disabled.def b/storage/connect/mysql-test/connect/disabled.def
index 6d59369a4df..0dcf030613d 100644
--- a/storage/connect/mysql-test/connect/disabled.def
+++ b/storage/connect/mysql-test/connect/disabled.def
@@ -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
diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp
index 0a6507315db..f669d644637 100644
--- a/storage/connect/plgdbutl.cpp
+++ b/storage/connect/plgdbutl.cpp
@@ -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
diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp
index 0855e265704..7b408870238 100644
--- a/storage/connect/plugutil.cpp
+++ b/storage/connect/plugutil.cpp
@@ -138,7 +138,7 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
if (trace > 1)
htrc("PlugInit: Language='%s'\n",
- ((!Language) ? "Null" : (char*)Language));
+ ((!Language) ? "Null" : (char*)Language));
try {
g = new GLOBAL;
@@ -160,13 +160,11 @@ PGLOBAL PlugInit(LPCSTR Language, uint worksize)
/*******************************************************************/
/* Allocate the main work segment. */
/*******************************************************************/
- if (worksize && !(g->Sarea = PlugAllocMem(g, worksize))) {
+ if (worksize && AllocSarea(g, worksize)) {
char errmsg[MAX_STR];
snprintf(errmsg, sizeof(errmsg) - 1, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
- g->Sarea_Size = 0;
- } else
- g->Sarea_Size = worksize;
+ } // endif Sarea
g->jump_level = -1; /* New setting to allow recursive call of Plug */
return(g);
@@ -183,15 +181,7 @@ int PlugExit(PGLOBAL g)
if (dup)
free(dup);
- if (g->Sarea) {
-#if !defined(DEVELOPMENT)
- if (trace)
-#endif
- htrc("Freeing Sarea at %p size=%d\n", g->Sarea, g->Sarea_Size);
-
- free(g->Sarea);
- } // endif Sarea
-
+ FreeSarea(g);
delete g;
} // endif g
@@ -459,30 +449,65 @@ short GetLineLength(PGLOBAL g)
/***********************************************************************/
/* Program for memory allocation of work and language areas. */
/***********************************************************************/
-void *PlugAllocMem(PGLOBAL g, uint size)
+bool AllocSarea(PGLOBAL g, uint size)
{
- void *areap; /* Pointer to allocated area */
-
/*********************************************************************/
/* This is the allocation routine for the WIN32/UNIX/AIX version. */
/*********************************************************************/
- if (!(areap = malloc(size)))
- sprintf(g->Message, MSG(MALLOC_ERROR), "malloc");
+#if defined(__WIN__)
+ if (size >= 1048576) // 1M
+ g->Sarea = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
+ else
+#endif
+ g->Sarea = malloc(size);
+
+ if (!g->Sarea) {
+ sprintf(g->Message, MSG(MALLOC_ERROR), "malloc");
+ g->Sarea_Size = 0;
+ } else
+ g->Sarea_Size = size;
#if defined(DEVELOPMENT)
if (true) {
#else
if (trace) {
#endif
- if (areap)
- htrc("Memory of %u allocated at %p\n", size, areap);
+ if (g->Sarea)
+ htrc("Work area of %u allocated at %p\n", size, g->Sarea);
else
- htrc("PlugAllocMem: %s\n", g->Message);
+ htrc("SareaAlloc: %s\n", g->Message);
} // endif trace
- return (areap);
-} // end of PlugAllocMem
+ return (!g->Sarea);
+} // end of AllocSarea
+
+/***********************************************************************/
+/* Program for memory freeing the work area. */
+/***********************************************************************/
+void FreeSarea(PGLOBAL g)
+{
+ if (g->Sarea) {
+#if defined(__WIN__)
+ if (g->Sarea_Size >= 1048576) // 1M
+ VirtualFree(g->Sarea, 0, MEM_RELEASE);
+ else
+#endif
+ free(g->Sarea);
+
+#if defined(DEVELOPMENT)
+ if (true)
+#else
+ if (trace)
+#endif
+ htrc("Freeing Sarea at %p size = %d\n", g->Sarea, g->Sarea_Size);
+
+ g->Sarea = NULL;
+ g->Sarea_Size = 0;
+ } // endif Sarea
+
+ return;
+} // end of FreeSarea
/***********************************************************************/
/* Program for SubSet initialization of memory pools. */
diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp
index d3fb31fb57a..7925e8f29a8 100644
--- a/storage/connect/tabtbl.cpp
+++ b/storage/connect/tabtbl.cpp
@@ -1,12 +1,9 @@
/************* TabTbl C++ Program Source Code File (.CPP) **************/
/* PROGRAM NAME: TABTBL */
/* ------------- */
-/* Version 1.8 */
+/* Version 1.9 */
/* */
-/* COPYRIGHT: */
-/* ---------- */
-/* (C) Copyright to PlugDB Software Development 2008-2017 */
-/* Author: Olivier BERTRAND */
+/* Author: Olivier BERTRAND 2008-2018 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -168,9 +165,14 @@ PTDB TBLDEF::GetTable(PGLOBAL g, MODE)
{
if (Catfunc == FNC_COL)
return new(g) TDBTBC(this);
- else if (Thread)
- return new(g) TDBTBM(this);
- else
+ else if (Thread) {
+#if defined(DEVELOPMENT)
+ return new(g) TDBTBM(this);
+#else
+ strcpy(g->Message, "Option THREAD is no more supported");
+ return NULL;
+#endif // DEVELOPMENT
+ } else
return new(g) TDBTBL(this);
} // end of GetTable
@@ -560,6 +562,7 @@ void TBTBLK::ReadColumn(PGLOBAL)
} // end of ReadColumn
+#if defined(DEVELOPMENT)
/* ------------------------- Class TDBTBM ---------------------------- */
/***********************************************************************/
@@ -650,7 +653,7 @@ bool TDBTBM::IsLocal(PTABLE tbp)
return ((!stricmp(tdbp->Host, "localhost") ||
!strcmp(tdbp->Host, "127.0.0.1")) &&
- tdbp->Port == (int)GetDefaultPort());
+ (int) tdbp->Port == (int)GetDefaultPort());
} // end of IsLocal
/***********************************************************************/
@@ -865,5 +868,6 @@ int TDBTBM::ReadNextRemote(PGLOBAL g)
return RC_OK;
} // end of ReadNextRemote
+#endif // DEVELOPMENT
/* ------------------------------------------------------------------- */
diff --git a/storage/connect/tabtbl.h b/storage/connect/tabtbl.h
index f02bf620aae..e7a84395787 100644
--- a/storage/connect/tabtbl.h
+++ b/storage/connect/tabtbl.h
@@ -11,30 +11,9 @@
typedef class TBLDEF *PTBLDEF;
typedef class TDBTBL *PTDBTBL;
-typedef class TDBTBM *PTDBTBM;
typedef class MYSQLC *PMYC;
/***********************************************************************/
-/* Defines the structures used for distributed TBM tables. */
-/***********************************************************************/
-typedef struct _TBMtable *PTBMT;
-
-typedef struct _TBMtable {
- PTBMT Next; // Points to next data table struct
- PTABLE Tap; // Points to the sub table
- PGLOBAL G; // Needed in thread routine
- bool Complete; // TRUE when all results are read
- bool Ready; // TRUE when results are there
- int Rows; // Total number of rows read so far
- int ProgCur; // Current pos
- int ProgMax; // Max pos
- int Rc; // Return code
- THD *Thd;
- pthread_attr_t attr; // ???
- pthread_t Tid; // CheckOpen thread ID
- } TBMT;
-
-/***********************************************************************/
/* TBL table. */
/***********************************************************************/
class DllExport TBLDEF : public PRXDEF { /* Logical table description */
@@ -123,7 +102,33 @@ class TBTBLK : public TIDBLK {
protected:
// Must not have additional members
- }; // end of class TBTBLK
+}; // end of class TBTBLK
+
+#if defined(DEVELOPMENT)
+/***********************************************************************/
+/* This table type is buggy and removed until a fix is found. */
+/***********************************************************************/
+typedef class TDBTBM *PTDBTBM;
+
+/***********************************************************************/
+/* Defines the structures used for distributed TBM tables. */
+/***********************************************************************/
+typedef struct _TBMtable *PTBMT;
+
+typedef struct _TBMtable {
+ PTBMT Next; // Points to next data table struct
+ PTABLE Tap; // Points to the sub table
+ PGLOBAL G; // Needed in thread routine
+ bool Complete; // TRUE when all results are read
+ bool Ready; // TRUE when results are there
+ int Rows; // Total number of rows read so far
+ int ProgCur; // Current pos
+ int ProgMax; // Max pos
+ int Rc; // Return code
+ THD *Thd;
+ pthread_attr_t attr; // ???
+ pthread_t Tid; // CheckOpen thread ID
+} TBMT;
/***********************************************************************/
/* This is the TBM Access Method class declaration. */
@@ -160,3 +165,4 @@ class DllExport TDBTBM : public TDBTBL {
}; // end of class TDBTBM
pthread_handler_t ThreadOpen(void *p);
+#endif // DEVELOPMENT
diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc
index 94d2c8ad5fd..cb62667c0fe 100644
--- a/storage/connect/user_connect.cc
+++ b/storage/connect/user_connect.cc
@@ -156,29 +156,20 @@ void user_connect::SetHandler(ha_connect *hc)
bool user_connect::CheckCleanup(bool force)
{
if (thdp->query_id > last_query_id || force) {
- uint worksize= GetWorkSize();
+ uint worksize= GetWorkSize(), size = g->Sarea_Size;
PlugCleanup(g, true);
- if (g->Sarea_Size != worksize) {
- if (g->Sarea) {
-#if !defined(DEVELOPMENT)
- if (trace)
-#endif
- htrc("CheckCleanup: Free Sarea at %p size=%d\n",
- g->Sarea, g->Sarea_Size);
-
- free(g->Sarea);
- } // endif Size
+ if (size != worksize) {
+ FreeSarea(g);
// Check whether the work area could be allocated
- if (!(g->Sarea = PlugAllocMem(g, worksize))) {
- g->Sarea = PlugAllocMem(g, g->Sarea_Size);
+ if (AllocSarea(g, worksize)) {
+ AllocSarea(g, size);
SetWorkSize(g->Sarea_Size); // Was too big
- } else
- g->Sarea_Size = worksize; // Ok
+ } // endif sarea
- } // endif worksize
+ } // endif worksize
PlugSubSet(g, g->Sarea, g->Sarea_Size);
g->Xchk = NULL;