MXS-1992 Provide canonical function for std::string

This commit is contained in:
Johan Wikman 2018-08-01 15:38:35 +03:00
parent 81297fb919
commit bcdab394c1
2 changed files with 15 additions and 2 deletions

View File

@ -26,4 +26,6 @@ namespace maxscale
std::string extract_sql(GWBUF* buffer, size_t len = -1);
std::string get_canonical(GWBUF* querybuf);
}

View File

@ -1350,7 +1350,10 @@ bool is_negation(const std::string& str)
return rval;
}
char* modutil_get_canonical(GWBUF* querybuf)
namespace maxscale
{
std::string get_canonical(GWBUF* querybuf)
{
std::string rval;
mxs::Buffer buf(querybuf);
@ -1492,7 +1495,15 @@ char* modutil_get_canonical(GWBUF* querybuf)
}
buf.release();
return MXS_STRDUP(rval.c_str());
return rval;
}
}
char* modutil_get_canonical(GWBUF* querybuf)
{
return MXS_STRDUP(maxscale::get_canonical(querybuf).c_str());
}
char* modutil_MySQL_bypass_whitespace(char* sql, size_t len)