summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-03-16 10:55:12 +0400
committerAlexander Barkov <bar@mariadb.org>2016-03-16 10:55:12 +0400
commite09299511e83f11f7476f7ea6c81ee12b00d7050 (patch)
treea3544293e29a5d191f2b07ce1810f58e257b1b10 /sql/sql_lex.cc
parentdc08ccab422098d2466fa342d577f03c941a4ffc (diff)
downloadmariadb-git-e09299511e83f11f7476f7ea6c81ee12b00d7050.tar.gz
MDEV-9665 Remove cs->cset->ismbchar()
Using a more powerfull cs->cset->charlen() instead.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc55
1 files changed, 22 insertions, 33 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index e93ba7fc10f..b529a0835ca 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1406,28 +1406,22 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
if (use_mb(cs))
{
result_state= IDENT_QUOTED;
- if (my_mbcharlen(cs, lip->yyGetLast()) > 1)
+ int char_length= my_charlen(cs, lip->get_ptr() - 1,
+ lip->get_end_of_query());
+ if (char_length <= 0)
{
- int l = my_ismbchar(cs,
- lip->get_ptr() -1,
- lip->get_end_of_query());
- if (l == 0) {
- state = MY_LEX_CHAR;
- continue;
- }
- lip->skip_binary(l - 1);
+ state= MY_LEX_CHAR;
+ continue;
}
+ lip->skip_binary(char_length - 1);
+
while (ident_map[c=lip->yyGet()])
{
- if (my_mbcharlen(cs, c) > 1)
- {
- int l;
- if ((l = my_ismbchar(cs,
- lip->get_ptr() -1,
- lip->get_end_of_query())) == 0)
- break;
- lip->skip_binary(l-1);
- }
+ char_length= my_charlen(cs, lip->get_ptr() - 1,
+ lip->get_end_of_query());
+ if (char_length <= 0)
+ break;
+ lip->skip_binary(char_length - 1);
}
}
else
@@ -1568,15 +1562,11 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
result_state= IDENT_QUOTED;
while (ident_map[c=lip->yyGet()])
{
- if (my_mbcharlen(cs, c) > 1)
- {
- int l;
- if ((l = my_ismbchar(cs,
- lip->get_ptr() -1,
- lip->get_end_of_query())) == 0)
- break;
- lip->skip_binary(l-1);
- }
+ int char_length= my_charlen(cs, lip->get_ptr() - 1,
+ lip->get_end_of_query());
+ if (char_length <= 0)
+ break;
+ lip->skip_binary(char_length - 1);
}
}
else
@@ -1604,8 +1594,9 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
char quote_char= c; // Used char
while ((c=lip->yyGet()))
{
- int var_length;
- if ((var_length= my_mbcharlen(cs, c)) == 1)
+ int var_length= my_charlen(cs, lip->get_ptr() - 1,
+ lip->get_end_of_query());
+ if (var_length == 1)
{
if (c == quote_char)
{
@@ -1617,11 +1608,9 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
}
}
#ifdef USE_MB
- else if (use_mb(cs))
+ else if (var_length > 1)
{
- if ((var_length= my_ismbchar(cs, lip->get_ptr() - 1,
- lip->get_end_of_query())))
- lip->skip_binary(var_length-1);
+ lip->skip_binary(var_length - 1);
}
#endif
}