Rename mxs_mysql_account_to_pcre

The function is not capable of doing the right thing for an entire
account string, but only separately for user and host names, so the
function name should reflect that.
This commit is contained in:
Johan Wikman
2016-12-29 11:47:08 +02:00
parent 997bec868f
commit 18008dec6d
3 changed files with 27 additions and 20 deletions

View File

@ -237,24 +237,24 @@ bool mxs_mysql_trim_quotes(char *s)
}
mxs_mysql_account_kind_t mxs_mysql_account_to_pcre(char *pcre,
const char *mysql,
mxs_pcre_quote_approach_t approach)
mxs_mysql_name_kind_t mxs_mysql_name_to_pcre(char *pcre,
const char *mysql,
mxs_pcre_quote_approach_t approach)
{
mxs_mysql_account_kind_t rv = MXS_MYSQL_ACCOUNT_WITHOUT_WILDCARD;
mxs_mysql_name_kind_t rv = MXS_MYSQL_NAME_WITHOUT_WILDCARD;
while (*mysql)
{
switch (*mysql)
{
case '%':
if (approach == MXS_PCRE_QUOTE_QUERY)
if (approach == MXS_PCRE_QUOTE_WILDCARD)
{
*pcre = '.';
pcre++;
*pcre = '*';
}
rv = MXS_MYSQL_ACCOUNT_WITH_WILDCARD;
rv = MXS_MYSQL_NAME_WITH_WILDCARD;
break;
case '\'':