MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / create

Method create

sql/item_create.cc:2808–2846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2806Create_sp_func Create_sp_func::s_singleton;
2807
2808Item*
2809Create_sp_func::create(THD *thd, LEX_STRING db, LEX_STRING name,
2810 bool use_explicit_name, List<Item> *item_list)
2811{
2812 int arg_count= 0;
2813 Item *func= NULL;
2814 LEX *lex= thd->lex;
2815 sp_name *qname;
2816
2817 if (has_named_parameters(item_list))
2818 {
2819 /*
2820 The syntax "db.foo(expr AS p1, expr AS p2, ...) is invalid,
2821 and has been rejected during syntactic parsing already,
2822 because a stored function call may not have named parameters.
2823
2824 The syntax "foo(expr AS p1, expr AS p2, ...)" is correct,
2825 because it can refer to a User Defined Function call.
2826 For a Stored Function however, this has no semantic.
2827 */
2828 my_error(ER_WRONG_PARAMETERS_TO_STORED_FCT, MYF(0), name.str);
2829 return NULL;
2830 }
2831
2832 if (item_list != NULL)
2833 arg_count= item_list->elements;
2834
2835 qname= new (thd->mem_root) sp_name(db, name, use_explicit_name);
2836 qname->init_qname(thd);
2837
2838 if (arg_count > 0)
2839 func= new (thd->mem_root) Item_func_sp(lex->current_context(), qname,
2840 *item_list);
2841 else
2842 func= new (thd->mem_root) Item_func_sp(lex->current_context(), qname);
2843
2844 lex->safe_to_cache_query= 0;
2845 return func;
2846}
2847
2848
2849Item*

Callers

nothing calls this directly

Calls 6

has_named_parametersFunction · 0.85
my_errorFunction · 0.85
init_qnameMethod · 0.80
current_contextMethod · 0.80
uncacheableMethod · 0.80
set_stmt_unsafeMethod · 0.80

Tested by

no test coverage detected