diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2013-06-12 01:02:04 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2013-06-12 01:02:04 +0200 |
commit | 13ced819d7c060b24633290c1c72b19ca683fb80 (patch) | |
tree | 141df7a3ccb7f4f423e8b6bf8fdc43b652bfe1e9 /storage/connect/tabmul.cpp | |
parent | c0fe5cc380188196ab84d281bded3eeb2b4631e8 (diff) | |
download | mariadb-git-13ced819d7c060b24633290c1c72b19ca683fb80.tar.gz |
- Fix MDEV-4638
modified:
storage/connect/ha_connect.cc
storage/connect/valblk.cpp
- Add trace in tabmul
modified:
storage/connect/tabmul.cpp
Diffstat (limited to 'storage/connect/tabmul.cpp')
-rw-r--r-- | storage/connect/tabmul.cpp | 65 |
1 files changed, 41 insertions, 24 deletions
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. */ |