diff options
author | Alexander Barkov <bar@mariadb.org> | 2016-10-03 10:33:22 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-04-05 15:02:52 +0400 |
commit | 054d00a9a3918fd4551bd5583256a3183802cdae (patch) | |
tree | a4879037d69209c747412580fd18b65c4965a943 /sql/sql_lex.cc | |
parent | 7fa1ad14dca4850caee52e75d69eae441af3f824 (diff) | |
download | mariadb-git-054d00a9a3918fd4551bd5583256a3183802cdae.tar.gz |
A fix for MDEV-10411 Providing compatibility for basic PL/SQL constructs (Part 6: Assignment operator)
Fixed that a crash in this script:
SET sql_mode=ORACLE;
max_sort_length:= 1024;
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index bf19ac34b67..585f9b19370 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -5922,6 +5922,35 @@ bool LEX::add_resignal_statement(THD *thd, const sp_condition_value *v) } +/* + Perform assignment for a trigger, a system variable, or an SP variable. + "variable" be previously set by init_internal_variable(variable, name). +*/ +bool LEX::set_variable(struct sys_var_with_base *variable, Item *item) +{ + if (variable->var == trg_new_row_fake_var) + { + /* We are in trigger and assigning value to field of new row */ + return set_trigger_new_row(&variable->base_name, item); + } + if (variable->var) + { + /* It is a system variable. */ + return set_system_variable(variable, option_type, item); + } + + /* + spcont and spv should not be NULL, as the variable + was previously checked by init_internal_variable(). + */ + DBUG_ASSERT(spcont); + sp_variable *spv= spcont->find_variable(variable->base_name, false); + DBUG_ASSERT(spv); + /* It is a local variable. */ + return set_local_variable(spv, item); +} + + #ifdef MYSQL_SERVER uint binlog_unsafe_map[256]; |