summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-04-25 15:34:02 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2014-04-25 15:34:02 +0200
commite9bb12acdb003f3335a547aeec0c3121b282e5b8 (patch)
tree0c7d7c589c7997fcc8f9784c3736f62979d9774b
parent39750cd4dbe9b79a100d45aae010f39f71ec7ddf (diff)
downloadmariadb-git-e9bb12acdb003f3335a547aeec0c3121b282e5b8.tar.gz
- Do not throw an error on empty ODBC CATFUNC (MDEV-5455)
modified: storage/connect/ha_connect.cc storage/connect/odbconn.cpp
-rw-r--r--storage/connect/ha_connect.cc17
-rw-r--r--storage/connect/odbconn.cpp10
2 files changed, 25 insertions, 2 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 71d263511a5..23c4a326c2c 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -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);
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index a857a1bc918..d0072987fd0 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -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) {