1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

MCOL-1475 Improve cross engine error handling

Now shows MariaDB error code and message where possible.
This commit is contained in:
Andrew Hutchings
2018-06-14 18:37:52 +01:00
parent 4a20da68ac
commit d6cb205dfc
2 changed files with 12 additions and 5 deletions

View File

@@ -773,11 +773,16 @@ string CrossEngineStep::makeQuery()
void CrossEngineStep::handleMySqlError(const char* errStr, unsigned int errCode)
{
ostringstream oss;
oss << errStr << "(" << errCode << ")";
if (errCode == (unsigned int) -1)
oss << "(null pointer)";
else
oss << "(" << errCode << ")";
if (mysql->getErrno())
{
oss << errStr << " (" << mysql->getErrno() << ")";
oss << " (" << mysql->getErrorMsg() << ")";
}
else
{
oss << errStr << " (" << errCode << ")";
oss << " (unknown)";
}
throw IDBExcept(oss.str(), ERR_CROSS_ENGINE_CONNECT);

View File

@@ -70,6 +70,8 @@ public:
long getFieldLength(int field) { return fieldLengths[field]; }
MYSQL_FIELD* getField(int field) { return &fFields[field]; }
const std::string& getError() { return fErrStr; }
unsigned int getErrno() { return mysql_errno(fCon); }
const char* getErrorMsg() { return mysql_error(fCon); }
private:
MYSQL* fCon;