diff options
author | Alexander Barkov <bar@mariadb.org> | 2016-10-08 11:50:18 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2016-10-08 11:50:18 +0400 |
commit | 4c45b820aa0e04fd25527279175fdc7fabcd731e (patch) | |
tree | e52297dbbe7798cc21aabc4e747467bad78e1e79 /sql/protocol.cc | |
parent | 8ea2e143f09bd0602ffd9695a78c076d483dd65a (diff) | |
download | mariadb-git-4c45b820aa0e04fd25527279175fdc7fabcd731e.tar.gz |
MDEV-10709 Expressions as parameters to Dynamic SQL
Diffstat (limited to 'sql/protocol.cc')
-rw-r--r-- | sql/protocol.cc | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/sql/protocol.cc b/sql/protocol.cc index be73c94c9b2..a3085c69f17 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -1306,33 +1306,27 @@ bool Protocol_text::send_out_parameters(List<Item_param> *sp_params) thd->lex->prepared_stmt_params.elements); List_iterator_fast<Item_param> item_param_it(*sp_params); - List_iterator_fast<LEX_STRING> user_var_name_it(thd->lex->prepared_stmt_params); + List_iterator_fast<Item> param_it(thd->lex->prepared_stmt_params); while (true) { Item_param *item_param= item_param_it++; - LEX_STRING *user_var_name= user_var_name_it++; + Item *param= param_it++; + Settable_routine_parameter *sparam; - if (!item_param || !user_var_name) + if (!item_param || !param) break; if (!item_param->get_out_param_info()) continue; // It's an IN-parameter. - Item_func_set_user_var *suv= - new (thd->mem_root) Item_func_set_user_var(thd, *user_var_name, item_param); - /* - Item_func_set_user_var is not fixed after construction, call - fix_fields(). - */ - if (suv->fix_fields(thd, NULL)) - return TRUE; - - if (suv->check(FALSE)) - return TRUE; + if (!(sparam= param->get_settable_routine_parameter())) + { + DBUG_ASSERT(0); + continue; + } - if (suv->update()) - return TRUE; + sparam->set_value(thd, thd->spcont, reinterpret_cast<Item **>(&item_param)); } return FALSE; |