diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-06-05 11:56:19 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-06-05 11:56:19 +0400 |
commit | f4dfc609cf89001e948566336f8f2b93ee147723 (patch) | |
tree | 62a44a1dd397b8ae4b405e2c75c00593ea8a62d2 | |
parent | ab297744b7318645159cd5f9ec26378473cecf52 (diff) | |
download | mariadb-git-f4dfc609cf89001e948566336f8f2b93ee147723.tar.gz |
MDEV-16388 Replace member Item::fixed to virtual method is_fixed()
-rw-r--r-- | sql/event_parse_data.cc | 2 | ||||
-rw-r--r-- | sql/item.cc | 127 | ||||
-rw-r--r-- | sql/item.h | 239 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 2 | ||||
-rw-r--r-- | sql/item_func.cc | 7 | ||||
-rw-r--r-- | sql/item_func.h | 4 | ||||
-rw-r--r-- | sql/item_geofunc.h | 2 | ||||
-rw-r--r-- | sql/item_row.cc | 2 | ||||
-rw-r--r-- | sql/item_row.h | 12 | ||||
-rw-r--r-- | sql/item_subselect.cc | 10 | ||||
-rw-r--r-- | sql/item_sum.cc | 2 | ||||
-rw-r--r-- | sql/item_sum.h | 1 | ||||
-rw-r--r-- | sql/opt_subselect.cc | 14 | ||||
-rw-r--r-- | sql/opt_table_elimination.cc | 2 | ||||
-rw-r--r-- | sql/sp_head.cc | 2 | ||||
-rw-r--r-- | sql/sql_base.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 16 | ||||
-rw-r--r-- | sql/sql_signal.cc | 2 | ||||
-rw-r--r-- | sql/sql_tvc.cc | 3 | ||||
-rw-r--r-- | sql/sql_type.cc | 2 | ||||
-rw-r--r-- | sql/sql_union.cc | 4 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 7 | ||||
-rw-r--r-- | sql/sql_yacc_ora.yy | 7 | ||||
-rw-r--r-- | sql/table.cc | 10 |
24 files changed, 216 insertions, 267 deletions
diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index b2ff80626db..d20d322d864 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -472,7 +472,7 @@ Event_parse_data::report_bad_value(const char *item_name, Item *bad_item) { char buff[120]; String str(buff,(uint32) sizeof(buff), system_charset_info); - String *str2= bad_item->fixed? bad_item->val_str(&str):NULL; + String *str2= bad_item->is_fixed() ? bad_item->val_str(&str) : NULL; my_error(ER_WRONG_VALUE, MYF(0), item_name, str2? str2->c_ptr_safe():"NULL"); } diff --git a/sql/item.cc b/sql/item.cc index 0a7972b6617..9852053f925 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -368,7 +368,7 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value) my_decimal *Item::val_decimal_from_date(my_decimal *decimal_value) { - DBUG_ASSERT(fixed == 1); + DBUG_ASSERT(is_fixed()); MYSQL_TIME ltime; if (get_temporal_with_sql_mode(<ime)) { @@ -382,7 +382,7 @@ my_decimal *Item::val_decimal_from_date(my_decimal *decimal_value) my_decimal *Item::val_decimal_from_time(my_decimal *decimal_value) { - DBUG_ASSERT(fixed == 1); + DBUG_ASSERT(is_fixed()); MYSQL_TIME ltime; if (get_time(<ime)) { @@ -395,7 +395,7 @@ my_decimal *Item::val_decimal_from_time(my_decimal *decimal_value) longlong Item::val_int_from_date() { - DBUG_ASSERT(fixed == 1); + DBUG_ASSERT(is_fixed()); MYSQL_TIME ltime; if (get_temporal_with_sql_mode(<ime)) return 0; @@ -406,7 +406,7 @@ longlong Item::val_int_from_date() double Item::val_real_from_date() { - DBUG_ASSERT(fixed == 1); + DBUG_ASSERT(is_fixed()); MYSQL_TIME ltime; if (get_temporal_with_sql_mode(<ime)) return 0; @@ -502,7 +502,7 @@ int Item::save_str_value_in_field(Field *field, String *result) Item::Item(THD *thd): is_expensive_cache(-1), rsize(0), name(null_clex_str), orig_name(0), - fixed(0), is_autogenerated_name(TRUE) + is_autogenerated_name(TRUE) { DBUG_ASSERT(thd); marker= 0; @@ -554,7 +554,6 @@ Item::Item(THD *thd, Item *item): with_param(item->with_param), with_window_func(item->with_window_func), with_field(item->with_field), - fixed(item->fixed), is_autogenerated_name(item->is_autogenerated_name) { next= thd->free_list; // Put in free list @@ -624,7 +623,6 @@ void Item::cleanup() { DBUG_ENTER("Item::cleanup"); DBUG_PRINT("enter", ("this: %p", this)); - fixed= 0; marker= 0; join_tab_idx= MAX_TABLES; if (orig_name) @@ -644,7 +642,7 @@ void Item::cleanup() bool Item::cleanup_processor(void *arg) { - if (fixed) + if (is_fixed()) cleanup(); return FALSE; } @@ -1166,7 +1164,7 @@ bool Item::check_type_scalar(const char *opname) const This hack in Item_outer_ref should probably be refactored eventually. Discuss with Sanja. */ - DBUG_ASSERT(fixed || type() == REF_ITEM); + DBUG_ASSERT(is_fixed() || type() == REF_ITEM); const Type_handler *handler= type_handler(); if (handler->is_scalar_type()) return false; @@ -1315,7 +1313,6 @@ Item *Item_cache::safe_charset_converter(THD *thd, CHARSET_INFO *tocs) unlikely(!(cache= new (thd->mem_root) Item_cache_str(thd, conv)))) return NULL; // Safe conversion is not possible, or OEM cache->setup(thd, conv); - cache->fixed= false; // Make Item::fix_fields() happy return cache; } @@ -1366,7 +1363,7 @@ Item *Item::const_charset_converter(THD *thd, CHARSET_INFO *tocs, const char *func_name) { DBUG_ASSERT(const_item()); - DBUG_ASSERT(fixed); + DBUG_ASSERT(is_fixed()); StringBuffer<64>tmp; String *s= val_str(&tmp); MEM_ROOT *mem_root= thd->mem_root; @@ -1676,7 +1673,7 @@ Query_fragment::Query_fragment(THD *thd, sp_head *sphead, *****************************************************************************/ Item_sp_variable::Item_sp_variable(THD *thd, const LEX_CSTRING *sp_var_name) - :Item(thd), m_thd(0), m_name(*sp_var_name) + :Item_fixed_hybrid(thd), m_thd(0), m_name(*sp_var_name) #ifndef DBUG_OFF , m_sp(0) #endif @@ -1688,7 +1685,7 @@ bool Item_sp_variable::fix_fields_from_item(THD *thd, Item **, const Item *it) { m_thd= thd; /* NOTE: this must be set before any this_xxx() */ - DBUG_ASSERT(it->fixed); + DBUG_ASSERT(it->is_fixed()); max_length= it->max_length; decimals= it->decimals; @@ -2165,7 +2162,7 @@ bool Item_name_const::is_null() Item_name_const::Item_name_const(THD *thd, Item *name_arg, Item *val): - Item(thd), value_item(val), name_item(name_arg) + Item_fixed_hybrid(thd), value_item(val), name_item(name_arg) { Item::maybe_null= TRUE; valid_args= true; @@ -2737,7 +2734,7 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll, else thd->change_item_tree(arg, conv); - if (conv->fix_fields(thd, arg)) + if (conv->fix_fields_if_needed(thd, arg)) { res= TRUE; break; // we cannot return here, we need to restore "arena". @@ -3653,7 +3650,6 @@ Item_int::Item_int(THD *thd, const char *str_arg, size_t length): the field name. */ name.length= !str_arg[max_length] ? max_length : strlen(str_arg); - fixed= 1; } @@ -3665,8 +3661,6 @@ my_decimal *Item_int::val_decimal(my_decimal *decimal_value) String *Item_int::val_str(String *str) { - // following assert is redundant, because fixed=1 assigned in constructor - DBUG_ASSERT(fixed == 1); str->set_int(value, unsigned_flag, collation.collation); return str; } @@ -3703,8 +3697,6 @@ Item_uint::Item_uint(THD *thd, const char *str_arg, longlong i, uint length): String *Item_uint::val_str(String *str) { - // following assert is redundant, because fixed=1 assigned in constructor - DBUG_ASSERT(fixed == 1); str->set((ulonglong) value, collation.collation); return str; } @@ -3726,7 +3718,6 @@ Item_decimal::Item_decimal(THD *thd, const char *str_arg, size_t length, name.str= str_arg; name.length= safe_strlen(str_arg); decimals= (uint8) decimal_value.frac; - fixed= 1; max_length= my_decimal_precision_to_length_no_truncation(decimal_value.intg + decimals, decimals, @@ -3738,7 +3729,6 @@ Item_decimal::Item_decimal(THD *thd, longlong val, bool unsig): { int2my_decimal(E_DEC_FATAL_ERROR, val, unsig, &decimal_value); decimals= (uint8) decimal_value.frac; - fixed= 1; max_length= my_decimal_precision_to_length_no_truncation(decimal_value.intg + decimals, decimals, @@ -3751,7 +3741,6 @@ Item_decimal::Item_decimal(THD *thd, double val, int precision, int scale): { double2my_decimal(E_DEC_FATAL_ERROR, val, &decimal_value); decimals= (uint8) decimal_value.frac; - fixed= 1; max_length= my_decimal_precision_to_length_no_truncation(decimal_value.intg + decimals, decimals, @@ -3768,7 +3757,6 @@ Item_decimal::Item_decimal(THD *thd, const char *str, const my_decimal *val_arg, name.length= safe_strlen(str); decimals= (uint8) decimal_par; max_length= length; - fixed= 1; } @@ -3777,7 +3765,6 @@ Item_decimal::Item_decimal(THD *thd, my_decimal *value_par): { my_decimal2decimal(value_par, &decimal_value); decimals= (uint8) decimal_value.frac; - fixed= 1; max_length= my_decimal_precision_to_length_no_truncation(decimal_value.intg + decimals, decimals, @@ -3791,7 +3778,6 @@ Item_decimal::Item_decimal(THD *thd, const uchar *bin, int precision, int scale) binary2my_decimal(E_DEC_FATAL_ERROR, bin, &decimal_value, precision, scale); decimals= (uint8) decimal_value.frac; - fixed= 1; max_length= my_decimal_precision_to_length_no_truncation(precision, decimals, unsigned_flag); } @@ -3864,8 +3850,6 @@ Item *Item_decimal::clone_item(THD *thd) String *Item_float::val_str(String *str) { - // following assert is redundant, because fixed=1 assigned in constructor - DBUG_ASSERT(fixed == 1); str->set_real(value, decimals, &my_charset_numeric); return str; } @@ -3873,8 +3857,6 @@ String *Item_float::val_str(String *str) my_decimal *Item_float::val_decimal(my_decimal *decimal_value) { - // following assert is redundant, because fixed=1 assigned in constructor - DBUG_ASSERT(fixed == 1); double2my_decimal(E_DEC_FATAL_ERROR, value, decimal_value); return (decimal_value); } @@ -3935,7 +3917,6 @@ void Item_string::print(String *str, enum_query_type query_type) double Item_string::val_real() { - DBUG_ASSERT(fixed == 1); return double_from_string_with_check(&str_value); } @@ -3946,7 +3927,6 @@ double Item_string::val_real() */ longlong Item_string::val_int() { - DBUG_ASSERT(fixed == 1); return longlong_from_string_with_check(&str_value); } @@ -3959,23 +3939,17 @@ my_decimal *Item_string::val_decimal(my_decimal *decimal_value) double Item_null::val_real() { - // following assert is redundant, because fixed=1 assigned in constructor - DBUG_ASSERT(fixed == 1); null_value=1; return 0.0; } longlong Item_null::val_int() { - // following assert is redundant, because fixed=1 assigned in constructor - DBUG_ASSERT(fixed == 1); null_value=1; return 0; } /* ARGSUSED */ String *Item_null::val_str(String *str) { - // following assert is redundant, because fixed=1 assigned in constructor - DBUG_ASSERT(fixed == 1); null_value=1; return 0; } @@ -3988,8 +3962,6 @@ my_decimal *Item_null::val_decimal(my_decimal *decimal_value) bool Item_null::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { - // following assert is redundant, because fixed=1 assigned in constructor - DBUG_ASSERT(fixed == 1); make_zero_date(ltime, fuzzydate); return (null_value= true); } @@ -4393,7 +4365,6 @@ void Item_param::reset() state= NO_VALUE; maybe_null= 1; null_value= 0; - fixed= false; /* Don't reset item_type to PARAM_ITEM: it's only needed to guard us from item optimizations at prepare stage, when item doesn't yet @@ -4441,6 +4412,7 @@ int Item_param::save_in_field(Field *field, bool no_conversions) bool Item_param::can_return_value() const { + DBUG_ASSERT(has_valid_state()); // There's no "default". See comments in Item_param::save_in_field(). switch (state) { case SHORT_DATA_VALUE: @@ -4724,7 +4696,7 @@ bool Item_param::convert_str_value(THD *thd) bool Item_param::basic_const_item() const { - DBUG_ASSERT(fixed || state == NO_VALUE); + DBUG_ASSERT(has_valid_state()); if (state == NO_VALUE || (state == SHORT_DATA_VALUE && type_handler()->cmp_type() == TIME_RESULT)) return FALSE; @@ -4889,7 +4861,6 @@ Item_param::set_param_type_and_swap_value(Item_param *src) maybe_null= src->maybe_null; null_value= src->null_value; state= src->state; - fixed= src->fixed; value.swap(src->value); } @@ -4899,7 +4870,6 @@ void Item_param::set_default() { m_is_settable_routine_parameter= false; state= DEFAULT_VALUE; - fixed= true; /* When Item_param is set to DEFAULT_VALUE: - its val_str() and val_decimal() return NULL @@ -4915,7 +4885,6 @@ void Item_param::set_ignore() { m_is_settable_routine_parameter= false; state= IGNORE_VALUE; - fixed= true; null_value= true; } @@ -5266,17 +5235,6 @@ void Item_copy_decimal::copy() Functions to convert item to field (for send_result_set_metadata) */ -/* ARGSUSED */ -bool Item::fix_fields(THD *thd, Item **ref) -{ - - // We do not check fields which are fixed during construction - DBUG_ASSERT(fixed == 0 || basic_const_item()); - fixed= 1; - return FALSE; -} - - void Item_ref_null_helper::save_val(Field *to) { DBUG_ASSERT(fixed == 1); @@ -5664,7 +5622,7 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select) ref->name.str, "forward reference in item list"); return NULL; } - DBUG_ASSERT((*select_ref)->fixed); + DBUG_ASSERT((*select_ref)->is_fixed()); return &select->ref_pointer_array[counter]; } if (group_by_ref) @@ -5941,7 +5899,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) return -1; /* Some error occurred (e.g. ambiguous names). */ if (ref != not_found_item) { - DBUG_ASSERT(*ref && (*ref)->fixed); + DBUG_ASSERT(*ref && (*ref)->is_fixed()); prev_subselect_item->used_tables_and_const_cache_join(*ref); break; } @@ -5983,7 +5941,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) Item_ref *rf; /* Should have been checked in resolve_ref_in_select_and_group(). */ - DBUG_ASSERT(*ref && (*ref)->fixed); + DBUG_ASSERT(*ref && (*ref)->is_fixed()); /* Here, a subset of actions performed by Item_ref::set_properties is not enough. So we pass ptr to NULL into Item_[direct]_ref @@ -7213,7 +7171,6 @@ Item_float::Item_float(THD *thd, const char *str_arg, size_t length): name.length= strlen(str_arg); decimals=(uint8) nr_of_decimals(str_arg, str_arg+length); max_length=(uint32)length; - fixed= 1; } @@ -7269,7 +7226,6 @@ void Item_hex_constant::hex_string_init(THD *thd, const char *str, size_t str_le } *ptr=0; // Keep purify happy collation.set(&my_charset_bin, DERIVATION_COERCIBLE); - fixed= 1; unsigned_flag= 1; } @@ -7348,7 +7304,6 @@ Item_bin_string::Item_bin_string(THD *thd, const char *str, size_t str_length): ptr[0]= 0; collation.set(&my_charset_bin, DERIVATION_COERCIBLE); - fixed= 1; } @@ -7379,7 +7334,6 @@ Item *Item_date_literal::clone_item(THD *thd) bool Item_date_literal::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) { - DBUG_ASSERT(fixed); fuzzy_date |= sql_mode_for_dates(current_thd); *ltime= cached_time; return (null_value= check_date_with_warn(ltime, fuzzy_date, @@ -7405,7 +7359,6 @@ Item *Item_datetime_literal::clone_item(THD *thd) bool Item_datetime_literal::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) { - DBUG_ASSERT(fixed); fuzzy_date |= sql_mode_for_dates(current_thd); *ltime= cached_time; return (null_value= check_date_with_warn(ltime, fuzzy_date, @@ -7431,7 +7384,6 @@ Item *Item_time_literal::clone_item(THD *thd) bool Item_time_literal::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) { - DBUG_ASSERT(fixed); *ltime= cached_time; if (fuzzy_date & TIME_TIME_ONLY) return (null_value= false); @@ -8034,7 +7986,7 @@ Item_ref::Item_ref(THD *thd, Name_resolution_context *context_arg, /* This constructor used to create some internals references over fixed items */ - if ((set_properties_only= (ref && *ref && (*ref)->fixed))) + if ((set_properties_only= (ref && *ref && (*ref)->is_fixed()))) set_properties(); } @@ -8083,7 +8035,7 @@ Item_ref::Item_ref(THD *thd, TABLE_LIST *view_arg, Item **item, /* This constructor is used to create some internal references over fixed items */ - if ((set_properties_only= (ref && *ref && (*ref)->fixed))) + if ((set_properties_only= (ref && *ref && (*ref)->is_fixed()))) set_properties(); } @@ -8209,7 +8161,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference) goto error; /* Some error occurred (e.g. ambiguous names). */ if (ref != not_found_item) { - DBUG_ASSERT(*ref && (*ref)->fixed); + DBUG_ASSERT(*ref && (*ref)->is_fixed()); prev_subselect_item->used_tables_and_const_cache_join(*ref); break; } @@ -8332,7 +8284,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference) goto error; } /* Should be checked in resolve_ref_in_select_and_group(). */ - DBUG_ASSERT(*ref && (*ref)->fixed); + DBUG_ASSERT(*ref && (*ref)->is_fixed()); mark_as_dependent(thd, last_checked_context->select_lex, context->select_lex, this, this); /* @@ -8360,7 +8312,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference) (((*ref)->with_sum_func && name.str && !(current_sel->linkage != GLOBAL_OPTIONS_TYPE && current_sel->having_fix_field)) || - !(*ref)->fixed)) + !(*ref)->is_fixed())) { my_error(ER_ILLEGAL_REFERENCE, MYF(0), name.str, ((*ref)->with_sum_func? @@ -8812,7 +8764,7 @@ Item_cache_wrapper::~Item_cache_wrapper() Item_cache_wrapper::Item_cache_wrapper(THD *thd, Item *item_arg): Item_result_field(thd), orig_item(item_arg), expr_cache(NULL), expr_value(NULL) { - DBUG_ASSERT(orig_item->fixed); + DBUG_ASSERT(orig_item->is_fixed()); Type_std_attributes::set(orig_item); maybe_null= orig_item->maybe_null; with_sum_func= orig_item->with_sum_func; @@ -8874,7 +8826,7 @@ void Item_cache_wrapper::print(String *str, enum_query_type query_type) bool Item_cache_wrapper::fix_fields(THD *thd __attribute__((unused)), Item **it __attribute__((unused))) { - DBUG_ASSERT(orig_item->fixed); + DBUG_ASSERT(orig_item->is_fixed()); DBUG_ASSERT(fixed); return FALSE; } @@ -9234,7 +9186,7 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference) /* view fild reference must be defined */ DBUG_ASSERT(*ref); /* (*ref)->check_cols() will be made in Item_direct_ref::fix_fields */ - if ((*ref)->fixed) + if ((*ref)->is_fixed()) { Item *ref_item= (*ref)->real_item(); if (ref_item->type() == Item::FIELD_ITEM) @@ -9520,7 +9472,6 @@ bool Item_default_value::fix_fields(THD *thd, Item **items) if (arg->fix_fields_if_needed(thd, &arg)) goto error; - real_arg= arg->real_item(); if (real_arg->type() != FIELD_ITEM) { @@ -9736,7 +9687,7 @@ bool Item_insert_value::fix_fields(THD *thd, Item **items) { DBUG_ASSERT(fixed == 0); /* We should only check that arg is in first table */ - if (!arg->fixed) + if (!arg->is_fixed()) { bool res; TABLE_LIST *orig_next_table= context->last_name_resolution_table; @@ -9948,7 +9899,7 @@ void Item_trigger_field::cleanup() Since special nature of Item_trigger_field we should not do most of things from Item_field::cleanup() or Item_ident::cleanup() here. */ - Item::cleanup(); + Item_fixed_hybrid::cleanup(); } @@ -10138,7 +10089,6 @@ bool Item_cache_int::cache_value() String *Item_cache_int::val_str(String *str) { - DBUG_ASSERT(fixed == 1); if (!has_value()) return NULL; str->set_int(value, unsigned_flag, default_charset()); @@ -10148,7 +10098,6 @@ String *Item_cache_int::val_str(String *str) my_decimal *Item_cache_int::val_decimal(my_decimal *decimal_val) { - DBUG_ASSERT(fixed == 1); if (!has_value()) return NULL; int2my_decimal(E_DEC_FATAL_ERROR, value, unsigned_flag, decimal_val); @@ -10157,7 +10106,6 @@ my_decimal *Item_cache_int::val_decimal(my_decimal *decimal_val) double Item_cache_int::val_real() { - DBUG_ASSERT(fixed == 1); if (!has_value()) return 0.0; return (double) value; @@ -10165,7 +10113,6 @@ double Item_cache_int::val_real() longlong Item_cache_int::val_int() { - DBUG_ASSERT(fixed == 1); if (!has_value()) return 0; return value; @@ -10207,7 +10154,6 @@ Item_cache_temporal::Item_cache_temporal(THD *thd, const Type_handler *handler) longlong Item_cache_temporal::val_datetime_packed() { - DBUG_ASSERT(fixed == 1); if (Item_cache_temporal::field_type() == MYSQL_TYPE_TIME) return Item::val_datetime_packed(); // TIME-to-DATETIME conversion needed if ((!value_cached && !cache_value()) || null_value) @@ -10221,7 +10167,6 @@ longlong Item_cache_temporal::val_datetime_packed() longlong Item_cache_temporal::val_time_packed() { - DBUG_ASSERT(fixed == 1); if (Item_cache_temporal::field_type() != MYSQL_TYPE_TIME) return Item::val_time_packed(); // DATETIME-to-TIME conversion needed if ((!value_cached && !cache_value()) || null_value) @@ -10235,7 +10180,6 @@ longlong Item_cache_temporal::val_time_packed() String *Item_cache_temporal::val_str(String *str) { - DBUG_ASSERT(fixed == 1); if (!has_value()) { null_value= true; @@ -10247,7 +10191,6 @@ String *Item_cache_temporal::val_str(String *str) my_decimal *Item_cache_temporal::val_decimal(my_decimal *decimal_value) { - DBUG_ASSERT(fixed == 1); if ((!value_cached && !cache_value()) || null_value) { null_value= true; @@ -10259,7 +10202,6 @@ my_decimal *Item_cache_temporal::val_decimal(my_decimal *decimal_value) longlong Item_cache_temporal::val_int() { - DBUG_ASSERT(fixed == 1); if ((!value_cached && !cache_value()) || null_value) { null_value= true; @@ -10271,7 +10213,6 @@ longlong Item_cache_temporal::val_int() double Item_cache_temporal::val_real() { - DBUG_ASSERT(fixed == 1); if ((!value_cached && !cache_value()) || null_value) { null_value= true; @@ -10395,7 +10336,6 @@ bool Item_cache_real::cache_value() double Item_cache_real::val_real() { - DBUG_ASSERT(fixed == 1); if (!has_value()) return 0.0; return value; @@ -10403,7 +10343,6 @@ double Item_cache_real::val_real() longlong Item_cache_real::val_int() { - DBUG_ASSERT(fixed == 1); if (!has_value()) return 0; return (longlong) rint(value); @@ -10412,7 +10351,6 @@ longlong Item_cache_real::val_int() String* Item_cache_real::val_str(String *str) { - DBUG_ASSERT(fixed == 1); if (!has_value()) return NULL; str->set_real(value, decimals, default_charset()); @@ -10422,7 +10360,6 @@ String* Item_cache_real::val_str(String *str) my_decimal *Item_cache_real::val_decimal(my_decimal *decimal_val) { - DBUG_ASSERT(fixed == 1); if (!has_value()) return NULL; double2my_decimal(E_DEC_FATAL_ERROR, value, decimal_val); @@ -10457,7 +10394,6 @@ bool Item_cache_decimal::cache_value() double Item_cache_decimal::val_real() { - DBUG_ASSERT(fixed); double res; if (!has_value()) return 0.0; @@ -10467,7 +10403,6 @@ double Item_cache_decimal::val_real() longlong Item_cache_decimal::val_int() { - DBUG_ASSERT(fixed); longlong res; if (!has_value()) return 0; @@ -10477,7 +10412,6 @@ longlong Item_cache_decimal::val_int() String* Item_cache_decimal::val_str(String *str) { - DBUG_ASSERT(fixed); if (!has_value()) return NULL; my_decimal_round(E_DEC_FATAL_ERROR, &decimal_value, decimals, FALSE, @@ -10488,7 +10422,6 @@ String* Item_cache_decimal::val_str(String *str) my_decimal *Item_cache_decimal::val_decimal(my_decimal *val) { - DBUG_ASSERT(fixed); if (!has_value()) return NULL; return &decimal_value; @@ -10540,7 +10473,6 @@ bool Item_cache_str::cache_value() double Item_cache_str::val_real() { - DBUG_ASSERT(fixed == 1); if (!has_value()) return 0.0; return value ? double_from_string_with_check(value) : 0.0; @@ -10549,7 +10481,6 @@ double Item_cache_str::val_real() longlong Item_cache_str::val_int() { - DBUG_ASSERT(fixed == 1); if (!has_value()) return 0; return value ? longlong_from_string_with_check(value) : 0; @@ -10558,7 +10489,6 @@ longlong Item_cache_str::val_int() String* Item_cache_str::val_str(String *str) { - DBUG_ASSERT(fixed == 1); if (!has_value()) return 0; return value; @@ -10567,7 +10497,6 @@ String* Item_cache_str::val_str(String *str) my_decimal *Item_cache_str::val_decimal(my_decimal *decimal_val) { - DBUG_ASSERT(fixed == 1); if (!has_value()) return NULL; return value ? decimal_from_string_with_check(decimal_val, value) : 0; @@ -10760,7 +10689,7 @@ bool Item_type_holder::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) void Item_result_field::cleanup() { DBUG_ENTER("Item_result_field::cleanup()"); - Item::cleanup(); + Item_fixed_hybrid::cleanup(); result_field= 0; DBUG_VOID_RETURN; } diff --git a/sql/item.h b/sql/item.h index 94f1f6abdb4..ee3dc7edd70 100644 --- a/sql/item.h +++ b/sql/item.h @@ -770,6 +770,7 @@ protected: */ Field *tmp_table_field_from_field_type(TABLE *table) { + DBUG_ASSERT(is_fixed()); const Type_handler *h= type_handler()->type_handler_for_tmp_table(this); return h->make_and_init_table_field(&name, Record_addr(maybe_null), *this, table); @@ -800,21 +801,21 @@ protected: /* Helper methods, to get an Item value from another Item */ double val_real_from_item(Item *item) { - DBUG_ASSERT(fixed == 1); + DBUG_ASSERT(is_fixed()); double value= item->val_real(); null_value= item->null_value; return value; } longlong val_int_from_item(Item *item) { - DBUG_ASSERT(fixed == 1); + DBUG_ASSERT(is_fixed()); longlong value= item->val_int(); null_value= item->null_value; return value; } String *val_str_from_item(Item *item, String *str) { - DBUG_ASSERT(fixed == 1); + DBUG_ASSERT(is_fixed()); String *res= item->val_str(str); if (res) res->set_charset(collation.collation); @@ -824,7 +825,7 @@ protected: } my_decimal *val_decimal_from_item(Item *item, my_decimal *decimal_value) { - DBUG_ASSERT(fixed == 1); + DBUG_ASSERT(is_fixed()); my_decimal *value= item->val_decimal(decimal_value); if ((null_value= item->null_value)) value= NULL; @@ -875,7 +876,6 @@ public: True if any item except Item_sum contains a field. Set during parsing. */ bool with_field; - bool fixed; /* If item fixed with fix_fields */ bool is_autogenerated_name; /* indicate was name of this Item autogenerated or set by user */ // alloc & destruct is done as start of select on THD::mem_root @@ -905,7 +905,7 @@ public: bool fix_fields_if_needed(THD *thd, Item **ref) { - return fixed ? false : fix_fields(thd, ref); + return is_fixed() ? false : fix_fields(thd, ref); } bool fix_fields_if_needed_for_scalar(THD *thd, Item **ref) { @@ -919,7 +919,27 @@ public: { return fix_fields_if_needed_for_scalar(thd, ref); } - virtual bool fix_fields(THD *, Item **); + /* + By default we assume that an Item is fixed by the contstructor. + */ + virtual bool fix_fields(THD *, Item **) + { + /* + This should not normally be called, because usually before + fix_fields() we check is_fixed() to be false. + But historically we allow fix_fields() to be called for Items + who return basic_const_item()==true. + */ + DBUG_ASSERT(is_fixed()); + DBUG_ASSERT(basic_const_item()); + return false; + } + virtual bool is_fixed() const { return true; } + virtual void unfix_fields() + { + DBUG_ASSERT(0); + } + /* Fix after some tables has been pulled out. Basically re-calculate all attributes that are dependent on the tables. @@ -939,7 +959,10 @@ public: but rather uses intermediate type conversion items. Then the method is supposed to be applied recursively. */ - virtual inline void quick_fix_field() { fixed= 1; } + virtual void quick_fix_field() + { + DBUG_ASSERT(0); + } bool save_in_value(struct st_value *value) { @@ -1335,7 +1358,7 @@ public: longlong val_int_from_date(); longlong val_int_from_real() { - DBUG_ASSERT(fixed == 1); + DBUG_ASSERT(is_fixed()); return Converter_double_to_longlong_with_warn(val_real(), false).result(); } longlong val_int_from_str(int *error); @@ -2127,13 +2150,13 @@ public: /* Return TRUE if the item points to a column of an outer-joined table. */ - virtual bool is_outer_field() const { DBUG_ASSERT(fixed); return FALSE; } + virtual bool is_outer_field() const { DBUG_ASSERT(is_fixed()); return FALSE; } /** Checks if this item or any of its decendents contains a subquery. This is a replacement of the former Item::has_subquery() and Item::with_subselect. */ - virtual bool with_subquery() const { DBUG_ASSERT(fixed); return false; } + virtual bool with_subquery() const { DBUG_ASSERT(is_fixed()); return false; } Item* set_expr_cache(THD *thd); @@ -2448,6 +2471,33 @@ public: class Item_string; +class Item_fixed_hybrid: public Item +{ +public: + bool fixed; // If item was fixed with fix_fields +public: + Item_fixed_hybrid(THD *thd): Item(thd), fixed(false) + { } + Item_fixed_hybrid(THD *thd, Item_fixed_hybrid *item) + :Item(thd, item), fixed(item->fixed) + { } + bool fix_fields(THD *thd, Item **ref) + { + DBUG_ASSERT(!fixed); + fixed= true; + return false; + } + void cleanup() + { + Item::cleanup(); + fixed= false; + } + void quick_fix_field() { fixed= true; } + void unfix_fields() { fixed= false; } + bool is_fixed() const { return fixed; } +}; + + /** A common class for Item_basic_constant and Item_param */ @@ -2543,27 +2593,13 @@ class Item_basic_constant :public Item_basic_value { public: Item_basic_constant(THD *thd): Item_basic_value(thd) {}; - bool check_vcol_func_processor(void *arg) { return FALSE;} + bool check_vcol_func_processor(void *arg) { return false; } virtual Item_basic_constant *make_string_literal_concat(THD *thd, const LEX_CSTRING *) { DBUG_ASSERT(0); return this; } - /* to prevent drop fixed flag (no need parent cleanup call) */ - void cleanup() - { - /* - Restore the original field name as it might not have been allocated - in the statement memory. If the name is auto generated, it must be - done again between subsequent executions of a prepared statement. - */ - if (orig_name) - { - name.str= orig_name; - name.length= strlen(orig_name); - } - } }; @@ -2574,7 +2610,7 @@ public: - CASE expression (Item_case_expr); *****************************************************************************/ -class Item_sp_variable :public Item +class Item_sp_variable :public Item_fixed_hybrid { protected: /* @@ -2882,7 +2918,7 @@ inline enum Item::Type Item_case_expr::type() const extract a common base with class Item_ref, too. */ -class Item_name_const : public Item +class Item_name_const : public Item_fixed_hybrid { Item *value_item; Item *name_item; @@ -2938,12 +2974,23 @@ public: { return get_item_copy<Item_name_const>(thd, this); } }; -class Item_num: public Item_basic_constant + +class Item_literal: public Item_basic_constant +{ +public: + Item_literal(THD *thd): Item_basic_constant(thd) + { } + bool check_partition_func_processor(void *int_arg) { return false;} + bool const_item() const { return true; } + bool basic_const_item() const { return true; } +}; + + +class Item_num: public Item_literal { public: - Item_num(THD *thd): Item_basic_constant(thd) { collation.set_numeric(); } + Item_num(THD *thd): Item_literal(thd) { collation.set_numeric(); } Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); - bool check_partition_func_processor(void *int_arg) { return FALSE;} bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { return type_handler()->Item_get_date(this, ltime, fuzzydate); @@ -2955,14 +3002,14 @@ public: class st_select_lex; -class Item_result_field :public Item /* Item with result field */ +class Item_result_field :public Item_fixed_hybrid /* Item with result field */ { public: Field *result_field; /* Save result here */ - Item_result_field(THD *thd): Item(thd), result_field(0) {} + Item_result_field(THD *thd): Item_fixed_hybrid(thd), result_field(0) {} // Constructor used for Item_sum/Item_cond_and/or (see Item comment) Item_result_field(THD *thd, Item_result_field *item): - Item(thd, item), result_field(item->result_field) + Item_fixed_hybrid(thd, item), result_field(item->result_field) {} ~Item_result_field() {} /* Required with gcc 2.95 */ Field *get_tmp_table_field() { return result_field; } @@ -3398,7 +3445,6 @@ public: max_length= 0; name.str= name_par ? name_par : "NULL"; name.length= strlen(name.str); - fixed= 1; collation.set(cs, DERIVATION_IGNORABLE, MY_REPERTOIRE_ASCII); } enum Type type() const { return NULL_ITEM; } @@ -3538,10 +3584,16 @@ class Item_param :public Item_basic_value, enum Type item_type; + bool has_valid_state() const + { + return item_type == PARAM_ITEM || state > NO_VALUE; + } + void fix_type(Type type) { item_type= type; - fixed= true; + DBUG_ASSERT(is_fixed()); + DBUG_ASSERT(has_valid_state()); } void fix_temporal(uint32 max_length_arg, uint decimals_arg); @@ -3666,13 +3718,13 @@ public: enum Type type() const { - DBUG_ASSERT(fixed || state == NO_VALUE); + DBUG_ASSERT(has_valid_state()); return item_type; } bool is_order_clause_position() const { - DBUG_ASSERT(fixed || state == NO_VALUE); + DBUG_ASSERT(has_valid_state()); return state == SHORT_DATA_VALUE && type_handler()->is_order_clause_position_type(); } @@ -3770,8 +3822,16 @@ public: so no one will use parameters value in fix_fields still parameter is constant during execution. */ + bool const_item() const + { + DBUG_ASSERT(has_valid_state()); + return state != NO_VALUE; + } virtual table_map used_tables() const - { return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; } + { + DBUG_ASSERT(has_valid_state()); + return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; + } virtual void print(String *str, enum_query_type query_type); bool is_null() { DBUG_ASSERT(state != NO_VALUE); return state == NULL_VALUE; } @@ -3844,26 +3904,24 @@ public: longlong value; Item_int(THD *thd, int32 i,size_t length= MY_INT32_NUM_DECIMAL_DIGITS): Item_num(thd), value((longlong) i) - { max_length=(uint32)length; fixed= 1; } + { max_length=(uint32)length; } Item_int(THD *thd, longlong i,size_t length= MY_INT64_NUM_DECIMAL_DIGITS): Item_num(thd), value(i) - { max_length=(uint32)length; fixed= 1; } + { max_length=(uint32)length; } Item_int(THD *thd, ulonglong i, size_t length= MY_INT64_NUM_DECIMAL_DIGITS): Item_num(thd), value((longlong)i) - { max_length=(uint32)length; fixed= 1; unsigned_flag= 1; } + { max_length=(uint32)length; unsigned_flag= 1; } Item_int(THD *thd, const char *str_arg,longlong i,size_t length): Item_num(thd), value(i) { max_length=(uint32)length; name.str= str_arg; name.length= safe_strlen(name.str); - fixed= 1; } Item_int(THD *thd, const char *str_arg,longlong i,size_t length, bool flag): Item_num(thd), value(i) { max_length=(uint32)length; name.str= str_arg; name.length= safe_strlen(name.str); - fixed= 1; unsigned_flag= flag; } Item_int(THD *thd, const char *str_arg, size_t length=64); @@ -3872,13 +3930,12 @@ public: { return type_handler_long_or_longlong(); } Field *create_field_for_create_select(TABLE *table) { return tmp_table_field_from_field_type(table); } - longlong val_int() { DBUG_ASSERT(fixed == 1); return value; } - longlong val_int_min() const { DBUG_ASSERT(fixed == 1); return value; } - double val_real() { DBUG_ASSERT(fixed == 1); return (double) value; } + longlong val_int() { return value; } + longlong val_int_min() const { return value; } + double val_real() { return (double) value; } my_decimal *val_decimal(my_decimal *); String *val_str(String*); int save_in_field(Field *field, bool no_conversions); - bool basic_const_item() const { return 1; } bool is_order_clause_position() const { return true; } Item *clone_item(THD *thd); virtual void print(String *str, enum_query_type query_type); @@ -3909,6 +3966,13 @@ public: { return &type_handler_bool; } const Type_handler *fixed_type_handler() const { return &type_handler_bool; } + void quick_fix_field() + { + /* + We can get here when Item_bool is created instead of a constant + predicate at various condition optimization stages in sql_select. + */ + } }; @@ -3918,8 +3982,7 @@ public: Item_uint(THD *thd, const char *str_arg, size_t length); Item_uint(THD *thd, ulonglong i): Item_int(thd, i, 10) {} Item_uint(THD *thd, const char *str_arg, longlong i, uint length); - double val_real() - { DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); } + double val_real() { return ulonglong2double((ulonglong)value); } String *val_str(String*); Item *clone_item(THD *thd); virtual void print(String *str, enum_query_type query_type); @@ -3970,7 +4033,6 @@ public: String *val_str(String*); my_decimal *val_decimal(my_decimal *val) { return &decimal_value; } int save_in_field(Field *field, bool no_conversions); - bool basic_const_item() const { return 1; } Item *clone_item(THD *thd); virtual void print(String *str, enum_query_type query_type); Item *neg(THD *thd); @@ -3995,21 +4057,18 @@ public: name.length= safe_strlen(str); decimals=(uint8) decimal_par; max_length= length; - fixed= 1; } Item_float(THD *thd, double value_par, uint decimal_par): Item_num(thd), presentation(0), value(value_par) { decimals= (uint8) decimal_par; - fixed= 1; } int save_in_field(Field *field, bool no_conversions); enum Type type() const { return REAL_ITEM; } const Type_handler *type_handler() const { return &type_handler_double; } - double val_real() { DBUG_ASSERT(fixed == 1); return value; } + double val_real() { return value; } longlong val_int() { - DBUG_ASSERT(fixed == 1); if (value <= (double) LONGLONG_MIN) { return LONGLONG_MIN; @@ -4022,7 +4081,6 @@ public: } String *val_str(String*); my_decimal *val_decimal(my_decimal *); - bool basic_const_item() const { return 1; } Item *clone_item(THD *thd); Item *neg(THD *thd); virtual void print(String *str, enum_query_type query_type); @@ -4054,14 +4112,12 @@ public: }; -class Item_string :public Item_basic_constant +class Item_string :public Item_literal { protected: void fix_from_value(Derivation dv, const Metadata metadata) { fix_charset_and_length(str_value.charset(), dv, metadata); - // it is constant => can be used without fix_fields (and frequently used) - fixed= 1; } void fix_and_set_name_from_value(THD *thd, Derivation dv, const Metadata metadata) @@ -4072,41 +4128,41 @@ protected: protected: /* Just create an item and do not fill string representation */ Item_string(THD *thd, CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE): - Item_basic_constant(thd) + Item_literal(thd) { collation.set(cs, dv); max_length= 0; set_name(thd, NULL, 0, system_charset_info); decimals= NOT_FIXED_DEC; - fixed= 1; } public: - Item_string(THD *thd, CHARSET_INFO *csi, const char *str_arg, uint length_arg): - Item_basic_constant(thd) + Item_string(THD *thd, CHARSET_INFO *csi, const char *str_arg, uint length_arg) + :Item_literal(thd) { collation.set(csi, DERIVATION_COERCIBLE); set_name(thd, NULL, 0, system_charset_info); decimals= NOT_FIXED_DEC; - fixed= 1; str_value.copy(str_arg, length_arg, csi); max_length= str_value.numchars() * csi->mbmaxlen; } // Constructors with the item name set from its value Item_string(THD *thd, const char *str, uint length, CHARSET_INFO *cs, - Derivation dv, uint repertoire): Item_basic_constant(thd) + Derivation dv, uint repertoire) + :Item_literal(thd) { str_value.set_or_copy_aligned(str, length, cs); fix_and_set_name_from_value(thd, dv, Metadata(&str_value, repertoire)); } Item_string(THD *thd, const char *str, size_t length, - CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE): - Item_basic_constant(thd) + CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE) + :Item_literal(thd) { str_value.set_or_copy_aligned(str, length, cs); fix_and_set_name_from_value(thd, dv, Metadata(&str_value)); } Item_string(THD *thd, const String *str, CHARSET_INFO *tocs, uint *conv_errors, - Derivation dv, uint repertoire): Item_basic_constant(thd) + Derivation dv, uint repertoire) + :Item_literal(thd) { if (str_value.copy(str, tocs, conv_errors)) str_value.set("", 0, tocs); // EOM ? @@ -4115,16 +4171,16 @@ public: } // Constructors with an externally provided item name Item_string(THD *thd, const char *name_par, const char *str, size_t length, - CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE): - Item_basic_constant(thd) + CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE) + :Item_literal(thd) { str_value.set_or_copy_aligned(str, length, cs); fix_from_value(dv, Metadata(&str_value)); set_name(thd, name_par,safe_strlen(name_par), system_charset_info); } Item_string(THD *thd, const char *name_par, const char *str, size_t length, - CHARSET_INFO *cs, Derivation dv, uint repertoire): - Item_basic_constant(thd) + CHARSET_INFO *cs, Derivation dv, uint repertoire) + :Item_literal(thd) { str_value.set_or_copy_aligned(str, length, cs); fix_from_value(dv, Metadata(&str_value, repertoire)); @@ -4139,7 +4195,6 @@ public: longlong val_int(); String *val_str(String*) { - DBUG_ASSERT(fixed == 1); return (String*) &str_value; } my_decimal *val_decimal(my_decimal *); @@ -4149,7 +4204,6 @@ public: } int save_in_field(Field *field, bool no_conversions); const Type_handler *type_handler() const { return &type_handler_varchar; } - bool basic_const_item() const { return 1; } bool eq(const Item *item, bool binary_cmp) const { return str_eq(&str_value, item, binary_cmp); @@ -4165,7 +4219,6 @@ public: max_length= str_value.numchars() * collation.collation->mbmaxlen; } virtual void print(String *str, enum_query_type query_type); - bool check_partition_func_processor(void *int_arg) {return FALSE;} /** Return TRUE if character-set-introducer was explicitly specified in the @@ -4408,17 +4461,17 @@ public: /** Item_hex_constant -- a common class for hex literals: X'HHHH' and 0xHHHH */ -class Item_hex_constant: public Item_basic_constant +class Item_hex_constant: public Item_literal { private: void hex_string_init(THD *thd, const char *str, size_t str_length); public: - Item_hex_constant(THD *thd): Item_basic_constant(thd) + Item_hex_constant(THD *thd): Item_literal(thd) { hex_string_init(thd, "", 0); } Item_hex_constant(THD *thd, const char *str, size_t str_length): - Item_basic_constant(thd) + Item_literal(thd) { hex_string_init(thd, str, str_length); } @@ -4428,15 +4481,13 @@ public: { return const_charset_converter(thd, tocs, true); } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool basic_const_item() const { return 1; } bool eq(const Item *item, bool binary_cmp) const { return item->basic_const_item() && item->type() == type() && item->cast_to_int_type_handler() == cast_to_int_type_handler() && str_value.bin_eq(&((Item_hex_constant*)item)->str_value); } - String *val_str(String*) { DBUG_ASSERT(fixed == 1); return &str_value; } + String *val_str(String*) { return &str_value; } bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { return type_handler()->Item_get_date(this, ltime, fuzzydate); @@ -4458,19 +4509,14 @@ public: uint decimal_precision() const; double val_real() { - DBUG_ASSERT(fixed == 1); return (double) (ulonglong) Item_hex_hybrid::val_int(); } longlong val_int() { - // following assert is redundant, because fixed=1 assigned in constructor - DBUG_ASSERT(fixed == 1); return longlong_from_hex_hybrid(str_value.ptr(), str_value.length()); } my_decimal *val_decimal(my_decimal *decimal_value) { - // following assert is redundant, because fixed=1 assigned in constructor - DBUG_ASSERT(fixed == 1); longlong value= Item_hex_hybrid::val_int(); int2my_decimal(E_DEC_FATAL_ERROR, value, TRUE, decimal_value); return decimal_value; @@ -4511,12 +4557,10 @@ public: Item_hex_constant(thd, str, str_length) {} longlong val_int() { - DBUG_ASSERT(fixed == 1); return longlong_from_string_with_check(&str_value); } double val_real() { - DBUG_ASSERT(fixed == 1); return double_from_string_with_check(&str_value); } my_decimal *val_decimal(my_decimal *decimal_value) @@ -4542,7 +4586,7 @@ public: }; -class Item_temporal_literal :public Item_basic_constant +class Item_temporal_literal :public Item_literal { protected: MYSQL_TIME cached_time; @@ -4552,26 +4596,22 @@ public: @param ltime DATE value. */ Item_temporal_literal(THD *thd, const MYSQL_TIME *ltime) - :Item_basic_constant(thd) + :Item_literal(thd) { collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII); decimals= 0; cached_time= *ltime; } Item_temporal_literal(THD *thd, const MYSQL_TIME *ltime, uint dec_arg): - Item_basic_constant(thd) + Item_literal(thd) { collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII); decimals= dec_arg; cached_time= *ltime; } - bool basic_const_item() const { return true; } - bool const_item() const { return true; } enum Type type() const { return DATE_ITEM; } bool eq(const Item *item, bool binary_cmp) const; - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool is_null() { return is_null_from_temporal(); } bool get_date_with_sql_mode(MYSQL_TIME *to); @@ -4598,7 +4638,6 @@ public: :Item_temporal_literal(thd, ltime) { max_length= MAX_DATE_WIDTH; - fixed= 1; /* If date has zero month or day, it can return NULL in case of NO_ZERO_DATE or NO_ZERO_IN_DATE. @@ -4627,7 +4666,6 @@ public: Item_temporal_literal(thd, ltime, dec_arg) { max_length= MIN_TIME_WIDTH + (decimals ? decimals + 1 : 0); - fixed= 1; } const Type_handler *type_handler() const { return &type_handler_time2; } void print(String *str, enum_query_type query_type); @@ -4648,7 +4686,6 @@ public: Item_temporal_literal(thd, ltime, dec_arg) { max_length= MAX_DATETIME_WIDTH + (decimals ? decimals + 1 : 0); - fixed= 1; // See the comment on maybe_null in Item_date_literal maybe_null= !ltime->month || !ltime->day; } @@ -5714,12 +5751,12 @@ protected: */ Item_copy(THD *thd, Item *i): Item(thd) { + DBUG_ASSERT(i->is_fixed()); item= i; null_value=maybe_null=item->maybe_null; Type_std_attributes::set(item); name= item->name; set_handler(item->type_handler()); - fixed= item->fixed; } public: @@ -6264,7 +6301,6 @@ public: value_cached(0), used_table_map(0) { - fixed= 1; maybe_null= 1; null_value= 1; } @@ -6276,7 +6312,6 @@ protected: value_cached(0), used_table_map(0) { - fixed= 1; maybe_null= 1; null_value= 1; } @@ -6672,7 +6707,7 @@ public: Type_handler_hybrid_field_type(item->real_type_handler()), enum_set_typelib(0) { - DBUG_ASSERT(item->fixed); + DBUG_ASSERT(item->is_fixed()); maybe_null= item->maybe_null; } Item_type_holder(THD *thd, diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 3034636dca3..152f5ba89be 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1299,7 +1299,7 @@ bool Item_in_optimizer::fix_left(THD *thd) cache->store(args[0]); cache->cache_value(); } - if (args[1]->fixed) + if (args[1]->is_fixed()) { /* to avoid overriding is called to update left expression */ used_tables_and_const_cache_join(args[1]); diff --git a/sql/item_func.cc b/sql/item_func.cc index 5567e733288..5f1860deb14 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -392,7 +392,7 @@ Item_func::quick_fix_field() { for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++) { - if (!(*arg)->fixed) + if (!(*arg)->is_fixed()) (*arg)->quick_fix_field(); } } @@ -5522,10 +5522,9 @@ bool Item_func_get_user_var::set_value(THD *thd, bool Item_user_var_as_out_param::fix_fields(THD *thd, Item **ref) { - DBUG_ASSERT(fixed == 0); + DBUG_ASSERT(!is_fixed()); DBUG_ASSERT(thd->lex->exchange); - if (Item::fix_fields(thd, ref) || - !(entry= get_variable(&thd->user_vars, &org_name, 1))) + if (!(entry= get_variable(&thd->user_vars, &org_name, 1))) return TRUE; entry->type= STRING_RESULT; /* diff --git a/sql/item_func.h b/sql/item_func.h index a6fcf8f4870..2de7fc69b59 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -2498,14 +2498,14 @@ public: in List<Item> and desire to place this code somewhere near other functions working with user variables. */ -class Item_user_var_as_out_param :public Item, +class Item_user_var_as_out_param :public Item_fixed_hybrid, public Load_data_outvar { LEX_CSTRING org_name; user_var_entry *entry; public: Item_user_var_as_out_param(THD *thd, const LEX_CSTRING *a) - :Item(thd) + :Item_fixed_hybrid(thd) { DBUG_ASSERT(a->length < UINT_MAX32); org_name= *a; diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 8101433abb5..ede118cc4f3 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -509,7 +509,7 @@ public: Item_geometry_func::fix_length_and_dec(); for (unsigned int i= 0; i < arg_count; ++i) { - if (args[i]->fixed && args[i]->field_type() != MYSQL_TYPE_GEOMETRY) + if (args[i]->is_fixed() && args[i]->field_type() != MYSQL_TYPE_GEOMETRY) { String str; args[i]->print(&str, QT_NO_DATA_EXPANSION); diff --git a/sql/item_row.cc b/sql/item_row.cc index 8233ba00f06..b7ded07440d 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -91,7 +91,7 @@ void Item_row::cleanup() { DBUG_ENTER("Item_row::cleanup"); - Item::cleanup(); + Item_fixed_hybrid::cleanup(); /* Reset to the original values */ used_tables_and_const_cache_init(); with_null= 0; diff --git a/sql/item_row.h b/sql/item_row.h index 73b198625ce..c0d64aba230 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -33,7 +33,7 @@ Item which stores (x,y,...) and ROW(x,y,...). Note that this can be recursive: ((x,y),(z,t)) is a ROW of ROWs. */ -class Item_row: public Item, +class Item_row: public Item_fixed_hybrid, private Item_args, private Used_tables_and_const_cache, private With_subquery_cache @@ -45,11 +45,13 @@ class Item_row: public Item, */ bool with_null; public: - Item_row(THD *thd, List<Item> &list): - Item(thd), Item_args(thd, list), not_null_tables_cache(0), with_null(0) + Item_row(THD *thd, List<Item> &list) + :Item_fixed_hybrid(thd), Item_args(thd, list), + not_null_tables_cache(0), with_null(0) { } - Item_row(THD *thd, Item_row *row): - Item(thd), Item_args(thd, static_cast<Item_args*>(row)), Used_tables_and_const_cache(), + Item_row(THD *thd, Item_row *row) + :Item_fixed_hybrid(thd), Item_args(thd, static_cast<Item_args*>(row)), + Used_tables_and_const_cache(), not_null_tables_cache(0), with_null(0) { } diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 048ec6a4fa1..ffb2bb4ff11 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -2028,7 +2028,7 @@ bool Item_in_subselect::fix_having(Item *having, SELECT_LEX *select_lex) { bool fix_res= 0; DBUG_ASSERT(thd); - if (!having->fixed) + if (!having->is_fixed()) { select_lex->having_fix_field= 1; fix_res= having->fix_fields(thd, 0); @@ -2365,9 +2365,9 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join, Item *item_having_part2= 0; for (uint i= 0; i < cols_num; i++) { - DBUG_ASSERT((left_expr->fixed && + DBUG_ASSERT((left_expr->is_fixed() && - select_lex->ref_pointer_array[i]->fixed) || + select_lex->ref_pointer_array[i]->is_fixed()) || (select_lex->ref_pointer_array[i]->type() == REF_ITEM && ((Item_ref*)(select_lex->ref_pointer_array[i]))->ref_type() == Item_ref::OUTER_REF)); @@ -2436,8 +2436,8 @@ Item_in_subselect::create_row_in_to_exists_cond(JOIN * join, for (uint i= 0; i < cols_num; i++) { Item *item, *item_isnull; - DBUG_ASSERT((left_expr->fixed && - select_lex->ref_pointer_array[i]->fixed) || + DBUG_ASSERT((left_expr->is_fixed() && + select_lex->ref_pointer_array[i]->is_fixed()) || (select_lex->ref_pointer_array[i]->type() == REF_ITEM && ((Item_ref*)(select_lex->ref_pointer_array[i]))->ref_type() == Item_ref::OUTER_REF)); diff --git a/sql/item_sum.cc b/sql/item_sum.cc index c206e71ed9a..e72aa80849f 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -890,7 +890,7 @@ bool Aggregator_distinct::setup(THD *thd) item_sum->null_value= item_sum->maybe_null= 1; item_sum->quick_group= 0; - DBUG_ASSERT(item_sum->get_arg(0)->fixed); + DBUG_ASSERT(item_sum->get_arg(0)->is_fixed()); arg= item_sum->get_arg(0); if (arg->const_item()) diff --git a/sql/item_sum.h b/sql/item_sum.h index b0dea818f01..985be4fdeae 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -1385,7 +1385,6 @@ public: decimals= item->decimals; max_length= item->max_length; unsigned_flag= item->unsigned_flag; - fixed= true; } table_map used_tables() const { return (table_map) 1L; } Field *create_tmp_field_ex(TABLE *table, Tmp_field_src *src, diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 7f7bb07d279..5051c26f4a3 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -822,7 +822,7 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs) { DBUG_ENTER("subquery_types_allow_materialization"); - DBUG_ASSERT(in_subs->left_expr->fixed); + DBUG_ASSERT(in_subs->left_expr->is_fixed()); List_iterator<Item> it(in_subs->unit->first_select()->item_list); uint elements= in_subs->unit->first_select()->item_list.elements; @@ -898,7 +898,7 @@ bool make_in_exists_conversion(THD *thd, JOIN *join, Item_in_subselect *item) /* We're going to finalize IN->EXISTS conversion. Normally, IN->EXISTS conversion takes place inside the - Item_subselect::fix_fields() call, where item_subselect->fixed==FALSE (as + Item_subselect::fix_fields() call, where item_subselect->is_fixed()==FALSE (as fix_fields() haven't finished yet) and item_subselect->changed==FALSE (as the conversion haven't been finalized) @@ -925,7 +925,7 @@ bool make_in_exists_conversion(THD *thd, JOIN *join, Item_in_subselect *item) item->fixed= 1; Item *substitute= item->substitution; - bool do_fix_fields= !item->substitution->fixed; + bool do_fix_fields= !item->substitution->is_fixed(); /* The Item_subselect has already been wrapped with Item_in_optimizer, so we should search for item->optimizer, not 'item'. @@ -1261,7 +1261,7 @@ bool convert_join_subqueries_to_semijoins(JOIN *join) in_subq->fixed= 1; Item *substitute= in_subq->substitution; - bool do_fix_fields= !in_subq->substitution->fixed; + bool do_fix_fields= !in_subq->substitution->is_fixed(); Item **tree= (in_subq->emb_on_expr_nest == NO_JOIN_NEST)? &join->conds : &(in_subq->emb_on_expr_nest->on_expr); Item *replace_me= in_subq->original_item(); @@ -1734,7 +1734,7 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) subq_lex->ref_pointer_array[i]); if (!item_eq) DBUG_RETURN(TRUE); - DBUG_ASSERT(subq_pred->left_expr->element_index(i)->fixed); + DBUG_ASSERT(subq_pred->left_expr->element_index(i)->is_fixed()); if (subq_pred->left_expr_orig->element_index(i) != subq_pred->left_expr->element_index(i)) thd->change_item_tree(item_eq->arguments(), @@ -6038,8 +6038,8 @@ bool JOIN::choose_subquery_plan(table_map join_tables) /* A strategy must be chosen earlier. */ DBUG_ASSERT(in_subs->has_strategy()); DBUG_ASSERT(in_to_exists_where || in_to_exists_having); - DBUG_ASSERT(!in_to_exists_where || in_to_exists_where->fixed); - DBUG_ASSERT(!in_to_exists_having || in_to_exists_having->fixed); + DBUG_ASSERT(!in_to_exists_where || in_to_exists_where->is_fixed()); + DBUG_ASSERT(!in_to_exists_having || in_to_exists_having->is_fixed()); /* The original QEP of the subquery. */ Join_plan_state save_qep(table_count); diff --git a/sql/opt_table_elimination.cc b/sql/opt_table_elimination.cc index ef9b07cca47..4b22aeaf871 100644 --- a/sql/opt_table_elimination.cc +++ b/sql/opt_table_elimination.cc @@ -622,7 +622,7 @@ void eliminate_tables(JOIN *join) List_iterator<Item> val_it(thd->lex->value_list); while ((item= val_it++)) { - DBUG_ASSERT(item->fixed); + DBUG_ASSERT(item->is_fixed()); used_tables |= item->used_tables(); } } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index ea3ddcf617d..ceb2055dc16 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1920,7 +1920,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, for (arg_no= 0; arg_no < argcount; arg_no++) { /* Arguments must be fixed in Item_func_sp::fix_fields */ - DBUG_ASSERT(argp[arg_no]->fixed); + DBUG_ASSERT(argp[arg_no]->is_fixed()); if ((err_status= (*func_ctx)->set_parameter(thd, arg_no, &(argp[arg_no])))) goto err_with_cleanup; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 00f45b1edf1..3ca223f3dd6 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8651,7 +8651,7 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order) Item_func_match *ifm; while ((ifm=li++)) - if (unlikely(!ifm->fixed)) + if (unlikely(!ifm->is_fixed())) /* it mean that clause where was FT function was removed, so we have to remove the function from the list. @@ -8886,7 +8886,7 @@ void unfix_fields(List<Item> &fields) List_iterator<Item> li(fields); Item *item; while ((item= li++)) - item->fixed= 0; + item->unfix_fields(); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 652949201f0..470e2b3e1cf 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1592,7 +1592,7 @@ JOIN::optimize_inner() { /* Item_cond_and can't be fixed after creation, so we do not check - conds->fixed + conds->is_fixed() */ conds->fix_fields(thd, &conds); conds->change_ref_to_fields(thd, tables_list); @@ -10676,7 +10676,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) Yet attributes of the just built condition are not needed. Thus we call sel->cond->quick_fix_field for safety. */ - if (sel->cond && !sel->cond->fixed) + if (sel->cond && !sel->cond->is_fixed()) sel->cond->quick_fix_field(); if (sel->test_quick_select(thd, tab->keys, @@ -15266,7 +15266,7 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top, conds= and_conds(join->thd, conds, table->on_expr); conds->top_level_item(); /* conds is always a new item as both cond and on_expr existed */ - DBUG_ASSERT(!conds->fixed); + DBUG_ASSERT(!conds->is_fixed()); conds->fix_fields(join->thd, &conds); } else @@ -16422,7 +16422,7 @@ Item_func_isnull::remove_eq_conds(THD *thd, Item::cond_result *cond_value, cond= new_cond; /* Item_func_eq can't be fixed after creation so we do not check - cond->fixed, also it do not need tables so we use 0 as second + cond->is_fixed(), also it do not need tables so we use 0 as second argument. */ cond->fix_fields(thd, &cond); @@ -17981,7 +17981,7 @@ bool Virtual_tmp_table::sp_set_all_fields_from_item_list(THD *thd, bool Virtual_tmp_table::sp_set_all_fields_from_item(THD *thd, Item *value) { - DBUG_ASSERT(value->fixed); + DBUG_ASSERT(value->is_fixed()); DBUG_ASSERT(value->cols() == s->fields); for (uint i= 0; i < value->cols(); i++) { @@ -22948,7 +22948,7 @@ find_order_in_list(THD *thd, Ref_ptr_array ref_pointer_array, inspite of that fix_fields() calls find_item_in_list() one more time. - We check order_item->fixed because Item_func_group_concat can put + We check order_item->is_fixed() because Item_func_group_concat can put arguments for which fix_fields already was called. */ if (order_item->fix_fields_if_needed_for_order_by(thd, order->item) || @@ -24234,7 +24234,7 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab) } if (unlikely(thd->is_fatal_error)) DBUG_RETURN(TRUE); - if (!cond->fixed) + if (!cond->is_fixed()) { Item *tmp_item= (Item*) cond; cond->fix_fields(thd, &tmp_item); @@ -25611,7 +25611,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, for such queries, we'll get here before having called subquery_expr->fix_fields(), which will cause failure to */ - if (unit->item && !unit->item->fixed) + if (unit->item && !unit->item->is_fixed()) { Item *ref= unit->item; if (unit->item->fix_fields(thd, &ref)) diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc index a92d40f6bb3..83abaebd4fd 100644 --- a/sql/sql_signal.cc +++ b/sql/sql_signal.cc @@ -323,7 +323,7 @@ end: set= m_set_signal_information.m_item[i]; if (set) { - if (set->fixed) + if (set->is_fixed()) set->cleanup(); } } diff --git a/sql/sql_tvc.cc b/sql/sql_tvc.cc index 188ba8c4629..f81fe173c7d 100644 --- a/sql/sql_tvc.cc +++ b/sql/sql_tvc.cc @@ -173,7 +173,7 @@ bool get_type_attributes_for_tvc(THD *thd, Item *item; for (uint holder_pos= 0 ; (item= it++); holder_pos++) { - DBUG_ASSERT(item->fixed); + DBUG_ASSERT(item->is_fixed()); holders[holder_pos].add_argument(item); } } @@ -251,7 +251,6 @@ bool table_value_constr::prepare(THD *thd, SELECT_LEX *sl, holders[pos].type_handler(), &holders[pos]/*Type_all_attributes*/, holders[pos].get_maybe_null()); - new_holder->fix_fields(thd, 0); sl->item_list.push_back(new_holder); } diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 1bedec8af7a..8eca6593e4e 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -4919,7 +4919,7 @@ uint Type_handler_string_result::Item_temporal_precision(Item *item, StringBuffer<64> buf; String *tmp; MYSQL_TIME_STATUS status; - DBUG_ASSERT(item->fixed); + DBUG_ASSERT(item->is_fixed()); if ((tmp= item->val_str(&buf)) && !(is_time ? str_to_time(tmp->charset(), tmp->ptr(), tmp->length(), diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 266f221ca78..761349c0a95 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -752,11 +752,11 @@ bool st_select_lex_unit::join_union_type_attributes(THD *thd_arg, been fixed yet. An Item_type_holder must be created based on a fixed Item, so use the inner Item instead. */ - DBUG_ASSERT(item_tmp->fixed || + DBUG_ASSERT(item_tmp->is_fixed() || (item_tmp->type() == Item::REF_ITEM && ((Item_ref *)(item_tmp))->ref_type() == Item_ref::OUTER_REF)); - if (!item_tmp->fixed) + if (!item_tmp->is_fixed()) item_tmp= item_tmp->real_item(); holders[holder_pos].add_argument(item_tmp); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b53a89ecc94..0043f6495e7 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -14702,11 +14702,6 @@ hex_or_bin_String: $1.length); if (unlikely(tmp == NULL)) MYSQL_YYABORT; - /* - it is OK only emulate fix_fields, because we need only - value of constant - */ - tmp->quick_fix_field(); $$= tmp->val_str((String*) 0); } | HEX_STRING @@ -14715,7 +14710,6 @@ hex_or_bin_String: $1.length); if (unlikely(tmp == NULL)) MYSQL_YYABORT; - tmp->quick_fix_field(); $$= tmp->val_str((String*) 0); } | BIN_NUM @@ -14728,7 +14722,6 @@ hex_or_bin_String: it is OK only emulate fix_fields, because we need only value of constant */ - tmp->quick_fix_field(); $$= tmp->val_str((String*) 0); } ; diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index f0db33f67ae..d9c3ee22faf 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -14864,11 +14864,6 @@ hex_or_bin_String: $1.length); if (unlikely(tmp == NULL)) MYSQL_YYABORT; - /* - it is OK only emulate fix_fields, because we need only - value of constant - */ - tmp->quick_fix_field(); $$= tmp->val_str((String*) 0); } | HEX_STRING @@ -14877,7 +14872,6 @@ hex_or_bin_String: $1.length); if (unlikely(tmp == NULL)) MYSQL_YYABORT; - tmp->quick_fix_field(); $$= tmp->val_str((String*) 0); } | BIN_NUM @@ -14890,7 +14884,6 @@ hex_or_bin_String: it is OK only emulate fix_fields, because we need only value of constant */ - tmp->quick_fix_field(); $$= tmp->val_str((String*) 0); } ; diff --git a/sql/table.cc b/sql/table.cc index fc53ac9d821..71aea2d3c3b 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2919,7 +2919,7 @@ bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol) DBUG_RETURN(0); vcol->expr->walk(&Item::cleanup_excluding_fields_processor, 0, 0); - DBUG_ASSERT(!vcol->expr->fixed); + DBUG_ASSERT(!vcol->expr->is_fixed()); DBUG_RETURN(fix_vcol_expr(thd, vcol)); } @@ -2974,7 +2974,7 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, DBUG_PRINT("info", ("vcol: %p", vcol)); DBUG_ASSERT(func_expr); - if (func_expr->fixed) + if (func_expr->is_fixed()) DBUG_RETURN(0); // nothing to do if (fix_vcol_expr(thd, vcol)) @@ -4913,7 +4913,7 @@ bool TABLE_LIST::prep_where(THD *thd, Item **conds, if (where) { - if (where->fixed) + if (where->is_fixed()) where->update_used_tables(); else if (where->fix_fields(thd, &where)) DBUG_RETURN(TRUE); @@ -5926,13 +5926,13 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref, ('mysql_schema_table' function). So we can return directly the field. This case happens only for 'show & where' commands. */ - DBUG_ASSERT(field && field->fixed); + DBUG_ASSERT(field && field->is_fixed()); DBUG_RETURN(field); } DBUG_ASSERT(field); thd->lex->current_select->no_wrap_view_item= TRUE; - if (!field->fixed) + if (!field->is_fixed()) { if (field->fix_fields(thd, field_ref)) { |