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) ...@@ -905,9 +905,13 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_VAR_STRING:
pcf->Flags |= U_VAR; pcf->Flags |= U_VAR;
/* no break */ /* no break */
case MYSQL_TYPE_STRING: default:
pcf->Type= TYPE_STRING; pcf->Type= MYSQLtoPLG(fp->type());
break;
} // endswitch SQL type
switch (pcf->Type) {
case TYPE_STRING:
// Do something for case // Do something for case
cp= fp->charset()->name; cp= fp->charset()->name;
...@@ -918,26 +922,10 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf) ...@@ -918,26 +922,10 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
} // endif ci } // endif ci
break; break;
case MYSQL_TYPE_LONG: case TYPE_FLOAT:
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;
pcf->Prec= max(min(fp->decimals(), ((unsigned)pcf->Length - 2)), 0); pcf->Prec= max(min(fp->decimals(), ((unsigned)pcf->Length - 2)), 0);
break; break;
case MYSQL_TYPE_DATE: case TYPE_DATE:
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
pcf->Type= TYPE_DATE;
// Field_length is only used for DATE columns // Field_length is only used for DATE columns
if (fop->fldlen) if (fop->fldlen)
pcf->Length= (int)fop->fldlen; pcf->Length= (int)fop->fldlen;
...@@ -962,12 +950,8 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf) ...@@ -962,12 +950,8 @@ void *ha_connect::GetColumnOption(PGLOBAL g, void *field, PCOLINFO pcf)
pcf->Length= (len) ? len : 11; pcf->Length= (len) ? len : 11;
} // endelse } // endelse
break;
case MYSQL_TYPE_LONGLONG:
pcf->Type= TYPE_BIGINT;
break; break;
default: default:
pcf->Type=TYPE_ERROR;
break; break;
} // endswitch type } // endswitch type
......
...@@ -368,7 +368,11 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b) ...@@ -368,7 +368,11 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
#if defined(MYSQL_SUPPORT) #if defined(MYSQL_SUPPORT)
// Access sub-table via MySQL API // Access sub-table via MySQL API
if (!(tdbp= cat->GetTable(g, tabp, MODE_READ, "MYPRX"))) { 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; goto err;
} // endif Define } // 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