Merge branch '2.3' into develop

This commit is contained in:
Esa Korhonen
2019-05-28 10:57:18 +03:00
4 changed files with 151 additions and 50 deletions

View File

@ -374,7 +374,7 @@ namespace maxscale
{
std::unique_ptr<mxq::QueryResult> execute_query(MYSQL* conn, const std::string& query,
std::string* errmsg_out)
std::string* errmsg_out, unsigned int* errno_out)
{
using mxq::QueryResult;
std::unique_ptr<QueryResult> rval;
@ -383,10 +383,19 @@ std::unique_ptr<mxq::QueryResult> execute_query(MYSQL* conn, const std::string&
{
rval = std::unique_ptr<QueryResult>(new QueryResult(result));
}
else if (errmsg_out)
else
{
*errmsg_out = mxb::string_printf("Query '%s' failed: '%s'.", query.c_str(), mysql_error(conn));
if (errmsg_out)
{
*errmsg_out = mxb::string_printf("Query '%s' failed: '%s'.", query.c_str(), mysql_error(conn));
}
if (errno_out)
{
*errno_out = mysql_errno(conn);
}
}
return rval;
}
}