Commit e9bb12ac authored by Olivier Bertrand's avatar Olivier Bertrand

- Do not throw an error on empty ODBC CATFUNC (MDEV-5455)

modified:
  storage/connect/ha_connect.cc
  storage/connect/odbconn.cpp
parent 39750cd4
......@@ -4407,7 +4407,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
if (!qrp) {
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
return HA_ERR_INTERNAL_ERROR;
} // endif qrp
} // endif !qrp
if (fnc != FNC_NO || src || ttp == TAB_PIVOT) {
// Catalog like table
......@@ -4429,7 +4429,18 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
} // endfor crp
} else // Not a catalog table
} else {
// Not a catalog table
if (!qrp->Nblin) {
if (tab)
sprintf(g->Message, "Cannot get columns from %s", tab);
else
strcpy(g->Message, "Fail to retrieve columns");
my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
return HA_ERR_INTERNAL_ERROR;
} // endif !nblin
for (i= 0; !rc && i < qrp->Nblin; i++) {
typ= len= prec= dec= 0;
tm= NOT_NULL_FLAG;
......@@ -4522,6 +4533,8 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
rc= HA_ERR_OUT_OF_MEM;
} // endfor i
} // endif fnc
if (!rc)
rc= init_table_share(thd, table_s, create_info, &sql);
// rc= init_table_share(thd, table_s, create_info, dsn, &sql);
......
......@@ -2287,6 +2287,7 @@ int ODBConn::GetCatInfo(CATPARM *cap)
} // endfor i
#if 0
if ((crow = i) && (rc == SQL_NO_DATA || rc == SQL_SUCCESS_WITH_INFO))
rc = SQL_SUCCESS;
......@@ -2303,6 +2304,15 @@ int ODBConn::GetCatInfo(CATPARM *cap)
} else
ThrowDBX(rc, fnc, hstmt);
#endif // 0
if (!rc || rc == SQL_NO_DATA || rc == SQL_SUCCESS_WITH_INFO) {
if ((rc = SQLFetch(hstmt)) != SQL_NO_DATA_FOUND)
qrp->Truncated = true;
crow = i;
} else
ThrowDBX(rc, fnc, hstmt);
irc = (int)crow;
} catch(DBX *x) {
......
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