summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorbar@gw.udmsearch.izhnet.ru <>2002-06-20 18:47:55 +0500
committerbar@gw.udmsearch.izhnet.ru <>2002-06-20 18:47:55 +0500
commit5eafe401c0cb60a45d838e4503ba6c053b71a52d (patch)
tree5a292752272cd0f05ab677c5019d3d788fff7ce2 /sql/sql_lex.cc
parent8d6342af2be2e6d77bc5b032f6079b67ab455fc2 (diff)
downloadmariadb-git-5eafe401c0cb60a45d838e4503ba6c053b71a52d.tar.gz
New syntax for string with charset: _latin1'string'
Remove dupicated code
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 008ef44d83a..bcf212f6bd2 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -525,7 +525,19 @@ int yylex(void *arg)
yylval->lex_str=get_token(lex,length);
if (lex->convert_set)
lex->convert_set->convert((char*) yylval->lex_str.str,lex->yytoklen);
- return(IDENT);
+
+ /*
+ Note: "SELECT _bla AS 'alias'"
+ _bla should be considered as a IDENT if charset haven't been found.
+ So we don't use MYF(MY_WME) with get_charset_by_name to avoid
+ producing an error.
+ */
+
+ if ((yylval->lex_str.str[0]=='_') &&
+ (lex->charset=get_charset_by_name(yylval->lex_str.str+1,MYF(0))))
+ return(UNDERSCORE_CHARSET);
+ else
+ return(IDENT);
case STATE_IDENT_SEP: // Found ident and now '.'
lex->next_state=STATE_IDENT_START;// Next is an ident (not a keyword)