diff options
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/sql/item.cc b/sql/item.cc index 5c662e5e6ff..3ea1a493db2 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1395,8 +1395,10 @@ bool Item::get_date_from_real(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate bool Item::get_date_from_string(THD *thd, MYSQL_TIME *to, date_mode_t mode) { StringBuffer<MAX_DATETIME_FULL_WIDTH+1> tmp; - Temporal::Warn_push warn(thd, field_table_or_null(), field_name_or_null(), - to, mode); + const TABLE_SHARE *s = field_table_or_null(); + Temporal::Warn_push warn(thd, s ? s->db.str : nullptr, + s ? s->table_name.str : nullptr, + field_name_or_null(), to, mode); Temporal_hybrid *t= new(to) Temporal_hybrid(thd, &warn, val_str(&tmp), mode); return !t->is_valid_temporal(); } @@ -2562,14 +2564,7 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll, bool res= FALSE; uint i; - /* - In case we're in statement prepare, create conversion item - in its memory: it will be reused on each execute. - */ - Query_arena backup; - Query_arena *arena= thd->stmt_arena->is_stmt_prepare() ? - thd->activate_stmt_arena_if_needed(&backup) : - NULL; + DBUG_ASSERT(!thd->stmt_arena->is_stmt_prepare()); for (i= 0, arg= args; i < nargs; i++, arg+= item_sep) { @@ -2591,20 +2586,8 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll, res= TRUE; break; // we cannot return here, we need to restore "arena". } - /* - If in statement prepare, then we create a converter for two - constant items, do it once and then reuse it. - If we're in execution of a prepared statement, arena is NULL, - and the conv was created in runtime memory. This can be - the case only if the argument is a parameter marker ('?'), - because for all true constants the charset converter has already - been created in prepare. In this case register the change for - rollback. - */ - if (thd->stmt_arena->is_stmt_prepare()) - *arg= conv; - else - thd->change_item_tree(arg, conv); + + thd->change_item_tree(arg, conv); if (conv->fix_fields_if_needed(thd, arg)) { @@ -2612,8 +2595,6 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll, break; // we cannot return here, we need to restore "arena". } } - if (arena) - thd->restore_active_arena(arena, &backup); return res; } @@ -4142,7 +4123,7 @@ void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type, { ErrConvTime str(&value.time); make_truncated_value_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, - &str, time_type, 0, 0); + &str, time_type, NULL, NULL, NULL); set_zero_time(&value.time, time_type); } maybe_null= 0; |