Commit 5821b8eb authored by Olivier Bertrand's avatar Olivier Bertrand

- in CheckCond change strcat to strncat to avoid the case of non zero

  terminated string.
modified:
  storage/connect/ha_connect.cc

- The Accept and Header Boolean variables were wrongly retrieved using
  GetIntInfo instead of GetBoolInfo causing some setting to ignored.
modified:
  storage/connect/tabdos.cpp
  storage/connect/tabdos.h
  storage/connect/tabfmt.cpp

- Fix date truncated because their Value class was not using their field length.
modified:
  storage/connect/ha_connect.cc
parent f80e4ed9
...@@ -1184,6 +1184,8 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf) ...@@ -1184,6 +1184,8 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
pcf->Length= (len) ? len : 11; pcf->Length= (len) ? len : 11;
} // endelse } // endelse
// For Value setting
pcf->Precision= MY_MAX(pcf->Precision, pcf->Length);
break; break;
default: default:
break; break;
...@@ -2429,7 +2431,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond) ...@@ -2429,7 +2431,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond)
if (!x) { if (!x) {
// Append the value to the filter // Append the value to the filter
if (args[i]->field_type() == MYSQL_TYPE_VARCHAR) if (args[i]->field_type() == MYSQL_TYPE_VARCHAR)
strcat(strcat(strcat(body, "'"), res->ptr()), "'"); strcat(strncat(strcat(body, "'"), res->ptr(), res->length()), "'");
else else
strncat(body, res->ptr(), res->length()); strncat(body, res->ptr(), res->length());
......
...@@ -146,7 +146,7 @@ bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -146,7 +146,7 @@ bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Eof = (GetIntCatInfo("EOF", 0) != 0); Eof = (GetIntCatInfo("EOF", 0) != 0);
} else if (Recfm == RECFM_DBF) { } else if (Recfm == RECFM_DBF) {
Maxerr = GetIntCatInfo("Maxerr", 0); Maxerr = GetIntCatInfo("Maxerr", 0);
Accept = (GetIntCatInfo("Accept", 0) != 0); Accept = GetBoolCatInfo("Accept", false);
ReadMode = GetIntCatInfo("Readmode", 0); ReadMode = GetIntCatInfo("Readmode", 0);
} else // (Recfm == RECFM_VAR) } else // (Recfm == RECFM_VAR)
AvgLen = GetIntCatInfo("Avglen", 0); AvgLen = GetIntCatInfo("Avglen", 0);
......
...@@ -77,7 +77,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */ ...@@ -77,7 +77,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
bool Mapped; /* 0: disk file, 1: memory mapped file */ bool Mapped; /* 0: disk file, 1: memory mapped file */
bool Padded; /* true for padded table file */ bool Padded; /* true for padded table file */
bool Huge; /* true for files larger than 2GB */ bool Huge; /* true for files larger than 2GB */
bool Accept; /* true if wrong lines are accepted (DBF)*/ bool Accept; /* true if wrong lines are accepted */
bool Eof; /* true if an EOF (0xA) character exists */ bool Eof; /* true if an EOF (0xA) character exists */
int *To_Pos; /* To array of block starting positions */ int *To_Pos; /* To array of block starting positions */
int Optimized; /* 0: No, 1:Yes, 2:Redo optimization */ int Optimized; /* 0: No, 1:Yes, 2:Redo optimization */
......
...@@ -390,8 +390,8 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep, ...@@ -390,8 +390,8 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep,
/***********************************************************************/ /***********************************************************************/
CSVDEF::CSVDEF(void) CSVDEF::CSVDEF(void)
{ {
Fmtd = Accept = Header = false; Fmtd = Header = false;
Maxerr = 0; //Maxerr = 0;
Quoted = -1; Quoted = -1;
Sep = ','; Sep = ',';
Qot = '\0'; Qot = '\0';
...@@ -428,9 +428,13 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ...@@ -428,9 +428,13 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
Qot = '"'; Qot = '"';
Fmtd = (!Sep || (am && (*am == 'F' || *am == 'f'))); Fmtd = (!Sep || (am && (*am == 'F' || *am == 'f')));
Header = (GetIntCatInfo("Header", 0) != 0); Header = GetBoolCatInfo("Header", false);
Maxerr = GetIntCatInfo("Maxerr", 0); Maxerr = GetIntCatInfo("Maxerr", 0);
Accept = (GetIntCatInfo("Accept", 0) != 0); Accept = GetBoolCatInfo("Accept", false);
if (Accept && Maxerr == 0)
Maxerr = INT_MAX32; // Accept all bad lines
return false; return false;
} // end of DefineAM } // end of DefineAM
......
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