summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authoriggy@rolltop.ignatz42.dyndns.org <>2006-12-04 15:30:55 -0500
committeriggy@rolltop.ignatz42.dyndns.org <>2006-12-04 15:30:55 -0500
commit50222ce9ffd74e054640fdaeaf6ff1e21e337196 (patch)
tree30ac7d827eac6887403f649acbac7ae22998bf6c /sql
parentb70d2b9341ae804fbd5147500a4d29bd86e2a5d6 (diff)
parent011b090c624993932c604d96bec4460150d8b379 (diff)
downloadmariadb-git-50222ce9ffd74e054640fdaeaf6ff1e21e337196.tar.gz
Merge rolltop.ignatz42.dyndns.org:/mnt/storeage/bug20836/my51-bug20836
into rolltop.ignatz42.dyndns.org:/mnt/storeage/mysql-5.1-maint
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_class.cc76
-rw-r--r--sql/sql_class.h4
2 files changed, 23 insertions, 57 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 07510c1fbb0..679bbf4fcdc 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1613,53 +1613,21 @@ bool select_exists_subselect::send_data(List<Item> &items)
int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
{
- List_iterator_fast<Item> li(list);
- List_iterator_fast<my_var> gl(var_list);
- Item *item;
-
- local_vars.empty(); // Clear list if SP
unit= u;
- row_count= 0;
-
+
if (var_list.elements != list.elements)
{
my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
return 1;
- }
- while ((item=li++))
- {
- my_var *mv= gl++;
- if (mv->local)
- {
- Item_splocal *var= new Item_splocal(mv->s, mv->offset, mv->type);
- (void)local_vars.push_back(var);
-#ifndef DBUG_OFF
- var->m_sp= mv->sp;
-#endif
- }
- else
- {
- Item_func_set_user_var *var= new Item_func_set_user_var(mv->s, item);
- /*
- Item_func_set_user_var can't substitute something else on its place =>
- 0 can be passed as last argument (reference on item)
- Item_func_set_user_var can't be fixed after creation, so we do not
- check var->fixed
- */
- var->fix_fields(thd, 0);
- var->fix_length_and_dec();
- vars.push_back(var);
- }
- }
+ }
return 0;
}
void select_dumpvar::cleanup()
{
- vars.empty();
- row_count=0;
+ row_count= 0;
}
@@ -1968,13 +1936,10 @@ Statement_map::~Statement_map()
bool select_dumpvar::send_data(List<Item> &items)
{
- List_iterator_fast<Item_func_set_user_var> li(vars);
- List_iterator_fast<Item_splocal> var_li(local_vars);
- List_iterator_fast<my_var> my_li(var_list);
+ List_iterator_fast<my_var> var_li(var_list);
List_iterator<Item> it(items);
- Item_func_set_user_var *xx;
- Item_splocal *yy;
- my_var *zz;
+ Item *item;
+ my_var *mv;
DBUG_ENTER("select_dumpvar::send_data");
if (unit->offset_limit_cnt)
@@ -1987,24 +1952,27 @@ bool select_dumpvar::send_data(List<Item> &items)
my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
DBUG_RETURN(1);
}
- while ((zz=my_li++) && (it++))
+ while ((mv= var_li++) && (item= it++))
{
- if (zz->local)
+ if (mv->local)
{
- if ((yy=var_li++))
- {
- if (thd->spcont->set_variable(current_thd, yy->get_var_idx(),
- it.ref()))
- DBUG_RETURN(1);
- }
+ if (thd->spcont->set_variable(thd, mv->offset, &item))
+ DBUG_RETURN(1);
}
else
{
- if ((xx=li++))
- {
- xx->check(0);
- xx->update();
- }
+ Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item);
+
+ /*
+ Item_func_set_user_var can't substitute something else on its
+ place => NULL may be passed as last argument (reference on
+ item) Item_func_set_user_var can't be fixed after creation, so
+ we do not check var->fixed
+ */
+
+ suv->fix_fields(thd, 0);
+ suv->check(0);
+ suv->update();
}
}
DBUG_RETURN(0);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 218c56959a3..20f1f680fb2 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2181,9 +2181,7 @@ class select_dumpvar :public select_result_interceptor {
ha_rows row_count;
public:
List<my_var> var_list;
- List<Item_func_set_user_var> vars;
- List<Item_splocal> local_vars;
- select_dumpvar(void) { var_list.empty(); local_vars.empty(); vars.empty(); row_count=0;}
+ select_dumpvar() { var_list.empty(); row_count= 0;}
~select_dumpvar() {}
int prepare(List<Item> &list, SELECT_LEX_UNIT *u);
bool send_data(List<Item> &items);