diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-11-11 09:35:05 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-11-11 09:35:05 +0400 |
commit | f5855ba03deef188516453b71e56d4239f74a653 (patch) | |
tree | e87e1dafd0cbbc80586b84f87729997b1fd7a209 /sql/sql_lex.cc | |
parent | 8e6f10335d2c6afb1d34e99af6e1ee49b6e4a875 (diff) | |
download | mariadb-git-f5855ba03deef188516453b71e56d4239f74a653.tar.gz |
MDEV-17664 Add sql_mode specific tokens for ':' and '%'
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index a80c6485cf0..254889ac414 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1423,6 +1423,13 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd) } /* Fall through */ case MY_LEX_CHAR: // Unknown or single char token + { + if (c == '%' && (m_thd->variables.sql_mode & MODE_ORACLE)) + { + next_state= MY_LEX_START; + return PERCENT_ORACLE_SYM; + } + } case MY_LEX_SKIP: // This should not happen if (c != ')') next_state= MY_LEX_START; // Allow signed numbers @@ -1861,8 +1868,13 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd) case MY_LEX_SET_VAR: // Check if ':=' if (yyPeek() != '=') { - state= MY_LEX_CHAR; // Return ':' - break; + next_state= MY_LEX_START; + if (m_thd->variables.sql_mode & MODE_ORACLE) + { + yylval->kwd.set_keyword(m_tok_start, 1); + return COLON_ORACLE_SYM; + } + return (int) ':'; } yySkip(); return (SET_VAR); @@ -6655,6 +6667,30 @@ Item *LEX::make_item_colon_ident_ident(THD *thd, } +Item *LEX::make_item_plsql_cursor_attr(THD *thd, const LEX_CSTRING *name, + plsql_cursor_attr_t attr) +{ + uint offset; + if (unlikely(!spcont || !spcont->find_cursor(name, &offset, false))) + { + my_error(ER_SP_CURSOR_MISMATCH, MYF(0), name->str); + return NULL; + } + switch (attr) { + case PLSQL_CURSOR_ATTR_ISOPEN: + return new (thd->mem_root) Item_func_cursor_isopen(thd, name, offset); + case PLSQL_CURSOR_ATTR_FOUND: + return new (thd->mem_root) Item_func_cursor_found(thd, name, offset); + case PLSQL_CURSOR_ATTR_NOTFOUND: + return new (thd->mem_root) Item_func_cursor_notfound(thd, name, offset); + case PLSQL_CURSOR_ATTR_ROWCOUNT: + return new (thd->mem_root) Item_func_cursor_rowcount(thd, name, offset); + } + DBUG_ASSERT(0); + return NULL; +} + + Item *LEX::make_item_sysvar(THD *thd, enum_var_type type, const LEX_CSTRING *name, |