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,
DBUG_RETURN(rc);
} // 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()) {
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG:
......
......@@ -68,6 +68,8 @@
#include "tabdos.h" // TDBDOS and DOSCOL class dcls
#include "tabmul.h" // TDBMUL and MULCOL classes dcls
extern "C" int trace;
/* ------------------------- Class TDBMUL ---------------------------- */
/***********************************************************************/
......@@ -123,14 +125,19 @@ PTDB TDBMUL::Duplicate(PGLOBAL g)
bool TDBMUL::InitFileNames(PGLOBAL g)
{
#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;
pfn = (char**)PlugSubAlloc(g, NULL, PFNZ * sizeof(char*));
// The sub table may need to refer to the Table original block
Tdbp->SetTable(To_Table); // Was not set at construction
PlugSetPath(filename, Tdbp->GetFile(g), Tdbp->GetPath());
if (trace)
htrc("InitFileName: fn='%s'\n", filename);
if (Mul == 1) {
/*******************************************************************/
/* To_File is a multiple name with special characters */
......@@ -194,15 +201,28 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
_splitpath(filename, NULL, direc, 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.
if (!(dir = opendir(direc))) {
sprintf(g->Message, MSG(BAD_DIRECTORY), direc, strerror(errno));
if (trace)
htrc("%s\n", g->Message);
return true;
} // endif dir
if (trace)
htrc("dir opened: reading files\n");
while ((entry = readdir(dir)) && n < PFNZ) {
strcat(strcpy(fn, direc), entry->d_name);
if (trace)
htrc("%s read\n", fn);
if (lstat(fn, &fileinfo) < 0) {
sprintf(g->Message, "%s: %s", fn, strerror(errno));
return true;
......@@ -218,6 +238,10 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
strcat(strcpy(filename, direc), entry->d_name);
pfn[n] = (char*)PlugSubAlloc(g, NULL, strlen(filename) + 1);
strcpy(pfn[n++], filename);
if (trace)
htrc("Adding pfn[%d] %s\n", n, filename);
} // endwhile readdir
// Close the dir handle.
......@@ -420,10 +444,9 @@ int TDBMUL::RowNumber(PGLOBAL g, bool b)
/***********************************************************************/
bool TDBMUL::OpenDB(PGLOBAL g)
{
#ifdef DEBTRACE
if (trace)
htrc("MUL OpenDB: tdbp=%p tdb=R%d use=%d key=%p mode=%d\n",
this, Tdb_No, Use, To_Key_Col, Mode);
#endif
if (Use == USE_OPEN) {
/*******************************************************************/
......@@ -735,10 +758,9 @@ int TDBDIR::GetMaxSize(PGLOBAL g)
/***********************************************************************/
bool TDBDIR::OpenDB(PGLOBAL g)
{
#ifdef DEBTRACE
if (trace)
htrc("DIR OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n",
this, Tdb_No, Use, Mode);
#endif
if (Use == USE_OPEN) {
/*******************************************************************/
......@@ -898,11 +920,9 @@ void DIRCOL::ReadColumn(PGLOBAL g)
{
PTDBDIR tdbp = (PTDBDIR)To_Tdb;
#ifdef DEBTRACE
fprintf(debug,
"DIR ReadColumn: col %s R%d use=%.4X status=%.4X type=%d N=%d\n",
if (trace)
htrc("DIR ReadColumn: col %s R%d use=%.4X status=%.4X type=%d N=%d\n",
Name, tdbp->GetTdb_No(), ColUse, Status, Buf_Type, N);
#endif
/*********************************************************************/
/* Retrieve the information corresponding to the column number. */
......@@ -1304,10 +1324,9 @@ int TDBDHR::GetMaxSize(PGLOBAL g)
/***********************************************************************/
bool TDBDHR::OpenDB(PGLOBAL g)
{
#ifdef DEBTRACE
if (trace)
htrc("DHR OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n",
this, Tdb_No, Use, Mode);
#endif
if (Use == USE_OPEN) {
/*******************************************************************/
......@@ -1442,11 +1461,9 @@ void DHRCOL::ReadColumn(PGLOBAL g)
int rc;
PTDBDHR tdbp = (PTDBDHR)To_Tdb;
#ifdef DEBTRACE
fprintf(debug,
"DHR ReadColumn: col %s R%d use=%.4X status=%.4X type=%d N=%d\n",
if (trace)
htrc("DHR ReadColumn: col %s R%d use=%.4X status=%.4X type=%d N=%d\n",
Name, tdbp->GetTdb_No(), ColUse, Status, Buf_Type, N);
#endif
/*********************************************************************/
/* Retrieve the information corresponding to the column number. */
......
......@@ -592,7 +592,7 @@ void CHRBLK::SetValue(char *sp, uint len, int n)
#endif
if (sp)
memcpy(p, sp, len);
memcpy(p, sp, Long);
if (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