diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 7d37b79bae8..672bad023a5 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -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: diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp index 5fe18ef5b1d..f339fcc9a39 100644 --- a/storage/connect/tabmul.cpp +++ b/storage/connect/tabmul.cpp @@ -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]; - int rc, n = 0; + 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 - 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 (trace) + htrc("MUL OpenDB: tdbp=%p tdb=R%d use=%d key=%p mode=%d\n", + this, Tdb_No, Use, To_Key_Col, Mode); if (Use == USE_OPEN) { /*******************************************************************/ @@ -735,10 +758,9 @@ int TDBDIR::GetMaxSize(PGLOBAL g) /***********************************************************************/ bool TDBDIR::OpenDB(PGLOBAL g) { -#ifdef DEBTRACE - htrc("DIR OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n", - this, Tdb_No, Use, Mode); -#endif + if (trace) + htrc("DIR OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n", + this, Tdb_No, Use, Mode); 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", - Name, tdbp->GetTdb_No(), ColUse, Status, Buf_Type, N); -#endif + 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); /*********************************************************************/ /* Retrieve the information corresponding to the column number. */ @@ -1304,10 +1324,9 @@ int TDBDHR::GetMaxSize(PGLOBAL g) /***********************************************************************/ bool TDBDHR::OpenDB(PGLOBAL g) { -#ifdef DEBTRACE - htrc("DHR OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n", - this, Tdb_No, Use, Mode); -#endif + if (trace) + htrc("DHR OpenDB: tdbp=%p tdb=R%d use=%d mode=%d\n", + this, Tdb_No, Use, Mode); 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", - Name, tdbp->GetTdb_No(), ColUse, Status, Buf_Type, N); -#endif + 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); /*********************************************************************/ /* Retrieve the information corresponding to the column number. */ diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp index a96dec2565c..575d88a56fc 100644 --- a/storage/connect/valblk.cpp +++ b/storage/connect/valblk.cpp @@ -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