Commit 13ced819 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix MDEV-4638

modified:
  storage/connect/ha_connect.cc
  storage/connect/valblk.cpp

- Add trace in tabmul

modified:
  storage/connect/tabmul.cpp
parent c0fe5cc3
...@@ -4027,6 +4027,14 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -4027,6 +4027,14 @@ int ha_connect::create(const char *name, TABLE *table_arg,
DBUG_RETURN(rc); DBUG_RETURN(rc);
} // endif flags } // endif flags
if (fp->flags & (BLOB_FLAG | BINARY_FLAG | ENUM_FLAG | SET_FLAG)) {
sprintf(g->Message, "Unsupported type for column %s",
fp->field_name);
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
rc= HA_ERR_INTERNAL_ERROR;
DBUG_RETURN(rc);
} // endif flags
switch (fp->type()) { switch (fp->type()) {
case MYSQL_TYPE_SHORT: case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG: case MYSQL_TYPE_LONG:
......
...@@ -68,6 +68,8 @@ ...@@ -68,6 +68,8 @@
#include "tabdos.h" // TDBDOS and DOSCOL class dcls #include "tabdos.h" // TDBDOS and DOSCOL class dcls
#include "tabmul.h" // TDBMUL and MULCOL classes dcls #include "tabmul.h" // TDBMUL and MULCOL classes dcls
extern "C" int trace;
/* ------------------------- Class TDBMUL ---------------------------- */ /* ------------------------- Class TDBMUL ---------------------------- */
/***********************************************************************/ /***********************************************************************/
...@@ -123,14 +125,19 @@ PTDB TDBMUL::Duplicate(PGLOBAL g) ...@@ -123,14 +125,19 @@ PTDB TDBMUL::Duplicate(PGLOBAL g)
bool TDBMUL::InitFileNames(PGLOBAL g) bool TDBMUL::InitFileNames(PGLOBAL g)
{ {
#define PFNZ 8192 #define PFNZ 8192
char *pfn[PFNZ], filename[_MAX_DRIVE+_MAX_DIR+_MAX_FNAME+_MAX_EXT]; char* *pfn, filename[_MAX_DRIVE+_MAX_DIR+_MAX_FNAME+_MAX_EXT];
int rc, n = 0; int rc, n = 0;
pfn = (char**)PlugSubAlloc(g, NULL, PFNZ * sizeof(char*));
// The sub table may need to refer to the Table original block // The sub table may need to refer to the Table original block
Tdbp->SetTable(To_Table); // Was not set at construction Tdbp->SetTable(To_Table); // Was not set at construction
PlugSetPath(filename, Tdbp->GetFile(g), Tdbp->GetPath()); PlugSetPath(filename, Tdbp->GetFile(g), Tdbp->GetPath());
if (trace)
htrc("InitFileName: fn='%s'\n", filename);
if (Mul == 1) { if (Mul == 1) {
/*******************************************************************/ /*******************************************************************/
/* To_File is a multiple name with special characters */ /* To_File is a multiple name with special characters */
...@@ -194,15 +201,28 @@ bool TDBMUL::InitFileNames(PGLOBAL g) ...@@ -194,15 +201,28 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
_splitpath(filename, NULL, direc, pattern, ftype); _splitpath(filename, NULL, direc, pattern, ftype);
strcat(pattern, ftype); strcat(pattern, ftype);
if (trace)
htrc("direc=%s pattern=%s ftype=%s\n", direc, pattern, ftype);
// Start searching files in the target directory. // Start searching files in the target directory.
if (!(dir = opendir(direc))) { if (!(dir = opendir(direc))) {
sprintf(g->Message, MSG(BAD_DIRECTORY), direc, strerror(errno)); sprintf(g->Message, MSG(BAD_DIRECTORY), direc, strerror(errno));
if (trace)
htrc("%s\n", g->Message);
return true; return true;
} // endif dir } // endif dir
if (trace)
htrc("dir opened: reading files\n");
while ((entry = readdir(dir)) && n < PFNZ) { while ((entry = readdir(dir)) && n < PFNZ) {
strcat(strcpy(fn, direc), entry->d_name); strcat(strcpy(fn, direc), entry->d_name);
if (trace)
htrc("%s read\n", fn);
if (lstat(fn, &fileinfo) < 0) { if (lstat(fn, &fileinfo) < 0) {
sprintf(g->Message, "%s: %s", fn, strerror(errno)); sprintf(g->Message, "%s: %s", fn, strerror(errno));
return true; return true;
...@@ -218,6 +238,10 @@ bool TDBMUL::InitFileNames(PGLOBAL g) ...@@ -218,6 +238,10 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
strcat(strcpy(filename, direc), entry->d_name); strcat(strcpy(filename, direc), entry->d_name);
pfn[n] = (char*)PlugSubAlloc(g, NULL, strlen(filename) + 1); pfn[n] = (char*)PlugSubAlloc(g, NULL, strlen(filename) + 1);
strcpy(pfn[n++], filename); strcpy(pfn[n++], filename);
if (trace)
htrc("Adding pfn[%d] %s\n", n, filename);
} // endwhile readdir } // endwhile readdir
// Close the dir handle. // Close the dir handle.
...@@ -420,10 +444,9 @@ int TDBMUL::RowNumber(PGLOBAL g, bool b) ...@@ -420,10 +444,9 @@ int TDBMUL::RowNumber(PGLOBAL g, bool b)
/***********************************************************************/ /***********************************************************************/
bool TDBMUL::OpenDB(PGLOBAL g) bool TDBMUL::OpenDB(PGLOBAL g)
{ {
#ifdef DEBTRACE if (trace)
htrc("MUL OpenDB: tdbp=%p tdb=R%d use=%d key=%p mode=%d\n", htrc("MUL OpenDB: tdbp=%p tdb=R%d use=%d key=%p mode=%d\n",
this, Tdb_No, Use, To_Key_Col, Mode); this, Tdb_No, Use, To_Key_Col, Mode);
#endif
if (Use == USE_OPEN) { if (Use == USE_OPEN) {
/*******************************************************************/ /*******************************************************************/
...@@ -735,10 +758,9 @@ int TDBDIR::GetMaxSize(PGLOBAL g) ...@@ -735,10 +758,9 @@ int TDBDIR::GetMaxSize(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
bool TDBDIR::OpenDB(PGLOBAL g) bool TDBDIR::OpenDB(PGLOBAL g)
{ {
#ifdef DEBTRACE if (trace)
htrc("DIR OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n", htrc("DIR OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n",
this, Tdb_No, Use, Mode); this, Tdb_No, Use, Mode);
#endif
if (Use == USE_OPEN) { if (Use == USE_OPEN) {
/*******************************************************************/ /*******************************************************************/
...@@ -898,11 +920,9 @@ void DIRCOL::ReadColumn(PGLOBAL g) ...@@ -898,11 +920,9 @@ void DIRCOL::ReadColumn(PGLOBAL g)
{ {
PTDBDIR tdbp = (PTDBDIR)To_Tdb; PTDBDIR tdbp = (PTDBDIR)To_Tdb;
#ifdef DEBTRACE if (trace)
fprintf(debug, htrc("DIR ReadColumn: col %s R%d use=%.4X status=%.4X type=%d N=%d\n",
"DIR ReadColumn: col %s R%d use=%.4X status=%.4X type=%d N=%d\n", Name, tdbp->GetTdb_No(), ColUse, Status, Buf_Type, N);
Name, tdbp->GetTdb_No(), ColUse, Status, Buf_Type, N);
#endif
/*********************************************************************/ /*********************************************************************/
/* Retrieve the information corresponding to the column number. */ /* Retrieve the information corresponding to the column number. */
...@@ -1304,10 +1324,9 @@ int TDBDHR::GetMaxSize(PGLOBAL g) ...@@ -1304,10 +1324,9 @@ int TDBDHR::GetMaxSize(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
bool TDBDHR::OpenDB(PGLOBAL g) bool TDBDHR::OpenDB(PGLOBAL g)
{ {
#ifdef DEBTRACE if (trace)
htrc("DHR OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n", htrc("DHR OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n",
this, Tdb_No, Use, Mode); this, Tdb_No, Use, Mode);
#endif
if (Use == USE_OPEN) { if (Use == USE_OPEN) {
/*******************************************************************/ /*******************************************************************/
...@@ -1442,11 +1461,9 @@ void DHRCOL::ReadColumn(PGLOBAL g) ...@@ -1442,11 +1461,9 @@ void DHRCOL::ReadColumn(PGLOBAL g)
int rc; int rc;
PTDBDHR tdbp = (PTDBDHR)To_Tdb; PTDBDHR tdbp = (PTDBDHR)To_Tdb;
#ifdef DEBTRACE if (trace)
fprintf(debug, htrc("DHR ReadColumn: col %s R%d use=%.4X status=%.4X type=%d N=%d\n",
"DHR ReadColumn: col %s R%d use=%.4X status=%.4X type=%d N=%d\n", Name, tdbp->GetTdb_No(), ColUse, Status, Buf_Type, N);
Name, tdbp->GetTdb_No(), ColUse, Status, Buf_Type, N);
#endif
/*********************************************************************/ /*********************************************************************/
/* Retrieve the information corresponding to the column number. */ /* Retrieve the information corresponding to the column number. */
......
...@@ -592,7 +592,7 @@ void CHRBLK::SetValue(char *sp, uint len, int n) ...@@ -592,7 +592,7 @@ void CHRBLK::SetValue(char *sp, uint len, int n)
#endif #endif
if (sp) if (sp)
memcpy(p, sp, len); memcpy(p, sp, Long);
if (Blanks) { if (Blanks) {
// Suppress eventual ending zero and right fill with blanks // Suppress eventual ending zero and right fill with blanks
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment