Skip to content

Commit fb3f469

Browse files
committed
- 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
1 parent 70b4e6d commit fb3f469

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

storage/connect/ha_connect.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4867,7 +4867,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
48674867
fncn= topt->catfunc;
48684868
fnc= GetFuncID(fncn);
48694869
sep= topt->separator;
4870-
spc= (!sep || !strcmp(sep, "\\t")) ? '\t' : *sep;
4870+
spc= (!sep) ? ',' : (!strcmp(sep, "\\t")) ? '\t' : *sep;
48714871
qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
48724872
hdr= (int)topt->header;
48734873
tbl= topt->tablist;
@@ -5237,7 +5237,13 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
52375237
for (crp= qrp->Colresp; crp; crp= crp->Next)
52385238
switch (crp->Fld) {
52395239
case FLD_NAME:
5240-
cnm= encode(g, crp->Kdata->GetCharValue(i));
5240+
if (ttp == TAB_CSV && topt->data_charset &&
5241+
(!stricmp(topt->data_charset, "UTF8") ||
5242+
!stricmp(topt->data_charset, "UTF-8")))
5243+
cnm= crp->Kdata->GetCharValue(i);
5244+
else
5245+
cnm= encode(g, crp->Kdata->GetCharValue(i));
5246+
52415247
break;
52425248
case FLD_TYPE:
52435249
typ= crp->Kdata->GetIntValue(i);

0 commit comments

Comments
 (0)