Commit 5bc538dd authored by Olivier Bertrand's avatar Olivier Bertrand

Commit the 2 last commits merged from 10.1

parent 92d283c0
......@@ -172,7 +172,7 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
char version[]= "Version 1.05.0003 February 27, 2017";
char version[]= "Version 1.05.0003 March 7, 2017";
#if defined(__WIN__)
char compver[]= "Version 1.05.0003 " __DATE__ " " __TIME__;
char slash= '\\';
......@@ -509,7 +509,7 @@ ha_create_table_option connect_table_option_list[]=
HA_TOPTION_NUMBER("LRECL", lrecl, 0, 0, INT_MAX32, 1),
HA_TOPTION_NUMBER("BLOCK_SIZE", elements, 0, 0, INT_MAX32, 1),
//HA_TOPTION_NUMBER("ESTIMATE", estimate, 0, 0, INT_MAX32, 1),
HA_TOPTION_NUMBER("MULTIPLE", multiple, 0, 0, 2, 1),
HA_TOPTION_NUMBER("MULTIPLE", multiple, 0, 0, 3, 1),
HA_TOPTION_NUMBER("HEADER", header, 0, 0, 3, 1),
HA_TOPTION_NUMBER("QUOTED", quoted, (ulonglong) -1, 0, 3, 1),
HA_TOPTION_NUMBER("ENDING", ending, (ulonglong) -1, 0, INT_MAX32, 1),
......
......@@ -135,10 +135,12 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
FLD_KEY, FLD_SCALE, FLD_RADIX, FLD_NULL,
FLD_REM, FLD_NO, FLD_DEFAULT, FLD_EXTRA,
FLD_CHARSET};
unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0};
//unsigned int length[] = {0, 4, 16, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0};
unsigned int length[] = {0, 4, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0};
char *fld, *colname, *chset, *fmt, v, buf[128], uns[16], zero[16];
int i, n, nf, ncol = sizeof(buftyp) / sizeof(int);
int len, type, prec, rc, k = 0;
bool b;
PQRYRES qrp;
PCOLRES crp;
MYSQLC myc;
......@@ -157,7 +159,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
/* Do an evaluation of the result size. */
/********************************************************************/
STRING cmd(g, 64, "SHOW FULL COLUMNS FROM ");
bool b = cmd.Append((PSZ)table);
b = cmd.Append((PSZ)table);
b |= cmd.Append(" FROM ");
b |= cmd.Append((PSZ)(db ? db : PlgGetUser(g)->DBName));
......@@ -232,11 +234,31 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
fld = myc.GetCharField(1);
prec = 0;
len = 0;
v = (chset && !strcmp(chset, "binary")) ? 'B' : 0;
// v = (chset && !strcmp(chset, "binary")) ? 'B' : 0;
v = 0;
*uns = 0;
*zero = 0;
switch ((nf = sscanf(fld, "%[^(](%d,%d", buf, &len, &prec))) {
b = false;
if (!strnicmp(fld, "enum", 4)) {
char *p2, *p1 = fld + 6; // to skip enum('
while (true) {
p2 = strchr(p1, '\'');
len = MY_MAX(len, p2 - p1);
if (*++p2 != ',') break;
p1 = p2 + 2;
} // endwhile
v = (len > 255) ? 'V' : 0;
strcpy(buf, "enum");
b = true;
} else if (!strnicmp(fld, "set", 3)) {
len = (int)strlen(fld) - 2;
v = 'V';
strcpy(buf, "set");
b = true;
} else switch ((nf = sscanf(fld, "%[^(](%d,%d", buf, &len, &prec))) {
case 3:
nf = sscanf(fld, "%[^(](%d,%d) %s %s", buf, &len, &prec, uns, zero);
break;
......@@ -286,6 +308,9 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db,
default: crp->Nulls[i] = v; break;
} // endswitch nf
if (b) // enum or set
nf = sscanf(fld, "%s ", buf); // get values
crp = crp->Next; // Type_Name
crp->Kdata->SetValue(buf, i);
......
......@@ -42,7 +42,8 @@ int MYSQLtoPLG(char *typname, char *var)
type = TYPE_INT;
else if (!stricmp(typname, "smallint"))
type = TYPE_SHORT;
else if (!stricmp(typname, "char") || !stricmp(typname, "varchar"))
else if (!stricmp(typname, "char") || !stricmp(typname, "varchar") ||
!stricmp(typname, "enum") || !stricmp(typname, "set"))
type = TYPE_STRING;
else if (!stricmp(typname, "double") || !stricmp(typname, "float") ||
!stricmp(typname, "real"))
......@@ -87,10 +88,12 @@ int MYSQLtoPLG(char *typname, char *var)
else if (!stricmp(typname, "year"))
*var = 'Y';
} else if (type == TYPE_STRING && !stricmp(typname, "varchar"))
} else if (type == TYPE_STRING) {
if (!stricmp(typname, "varchar"))
// This is to make the difference between CHAR and VARCHAR
*var = 'V';
else if (type == TYPE_ERROR && xconv == TPC_SKIP)
} else if (type == TYPE_ERROR && xconv == TPC_SKIP)
*var = 'K';
else
*var = 0;
......
This diff is collapsed.
......@@ -69,6 +69,34 @@ class DllExport TDBMUL : public TDBASE {
int iFile; // Index of currently processed file
}; // end of class TDBMUL
#if 0
/***********************************************************************/
/* This is the MSD Access Method class declaration for files that are */
/* physically split in multiple files having the same format. */
/* This sub-class also include files of the sub-directories. */
/***********************************************************************/
class DllExport TDBMSD : public TDBMUL {
//friend class MULCOL;
public:
// Constructor
TDBMSD(PTDB tdbp) : TDBMUL(tdbp) {}
TDBMSD(PTDBMSD tdbp) : TDBMUL(tdbp) {}
// Implementation
virtual PTDB Duplicate(PGLOBAL g);
// Methods
virtual PTDB Clone(PTABS t);
bool InitFileNames(PGLOBAL g);
// Database routines
protected:
// Members
}; // end of class TDBMSD
#endif
/***********************************************************************/
/* Directory listing table. */
/***********************************************************************/
......@@ -101,18 +129,16 @@ class DllExport DIRDEF : public TABDEF { /* Directory listing table */
/***********************************************************************/
class TDBDIR : public TDBASE {
friend class DIRCOL;
public:
friend class TDBMUL;
public:
// Constructor
TDBDIR(PDIRDEF tdp);
TDBDIR(PTDBDIR tdbp);
TDBDIR(PSZ fpat);
// Implementation
virtual AMT GetAmType(void) {return TYPE_AM_DIR;}
virtual PTDB Duplicate(PGLOBAL g)
{return (PTDB)new(g) TDBDIR(this);}
// Methods
virtual PTDB Clone(PTABS t);
virtual int GetRecpos(void) {return iFile;}
// Database routines
......@@ -127,14 +153,16 @@ class TDBDIR : public TDBASE {
virtual void CloseDB(PGLOBAL g);
protected:
void Init(void);
char *Path(PGLOBAL g);
// Members
PSZ To_File; // Points to file search pathname
int iFile; // Index of currently retrieved file
#if defined(__WIN__)
_finddata_t FileData; // Find data structure
intptr_t Hsearch; // Search handle
PVAL Dvalp; // Used to retrieve file date values
WIN32_FIND_DATA FileData; // Find data structure
HANDLE hSearch; // Search handle
char Drive[_MAX_DRIVE]; // Drive name
#else // !__WIN__
struct stat Fileinfo; // File info structure
......@@ -158,17 +186,11 @@ class TDBDIR : public TDBASE {
/***********************************************************************/
class TDBSDR : public TDBDIR {
friend class DIRCOL;
friend class TDBMUL;
public:
// Constructors
TDBSDR(PDIRDEF tdp) : TDBDIR(tdp) {Sub = NULL;}
TDBSDR(PTDBSDR tdbp);
// Implementation
virtual PTDB Duplicate(PGLOBAL g)
{return (PTDB)new(g) TDBSDR(this);}
// Methods
virtual PTDB Clone(PTABS t);
TDBSDR(PSZ fpat) : TDBDIR(fpat) {Sub = NULL;}
// Database routines
virtual int GetMaxSize(PGLOBAL g);
......@@ -184,7 +206,7 @@ class TDBSDR : public TDBDIR {
struct _Sub_Dir *Next;
struct _Sub_Dir *Prev;
#if defined(__WIN__)
intptr_t H; // Search handle
HANDLE H; // Search handle
#else // !__WIN__
DIR *D;
#endif // !__WIN__
......@@ -214,7 +236,11 @@ class DIRCOL : public COLBLK {
protected:
// Default constructor not to be used
DIRCOL(void) {}
#if defined(__WIN__)
void SetTimeValue(PGLOBAL g, FILETIME& ftime);
#endif // __WIN__
// Members
PTDBDIR Tdbp; // To DIR table
int N; // Column number
}; // end of class DIRCOL
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