summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 3e3ef2a0bbe..3f4a121b6af 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1106,7 +1106,7 @@ bool Item_splocal::set_value(THD *thd, sp_rcontext *ctx, Item **it)
Item_case_expr methods
*****************************************************************************/
-Item_case_expr::Item_case_expr(int case_expr_id)
+Item_case_expr::Item_case_expr(uint case_expr_id)
:Item_sp_variable( C_STRING_WITH_LEN("case_expr")),
m_case_expr_id(case_expr_id)
{
@@ -1143,6 +1143,8 @@ Item_case_expr::this_item_addr(THD *thd, Item **)
void Item_case_expr::print(String *str)
{
+ if (str->reserve(MAX_INT_WIDTH + sizeof("case_expr@")))
+ return; /* purecov: inspected */
VOID(str->append(STRING_WITH_LEN("case_expr@")));
str->qs_append(m_case_expr_id);
}
@@ -1307,15 +1309,18 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
Exception is Item_direct_view_ref which we need to convert to
Item_ref to allow fields from view being stored in tmp table.
*/
+ Item_aggregate_ref *item_ref;
uint el= fields.elements;
- Item *new_item, *real_itm= real_item();
+ Item *real_itm= real_item();
ref_pointer_array[el]= real_itm;
- if (!(new_item= new Item_aggregate_ref(&thd->lex->current_select->context,
+ if (!(item_ref= new Item_aggregate_ref(&thd->lex->current_select->context,
ref_pointer_array + el, 0, name)))
return; // fatal_error is set
+ if (type() == SUM_FUNC_ITEM)
+ item_ref->depended_from= ((Item_sum *) this)->depended_from();
fields.push_front(real_itm);
- thd->change_item_tree(ref, new_item);
+ thd->change_item_tree(ref, item_ref);
}
}
@@ -4377,13 +4382,16 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
- case MYSQL_TYPE_GEOMETRY:
if (this->type() == Item::TYPE_HOLDER)
field= new Field_blob(max_length, maybe_null, name, collation.collation,
1);
else
field= new Field_blob(max_length, maybe_null, name, collation.collation);
break; // Blob handled outside of case
+ case MYSQL_TYPE_GEOMETRY:
+ return new Field_geom(max_length, maybe_null, name, table->s,
+ (Field::geometry_type)
+ ((Item_geometry_func *)this)->get_geometry_type());
}
if (field)
field->init(table);