Commit cc8e8633 authored by Alexander Barkov's avatar Alexander Barkov

Removing sp_variable::type, as it was always set to the same value with

sp_variable::field_def.type, so there was data redundancy.
parent b50fa6da
...@@ -2603,8 +2603,7 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath) ...@@ -2603,8 +2603,7 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath)
(spv= spc->find_variable(name, false))) (spv= spc->find_variable(name, false)))
{ {
Item_splocal *splocal= new (thd->mem_root) Item_splocal *splocal= new (thd->mem_root)
Item_splocal(thd, name, spv->offset, Item_splocal(thd, name, spv->offset, spv->sql_type(), 0);
spv->type, 0);
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (splocal) if (splocal)
splocal->m_sp= lex->sphead; splocal->m_sp= lex->sphead;
......
...@@ -43,9 +43,6 @@ class sp_variable : public Sql_alloc ...@@ -43,9 +43,6 @@ class sp_variable : public Sql_alloc
/// Name of the SP-variable. /// Name of the SP-variable.
LEX_STRING name; LEX_STRING name;
/// Field-type of the SP-variable.
enum enum_field_types type;
/// Mode of the SP-variable. /// Mode of the SP-variable.
enum_mode mode; enum_mode mode;
...@@ -62,11 +59,12 @@ class sp_variable : public Sql_alloc ...@@ -62,11 +59,12 @@ class sp_variable : public Sql_alloc
/// Full type information (field meta-data) of the SP-variable. /// Full type information (field meta-data) of the SP-variable.
Column_definition field_def; Column_definition field_def;
/// Field-type of the SP-variable.
enum_field_types sql_type() const { return field_def.sql_type; }
public: public:
sp_variable(LEX_STRING _name, uint _offset) sp_variable(LEX_STRING _name, uint _offset)
:Sql_alloc(), :Sql_alloc(),
name(_name), name(_name),
type(MYSQL_TYPE_NULL),
mode(MODE_IN), mode(MODE_IN),
offset(_offset), offset(_offset),
default_value(NULL) default_value(NULL)
......
...@@ -435,7 +435,8 @@ set_local_variable(THD *thd, sp_variable *spv, Item *val) ...@@ -435,7 +435,8 @@ set_local_variable(THD *thd, sp_variable *spv, Item *val)
sp_set= new (thd->mem_root) sp_set= new (thd->mem_root)
sp_instr_set(lex->sphead->instructions(), lex->spcont, sp_instr_set(lex->sphead->instructions(), lex->spcont,
spv->offset, it, spv->type, lex, TRUE); spv->offset, it, spv->sql_type(),
lex, TRUE);
return (sp_set == NULL || lex->sphead->add_instr(sp_set)); return (sp_set == NULL || lex->sphead->add_instr(sp_set));
} }
...@@ -534,7 +535,8 @@ create_item_for_sp_var(THD *thd, LEX_STRING name, sp_variable *spvar, ...@@ -534,7 +535,8 @@ create_item_for_sp_var(THD *thd, LEX_STRING name, sp_variable *spvar,
len_in_q= end_in_q - start_in_q; len_in_q= end_in_q - start_in_q;
item= new (thd->mem_root) item= new (thd->mem_root)
Item_splocal(thd, name, spvar->offset, spvar->type, pos_in_q, len_in_q); Item_splocal(thd, name, spvar->offset, spvar->sql_type(),
pos_in_q, len_in_q);
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (item) if (item)
...@@ -2942,7 +2944,6 @@ sp_param_name_and_type: ...@@ -2942,7 +2944,6 @@ sp_param_name_and_type:
LEX *lex= Lex; LEX *lex= Lex;
sp_variable *spvar= $<spvar>2; sp_variable *spvar= $<spvar>2;
spvar->type= $3.field_type();
if (lex->sphead->fill_field_definition(thd, lex, lex->last_field)) if (lex->sphead->fill_field_definition(thd, lex, lex->last_field))
{ {
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -3060,7 +3061,6 @@ sp_decl: ...@@ -3060,7 +3061,6 @@ sp_decl:
if (!last) if (!last)
spvar->field_def= *lex->last_field; spvar->field_def= *lex->last_field;
spvar->type= $4.field_type();
spvar->default_value= dflt_value_item; spvar->default_value= dflt_value_item;
spvar->field_def.field_name= spvar->name.str; spvar->field_def.field_name= spvar->name.str;
...@@ -11455,7 +11455,7 @@ limit_option: ...@@ -11455,7 +11455,7 @@ limit_option:
if (spc && (spv = spc->find_variable($1, false))) if (spc && (spv = spc->find_variable($1, false)))
{ {
splocal= new (thd->mem_root) splocal= new (thd->mem_root)
Item_splocal(thd, $1, spv->offset, spv->type, Item_splocal(thd, $1, spv->offset, spv->sql_type(),
lip->get_tok_start() - lex->sphead->m_tmp_query, lip->get_tok_start() - lex->sphead->m_tmp_query,
lip->get_ptr() - lip->get_tok_start()); lip->get_ptr() - lip->get_tok_start());
if (splocal == NULL) if (splocal == NULL)
...@@ -11695,7 +11695,7 @@ select_outvar: ...@@ -11695,7 +11695,7 @@ select_outvar:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
$$ = Lex->result ? (new (thd->mem_root) $$ = Lex->result ? (new (thd->mem_root)
my_var_sp($1, t->offset, t->type, my_var_sp($1, t->offset, t->sql_type(),
Lex->sphead)) : Lex->sphead)) :
NULL; NULL;
} }
...@@ -13710,7 +13710,7 @@ simple_ident: ...@@ -13710,7 +13710,7 @@ simple_ident:
Item_splocal *splocal; Item_splocal *splocal;
splocal= new (thd->mem_root) splocal= new (thd->mem_root)
Item_splocal(thd, $1, spv->offset, spv->type, Item_splocal(thd, $1, spv->offset, spv->sql_type(),
lip->get_tok_start_prev() - lex->sphead->m_tmp_query, lip->get_tok_start_prev() - lex->sphead->m_tmp_query,
lip->get_tok_end() - lip->get_tok_start_prev()); lip->get_tok_end() - lip->get_tok_start_prev());
if (splocal == NULL) if (splocal == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment