Commit fb3f4696 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix two bugs concerning Discovery of CSV tables:

  Sep_char default is now ',' like when discovery is not used
  If data_charset is UTF8, column names retrieved from the header
  are no longer converted to UTF8 considering they already are (MDEV-7421)
modified:
  storage/connect/ha_connect.cc
parent 70b4e6d3
...@@ -4867,7 +4867,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -4867,7 +4867,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
fncn= topt->catfunc; fncn= topt->catfunc;
fnc= GetFuncID(fncn); fnc= GetFuncID(fncn);
sep= topt->separator; sep= topt->separator;
spc= (!sep || !strcmp(sep, "\\t")) ? '\t' : *sep; spc= (!sep) ? ',' : (!strcmp(sep, "\\t")) ? '\t' : *sep;
qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0; qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
hdr= (int)topt->header; hdr= (int)topt->header;
tbl= topt->tablist; tbl= topt->tablist;
...@@ -5237,7 +5237,13 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -5237,7 +5237,13 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
for (crp= qrp->Colresp; crp; crp= crp->Next) for (crp= qrp->Colresp; crp; crp= crp->Next)
switch (crp->Fld) { switch (crp->Fld) {
case FLD_NAME: case FLD_NAME:
cnm= encode(g, crp->Kdata->GetCharValue(i)); if (ttp == TAB_CSV && topt->data_charset &&
(!stricmp(topt->data_charset, "UTF8") ||
!stricmp(topt->data_charset, "UTF-8")))
cnm= crp->Kdata->GetCharValue(i);
else
cnm= encode(g, crp->Kdata->GetCharValue(i));
break; break;
case FLD_TYPE: case FLD_TYPE:
typ= crp->Kdata->GetIntValue(i); typ= crp->Kdata->GetIntValue(i);
......
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