diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2014-10-09 17:23:37 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2014-10-09 17:23:37 +0200 |
commit | 5821b8eb022f23a7384a18b5f580de8b0644d5bb (patch) | |
tree | affcde99cf6d0386baba439edcdc3da36be218f9 | |
parent | f80e4ed941ab28f3ee150d98ea6a411e51a8396f (diff) | |
download | mariadb-git-5821b8eb022f23a7384a18b5f580de8b0644d5bb.tar.gz |
- 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
-rw-r--r-- | storage/connect/ha_connect.cc | 4 | ||||
-rw-r--r-- | storage/connect/tabdos.cpp | 2 | ||||
-rw-r--r-- | storage/connect/tabdos.h | 2 | ||||
-rw-r--r-- | storage/connect/tabfmt.cpp | 12 |
4 files changed, 13 insertions, 7 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 25e3fe1cdc3..c6ca6c11df6 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -1184,6 +1184,8 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf) pcf->Length= (len) ? len : 11; } // endelse + // For Value setting + pcf->Precision= MY_MAX(pcf->Precision, pcf->Length); break; default: break; @@ -2429,7 +2431,7 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond) if (!x) { // Append the value to the filter if (args[i]->field_type() == MYSQL_TYPE_VARCHAR) - strcat(strcat(strcat(body, "'"), res->ptr()), "'"); + strcat(strncat(strcat(body, "'"), res->ptr(), res->length()), "'"); else strncat(body, res->ptr(), res->length()); diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index 1af10183687..7bba914a1ca 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -146,7 +146,7 @@ bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Eof = (GetIntCatInfo("EOF", 0) != 0); } else if (Recfm == RECFM_DBF) { Maxerr = GetIntCatInfo("Maxerr", 0); - Accept = (GetIntCatInfo("Accept", 0) != 0); + Accept = GetBoolCatInfo("Accept", false); ReadMode = GetIntCatInfo("Readmode", 0); } else // (Recfm == RECFM_VAR) AvgLen = GetIntCatInfo("Avglen", 0); diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h index 1c772e8bf23..156d46b9791 100644 --- a/storage/connect/tabdos.h +++ b/storage/connect/tabdos.h @@ -77,7 +77,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */ bool Mapped; /* 0: disk file, 1: memory mapped file */ bool Padded; /* true for padded table file */ 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 */ int *To_Pos; /* To array of block starting positions */ int Optimized; /* 0: No, 1:Yes, 2:Redo optimization */ diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index c1119c57065..2efdd0d661b 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -390,8 +390,8 @@ PQRYRES CSVColumns(PGLOBAL g, char *dp, const char *fn, char sep, /***********************************************************************/ CSVDEF::CSVDEF(void) { - Fmtd = Accept = Header = false; - Maxerr = 0; + Fmtd = Header = false; +//Maxerr = 0; Quoted = -1; Sep = ','; Qot = '\0'; @@ -428,9 +428,13 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Qot = '"'; Fmtd = (!Sep || (am && (*am == 'F' || *am == 'f'))); - Header = (GetIntCatInfo("Header", 0) != 0); + Header = GetBoolCatInfo("Header", false); 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; } // end of DefineAM |