| 154 | |
| 155 | |
| 156 | sp_rcontext *sp_rcontext::create(THD *thd, |
| 157 | sp_head *owner, |
| 158 | const sp_pcontext *root_parsing_ctx, |
| 159 | Field *return_value_fld, |
| 160 | Row_definition_list &field_def_lst) |
| 161 | { |
| 162 | SELECT_LEX *save_current_select; |
| 163 | sp_rcontext *ctx= new (thd->mem_root) sp_rcontext(owner, |
| 164 | root_parsing_ctx, |
| 165 | return_value_fld, |
| 166 | thd->in_sub_stmt); |
| 167 | if (!ctx) |
| 168 | return NULL; |
| 169 | |
| 170 | /* Reset current_select as it's checked in Item_ident::Item_ident */ |
| 171 | save_current_select= thd->lex->current_select; |
| 172 | thd->lex->current_select= 0; |
| 173 | |
| 174 | if (ctx->alloc_arrays(thd) || |
| 175 | ctx->init_var_table(thd, field_def_lst) || |
| 176 | ctx->init_var_items(thd, field_def_lst)) |
| 177 | { |
| 178 | delete ctx; |
| 179 | ctx= 0; |
| 180 | } |
| 181 | |
| 182 | thd->lex->current_select= save_current_select; |
| 183 | return ctx; |
| 184 | } |
| 185 | |
| 186 | |
| 187 | /* |
nothing calls this directly
no test coverage detected