Commit af9e6182 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix MDEV-4881. SQL_TYPE_DECIMAL was not recognized in ha_connect::GetColumnOption.

  Crash on second SELECT was because tshp was not reset to NULL in case of error.

modified:
  storage/connect/ha_connect.cc
  storage/connect/tabutil.cpp
parent 8bd158c1
......@@ -905,9 +905,13 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
case MYSQL_TYPE_VAR_STRING:
pcf->Flags |= U_VAR;
/* no break */
case MYSQL_TYPE_STRING:
pcf->Type= TYPE_STRING;
default:
pcf->Type= MYSQLtoPLG(fp->type());
break;
} // endswitch SQL type
switch (pcf->Type) {
case TYPE_STRING:
// Do something for case
cp= fp->charset()->name;
......@@ -918,26 +922,10 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
} // endif ci
break;
case MYSQL_TYPE_LONG:
pcf->Type= TYPE_INT;
break;
case MYSQL_TYPE_SHORT:
pcf->Type= TYPE_SHORT;
break;
case MYSQL_TYPE_TINY:
pcf->Type= TYPE_TINY;
break;
case MYSQL_TYPE_DOUBLE:
case MYSQL_TYPE_FLOAT:
pcf->Type= TYPE_FLOAT;
case TYPE_FLOAT:
pcf->Prec= max(min(fp->decimals(), ((unsigned)pcf->Length - 2)), 0);
break;
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
pcf->Type= TYPE_DATE;
case TYPE_DATE:
// Field_length is only used for DATE columns
if (fop->fldlen)
pcf->Length= (int)fop->fldlen;
......@@ -962,12 +950,8 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
pcf->Length= (len) ? len : 11;
} // endelse
break;
case MYSQL_TYPE_LONGLONG:
pcf->Type= TYPE_BIGINT;
break;
default:
pcf->Type=TYPE_ERROR;
break;
} // endswitch type
......
......@@ -368,7 +368,11 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
#if defined(MYSQL_SUPPORT)
// Access sub-table via MySQL API
if (!(tdbp= cat->GetTable(g, tabp, MODE_READ, "MYPRX"))) {
sprintf(g->Message, "Cannot access %s.%s", db, name);
char buf[MAX_STR];
strcpy(buf, g->Message);
sprintf(g->Message, "Error accessing %s.%s: %s", db, name, buf);
hc->tshp = NULL;
goto err;
} // endif Define
......
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