summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <kgeorge@mysql.com>2008-12-09 20:35:02 +0200
committerGeorgi Kodinov <kgeorge@mysql.com>2008-12-09 20:35:02 +0200
commitd506265f2ccbaea41f268aa58f0272273537e443 (patch)
tree0db843e1daa7ae2e3211dd641d435f7584a1a8c6 /sql/sql_select.cc
parentc69ca8476cf5229775ae5ca6abc88a14179d08b2 (diff)
downloadmariadb-git-d506265f2ccbaea41f268aa58f0272273537e443.tar.gz
backported the fix for bug #34773 to 5.0
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b080fff8725..48276170caf 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -9444,11 +9444,11 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
}
if (type == Item::SUM_FUNC_ITEM && !group && !save_sum_fields)
{ /* Can't calc group yet */
- ((Item_sum*) item)->result_field=0;
- for (i=0 ; i < ((Item_sum*) item)->arg_count ; i++)
+ Item_sum *sum_item= (Item_sum *) item;
+ sum_item->result_field=0;
+ for (i=0 ; i < sum_item->get_arg_count() ; i++)
{
- Item **argp= ((Item_sum*) item)->args + i;
- Item *arg= *argp;
+ Item *arg= sum_item->get_arg(i);
if (!arg->const_item())
{
uint field_index= (uint) (reg_field - table->field);
@@ -9478,7 +9478,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
string_total_length+= new_field->pack_length();
}
thd->mem_root= mem_root_save;
- thd->change_item_tree(argp, new Item_field(new_field));
+ arg= sum_item->set_arg(i, thd, new Item_field(new_field));
thd->mem_root= &table->mem_root;
if (!(new_field->flags & NOT_NULL_FLAG))
{
@@ -9487,7 +9487,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
new_field->maybe_null() is still false, it will be
changed below. But we have to setup Item_field correctly
*/
- (*argp)->maybe_null=1;
+ arg->maybe_null=1;
}
new_field->query_id= thd->query_id;
}
@@ -13922,9 +13922,9 @@ count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param,
param->quick_group=0; // UDF SUM function
param->sum_func_count++;
- for (uint i=0 ; i < sum_item->arg_count ; i++)
+ for (uint i=0 ; i < sum_item->get_arg_count() ; i++)
{
- if (sum_item->args[0]->real_item()->type() == Item::FIELD_ITEM)
+ if (sum_item->get_arg(i)->real_item()->type() == Item::FIELD_ITEM)
param->field_count++;
else
param->func_count++;