MDEV-23479: Add a THD* argument to Item_func_or_sum::fix_length_and_dec()

Fix: Added THD *thd argument in Item_func_or_sum::fix_length_and_dec() and in
fix_length_and_dec() for all derived classes of Item_func_or_sum.
This commit is contained in:
Rucha Deodhar 2022-01-26 03:02:45 +05:30
parent 12abe61af4
commit 3eb1e11d8a
25 changed files with 432 additions and 444 deletions

View File

@ -29,7 +29,7 @@ public:
null_value= str->copy(STRING_WITH_LEN("sysconst_test"), system_charset_info); null_value= str->copy(STRING_WITH_LEN("sysconst_test"), system_charset_info);
return null_value ? NULL : str; return null_value ? NULL : str;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen; max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
set_maybe_null(); set_maybe_null();

View File

@ -37,7 +37,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("inet_aton") }; static LEX_CSTRING name= {STRING_WITH_LEN("inet_aton") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= 0; decimals= 0;
max_length= 21; max_length= 21;
@ -65,7 +65,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("inet_ntoa") }; static LEX_CSTRING name= {STRING_WITH_LEN("inet_ntoa") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= 0; decimals= 0;
fix_length_and_charset(3 * 8 + 7, default_charset()); fix_length_and_charset(3 * 8 + 7, default_charset());
@ -111,7 +111,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("inet6_aton") }; static LEX_CSTRING name= {STRING_WITH_LEN("inet6_aton") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= 0; decimals= 0;
fix_length_and_charset(16, &my_charset_bin); fix_length_and_charset(16, &my_charset_bin);
@ -143,7 +143,7 @@ public:
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= 0; decimals= 0;

View File

@ -27,7 +27,7 @@ protected:
{ return MY_UUID_BARE_STRING_LENGTH + with_dashes*MY_UUID_SEPARATORS; } { return MY_UUID_BARE_STRING_LENGTH + with_dashes*MY_UUID_SEPARATORS; }
public: public:
Item_func_sys_guid(THD *thd): Item_str_func(thd), with_dashes(false) {} Item_func_sys_guid(THD *thd): Item_str_func(thd), with_dashes(false) {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(DTCollation_numeric()); collation.set(DTCollation_numeric());
fix_char_length(uuid_len()); fix_char_length(uuid_len());

View File

@ -5458,7 +5458,7 @@ public:
inline const char *func_name() const inline const char *func_name() const
{ return (char*) func_name_cstring().str; } { return (char*) func_name_cstring().str; }
virtual LEX_CSTRING func_name_cstring() const= 0; virtual LEX_CSTRING func_name_cstring() const= 0;
virtual bool fix_length_and_dec()= 0; virtual bool fix_length_and_dec(THD *thd)= 0;
bool const_item() const override { return const_item_cache; } bool const_item() const override { return const_item_cache; }
table_map used_tables() const override { return used_tables_cache; } table_map used_tables() const override { return used_tables_cache; }
Item* build_clone(THD *thd) override; Item* build_clone(THD *thd) override;

View File

@ -436,7 +436,7 @@ Item_bool_rowready_func2::value_depends_on_sql_mode() const
} }
bool Item_bool_rowready_func2::fix_length_and_dec() bool Item_bool_rowready_func2::fix_length_and_dec(THD *thd)
{ {
max_length= 1; // Function returns 0 or 1 max_length= 1; // Function returns 0 or 1
@ -1137,7 +1137,7 @@ int Arg_comparator::compare_e_str_json()
} }
bool Item_func_truth::fix_length_and_dec() bool Item_func_truth::fix_length_and_dec(THD *thd)
{ {
base_flags&= ~item_base_t::MAYBE_NULL; base_flags&= ~item_base_t::MAYBE_NULL;
null_value= 0; null_value= 0;
@ -1766,9 +1766,9 @@ longlong Item_func_eq::val_int()
/** Same as Item_func_eq, but NULL = NULL. */ /** Same as Item_func_eq, but NULL = NULL. */
bool Item_func_equal::fix_length_and_dec() bool Item_func_equal::fix_length_and_dec(THD *thd)
{ {
bool rc= Item_bool_rowready_func2::fix_length_and_dec(); bool rc= Item_bool_rowready_func2::fix_length_and_dec(thd);
base_flags&= ~item_base_t::MAYBE_NULL; base_flags&= ~item_base_t::MAYBE_NULL;
null_value=0; null_value=0;
return rc; return rc;
@ -1865,7 +1865,7 @@ bool Item_func_interval::fix_fields(THD *thd, Item **ref)
} }
bool Item_func_interval::fix_length_and_dec() bool Item_func_interval::fix_length_and_dec(THD *thd)
{ {
uint rows= row->cols(); uint rows= row->cols();
@ -2099,7 +2099,7 @@ void Item_func_between::fix_after_pullout(st_select_lex *new_parent,
eval_not_null_tables(NULL); eval_not_null_tables(NULL);
} }
bool Item_func_between::fix_length_and_dec() bool Item_func_between::fix_length_and_dec(THD *thd)
{ {
max_length= 1; max_length= 1;
@ -2113,7 +2113,7 @@ bool Item_func_between::fix_length_and_dec()
func_name_cstring(), func_name_cstring(),
args, 3, false)) args, 3, false))
{ {
DBUG_ASSERT(current_thd->is_error()); DBUG_ASSERT(thd->is_error());
return TRUE; return TRUE;
} }
@ -2555,7 +2555,7 @@ void Item_func_nullif::update_used_tables()
bool bool
Item_func_nullif::fix_length_and_dec() Item_func_nullif::fix_length_and_dec(THD *thd)
{ {
/* /*
If this is the first invocation of fix_length_and_dec(), create the If this is the first invocation of fix_length_and_dec(), create the
@ -2567,7 +2567,6 @@ Item_func_nullif::fix_length_and_dec()
if (arg_count == 2) if (arg_count == 2)
args[arg_count++]= m_arg0 ? m_arg0 : args[0]; args[arg_count++]= m_arg0 ? m_arg0 : args[0];
THD *thd= current_thd;
/* /*
At prepared statement EXECUTE time, args[0] can already At prepared statement EXECUTE time, args[0] can already
point to a different Item, created during PREPARE time fix_length_and_dec(). point to a different Item, created during PREPARE time fix_length_and_dec().
@ -3177,24 +3176,21 @@ bool Item_func_case_simple::prepare_predicant_and_values(THD *thd,
} }
bool Item_func_case_searched::fix_length_and_dec() bool Item_func_case_searched::fix_length_and_dec(THD *thd)
{ {
THD *thd= current_thd;
return aggregate_then_and_else_arguments(thd, when_count()); return aggregate_then_and_else_arguments(thd, when_count());
} }
bool Item_func_case_simple::fix_length_and_dec() bool Item_func_case_simple::fix_length_and_dec(THD *thd)
{ {
THD *thd= current_thd;
return (aggregate_then_and_else_arguments(thd, when_count() + 1) || return (aggregate_then_and_else_arguments(thd, when_count() + 1) ||
aggregate_switch_and_when_arguments(thd, false)); aggregate_switch_and_when_arguments(thd, false));
} }
bool Item_func_decode_oracle::fix_length_and_dec() bool Item_func_decode_oracle::fix_length_and_dec(THD *thd)
{ {
THD *thd= current_thd;
return (aggregate_then_and_else_arguments(thd, when_count() + 1) || return (aggregate_then_and_else_arguments(thd, when_count() + 1) ||
aggregate_switch_and_when_arguments(thd, true)); aggregate_switch_and_when_arguments(thd, true));
} }
@ -4394,9 +4390,8 @@ bool Item_func_in::prepare_predicant_and_values(THD *thd, uint *found_types)
} }
bool Item_func_in::fix_length_and_dec() bool Item_func_in::fix_length_and_dec(THD *thd)
{ {
THD *thd= current_thd;
uint found_types; uint found_types;
m_comparator.set_handler(type_handler_varchar.type_handler_for_comparison()); m_comparator.set_handler(type_handler_varchar.type_handler_for_comparison());
max_length= 1; max_length= 1;
@ -4752,7 +4747,7 @@ public:
}; };
bool Item_func_bit_or::fix_length_and_dec() bool Item_func_bit_or::fix_length_and_dec(THD *thd)
{ {
static Func_handler_bit_or_int_to_ulonglong ha_int_to_ull; static Func_handler_bit_or_int_to_ulonglong ha_int_to_ull;
static Func_handler_bit_or_dec_to_ulonglong ha_dec_to_ull; static Func_handler_bit_or_dec_to_ulonglong ha_dec_to_ull;
@ -4787,7 +4782,7 @@ public:
}; };
bool Item_func_bit_and::fix_length_and_dec() bool Item_func_bit_and::fix_length_and_dec(THD *thd)
{ {
static Func_handler_bit_and_int_to_ulonglong ha_int_to_ull; static Func_handler_bit_and_int_to_ulonglong ha_int_to_ull;
static Func_handler_bit_and_dec_to_ulonglong ha_dec_to_ull; static Func_handler_bit_and_dec_to_ulonglong ha_dec_to_ull;
@ -4938,7 +4933,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
base_flags|= item->base_flags & item_base_t::MAYBE_NULL; base_flags|= item->base_flags & item_base_t::MAYBE_NULL;
with_flags|= item->with_flags; with_flags|= item->with_flags;
} }
if (fix_length_and_dec()) if (fix_length_and_dec(thd))
return TRUE; return TRUE;
base_flags|= item_base_t::FIXED; base_flags|= item_base_t::FIXED;
return FALSE; return FALSE;
@ -6098,9 +6093,9 @@ void Regexp_processor_pcre::fix_owner(Item_func *owner,
bool bool
Item_func_regex::fix_length_and_dec() Item_func_regex::fix_length_and_dec(THD *thd)
{ {
if (Item_bool_func::fix_length_and_dec() || if (Item_bool_func::fix_length_and_dec(thd) ||
agg_arg_charsets_for_comparison(cmp_collation, args, 2)) agg_arg_charsets_for_comparison(cmp_collation, args, 2))
return TRUE; return TRUE;
@ -6124,7 +6119,7 @@ longlong Item_func_regex::val_int()
bool bool
Item_func_regexp_instr::fix_length_and_dec() Item_func_regexp_instr::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_comparison(cmp_collation, args, 2)) if (agg_arg_charsets_for_comparison(cmp_collation, args, 2))
return TRUE; return TRUE;
@ -7067,7 +7062,7 @@ bool Item_equal::fix_fields(THD *thd, Item **ref)
} }
if (prev_equal_field && last_equal_field != first_equal_field) if (prev_equal_field && last_equal_field != first_equal_field)
last_equal_field->next_equal_field= first_equal_field; last_equal_field->next_equal_field= first_equal_field;
if (fix_length_and_dec()) if (fix_length_and_dec(thd))
return TRUE; return TRUE;
base_flags|= item_base_t::FIXED; base_flags|= item_base_t::FIXED;
return FALSE; return FALSE;
@ -7196,11 +7191,11 @@ longlong Item_equal::val_int()
} }
bool Item_equal::fix_length_and_dec() bool Item_equal::fix_length_and_dec(THD *thd)
{ {
Item *item= get_first(NO_PARTICULAR_TAB, NULL); Item *item= get_first(NO_PARTICULAR_TAB, NULL);
const Type_handler *handler= item->type_handler(); const Type_handler *handler= item->type_handler();
eval_item= handler->make_cmp_item(current_thd, item->collation.collation); eval_item= handler->make_cmp_item(thd, item->collation.collation);
return eval_item == NULL; return eval_item == NULL;
} }

View File

@ -227,7 +227,7 @@ public:
const Type_handler *fixed_type_handler() const override const Type_handler *fixed_type_handler() const override
{ return &type_handler_bool; } { return &type_handler_bool; }
CHARSET_INFO *compare_collation() const override { return NULL; } CHARSET_INFO *compare_collation() const override { return NULL; }
bool fix_length_and_dec() override { decimals=0; max_length=1; return FALSE; } bool fix_length_and_dec(THD *thd) override { decimals=0; max_length=1; return FALSE; }
decimal_digits_t decimal_precision() const override { return 1; } decimal_digits_t decimal_precision() const override { return 1; }
bool need_parentheses_in_default() override { return true; } bool need_parentheses_in_default() override { return true; }
}; };
@ -243,7 +243,7 @@ class Item_func_truth : public Item_bool_func
public: public:
bool val_bool() override; bool val_bool() override;
longlong val_int() override; longlong val_int() override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void print(String *str, enum_query_type query_type) override; void print(String *str, enum_query_type query_type) override;
enum precedence precedence() const override { return CMP_PRECEDENCE; } enum precedence precedence() const override { return CMP_PRECEDENCE; }
@ -562,7 +562,7 @@ public:
cond); cond);
return this; return this;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
int set_cmp_func(THD *thd) int set_cmp_func(THD *thd)
{ {
return cmp.set_cmp_func(thd, this, tmp_arg, tmp_arg + 1, true); return cmp.set_cmp_func(thd, this, tmp_arg, tmp_arg + 1, true);
@ -796,7 +796,7 @@ public:
Item_func_equal(THD *thd, Item *a, Item *b): Item_func_equal(THD *thd, Item *a, Item *b):
Item_bool_rowready_func2(thd, a, b) {} Item_bool_rowready_func2(thd, a, b) {}
longlong val_int() override; longlong val_int() override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
table_map not_null_tables() const override { return 0; } table_map not_null_tables() const override { return 0; }
bool find_not_null_fields(table_map allowed) override { return false; } bool find_not_null_fields(table_map allowed) override { return false; }
enum Functype functype() const override { return EQUAL_FUNC; } enum Functype functype() const override { return EQUAL_FUNC; }
@ -991,7 +991,7 @@ public:
return name; return name;
} }
enum precedence precedence() const override { return BETWEEN_PRECEDENCE; } enum precedence precedence() const override { return BETWEEN_PRECEDENCE; }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool fix_length_and_dec_string(THD *) bool fix_length_and_dec_string(THD *)
{ {
return agg_arg_charsets_for_comparison(cmp_collation, args, 3); return agg_arg_charsets_for_comparison(cmp_collation, args, 3);
@ -1047,7 +1047,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("strcmp") }; static LEX_CSTRING name= {STRING_WITH_LEN("strcmp") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
if (agg_arg_charsets_for_comparison(cmp_collation, args, 2)) if (agg_arg_charsets_for_comparison(cmp_collation, args, 2))
return TRUE; return TRUE;
@ -1081,7 +1081,7 @@ public:
{ } { }
bool fix_fields(THD *, Item **) override; bool fix_fields(THD *, Item **) override;
longlong val_int() override; longlong val_int() override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("interval") }; static LEX_CSTRING name= {STRING_WITH_LEN("interval") };
@ -1112,7 +1112,7 @@ public:
bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool time_op(THD *thd, MYSQL_TIME *ltime) override; bool time_op(THD *thd, MYSQL_TIME *ltime) override;
bool native_op(THD *thd, Native *to) override; bool native_op(THD *thd, Native *to) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
if (aggregate_for_result(func_name_cstring(), args, arg_count, true)) if (aggregate_for_result(func_name_cstring(), args, arg_count, true))
return TRUE; return TRUE;
@ -1196,7 +1196,7 @@ public:
bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool time_op(THD *thd, MYSQL_TIME *ltime) override; bool time_op(THD *thd, MYSQL_TIME *ltime) override;
bool native_op(THD *thd, Native *to) override; bool native_op(THD *thd, Native *to) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
/* /*
Set nullability from args[1] by default. Set nullability from args[1] by default.
@ -1287,7 +1287,7 @@ public:
Item_func_case_abbreviation2_switch(thd, a, b, c) Item_func_case_abbreviation2_switch(thd, a, b, c)
{} {}
bool fix_fields(THD *, Item **) override; bool fix_fields(THD *, Item **) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return fix_length_and_dec2_eliminate_null(args + 1); return fix_length_and_dec2_eliminate_null(args + 1);
} }
@ -1321,7 +1321,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("nvl2") }; static LEX_CSTRING name= {STRING_WITH_LEN("nvl2") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return fix_length_and_dec2_eliminate_null(args + 1); return fix_length_and_dec2_eliminate_null(args + 1);
} }
@ -1384,7 +1384,7 @@ public:
String *str_op(String *str) override; String *str_op(String *str) override;
my_decimal *decimal_op(my_decimal *) override; my_decimal *decimal_op(my_decimal *) override;
bool native_op(THD *thd, Native *to) override; bool native_op(THD *thd, Native *to) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool walk(Item_processor processor, bool walk_subquery, void *arg) override; bool walk(Item_processor processor, bool walk_subquery, void *arg) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
@ -2344,7 +2344,7 @@ public:
} }
enum Functype functype() const override { return CASE_SEARCHED_FUNC; } enum Functype functype() const override { return CASE_SEARCHED_FUNC; }
void print(String *str, enum_query_type query_type) override; void print(String *str, enum_query_type query_type) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
override override
{ {
@ -2399,7 +2399,7 @@ public:
} }
enum Functype functype() const override { return CASE_SIMPLE_FUNC; } enum Functype functype() const override { return CASE_SIMPLE_FUNC; }
void print(String *str, enum_query_type query_type) override; void print(String *str, enum_query_type query_type) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
override; override;
Item *find_item() override; Item *find_item() override;
@ -2429,7 +2429,7 @@ public:
return name; return name;
} }
void print(String *str, enum_query_type query_type) override; void print(String *str, enum_query_type query_type) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *find_item() override; Item *find_item() override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_decode_oracle>(thd, this); } { return get_item_copy<Item_func_decode_oracle>(thd, this); }
@ -2519,7 +2519,7 @@ public:
{ } { }
longlong val_int() override; longlong val_int() override;
bool fix_fields(THD *, Item **) override; bool fix_fields(THD *, Item **) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool compatible_types_scalar_bisection_possible() bool compatible_types_scalar_bisection_possible()
{ {
DBUG_ASSERT(m_comparator.cmp_type() != ROW_RESULT); DBUG_ASSERT(m_comparator.cmp_type() != ROW_RESULT);
@ -2695,7 +2695,7 @@ public:
} }
CHARSET_INFO *compare_collation() const override CHARSET_INFO *compare_collation() const override
{ return args[0]->collation.collation; } { return args[0]->collation.collation; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=1; max_length=1;
@ -2944,7 +2944,7 @@ public:
} }
enum precedence precedence() const override { return IN_PRECEDENCE; } enum precedence precedence() const override { return IN_PRECEDENCE; }
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= 1; max_length= 1;
return agg_arg_charsets_for_comparison(cmp_collation, args, 2); return agg_arg_charsets_for_comparison(cmp_collation, args, 2);
@ -3056,7 +3056,7 @@ public:
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
longlong val_int() override; longlong val_int() override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("regexp") }; static LEX_CSTRING name= {STRING_WITH_LEN("regexp") };
@ -3101,7 +3101,7 @@ public:
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
longlong val_int() override; longlong val_int() override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("regexp_instr") }; static LEX_CSTRING name= {STRING_WITH_LEN("regexp_instr") };
@ -3347,7 +3347,7 @@ public:
return name; return name;
} }
void sort(Item_field_cmpfunc compare, void *arg); void sort(Item_field_cmpfunc compare, void *arg);
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
void cleanup() override void cleanup() override
{ {

View File

@ -356,7 +356,7 @@ Item_func::fix_fields(THD *thd, Item **ref)
} }
if (check_arguments()) if (check_arguments())
return true; return true;
if (fix_length_and_dec()) if (fix_length_and_dec(thd))
return TRUE; return TRUE;
base_flags|= item_base_t::FIXED; base_flags|= item_base_t::FIXED;
return FALSE; return FALSE;
@ -757,9 +757,9 @@ String *Item_int_func::val_str(String *str)
} }
bool Item_func_connection_id::fix_length_and_dec() bool Item_func_connection_id::fix_length_and_dec(THD *thd)
{ {
if (Item_long_func::fix_length_and_dec()) if (Item_long_func::fix_length_and_dec(thd))
return TRUE; return TRUE;
max_length= 10; max_length= 10;
return FALSE; return FALSE;
@ -789,7 +789,7 @@ bool Item_num_op::fix_type_handler(const Type_aggregator *aggregator)
} }
bool Item_func_plus::fix_length_and_dec(void) bool Item_func_plus::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_func_plus::fix_length_and_dec"); DBUG_ENTER("Item_func_plus::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name())); DBUG_PRINT("info", ("name %s", func_name()));
@ -1229,7 +1229,7 @@ void Item_func_minus::fix_unsigned_flag()
} }
bool Item_func_minus::fix_length_and_dec() bool Item_func_minus::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_func_minus::fix_length_and_dec"); DBUG_ENTER("Item_func_minus::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name())); DBUG_PRINT("info", ("name %s", func_name()));
@ -1472,7 +1472,7 @@ void Item_func_mul::result_precision()
} }
bool Item_func_mul::fix_length_and_dec(void) bool Item_func_mul::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_func_mul::fix_length_and_dec"); DBUG_ENTER("Item_func_mul::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name())); DBUG_PRINT("info", ("name %s", func_name()));
@ -1573,11 +1573,11 @@ void Item_func_div::fix_length_and_dec_int(void)
} }
bool Item_func_div::fix_length_and_dec() bool Item_func_div::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_func_div::fix_length_and_dec"); DBUG_ENTER("Item_func_div::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name())); DBUG_PRINT("info", ("name %s", func_name()));
prec_increment= current_thd->variables.div_precincrement; prec_increment= thd->variables.div_precincrement;
set_maybe_null(); // division by zero set_maybe_null(); // division by zero
const Type_aggregator *aggregator= &type_handler_data->m_type_aggregator_for_div; const Type_aggregator *aggregator= &type_handler_data->m_type_aggregator_for_div;
@ -1651,7 +1651,7 @@ longlong Item_func_int_div::val_int()
} }
bool Item_func_int_div::fix_length_and_dec() bool Item_func_int_div::fix_length_and_dec(THD *thd)
{ {
uint32 prec= args[0]->decimal_int_part(); uint32 prec= args[0]->decimal_int_part();
set_if_smaller(prec, MY_INT64_NUM_DECIMAL_DIGITS); set_if_smaller(prec, MY_INT64_NUM_DECIMAL_DIGITS);
@ -1732,7 +1732,7 @@ void Item_func_mod::result_precision()
} }
bool Item_func_mod::fix_length_and_dec() bool Item_func_mod::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_func_mod::fix_length_and_dec"); DBUG_ENTER("Item_func_mod::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name())); DBUG_PRINT("info", ("name %s", func_name()));
@ -1780,7 +1780,7 @@ longlong Item_func_hash::val_int()
} }
bool Item_func_hash::fix_length_and_dec() bool Item_func_hash::fix_length_and_dec(THD *thd)
{ {
decimals= 0; decimals= 0;
max_length= 8; max_length= 8;
@ -1883,7 +1883,7 @@ void Item_func_neg::fix_length_and_dec_decimal()
} }
bool Item_func_neg::fix_length_and_dec() bool Item_func_neg::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_func_neg::fix_length_and_dec"); DBUG_ENTER("Item_func_neg::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name())); DBUG_PRINT("info", ("name %s", func_name()));
@ -1956,7 +1956,7 @@ void Item_func_abs::fix_length_and_dec_decimal()
} }
bool Item_func_abs::fix_length_and_dec() bool Item_func_abs::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_func_abs::fix_length_and_dec"); DBUG_ENTER("Item_func_abs::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name())); DBUG_PRINT("info", ("name %s", func_name()));
@ -2179,7 +2179,7 @@ public:
}; };
bool Item_func_shift_left::fix_length_and_dec() bool Item_func_shift_left::fix_length_and_dec(THD *thd)
{ {
static Func_handler_shift_left_int_to_ulonglong ha_int_to_ull; static Func_handler_shift_left_int_to_ulonglong ha_int_to_ull;
static Func_handler_shift_left_decimal_to_ulonglong ha_dec_to_ull; static Func_handler_shift_left_decimal_to_ulonglong ha_dec_to_ull;
@ -2213,7 +2213,7 @@ public:
}; };
bool Item_func_shift_right::fix_length_and_dec() bool Item_func_shift_right::fix_length_and_dec(THD *thd)
{ {
static Func_handler_shift_right_int_to_ulonglong ha_int_to_ull; static Func_handler_shift_right_int_to_ulonglong ha_int_to_ull;
static Func_handler_shift_right_decimal_to_ulonglong ha_dec_to_ull; static Func_handler_shift_right_decimal_to_ulonglong ha_dec_to_ull;
@ -2245,7 +2245,7 @@ public:
}; };
bool Item_func_bit_neg::fix_length_and_dec() bool Item_func_bit_neg::fix_length_and_dec(THD *thd)
{ {
static Func_handler_bit_neg_int_to_ulonglong ha_int_to_ull; static Func_handler_bit_neg_int_to_ulonglong ha_int_to_ull;
static Func_handler_bit_neg_decimal_to_ulonglong ha_dec_to_ull; static Func_handler_bit_neg_decimal_to_ulonglong ha_dec_to_ull;
@ -2317,7 +2317,7 @@ void Item_func_int_val::fix_length_and_dec_double()
} }
bool Item_func_int_val::fix_length_and_dec() bool Item_func_int_val::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_func_int_val::fix_length_and_dec"); DBUG_ENTER("Item_func_int_val::fix_length_and_dec");
DBUG_PRINT("info", ("name %s", func_name())); DBUG_PRINT("info", ("name %s", func_name()));
@ -3225,7 +3225,7 @@ longlong Item_func_field::val_int()
} }
bool Item_func_field::fix_length_and_dec() bool Item_func_field::fix_length_and_dec(THD *thd)
{ {
base_flags&= ~item_base_t::MAYBE_NULL; base_flags&= ~item_base_t::MAYBE_NULL;
max_length=3; max_length=3;
@ -3281,7 +3281,7 @@ longlong Item_func_ord::val_int()
/* Returns number of found type >= 1 or 0 if not found */ /* Returns number of found type >= 1 or 0 if not found */
/* This optimizes searching in enums to bit testing! */ /* This optimizes searching in enums to bit testing! */
bool Item_func_find_in_set::fix_length_and_dec() bool Item_func_find_in_set::fix_length_and_dec(THD *thd)
{ {
decimals=0; decimals=0;
max_length=3; // 1-999 max_length=3; // 1-999
@ -3410,7 +3410,7 @@ public:
}; };
bool Item_func_bit_count::fix_length_and_dec() bool Item_func_bit_count::fix_length_and_dec(THD *thd)
{ {
static Func_handler_bit_count_int_to_slong ha_int_to_slong; static Func_handler_bit_count_int_to_slong ha_int_to_slong;
static Func_handler_bit_count_decimal_to_slong ha_dec_to_slong; static Func_handler_bit_count_decimal_to_slong ha_dec_to_slong;
@ -3524,7 +3524,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
NullS)) NullS))
goto err_exit; goto err_exit;
} }
if (func->fix_length_and_dec()) if (func->fix_length_and_dec(thd))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
initid.max_length=func->max_length; initid.max_length=func->max_length;
initid.maybe_null=func->maybe_null(); initid.maybe_null=func->maybe_null();
@ -3823,7 +3823,7 @@ my_decimal *Item_func_udf_decimal::val_decimal(my_decimal *dec_buf)
/* Default max_length is max argument length */ /* Default max_length is max argument length */
bool Item_func_udf_str::fix_length_and_dec() bool Item_func_udf_str::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_func_udf_str::fix_length_and_dec"); DBUG_ENTER("Item_func_udf_str::fix_length_and_dec");
max_length=0; max_length=0;
@ -4773,7 +4773,7 @@ bool Item_func_set_user_var::fix_fields(THD *thd, Item **ref)
bool bool
Item_func_set_user_var::fix_length_and_dec() Item_func_set_user_var::fix_length_and_dec(THD *thd)
{ {
base_flags|= (args[0]->base_flags & item_base_t::MAYBE_NULL); base_flags|= (args[0]->base_flags & item_base_t::MAYBE_NULL);
decimals=args[0]->decimals; decimals=args[0]->decimals;
@ -5628,9 +5628,8 @@ err:
return 1; return 1;
} }
bool Item_func_get_user_var::fix_length_and_dec() bool Item_func_get_user_var::fix_length_and_dec(THD *thd)
{ {
THD *thd=current_thd;
int error; int error;
set_maybe_null(); set_maybe_null();
decimals=NOT_FIXED_DEC; decimals=NOT_FIXED_DEC;
@ -5839,7 +5838,7 @@ void Item_func_get_system_var::update_null_value()
} }
bool Item_func_get_system_var::fix_length_and_dec() bool Item_func_get_system_var::fix_length_and_dec(THD *thd)
{ {
const char *cptr; const char *cptr;
set_maybe_null(); set_maybe_null();
@ -5876,9 +5875,9 @@ bool Item_func_get_system_var::fix_length_and_dec()
case SHOW_CHAR_PTR: case SHOW_CHAR_PTR:
mysql_mutex_lock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_global_system_variables);
cptr= var->show_type() == SHOW_CHAR ? cptr= var->show_type() == SHOW_CHAR ?
reinterpret_cast<const char*>(var->value_ptr(current_thd, var_type, reinterpret_cast<const char*>(var->value_ptr(thd, var_type,
&component)) : &component)) :
*reinterpret_cast<const char* const*>(var->value_ptr(current_thd, *reinterpret_cast<const char* const*>(var->value_ptr(thd,
var_type, var_type,
&component)); &component));
if (cptr) if (cptr)
@ -6465,7 +6464,7 @@ public:
}; };
bool Item_func_bit_xor::fix_length_and_dec() bool Item_func_bit_xor::fix_length_and_dec(THD *thd)
{ {
static const Func_handler_bit_xor_int_to_ulonglong ha_int_to_ull; static const Func_handler_bit_xor_int_to_ulonglong ha_int_to_ull;
static const Func_handler_bit_xor_dec_to_ulonglong ha_dec_to_ull; static const Func_handler_bit_xor_dec_to_ulonglong ha_dec_to_ull;
@ -6604,7 +6603,7 @@ bool Item_func_sp::is_expensive()
@note called from Item::fix_fields. @note called from Item::fix_fields.
*/ */
bool Item_func_sp::fix_length_and_dec() bool Item_func_sp::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_func_sp::fix_length_and_dec"); DBUG_ENTER("Item_func_sp::fix_length_and_dec");
@ -6940,7 +6939,7 @@ bool Item_func_last_value::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuz
} }
bool Item_func_last_value::fix_length_and_dec() bool Item_func_last_value::fix_length_and_dec(THD *thd)
{ {
last_value= args[arg_count -1]; last_value= args[arg_count -1];
Type_std_attributes::set(last_value); Type_std_attributes::set(last_value);

View File

@ -413,7 +413,7 @@ public:
{ return get_date_from_real(thd, ltime, fuzzydate); } { return get_date_from_real(thd, ltime, fuzzydate); }
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_double; } { return &type_handler_double; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= NOT_FIXED_DEC; decimals= NOT_FIXED_DEC;
max_length= float_length(decimals); max_length= float_length(decimals);
@ -1168,7 +1168,7 @@ public:
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ return get_date_from_int(thd, ltime, fuzzydate); } { return get_date_from_int(thd, ltime, fuzzydate); }
const Type_handler *type_handler() const override= 0; const Type_handler *type_handler() const override= 0;
bool fix_length_and_dec() override { return FALSE; } bool fix_length_and_dec(THD *thd) override { return FALSE; }
}; };
@ -1187,7 +1187,7 @@ public:
return &type_handler_ulong; return &type_handler_ulong;
return &type_handler_slong; return &type_handler_slong;
} }
bool fix_length_and_dec() override { max_length= 11; return FALSE; } bool fix_length_and_dec(THD *thd) override { max_length= 11; return FALSE; }
}; };
@ -1197,7 +1197,7 @@ public:
Item_func_hash(THD *thd, List<Item> &item): Item_int_func(thd, item) Item_func_hash(THD *thd, List<Item> &item): Item_int_func(thd, item)
{} {}
longlong val_int() override; longlong val_int() override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_slong; } { return &type_handler_slong; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
@ -1283,7 +1283,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("connection_id") }; static LEX_CSTRING name= {STRING_WITH_LEN("connection_id") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
longlong val_int() override { DBUG_ASSERT(fixed()); return value; } longlong val_int() override { DBUG_ASSERT(fixed()); return value; }
bool check_vcol_func_processor(void *arg) override bool check_vcol_func_processor(void *arg) override
@ -1348,7 +1348,7 @@ public:
set_if_bigger(char_length, 1U + (unsigned_flag ? 0 : 1)); set_if_bigger(char_length, 1U + (unsigned_flag ? 0 : 1));
fix_char_length(char_length); fix_char_length(char_length);
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return args[0]->type_handler()->Item_func_signed_fix_length_and_dec(this); return args[0]->type_handler()->Item_func_signed_fix_length_and_dec(this);
} }
@ -1385,7 +1385,7 @@ public:
null_value= args[0]->null_value; null_value= args[0]->null_value;
return value; return value;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return args[0]->type_handler()->Item_func_unsigned_fix_length_and_dec(this); return args[0]->type_handler()->Item_func_unsigned_fix_length_and_dec(this);
} }
@ -1420,7 +1420,7 @@ public:
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_newdecimal; } { return &type_handler_newdecimal; }
void fix_length_and_dec_generic() {} void fix_length_and_dec_generic() {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return return
args[0]->type_handler()->Item_decimal_typecast_fix_length_and_dec(this); args[0]->type_handler()->Item_decimal_typecast_fix_length_and_dec(this);
@ -1465,7 +1465,7 @@ public:
{ } { }
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_float; } { return &type_handler_float; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return return
args[0]->type_handler()->Item_float_typecast_fix_length_and_dec(this); args[0]->type_handler()->Item_float_typecast_fix_length_and_dec(this);
@ -1498,7 +1498,7 @@ public:
Item_double_typecast(THD *thd, Item *a, uint len, uint dec): Item_double_typecast(THD *thd, Item *a, uint len, uint dec):
Item_real_typecast(thd, a, len, dec) Item_real_typecast(thd, a, len, dec)
{ } { }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return return
args[0]->type_handler()->Item_double_typecast_fix_length_and_dec(this); args[0]->type_handler()->Item_double_typecast_fix_length_and_dec(this);
@ -1535,7 +1535,7 @@ public:
return name; return name;
} }
enum precedence precedence() const override { return ADD_PRECEDENCE; } enum precedence precedence() const override { return ADD_PRECEDENCE; }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
longlong int_op() override; longlong int_op() override;
double real_op() override; double real_op() override;
my_decimal *decimal_op(my_decimal *) override; my_decimal *decimal_op(my_decimal *) override;
@ -1561,7 +1561,7 @@ public:
longlong int_op() override; longlong int_op() override;
double real_op() override; double real_op() override;
my_decimal *decimal_op(my_decimal *) override; my_decimal *decimal_op(my_decimal *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void fix_unsigned_flag(); void fix_unsigned_flag();
void fix_length_and_dec_double() void fix_length_and_dec_double()
{ {
@ -1598,7 +1598,7 @@ public:
double real_op() override; double real_op() override;
my_decimal *decimal_op(my_decimal *) override; my_decimal *decimal_op(my_decimal *) override;
void result_precision() override; void result_precision() override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool check_partition_func_processor(void *int_arg) override {return FALSE;} bool check_partition_func_processor(void *int_arg) override {return FALSE;}
bool check_vcol_func_processor(void *arg) override { return FALSE;} bool check_vcol_func_processor(void *arg) override { return FALSE;}
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
@ -1620,7 +1620,7 @@ public:
return name; return name;
} }
enum precedence precedence() const override { return MUL_PRECEDENCE; } enum precedence precedence() const override { return MUL_PRECEDENCE; }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void fix_length_and_dec_double(); void fix_length_and_dec_double();
void fix_length_and_dec_int(); void fix_length_and_dec_int();
void result_precision() override; void result_precision() override;
@ -1643,7 +1643,7 @@ public:
enum precedence precedence() const override { return MUL_PRECEDENCE; } enum precedence precedence() const override { return MUL_PRECEDENCE; }
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return type_handler_long_or_longlong(); } { return type_handler_long_or_longlong(); }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void print(String *str, enum_query_type query_type) override void print(String *str, enum_query_type query_type) override
{ {
print_op(str, query_type); print_op(str, query_type);
@ -1671,7 +1671,7 @@ public:
} }
enum precedence precedence() const override { return MUL_PRECEDENCE; } enum precedence precedence() const override { return MUL_PRECEDENCE; }
void result_precision() override; void result_precision() override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void fix_length_and_dec_double() void fix_length_and_dec_double()
{ {
Item_num_op::fix_length_and_dec_double(); Item_num_op::fix_length_and_dec_double();
@ -1717,7 +1717,7 @@ public:
void fix_length_and_dec_int(); void fix_length_and_dec_int();
void fix_length_and_dec_double(); void fix_length_and_dec_double();
void fix_length_and_dec_decimal(); void fix_length_and_dec_decimal();
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
decimal_digits_t decimal_precision() const override decimal_digits_t decimal_precision() const override
{ return args[0]->decimal_precision(); } { return args[0]->decimal_precision(); }
bool need_parentheses_in_default() override { return true; } bool need_parentheses_in_default() override { return true; }
@ -1741,7 +1741,7 @@ public:
void fix_length_and_dec_int(); void fix_length_and_dec_int();
void fix_length_and_dec_double(); void fix_length_and_dec_double();
void fix_length_and_dec_decimal(); void fix_length_and_dec_decimal();
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_abs>(thd, this); } { return get_item_copy<Item_func_abs>(thd, this); }
}; };
@ -1755,7 +1755,7 @@ class Item_dec_func :public Item_real_func
public: public:
Item_dec_func(THD *thd, Item *a): Item_real_func(thd, a) {} Item_dec_func(THD *thd, Item *a): Item_real_func(thd, a) {}
Item_dec_func(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {} Item_dec_func(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= NOT_FIXED_DEC; decimals= NOT_FIXED_DEC;
max_length= float_length(decimals); max_length= float_length(decimals);
@ -1991,7 +1991,7 @@ public:
// Thinks like CEILING(TIMESTAMP'0000-01-01 23:59:59.9') returns NULL // Thinks like CEILING(TIMESTAMP'0000-01-01 23:59:59.9') returns NULL
set_maybe_null(); set_maybe_null();
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *str_op(String *str) override { DBUG_ASSERT(0); return 0; } String *str_op(String *str) override { DBUG_ASSERT(0); return 0; }
bool native_op(THD *thd, Native *to) override bool native_op(THD *thd, Native *to) override
{ {
@ -2081,7 +2081,7 @@ public:
void fix_arg_time(); void fix_arg_time();
void fix_arg_datetime(); void fix_arg_datetime();
void fix_arg_temporal(const Type_handler *h, uint int_part_length); void fix_arg_temporal(const Type_handler *h, uint int_part_length);
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
/* /*
We don't want to translate ENUM/SET to CHAR here. We don't want to translate ENUM/SET to CHAR here.
@ -2145,7 +2145,7 @@ public:
void update_used_tables() override {} void update_used_tables() override {}
bool const_item() const override { return 0; } bool const_item() const override { return 0; }
void fix_after_optimize(THD *thd) override; void fix_after_optimize(THD *thd) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
unsigned_flag= 1; unsigned_flag= 1;
used_tables_cache= RAND_TABLE_BIT; used_tables_cache= RAND_TABLE_BIT;
@ -2192,7 +2192,7 @@ public:
return name; return name;
} }
decimal_digits_t decimal_precision() const override { return 1; } decimal_digits_t decimal_precision() const override { return 1; }
bool fix_length_and_dec() override { fix_char_length(2); return FALSE; } bool fix_length_and_dec(THD *thd) override { fix_char_length(2); return FALSE; }
longlong val_int() override; longlong val_int() override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_sign>(thd, this); } { return get_item_copy<Item_func_sign>(thd, this); }
@ -2215,7 +2215,7 @@ public:
} }
double val_real() override; double val_real() override;
LEX_CSTRING func_name_cstring() const override { return name; } LEX_CSTRING func_name_cstring() const override { return name; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= NOT_FIXED_DEC; decimals= NOT_FIXED_DEC;
max_length= float_length(decimals); max_length= float_length(decimals);
@ -2309,7 +2309,7 @@ public:
Item_func::aggregate_attributes_real(items, nitems); Item_func::aggregate_attributes_real(items, nitems);
max_length= float_length(decimals); max_length= float_length(decimals);
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
if (aggregate_for_min_max(func_name_cstring(), args, arg_count)) if (aggregate_for_min_max(func_name_cstring(), args, arg_count))
return true; return true;
@ -2375,7 +2375,7 @@ public:
bool const_item() const override { return 0; } bool const_item() const override { return 0; }
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return args[0]->type_handler(); } { return args[0]->type_handler(); }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
Type_std_attributes::set(*args[0]); Type_std_attributes::set(*args[0]);
return FALSE; return FALSE;
@ -2391,7 +2391,7 @@ class Item_long_func_length: public Item_long_func
{ return args[0]->check_type_can_return_str(func_name_cstring()); } { return args[0]->check_type_can_return_str(func_name_cstring()); }
public: public:
Item_long_func_length(THD *thd, Item *a): Item_long_func(thd, a) {} Item_long_func_length(THD *thd, Item *a): Item_long_func(thd, a) {}
bool fix_length_and_dec() override { max_length=10; return FALSE; } bool fix_length_and_dec(THD *thd) override { max_length=10; return FALSE; }
}; };
@ -2415,7 +2415,7 @@ class Item_func_bit_length :public Item_longlong_func
String value; String value;
public: public:
Item_func_bit_length(THD *thd, Item *a): Item_longlong_func(thd, a) {} Item_func_bit_length(THD *thd, Item *a): Item_longlong_func(thd, a) {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= 11; // 0x100000000*8 = 34,359,738,368 max_length= 11; // 0x100000000*8 = 34,359,738,368
return FALSE; return FALSE;
@ -2457,7 +2457,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("coercibility") }; static LEX_CSTRING name= {STRING_WITH_LEN("coercibility") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length=10; max_length=10;
base_flags&= ~item_base_t::MAYBE_NULL; base_flags&= ~item_base_t::MAYBE_NULL;
@ -2507,7 +2507,7 @@ public:
return name; return name;
} }
longlong val_int() override; longlong val_int() override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= MY_INT32_NUM_DECIMAL_DIGITS; max_length= MY_INT32_NUM_DECIMAL_DIGITS;
return agg_arg_charsets_for_comparison(cmp_collation, args, 2); return agg_arg_charsets_for_comparison(cmp_collation, args, 2);
@ -2531,7 +2531,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("field") }; static LEX_CSTRING name= {STRING_WITH_LEN("field") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_field>(thd, this); } { return get_item_copy<Item_func_field>(thd, this); }
}; };
@ -2550,7 +2550,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("ascii") }; static LEX_CSTRING name= {STRING_WITH_LEN("ascii") };
return name; return name;
} }
bool fix_length_and_dec() override { max_length=3; return FALSE; } bool fix_length_and_dec(THD *thd) override { max_length=3; return FALSE; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_ascii>(thd, this); } { return get_item_copy<Item_func_ascii>(thd, this); }
}; };
@ -2562,7 +2562,7 @@ class Item_func_ord :public Item_long_func
String value; String value;
public: public:
Item_func_ord(THD *thd, Item *a): Item_long_func(thd, a) {} Item_func_ord(THD *thd, Item *a): Item_long_func(thd, a) {}
bool fix_length_and_dec() override { fix_char_length(7); return FALSE; } bool fix_length_and_dec(THD *thd) override { fix_char_length(7); return FALSE; }
longlong val_int() override; longlong val_int() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
@ -2590,7 +2590,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("find_in_set") }; static LEX_CSTRING name= {STRING_WITH_LEN("find_in_set") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_find_in_set>(thd, this); } { return get_item_copy<Item_func_find_in_set>(thd, this); }
}; };
@ -2630,7 +2630,7 @@ class Item_func_bit_or :public Item_func_bit_operator
public: public:
Item_func_bit_or(THD *thd, Item *a, Item *b) Item_func_bit_or(THD *thd, Item *a, Item *b)
:Item_func_bit_operator(thd, a, b) {} :Item_func_bit_operator(thd, a, b) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("|") }; static LEX_CSTRING name= {STRING_WITH_LEN("|") };
@ -2646,7 +2646,7 @@ class Item_func_bit_and :public Item_func_bit_operator
public: public:
Item_func_bit_and(THD *thd, Item *a, Item *b) Item_func_bit_and(THD *thd, Item *a, Item *b)
:Item_func_bit_operator(thd, a, b) {} :Item_func_bit_operator(thd, a, b) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("&") }; static LEX_CSTRING name= {STRING_WITH_LEN("&") };
@ -2668,7 +2668,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("bit_count") }; static LEX_CSTRING name= {STRING_WITH_LEN("bit_count") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_bit_count>(thd, this); } { return get_item_copy<Item_func_bit_count>(thd, this); }
}; };
@ -2678,7 +2678,7 @@ class Item_func_shift_left :public Item_func_bit_operator
public: public:
Item_func_shift_left(THD *thd, Item *a, Item *b) Item_func_shift_left(THD *thd, Item *a, Item *b)
:Item_func_bit_operator(thd, a, b) {} :Item_func_bit_operator(thd, a, b) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("<<") }; static LEX_CSTRING name= {STRING_WITH_LEN("<<") };
@ -2694,7 +2694,7 @@ class Item_func_shift_right :public Item_func_bit_operator
public: public:
Item_func_shift_right(THD *thd, Item *a, Item *b) Item_func_shift_right(THD *thd, Item *a, Item *b)
:Item_func_bit_operator(thd, a, b) {} :Item_func_bit_operator(thd, a, b) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN(">>") }; static LEX_CSTRING name= {STRING_WITH_LEN(">>") };
@ -2709,7 +2709,7 @@ class Item_func_bit_neg :public Item_func_bit_operator
{ {
public: public:
Item_func_bit_neg(THD *thd, Item *a): Item_func_bit_operator(thd, a) {} Item_func_bit_neg(THD *thd, Item *a): Item_func_bit_operator(thd, a) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("~") }; static LEX_CSTRING name= {STRING_WITH_LEN("~") };
@ -2739,7 +2739,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("last_insert_id") }; static LEX_CSTRING name= {STRING_WITH_LEN("last_insert_id") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
unsigned_flag= true; unsigned_flag= true;
if (arg_count) if (arg_count)
@ -2773,7 +2773,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("benchmark") }; static LEX_CSTRING name= {STRING_WITH_LEN("benchmark") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length=1; max_length=1;
base_flags&= ~item_base_t::MAYBE_NULL; base_flags&= ~item_base_t::MAYBE_NULL;
@ -2798,7 +2798,7 @@ class Item_func_sleep :public Item_long_func
{ return args[0]->check_type_can_return_real(func_name_cstring()); } { return args[0]->check_type_can_return_real(func_name_cstring()); }
public: public:
Item_func_sleep(THD *thd, Item *a): Item_long_func(thd, a) {} Item_func_sleep(THD *thd, Item *a): Item_long_func(thd, a) {}
bool fix_length_and_dec() override { fix_char_length(1); return FALSE; } bool fix_length_and_dec(THD *thd) override { fix_char_length(1); return FALSE; }
bool const_item() const override { return 0; } bool const_item() const override { return 0; }
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
@ -2971,7 +2971,7 @@ class Item_func_udf_float :public Item_udf_func
String *val_str(String *str) override; String *val_str(String *str) override;
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_double; } { return &type_handler_double; }
bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; } bool fix_length_and_dec(THD *thd) override { fix_num_length_and_dec(); return FALSE; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_udf_float>(thd, this); } { return get_item_copy<Item_func_udf_float>(thd, this); }
}; };
@ -2998,7 +2998,7 @@ public:
return &type_handler_ulonglong; return &type_handler_ulonglong;
return &type_handler_slonglong; return &type_handler_slonglong;
} }
bool fix_length_and_dec() override { decimals= 0; max_length= 21; return FALSE; } bool fix_length_and_dec(THD *thd) override { decimals= 0; max_length= 21; return FALSE; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_udf_int>(thd, this); } { return get_item_copy<Item_func_udf_int>(thd, this); }
}; };
@ -3026,7 +3026,7 @@ public:
} }
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_newdecimal; } { return &type_handler_newdecimal; }
bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; } bool fix_length_and_dec(THD *thd) override { fix_num_length_and_dec(); return FALSE; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_udf_decimal>(thd, this); } { return get_item_copy<Item_func_udf_decimal>(thd, this); }
}; };
@ -3066,7 +3066,7 @@ public:
} }
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return string_type_handler(); } { return string_type_handler(); }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_udf_str>(thd, this); } { return get_item_copy<Item_func_udf_str>(thd, this); }
}; };
@ -3121,7 +3121,7 @@ public:
{ DBUG_ASSERT(fixed()); null_value=1; return 0; } { DBUG_ASSERT(fixed()); null_value=1; return 0; }
double val_real() { DBUG_ASSERT(fixed()); null_value= 1; return 0.0; } double val_real() { DBUG_ASSERT(fixed()); null_value= 1; return 0.0; }
longlong val_int() { DBUG_ASSERT(fixed()); null_value=1; return 0; } longlong val_int() { DBUG_ASSERT(fixed()); null_value=1; return 0; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ base_flags|= item_base_t::MAYBE_NULL; max_length=0; return FALSE; } { base_flags|= item_base_t::MAYBE_NULL; max_length=0; return FALSE; }
}; };
@ -3166,7 +3166,7 @@ class Item_func_get_lock final :public Item_func_lock
static LEX_CSTRING name= {STRING_WITH_LEN("get_lock") }; static LEX_CSTRING name= {STRING_WITH_LEN("get_lock") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= 1; max_length= 1;
set_maybe_null(); set_maybe_null();
@ -3206,7 +3206,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("release_lock") }; static LEX_CSTRING name= {STRING_WITH_LEN("release_lock") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= 1; max_length= 1;
set_maybe_null(); set_maybe_null();
@ -3243,7 +3243,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("master_pos_wait") }; static LEX_CSTRING name= {STRING_WITH_LEN("master_pos_wait") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length=21; max_length=21;
set_maybe_null(); set_maybe_null();
@ -3277,7 +3277,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("master_gtid_wait") }; static LEX_CSTRING name= {STRING_WITH_LEN("master_gtid_wait") };
return name; return name;
} }
bool fix_length_and_dec() override { max_length=2; return FALSE; } bool fix_length_and_dec(THD *thd) override { max_length=2; return FALSE; }
bool check_vcol_func_processor(void *arg) override bool check_vcol_func_processor(void *arg) override
{ {
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
@ -3380,7 +3380,7 @@ public:
void save_item_result(Item *item); void save_item_result(Item *item);
bool update(); bool update();
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void print(String *str, enum_query_type query_type) override; void print(String *str, enum_query_type query_type) override;
enum precedence precedence() const override { return ASSIGN_PRECEDENCE; } enum precedence precedence() const override { return ASSIGN_PRECEDENCE; }
void print_as_stmt(String *str, enum_query_type query_type); void print_as_stmt(String *str, enum_query_type query_type);
@ -3421,7 +3421,7 @@ public:
longlong val_int() override; longlong val_int() override;
my_decimal *val_decimal(my_decimal*) override; my_decimal *val_decimal(my_decimal*) override;
String *val_str(String* str) override; String *val_str(String* str) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void print(String *str, enum_query_type query_type) override; void print(String *str, enum_query_type query_type) override;
/* /*
We must always return variables as strings to guard against selects of type We must always return variables as strings to guard against selects of type
@ -3549,7 +3549,7 @@ public:
size_t name_len_arg); size_t name_len_arg);
enum Functype functype() const override { return GSYSVAR_FUNC; } enum Functype functype() const override { return GSYSVAR_FUNC; }
void update_null_value() override; void update_null_value() override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void print(String *str, enum_query_type query_type) override; void print(String *str, enum_query_type query_type) override;
bool const_item() const override { return true; } bool const_item() const override { return true; }
table_map used_tables() const override { return 0; } table_map used_tables() const override { return 0; }
@ -3690,7 +3690,7 @@ class Item_func_bit_xor : public Item_func_bit_operator
public: public:
Item_func_bit_xor(THD *thd, Item *a, Item *b) Item_func_bit_xor(THD *thd, Item *a, Item *b)
:Item_func_bit_operator(thd, a, b) {} :Item_func_bit_operator(thd, a, b) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("^") }; static LEX_CSTRING name= {STRING_WITH_LEN("^") };
@ -3714,7 +3714,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_free_lock") }; static LEX_CSTRING name= {STRING_WITH_LEN("is_free_lock") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=1; max_length=1;
@ -3742,7 +3742,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_used_lock") }; static LEX_CSTRING name= {STRING_WITH_LEN("is_used_lock") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; max_length=10; decimals=0; max_length=10;
set_maybe_null(); set_maybe_null();
@ -3809,7 +3809,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("row_count") }; static LEX_CSTRING name= {STRING_WITH_LEN("row_count") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= 0; decimals= 0;
base_flags&= ~item_base_t::MAYBE_NULL; base_flags&= ~item_base_t::MAYBE_NULL;
@ -3941,7 +3941,7 @@ public:
enum Functype functype() const override { return FUNC_SP; } enum Functype functype() const override { return FUNC_SP; }
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec(void) override; bool fix_length_and_dec(THD *thd) override;
bool is_expensive() override; bool is_expensive() override;
inline Field *get_sp_result_field() inline Field *get_sp_result_field()
@ -3983,7 +3983,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("found_rows") }; static LEX_CSTRING name= {STRING_WITH_LEN("found_rows") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= 0; decimals= 0;
base_flags&= ~item_base_t::MAYBE_NULL; base_flags&= ~item_base_t::MAYBE_NULL;
@ -4039,7 +4039,7 @@ public:
{ {
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
base_flags&= ~item_base_t::MAYBE_NULL; base_flags&= ~item_base_t::MAYBE_NULL;
null_value= false; null_value= false;
@ -4065,7 +4065,7 @@ public:
} }
longlong val_int() override; longlong val_int() override;
bool const_item() const override { return false; } bool const_item() const override { return false; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ max_length= 21; unsigned_flag=1; return FALSE; } { max_length= 21; unsigned_flag=1; return FALSE; }
table_map used_tables() const override { return RAND_TABLE_BIT; } table_map used_tables() const override { return RAND_TABLE_BIT; }
bool check_vcol_func_processor(void *arg) override bool check_vcol_func_processor(void *arg) override
@ -4090,7 +4090,7 @@ public:
my_decimal *val_decimal(my_decimal *) override; my_decimal *val_decimal(my_decimal *) override;
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool val_native(THD *thd, Native *) override; bool val_native(THD *thd, Native *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("last_value") }; static LEX_CSTRING name= {STRING_WITH_LEN("last_value") };
@ -4135,7 +4135,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("nextval") }; static LEX_CSTRING name= {STRING_WITH_LEN("nextval") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
unsigned_flag= 0; unsigned_flag= 0;
max_length= MAX_BIGINT_WIDTH; max_length= MAX_BIGINT_WIDTH;

View File

@ -42,7 +42,7 @@
#include "item_create.h" #include "item_create.h"
bool Item_geometry_func::fix_length_and_dec() bool Item_geometry_func::fix_length_and_dec(THD *thd)
{ {
collation.set(&my_charset_bin); collation.set(&my_charset_bin);
decimals=0; decimals=0;
@ -214,7 +214,7 @@ String *Item_func_as_wkt::val_str_ascii(String *str)
} }
bool Item_func_as_wkt::fix_length_and_dec() bool Item_func_as_wkt::fix_length_and_dec(THD *thd)
{ {
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
max_length= (uint32) UINT_MAX32; max_length= (uint32) UINT_MAX32;
@ -241,7 +241,7 @@ String *Item_func_as_wkb::val_str(String *str)
} }
bool Item_func_as_geojson::fix_length_and_dec() bool Item_func_as_geojson::fix_length_and_dec(THD *thd)
{ {
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
max_length=MAX_BLOB_WIDTH; max_length=MAX_BLOB_WIDTH;

View File

@ -42,7 +42,7 @@ public:
Item_geometry_func(THD *thd, Item *a, Item *b, Item *c): Item_geometry_func(THD *thd, Item *a, Item *b, Item *c):
Item_str_func(thd, a, b, c) {} Item_str_func(thd, a, b, c) {}
Item_geometry_func(THD *thd, List<Item> &list): Item_str_func(thd, list) {} Item_geometry_func(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_geometry; } { return &type_handler_geometry; }
}; };
@ -283,7 +283,7 @@ public:
return name; return name;
} }
String *val_str_ascii(String *) override; String *val_str_ascii(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_as_wkt>(thd, this); } { return get_item_copy<Item_func_as_wkt>(thd, this); }
}; };
@ -301,7 +301,7 @@ public:
String *val_str(String *) override; String *val_str(String *) override;
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_long_blob; } { return &type_handler_long_blob; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(&my_charset_bin); collation.set(&my_charset_bin);
decimals=0; decimals=0;
@ -334,7 +334,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_asgeojson") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_asgeojson") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str_ascii(String *) override; String *val_str_ascii(String *) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_as_geojson>(thd, this); } { return get_item_copy<Item_func_as_geojson>(thd, this); }
@ -352,7 +352,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_geometrytype") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_geometrytype") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
// "GeometryCollection" is the longest // "GeometryCollection" is the longest
fix_length_and_charset(20, default_charset()); fix_length_and_charset(20, default_charset());
@ -586,9 +586,9 @@ public:
item_type=it; item_type=it;
} }
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
if (Item_geometry_func::fix_length_and_dec()) if (Item_geometry_func::fix_length_and_dec(thd))
return TRUE; return TRUE;
for (unsigned int i= 0; i < arg_count; ++i) for (unsigned int i= 0; i < arg_count; ++i)
{ {
@ -951,7 +951,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_isempty") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_isempty") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ set_maybe_null(); return FALSE; } { set_maybe_null(); return FALSE; }
bool need_parentheses_in_default() override { return false; } bool need_parentheses_in_default() override { return false; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
@ -973,7 +973,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_issimple") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_issimple") };
return name; return name;
} }
bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; } bool fix_length_and_dec(THD *thd) override { decimals=0; max_length=2; return FALSE; }
decimal_digits_t decimal_precision() const override { return 1; } decimal_digits_t decimal_precision() const override { return 1; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_issimple>(thd, this); } { return get_item_copy<Item_func_issimple>(thd, this); }
@ -990,7 +990,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_isclosed") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_isclosed") };
return name; return name;
} }
bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; } bool fix_length_and_dec(THD *thd) override { decimals=0; max_length=2; return FALSE; }
decimal_digits_t decimal_precision() const override { return 1; } decimal_digits_t decimal_precision() const override { return 1; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_isclosed>(thd, this); } { return get_item_copy<Item_func_isclosed>(thd, this); }
@ -1021,7 +1021,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_dimension") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_dimension") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ max_length= 10; set_maybe_null(); return FALSE; } { max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_dimension>(thd, this); } { return get_item_copy<Item_func_dimension>(thd, this); }
@ -1038,9 +1038,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_x") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_x") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
if (Item_real_func::fix_length_and_dec()) if (Item_real_func::fix_length_and_dec(thd))
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
@ -1060,9 +1060,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_y") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_y") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
if (Item_real_func::fix_length_and_dec()) if (Item_real_func::fix_length_and_dec(thd))
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
@ -1083,7 +1083,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_numgeometries") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_numgeometries") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ max_length= 10; set_maybe_null(); return FALSE; } { max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_numgeometries>(thd, this); } { return get_item_copy<Item_func_numgeometries>(thd, this); }
@ -1101,7 +1101,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_numinteriorrings") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_numinteriorrings") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ max_length= 10; set_maybe_null(); return FALSE; } { max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_numinteriorring>(thd, this); } { return get_item_copy<Item_func_numinteriorring>(thd, this); }
@ -1119,7 +1119,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_numpoints") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_numpoints") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ max_length= 10; set_maybe_null(); return FALSE; } { max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_numpoints>(thd, this); } { return get_item_copy<Item_func_numpoints>(thd, this); }
@ -1136,9 +1136,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_area") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_area") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
if (Item_real_func::fix_length_and_dec()) if (Item_real_func::fix_length_and_dec(thd))
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
@ -1160,9 +1160,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_length") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_length") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
if (Item_real_func::fix_length_and_dec()) if (Item_real_func::fix_length_and_dec(thd))
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
@ -1183,7 +1183,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("srid") }; static LEX_CSTRING name= {STRING_WITH_LEN("srid") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ max_length= 10; set_maybe_null(); return FALSE; } { max_length= 10; set_maybe_null(); return FALSE; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_srid>(thd, this); } { return get_item_copy<Item_func_srid>(thd, this); }
@ -1259,7 +1259,7 @@ class Item_func_gis_debug: public Item_long_func
public: public:
Item_func_gis_debug(THD *thd, Item *a): Item_long_func(thd, a) Item_func_gis_debug(THD *thd, Item *a): Item_long_func(thd, a)
{ null_value= false; } { null_value= false; }
bool fix_length_and_dec() override { fix_char_length(10); return FALSE; } bool fix_length_and_dec(THD *thd) override { fix_char_length(10); return FALSE; }
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("st_gis_debug") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_gis_debug") };

View File

@ -394,9 +394,9 @@ longlong Item_func_json_valid::val_int()
} }
bool Item_func_json_equals::fix_length_and_dec() bool Item_func_json_equals::fix_length_and_dec(THD *thd)
{ {
if (Item_bool_func::fix_length_and_dec()) if (Item_bool_func::fix_length_and_dec(thd))
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
@ -454,9 +454,9 @@ end:
} }
bool Item_func_json_exists::fix_length_and_dec() bool Item_func_json_exists::fix_length_and_dec(THD *thd)
{ {
if (Item_bool_func::fix_length_and_dec()) if (Item_bool_func::fix_length_and_dec(thd))
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
path.set_constant_flag(args[1]->const_item()); path.set_constant_flag(args[1]->const_item());
@ -507,7 +507,7 @@ err_return:
} }
bool Item_func_json_value::fix_length_and_dec() bool Item_func_json_value::fix_length_and_dec(THD *thd)
{ {
collation.set(args[0]->collation); collation.set(args[0]->collation);
max_length= args[0]->max_length; max_length= args[0]->max_length;
@ -517,7 +517,7 @@ bool Item_func_json_value::fix_length_and_dec()
} }
bool Item_func_json_query::fix_length_and_dec() bool Item_func_json_query::fix_length_and_dec(THD *thd)
{ {
collation.set(args[0]->collation); collation.set(args[0]->collation);
max_length= args[0]->max_length; max_length= args[0]->max_length;
@ -629,7 +629,7 @@ bool Json_engine_scan::check_and_get_value_complex(String *res, int *error)
} }
bool Item_func_json_quote::fix_length_and_dec() bool Item_func_json_quote::fix_length_and_dec(THD *thd)
{ {
collation.set(&my_charset_utf8mb4_bin); collation.set(&my_charset_utf8mb4_bin);
/* /*
@ -665,7 +665,7 @@ String *Item_func_json_quote::val_str(String *str)
} }
bool Item_func_json_unquote::fix_length_and_dec() bool Item_func_json_unquote::fix_length_and_dec(THD *thd)
{ {
collation.set(&my_charset_utf8mb3_general_ci, collation.set(&my_charset_utf8mb3_general_ci,
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
@ -785,7 +785,7 @@ void Item_json_str_multipath::cleanup()
} }
bool Item_func_json_extract::fix_length_and_dec() bool Item_func_json_extract::fix_length_and_dec(THD *thd)
{ {
collation.set(args[0]->collation); collation.set(args[0]->collation);
max_length= args[0]->max_length * (arg_count - 1); max_length= args[0]->max_length * (arg_count - 1);
@ -1055,14 +1055,14 @@ my_decimal *Item_func_json_extract::val_decimal(my_decimal *to)
bool Item_func_json_contains::fix_length_and_dec() bool Item_func_json_contains::fix_length_and_dec(THD *thd)
{ {
a2_constant= args[1]->const_item(); a2_constant= args[1]->const_item();
a2_parsed= FALSE; a2_parsed= FALSE;
set_maybe_null(); set_maybe_null();
if (arg_count > 2) if (arg_count > 2)
path.set_constant_flag(args[2]->const_item()); path.set_constant_flag(args[2]->const_item());
return Item_bool_func::fix_length_and_dec(); return Item_bool_func::fix_length_and_dec(thd);
} }
@ -1306,13 +1306,13 @@ bool Item_func_json_contains_path::fix_fields(THD *thd, Item **ref)
} }
bool Item_func_json_contains_path::fix_length_and_dec() bool Item_func_json_contains_path::fix_length_and_dec(THD *thd)
{ {
ooa_constant= args[1]->const_item(); ooa_constant= args[1]->const_item();
ooa_parsed= FALSE; ooa_parsed= FALSE;
set_maybe_null(); set_maybe_null();
mark_constant_paths(paths, args+2, arg_count-2); mark_constant_paths(paths, args+2, arg_count-2);
return Item_bool_func::fix_length_and_dec(); return Item_bool_func::fix_length_and_dec(thd);
} }
@ -1643,7 +1643,7 @@ append_null:
} }
bool Item_func_json_array::fix_length_and_dec() bool Item_func_json_array::fix_length_and_dec(THD *thd)
{ {
ulonglong char_length= 2; ulonglong char_length= 2;
uint n_arg; uint n_arg;
@ -1712,7 +1712,7 @@ err_return:
} }
bool Item_func_json_array_append::fix_length_and_dec() bool Item_func_json_array_append::fix_length_and_dec(THD *thd)
{ {
uint n_arg; uint n_arg;
ulonglong char_length; ulonglong char_length;
@ -2651,7 +2651,7 @@ null_return:
} }
bool Item_func_json_length::fix_length_and_dec() bool Item_func_json_length::fix_length_and_dec(THD *thd)
{ {
if (arg_count > 1) if (arg_count > 1)
path.set_constant_flag(args[1]->const_item()); path.set_constant_flag(args[1]->const_item());
@ -2797,7 +2797,7 @@ longlong Item_func_json_depth::val_int()
} }
bool Item_func_json_type::fix_length_and_dec() bool Item_func_json_type::fix_length_and_dec(THD *thd)
{ {
collation.set(&my_charset_utf8mb3_general_ci); collation.set(&my_charset_utf8mb3_general_ci);
max_length= 12; max_length= 12;
@ -2855,7 +2855,7 @@ error:
} }
bool Item_func_json_insert::fix_length_and_dec() bool Item_func_json_insert::fix_length_and_dec(THD *thd)
{ {
uint n_arg; uint n_arg;
ulonglong char_length; ulonglong char_length;
@ -3119,7 +3119,7 @@ return_null:
} }
bool Item_func_json_remove::fix_length_and_dec() bool Item_func_json_remove::fix_length_and_dec(THD *thd)
{ {
collation.set(args[0]->collation); collation.set(args[0]->collation);
max_length= args[0]->max_length; max_length= args[0]->max_length;
@ -3308,7 +3308,7 @@ null_return:
} }
bool Item_func_json_keys::fix_length_and_dec() bool Item_func_json_keys::fix_length_and_dec(THD *thd)
{ {
collation.set(args[0]->collation); collation.set(args[0]->collation);
max_length= args[0]->max_length; max_length= args[0]->max_length;
@ -3476,7 +3476,7 @@ bool Item_func_json_search::fix_fields(THD *thd, Item **ref)
static const uint SQR_MAX_BLOB_WIDTH= (uint) sqrt(MAX_BLOB_WIDTH); static const uint SQR_MAX_BLOB_WIDTH= (uint) sqrt(MAX_BLOB_WIDTH);
bool Item_func_json_search::fix_length_and_dec() bool Item_func_json_search::fix_length_and_dec(THD *thd)
{ {
collation.set(args[0]->collation); collation.set(args[0]->collation);
@ -3676,7 +3676,7 @@ LEX_CSTRING Item_func_json_format::func_name_cstring() const
} }
bool Item_func_json_format::fix_length_and_dec() bool Item_func_json_format::fix_length_and_dec(THD *thd)
{ {
decimals= 0; decimals= 0;
collation.set(args[0]->collation); collation.set(args[0]->collation);
@ -4023,7 +4023,7 @@ end:
} }
bool Item_func_json_normalize::fix_length_and_dec() bool Item_func_json_normalize::fix_length_and_dec(THD *thd)
{ {
collation.set(&my_charset_utf8mb4_bin); collation.set(&my_charset_utf8mb4_bin);
/* 0 becomes 0.0E0, thus one character becomes 5 chars */ /* 0 becomes 0.0E0, thus one character becomes 5 chars */
@ -4390,11 +4390,11 @@ error:
return 0; return 0;
} }
bool Item_func_json_overlaps::fix_length_and_dec() bool Item_func_json_overlaps::fix_length_and_dec(THD *thd)
{ {
a2_constant= args[1]->const_item(); a2_constant= args[1]->const_item();
a2_parsed= FALSE; a2_parsed= FALSE;
set_maybe_null(); set_maybe_null();
return Item_bool_func::fix_length_and_dec(); return Item_bool_func::fix_length_and_dec(thd);
} }

View File

@ -101,9 +101,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_valid") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_valid") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
if (Item_bool_func::fix_length_and_dec()) if (Item_bool_func::fix_length_and_dec(thd))
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
@ -130,7 +130,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_equals") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_equals") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_equals>(thd, this); } { return get_item_copy<Item_func_json_equals>(thd, this); }
longlong val_int() override; longlong val_int() override;
@ -151,7 +151,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_exists") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_exists") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_exists>(thd, this); } { return get_item_copy<Item_func_json_exists>(thd, this); }
longlong val_int() override; longlong val_int() override;
@ -188,7 +188,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_value") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_value") };
return name; return name;
} }
bool fix_length_and_dec() override ; bool fix_length_and_dec(THD *thd) override ;
String *val_str(String *to) override String *val_str(String *to) override
{ {
null_value= Json_path_extractor::extract(to, args[0], args[1], null_value= Json_path_extractor::extract(to, args[0], args[1],
@ -216,7 +216,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_query") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_query") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *to) override String *val_str(String *to) override
{ {
null_value= Json_path_extractor::extract(to, args[0], args[1], null_value= Json_path_extractor::extract(to, args[0], args[1],
@ -245,7 +245,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_quote") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_quote") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override; String *val_str(String *) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_quote>(thd, this); } { return get_item_copy<Item_func_json_quote>(thd, this); }
@ -264,7 +264,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_unquote") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_unquote") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override; String *val_str(String *) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_unquote>(thd, this); } { return get_item_copy<Item_func_json_unquote>(thd, this); }
@ -300,7 +300,7 @@ public:
return name; return name;
} }
enum Functype functype() const override { return JSON_EXTRACT_FUNC; } enum Functype functype() const override { return JSON_EXTRACT_FUNC; }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override; String *val_str(String *) override;
longlong val_int() override; longlong val_int() override;
double val_real() override; double val_real() override;
@ -327,7 +327,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_contains") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_contains") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
longlong val_int() override; longlong val_int() override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_contains>(thd, this); } { return get_item_copy<Item_func_json_contains>(thd, this); }
@ -353,7 +353,7 @@ public:
return name; return name;
} }
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void cleanup() override; void cleanup() override;
longlong val_int() override; longlong val_int() override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
@ -372,7 +372,7 @@ public:
Item_func_json_array(THD *thd, List<Item> &list): Item_func_json_array(THD *thd, List<Item> &list):
Item_json_func(thd, list) {} Item_json_func(thd, list) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("json_array") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_array") };
@ -391,7 +391,7 @@ protected:
public: public:
Item_func_json_array_append(THD *thd, List<Item> &list): Item_func_json_array_append(THD *thd, List<Item> &list):
Item_json_str_multipath(thd, list) {} Item_json_str_multipath(thd, list) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override; String *val_str(String *) override;
uint get_n_paths() const override { return arg_count/2; } uint get_n_paths() const override { return arg_count/2; }
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
@ -482,7 +482,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_normalize") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_normalize") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_normalize>(thd, this); } { return get_item_copy<Item_func_json_normalize>(thd, this); }
}; };
@ -508,7 +508,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_length") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_length") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
longlong val_int() override; longlong val_int() override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_length>(thd, this); } { return get_item_copy<Item_func_json_length>(thd, this); }
@ -528,7 +528,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_depth") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_depth") };
return name; return name;
} }
bool fix_length_and_dec() override { max_length= 10; return FALSE; } bool fix_length_and_dec(THD *thd) override { max_length= 10; return FALSE; }
longlong val_int() override; longlong val_int() override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_depth>(thd, this); } { return get_item_copy<Item_func_json_depth>(thd, this); }
@ -546,7 +546,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_type") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_type") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override; String *val_str(String *) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_type>(thd, this); } { return get_item_copy<Item_func_json_type>(thd, this); }
@ -563,7 +563,7 @@ public:
Item_func_json_insert(bool i_mode, bool r_mode, THD *thd, List<Item> &list): Item_func_json_insert(bool i_mode, bool r_mode, THD *thd, List<Item> &list):
Item_json_str_multipath(thd, list), Item_json_str_multipath(thd, list),
mode_insert(i_mode), mode_replace(r_mode) {} mode_insert(i_mode), mode_replace(r_mode) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override; String *val_str(String *) override;
uint get_n_paths() const override { return arg_count/2; } uint get_n_paths() const override { return arg_count/2; }
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
@ -586,7 +586,7 @@ protected:
public: public:
Item_func_json_remove(THD *thd, List<Item> &list): Item_func_json_remove(THD *thd, List<Item> &list):
Item_json_str_multipath(thd, list) {} Item_json_str_multipath(thd, list) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override; String *val_str(String *) override;
uint get_n_paths() const override { return arg_count - 1; } uint get_n_paths() const override { return arg_count - 1; }
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
@ -613,7 +613,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_keys") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_keys") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override; String *val_str(String *) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_keys>(thd, this); } { return get_item_copy<Item_func_json_keys>(thd, this); }
@ -641,7 +641,7 @@ public:
return name; return name;
} }
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *) override; String *val_str(String *) override;
uint get_n_paths() const override { return arg_count > 4 ? arg_count - 4 : 0; } uint get_n_paths() const override { return arg_count > 4 ? arg_count - 4 : 0; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
@ -669,7 +669,7 @@ public:
Item_json_func(thd, list), fmt(DETAILED) {} Item_json_func(thd, list), fmt(DETAILED) {}
LEX_CSTRING func_name_cstring() const override; LEX_CSTRING func_name_cstring() const override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str(String *str) override; String *val_str(String *str) override;
String *val_json(String *str) override; String *val_json(String *str) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
@ -785,7 +785,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_overlaps") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_overlaps") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
longlong val_int() override; longlong val_int() override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_overlaps>(thd, this); } { return get_item_copy<Item_func_json_overlaps>(thd, this); }

View File

@ -210,7 +210,7 @@ String *Item_func_sha::val_str_ascii(String *str)
return 0; return 0;
} }
bool Item_func_sha::fix_length_and_dec() bool Item_func_sha::fix_length_and_dec(THD *thd)
{ {
// size of hex representation of hash // size of hex representation of hash
fix_length_and_charset(MY_SHA1_HASH_SIZE * 2, default_charset()); fix_length_and_charset(MY_SHA1_HASH_SIZE * 2, default_charset());
@ -290,7 +290,7 @@ String *Item_func_sha2::val_str_ascii(String *str)
} }
bool Item_func_sha2::fix_length_and_dec() bool Item_func_sha2::fix_length_and_dec(THD *thd)
{ {
set_maybe_null(); set_maybe_null();
max_length = 0; max_length = 0;
@ -370,7 +370,7 @@ String *Item_aes_crypt::val_str(String *str2)
return 0; return 0;
} }
bool Item_func_aes_encrypt::fix_length_and_dec() bool Item_func_aes_encrypt::fix_length_and_dec(THD *thd)
{ {
max_length=my_aes_get_size(MY_AES_ECB, args[0]->max_length); max_length=my_aes_get_size(MY_AES_ECB, args[0]->max_length);
what= ENCRYPTION_FLAG_ENCRYPT; what= ENCRYPTION_FLAG_ENCRYPT;
@ -379,7 +379,7 @@ bool Item_func_aes_encrypt::fix_length_and_dec()
bool Item_func_aes_decrypt::fix_length_and_dec() bool Item_func_aes_decrypt::fix_length_and_dec(THD *thd)
{ {
max_length=args[0]->max_length; max_length=args[0]->max_length;
set_maybe_null(); set_maybe_null();
@ -388,7 +388,7 @@ bool Item_func_aes_decrypt::fix_length_and_dec()
} }
bool Item_func_to_base64::fix_length_and_dec() bool Item_func_to_base64::fix_length_and_dec(THD *thd)
{ {
base_flags|= args[0]->base_flags & item_base_t::MAYBE_NULL; base_flags|= args[0]->base_flags & item_base_t::MAYBE_NULL;
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
@ -439,7 +439,7 @@ String *Item_func_to_base64::val_str_ascii(String *str)
} }
bool Item_func_from_base64::fix_length_and_dec() bool Item_func_from_base64::fix_length_and_dec(THD *thd)
{ {
if (args[0]->max_length > (uint) my_base64_decode_max_arg_length()) if (args[0]->max_length > (uint) my_base64_decode_max_arg_length())
{ {
@ -709,7 +709,7 @@ bool Item_func_concat::append_value(THD *thd, String *res, const String *app)
} }
bool Item_func_concat::fix_length_and_dec() bool Item_func_concat::fix_length_and_dec(THD *thd)
{ {
ulonglong char_length= 0; ulonglong char_length= 0;
@ -1071,7 +1071,7 @@ null:
} }
bool Item_func_concat_ws::fix_length_and_dec() bool Item_func_concat_ws::fix_length_and_dec(THD *thd)
{ {
ulonglong char_length; ulonglong char_length;
@ -1141,7 +1141,7 @@ String *Item_func_reverse::val_str(String *str)
} }
bool Item_func_reverse::fix_length_and_dec() bool Item_func_reverse::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result(collation, args, 1)) if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE; return TRUE;
@ -1300,7 +1300,7 @@ null:
} }
bool Item_func_replace::fix_length_and_dec() bool Item_func_replace::fix_length_and_dec(THD *thd)
{ {
ulonglong char_length= (ulonglong) args[0]->max_char_length(); ulonglong char_length= (ulonglong) args[0]->max_char_length();
int diff=(int) (args[2]->max_char_length() - 1); int diff=(int) (args[2]->max_char_length() - 1);
@ -1327,7 +1327,7 @@ Item_func_sformat::Item_func_sformat(THD *thd, List<Item> &list)
} }
bool Item_func_sformat::fix_length_and_dec() bool Item_func_sformat::fix_length_and_dec(THD *thd)
{ {
if (!val_arg) if (!val_arg)
return TRUE; return TRUE;
@ -1450,7 +1450,7 @@ String *Item_func_sformat::val_str(String *res)
} }
/*********************************************************************/ /*********************************************************************/
bool Item_func_regexp_replace::fix_length_and_dec() bool Item_func_regexp_replace::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 3)) if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 3))
return TRUE; return TRUE;
@ -1588,7 +1588,7 @@ err:
} }
bool Item_func_regexp_substr::fix_length_and_dec() bool Item_func_regexp_substr::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 2)) if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 2))
return TRUE; return TRUE;
@ -1703,7 +1703,7 @@ null:
} }
bool Item_func_insert::fix_length_and_dec() bool Item_func_insert::fix_length_and_dec(THD *thd)
{ {
ulonglong char_length; ulonglong char_length;
@ -1736,7 +1736,7 @@ String *Item_str_conv::val_str(String *str)
} }
bool Item_func_lcase::fix_length_and_dec() bool Item_func_lcase::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result(collation, args, 1)) if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE; return TRUE;
@ -1747,7 +1747,7 @@ bool Item_func_lcase::fix_length_and_dec()
return FALSE; return FALSE;
} }
bool Item_func_ucase::fix_length_and_dec() bool Item_func_ucase::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result(collation, args, 1)) if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE; return TRUE;
@ -1795,7 +1795,7 @@ void Item_str_func::left_right_max_length()
} }
bool Item_func_left::fix_length_and_dec() bool Item_func_left::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result(collation, args, 1)) if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE; return TRUE;
@ -1831,7 +1831,7 @@ String *Item_func_right::val_str(String *str)
} }
bool Item_func_right::fix_length_and_dec() bool Item_func_right::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result(collation, args, 1)) if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE; return TRUE;
@ -1888,7 +1888,7 @@ String *Item_func_substr::val_str(String *str)
} }
bool Item_func_substr::fix_length_and_dec() bool Item_func_substr::fix_length_and_dec(THD *thd)
{ {
max_length=args[0]->max_length; max_length=args[0]->max_length;
@ -1918,7 +1918,7 @@ bool Item_func_substr::fix_length_and_dec()
} }
bool Item_func_substr_index::fix_length_and_dec() bool Item_func_substr_index::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 2)) if (agg_arg_charsets_for_string_result_with_comparison(collation, args, 2))
return TRUE; return TRUE;
@ -2263,7 +2263,7 @@ String *Item_func_trim::val_str(String *str)
return trimmed_value(res, (uint32) (ptr - res->ptr()), (uint32) (end - ptr)); return trimmed_value(res, (uint32) (ptr - res->ptr()), (uint32) (end - ptr));
} }
bool Item_func_trim::fix_length_and_dec() bool Item_func_trim::fix_length_and_dec(THD *thd)
{ {
if (arg_count == 1) if (arg_count == 1)
{ {
@ -2459,7 +2459,7 @@ bool Item_func_encode::seed()
return FALSE; return FALSE;
} }
bool Item_func_encode::fix_length_and_dec() bool Item_func_encode::fix_length_and_dec(THD *thd)
{ {
max_length=args[0]->max_length; max_length=args[0]->max_length;
base_flags|= ((args[0]->base_flags | args[1]->base_flags) & base_flags|= ((args[0]->base_flags | args[1]->base_flags) &
@ -2635,7 +2635,7 @@ bool Item_func_current_role::fix_fields(THD *thd, Item **ref)
return 0; return 0;
} }
bool Item_func_soundex::fix_length_and_dec() bool Item_func_soundex::fix_length_and_dec(THD *thd)
{ {
uint32 char_length= args[0]->max_char_length(); uint32 char_length= args[0]->max_char_length();
if (agg_arg_charsets_for_string_result(collation, args, 1)) if (agg_arg_charsets_for_string_result(collation, args, 1))
@ -2805,7 +2805,7 @@ String *Item_func_soundex::val_str(String *str)
const int FORMAT_MAX_DECIMALS= 38; const int FORMAT_MAX_DECIMALS= 38;
bool Item_func_format::fix_length_and_dec() bool Item_func_format::fix_length_and_dec(THD *thd)
{ {
uint32 char_length= args[0]->type_handler()->Item_decimal_notation_int_digits(args[0]); uint32 char_length= args[0]->type_handler()->Item_decimal_notation_int_digits(args[0]);
uint dec= FORMAT_MAX_DECIMALS; uint dec= FORMAT_MAX_DECIMALS;
@ -2952,7 +2952,7 @@ String *Item_func_format::val_str_ascii(String *str)
} }
bool Item_func_elt::fix_length_and_dec() bool Item_func_elt::fix_length_and_dec(THD *thd)
{ {
uint32 char_length= 0; uint32 char_length= 0;
decimals=0; decimals=0;
@ -3014,7 +3014,7 @@ String *Item_func_elt::val_str(String *str)
} }
bool Item_func_make_set::fix_length_and_dec() bool Item_func_make_set::fix_length_and_dec(THD *thd)
{ {
uint32 char_length= arg_count - 2; /* Separators */ uint32 char_length= arg_count - 2; /* Separators */
@ -3177,7 +3177,7 @@ inline String* alloc_buffer(String *res,String *str,String *tmp_value,
} }
bool Item_func_repeat::fix_length_and_dec() bool Item_func_repeat::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result(collation, args, 1)) if (agg_arg_charsets_for_string_result(collation, args, 1))
return TRUE; return TRUE;
@ -3253,7 +3253,7 @@ err:
} }
bool Item_func_space::fix_length_and_dec() bool Item_func_space::fix_length_and_dec(THD *thd)
{ {
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
if (args[0]->can_eval_in_optimize()) if (args[0]->can_eval_in_optimize())
@ -3313,7 +3313,7 @@ err:
} }
bool Item_func_binlog_gtid_pos::fix_length_and_dec() bool Item_func_binlog_gtid_pos::fix_length_and_dec(THD *thd)
{ {
collation.set(system_charset_info); collation.set(system_charset_info);
max_length= MAX_BLOB_WIDTH; max_length= MAX_BLOB_WIDTH;
@ -3362,7 +3362,7 @@ static String *default_pad_str(String *pad_str, CHARSET_INFO *collation)
return pad_str; return pad_str;
} }
bool Item_func_pad::fix_length_and_dec() bool Item_func_pad::fix_length_and_dec(THD *thd)
{ {
if (arg_count == 3) if (arg_count == 3)
{ {
@ -3698,7 +3698,7 @@ String *Item_func_conv_charset::val_str(String *str)
0 : str; 0 : str;
} }
bool Item_func_conv_charset::fix_length_and_dec() bool Item_func_conv_charset::fix_length_and_dec(THD *thd)
{ {
DBUG_ASSERT(collation.derivation == DERIVATION_IMPLICIT); DBUG_ASSERT(collation.derivation == DERIVATION_IMPLICIT);
fix_char_length(args[0]->max_char_length()); fix_char_length(args[0]->max_char_length());
@ -3724,7 +3724,7 @@ String *Item_func_set_collation::val_str(String *str)
return str; return str;
} }
bool Item_func_set_collation::fix_length_and_dec() bool Item_func_set_collation::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result(collation, args, 1)) if (agg_arg_charsets_for_string_result(collation, args, 1))
return true; return true;
@ -3781,7 +3781,7 @@ String *Item_func_collation::val_str(String *str)
} }
bool Item_func_weight_string::fix_length_and_dec() bool Item_func_weight_string::fix_length_and_dec(THD *thd)
{ {
CHARSET_INFO *cs= args[0]->collation.collation; CHARSET_INFO *cs= args[0]->collation.collation;
collation.set(&my_charset_bin, args[0]->collation.derivation); collation.set(&my_charset_bin, args[0]->collation.derivation);
@ -4171,7 +4171,7 @@ String* Item_func_export_set::val_str(String* str)
return str; return str;
} }
bool Item_func_export_set::fix_length_and_dec() bool Item_func_export_set::fix_length_and_dec(THD *thd)
{ {
uint32 length= MY_MAX(args[1]->max_char_length(), args[2]->max_char_length()); uint32 length= MY_MAX(args[1]->max_char_length(), args[2]->max_char_length());
uint32 sep_length= (arg_count > 3 ? args[3]->max_char_length() : 1); uint32 sep_length= (arg_count > 3 ? args[3]->max_char_length() : 1);
@ -4583,7 +4583,7 @@ bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref)
} }
bool Item_func_dyncol_create::fix_length_and_dec() bool Item_func_dyncol_create::fix_length_and_dec(THD *thd)
{ {
max_length= MAX_BLOB_WIDTH; max_length= MAX_BLOB_WIDTH;
set_maybe_null(); set_maybe_null();
@ -5434,7 +5434,7 @@ Item_temptable_rowid::Item_temptable_rowid(TABLE *table_arg)
max_length= table->file->ref_length; max_length= table->file->ref_length;
} }
bool Item_temptable_rowid::fix_length_and_dec() bool Item_temptable_rowid::fix_length_and_dec(THD *thd)
{ {
used_tables_cache= table->map; used_tables_cache= table->map;
const_item_cache= false; const_item_cache= false;
@ -5700,7 +5700,7 @@ error_exit:
return nullptr; return nullptr;
} }
bool Item_func_natural_sort_key::fix_length_and_dec(void) bool Item_func_natural_sort_key::fix_length_and_dec(THD *thd)
{ {
if (agg_arg_charsets_for_string_result(collation, args, 1)) if (agg_arg_charsets_for_string_result(collation, args, 1))
return true; return true;

View File

@ -145,7 +145,7 @@ class Item_func_md5 :public Item_str_ascii_checksum_func
public: public:
Item_func_md5(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {} Item_func_md5(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {}
String *val_str_ascii(String *) override; String *val_str_ascii(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
fix_length_and_charset(32, default_charset()); fix_length_and_charset(32, default_charset());
return FALSE; return FALSE;
@ -165,7 +165,7 @@ class Item_func_sha :public Item_str_ascii_checksum_func
public: public:
Item_func_sha(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {} Item_func_sha(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {}
String *val_str_ascii(String *) override; String *val_str_ascii(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("sha") }; static LEX_CSTRING name= {STRING_WITH_LEN("sha") };
@ -181,7 +181,7 @@ public:
Item_func_sha2(THD *thd, Item *a, Item *b) Item_func_sha2(THD *thd, Item *a, Item *b)
:Item_str_ascii_checksum_func(thd, a, b) {} :Item_str_ascii_checksum_func(thd, a, b) {}
String *val_str_ascii(String *) override; String *val_str_ascii(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("sha2") }; static LEX_CSTRING name= {STRING_WITH_LEN("sha2") };
@ -198,7 +198,7 @@ public:
Item_func_to_base64(THD *thd, Item *a) Item_func_to_base64(THD *thd, Item *a)
:Item_str_ascii_checksum_func(thd, a) {} :Item_str_ascii_checksum_func(thd, a) {}
String *val_str_ascii(String *) override; String *val_str_ascii(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("to_base64") }; static LEX_CSTRING name= {STRING_WITH_LEN("to_base64") };
@ -215,7 +215,7 @@ public:
Item_func_from_base64(THD *thd, Item *a) Item_func_from_base64(THD *thd, Item *a)
:Item_str_binary_checksum_func(thd, a) { } :Item_str_binary_checksum_func(thd, a) { }
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("from_base64") }; static LEX_CSTRING name= {STRING_WITH_LEN("from_base64") };
@ -246,7 +246,7 @@ class Item_func_aes_encrypt :public Item_aes_crypt
public: public:
Item_func_aes_encrypt(THD *thd, Item *a, Item *b) Item_func_aes_encrypt(THD *thd, Item *a, Item *b)
:Item_aes_crypt(thd, a, b) {} :Item_aes_crypt(thd, a, b) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("aes_encrypt") }; static LEX_CSTRING name= {STRING_WITH_LEN("aes_encrypt") };
@ -261,7 +261,7 @@ class Item_func_aes_decrypt :public Item_aes_crypt
public: public:
Item_func_aes_decrypt(THD *thd, Item *a, Item *b): Item_func_aes_decrypt(THD *thd, Item *a, Item *b):
Item_aes_crypt(thd, a, b) {} Item_aes_crypt(thd, a, b) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("aes_decrypt") }; static LEX_CSTRING name= {STRING_WITH_LEN("aes_decrypt") };
@ -282,7 +282,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("natural_sort_key")}; static LEX_CSTRING name= {STRING_WITH_LEN("natural_sort_key")};
return name; return name;
} }
bool fix_length_and_dec(void) override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ {
return get_item_copy<Item_func_natural_sort_key>(thd, this); return get_item_copy<Item_func_natural_sort_key>(thd, this);
@ -308,7 +308,7 @@ public:
Item_func_concat(THD *thd, List<Item> &list): Item_str_func(thd, list) {} Item_func_concat(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
Item_func_concat(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} Item_func_concat(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("concat") }; static LEX_CSTRING name= {STRING_WITH_LEN("concat") };
@ -351,7 +351,7 @@ public:
Item_func_decode_histogram(THD *thd, Item *a, Item *b): Item_func_decode_histogram(THD *thd, Item *a, Item *b):
Item_str_func(thd, a, b) {} Item_str_func(thd, a, b) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(system_charset_info); collation.set(system_charset_info);
max_length= MAX_BLOB_WIDTH; max_length= MAX_BLOB_WIDTH;
@ -373,7 +373,7 @@ class Item_func_concat_ws :public Item_str_func
public: public:
Item_func_concat_ws(THD *thd, List<Item> &list): Item_str_func(thd, list) {} Item_func_concat_ws(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("concat_ws") }; static LEX_CSTRING name= {STRING_WITH_LEN("concat_ws") };
@ -390,7 +390,7 @@ class Item_func_reverse :public Item_str_func
public: public:
Item_func_reverse(THD *thd, Item *a): Item_str_func(thd, a) {} Item_func_reverse(THD *thd, Item *a): Item_str_func(thd, a) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("reverse") }; static LEX_CSTRING name= {STRING_WITH_LEN("reverse") };
@ -408,7 +408,7 @@ public:
Item_func_replace(THD *thd, Item *org, Item *find, Item *replace): Item_func_replace(THD *thd, Item *org, Item *find, Item *replace):
Item_str_func(thd, org, find, replace) {} Item_str_func(thd, org, find, replace) {}
String *val_str(String *to) override { return val_str_internal(to, NULL); }; String *val_str(String *to) override { return val_str_internal(to, NULL); };
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
String *val_str_internal(String *str, String *empty_string_for_null); String *val_str_internal(String *str, String *empty_string_for_null);
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
@ -456,7 +456,7 @@ public:
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
String *val_str(String *str) override; String *val_str(String *str) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("regexp_replace") }; static LEX_CSTRING name= {STRING_WITH_LEN("regexp_replace") };
@ -481,7 +481,7 @@ public:
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
String *val_str(String *str) override; String *val_str(String *str) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("regexp_substr") }; static LEX_CSTRING name= {STRING_WITH_LEN("regexp_substr") };
@ -499,7 +499,7 @@ public:
Item *new_str): Item *new_str):
Item_str_func(thd, org, start, length, new_str) {} Item_str_func(thd, org, start, length, new_str) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("insert") }; static LEX_CSTRING name= {STRING_WITH_LEN("insert") };
@ -531,7 +531,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("lcase") }; static LEX_CSTRING name= {STRING_WITH_LEN("lcase") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_lcase>(thd, this); } { return get_item_copy<Item_func_lcase>(thd, this); }
}; };
@ -545,7 +545,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("ucase") }; static LEX_CSTRING name= {STRING_WITH_LEN("ucase") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_ucase>(thd, this); } { return get_item_copy<Item_func_ucase>(thd, this); }
}; };
@ -557,7 +557,7 @@ class Item_func_left :public Item_str_func
public: public:
Item_func_left(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} Item_func_left(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("left") }; static LEX_CSTRING name= {STRING_WITH_LEN("left") };
@ -574,7 +574,7 @@ class Item_func_right :public Item_str_func
public: public:
Item_func_right(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} Item_func_right(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("right") }; static LEX_CSTRING name= {STRING_WITH_LEN("right") };
@ -595,7 +595,7 @@ public:
Item_func_substr(THD *thd, Item *a, Item *b, Item *c): Item_func_substr(THD *thd, Item *a, Item *b, Item *c):
Item_str_func(thd, a, b, c) {} Item_str_func(thd, a, b, c) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("substr") }; static LEX_CSTRING name= {STRING_WITH_LEN("substr") };
@ -612,7 +612,7 @@ public:
Item_func_sformat(THD *thd, List<Item> &list); Item_func_sformat(THD *thd, List<Item> &list);
~Item_func_sformat() { delete [] val_arg; } ~Item_func_sformat() { delete [] val_arg; }
String *val_str(String*) override; String *val_str(String*) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("sformat") }; static LEX_CSTRING name= {STRING_WITH_LEN("sformat") };
@ -634,9 +634,9 @@ public:
Item_func_substr(thd, a, b) {} Item_func_substr(thd, a, b) {}
Item_func_substr_oracle(THD *thd, Item *a, Item *b, Item *c): Item_func_substr_oracle(THD *thd, Item *a, Item *b, Item *c):
Item_func_substr(thd, a, b, c) {} Item_func_substr(thd, a, b, c) {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
bool res= Item_func_substr::fix_length_and_dec(); bool res= Item_func_substr::fix_length_and_dec(thd);
set_maybe_null(); set_maybe_null();
return res; return res;
} }
@ -656,7 +656,7 @@ public:
Item_func_substr_index(THD *thd, Item *a,Item *b,Item *c): Item_func_substr_index(THD *thd, Item *a,Item *b,Item *c):
Item_str_func(thd, a, b, c) {} Item_str_func(thd, a, b, c) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("substring_index") }; static LEX_CSTRING name= {STRING_WITH_LEN("substring_index") };
@ -701,7 +701,7 @@ public:
Item_func_trim(THD *thd, Item *a): Item_str_func(thd, a) {} Item_func_trim(THD *thd, Item *a): Item_str_func(thd, a) {}
Sql_mode_dependency value_depends_on_sql_mode() const override; Sql_mode_dependency value_depends_on_sql_mode() const override;
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("trim") }; static LEX_CSTRING name= {STRING_WITH_LEN("trim") };
@ -733,9 +733,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("trim_oracle") }; static LEX_CSTRING name= {STRING_WITH_LEN("trim_oracle") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
bool res= Item_func_trim::fix_length_and_dec(); bool res= Item_func_trim::fix_length_and_dec(thd);
set_maybe_null(); set_maybe_null();
return res; return res;
} }
@ -785,9 +785,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("ltrim_oracle") }; static LEX_CSTRING name= {STRING_WITH_LEN("ltrim_oracle") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
bool res= Item_func_ltrim::fix_length_and_dec(); bool res= Item_func_ltrim::fix_length_and_dec(thd);
set_maybe_null(); set_maybe_null();
return res; return res;
} }
@ -833,9 +833,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("rtrim_oracle") }; static LEX_CSTRING name= {STRING_WITH_LEN("rtrim_oracle") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
bool res= Item_func_rtrim::fix_length_and_dec(); bool res= Item_func_rtrim::fix_length_and_dec(thd);
set_maybe_null(); set_maybe_null();
return res; return res;
} }
@ -866,7 +866,7 @@ public:
Item_str_ascii_checksum_func(thd, a), alg(al), deflt(0) {} Item_str_ascii_checksum_func(thd, a), alg(al), deflt(0) {}
String *val_str_ascii(String *str) override; String *val_str_ascii(String *str) override;
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
fix_length_and_charset((alg == 1 ? fix_length_and_charset((alg == 1 ?
SCRAMBLED_PASSWORD_CHAR_LENGTH : SCRAMBLED_PASSWORD_CHAR_LENGTH :
@ -897,7 +897,7 @@ public:
Item_func_des_encrypt(THD *thd, Item *a, Item *b) Item_func_des_encrypt(THD *thd, Item *a, Item *b)
:Item_str_binary_checksum_func(thd, a, b) {} :Item_str_binary_checksum_func(thd, a, b) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
set_maybe_null(); set_maybe_null();
/* 9 = MAX ((8- (arg_len % 8)) + 1) */ /* 9 = MAX ((8- (arg_len % 8)) + 1) */
@ -922,7 +922,7 @@ public:
Item_func_des_decrypt(THD *thd, Item *a, Item *b) Item_func_des_decrypt(THD *thd, Item *a, Item *b)
:Item_str_binary_checksum_func(thd, a, b) {} :Item_str_binary_checksum_func(thd, a, b) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
set_maybe_null(); set_maybe_null();
/* 9 = MAX ((8- (arg_len % 8)) + 1) */ /* 9 = MAX ((8- (arg_len % 8)) + 1) */
@ -966,7 +966,7 @@ public:
constructor_helper(); constructor_helper();
} }
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
set_maybe_null(); set_maybe_null();
max_length = 13; max_length = 13;
@ -999,7 +999,7 @@ public:
Item_func_encode(THD *thd, Item *a, Item *seed_arg): Item_func_encode(THD *thd, Item *a, Item *seed_arg):
Item_str_binary_checksum_func(thd, a, seed_arg) {} Item_str_binary_checksum_func(thd, a, seed_arg) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("encode") }; static LEX_CSTRING name= {STRING_WITH_LEN("encode") };
@ -1057,7 +1057,7 @@ class Item_func_database :public Item_func_sysconst
public: public:
Item_func_database(THD *thd): Item_func_sysconst(thd) {} Item_func_database(THD *thd): Item_func_sysconst(thd) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= NAME_CHAR_LEN * system_charset_info->mbmaxlen; max_length= NAME_CHAR_LEN * system_charset_info->mbmaxlen;
set_maybe_null(); set_maybe_null();
@ -1091,7 +1091,7 @@ public:
{ {
str->append(func_name_cstring()); str->append(func_name_cstring());
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= 512 * system_charset_info->mbmaxlen; max_length= 512 * system_charset_info->mbmaxlen;
null_value= false; null_value= false;
@ -1119,7 +1119,7 @@ public:
return (null_value ? 0 : &str_value); return (null_value ? 0 : &str_value);
} }
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= (uint32) (username_char_length + max_length= (uint32) (username_char_length +
HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN; HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN;
@ -1173,7 +1173,7 @@ public:
Item_func_current_role(THD *thd, Name_resolution_context *context_arg): Item_func_current_role(THD *thd, Name_resolution_context *context_arg):
Item_func_sysconst(thd), context(context_arg) {} Item_func_sysconst(thd), context(context_arg) {}
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= (uint32) username_char_length * SYSTEM_CHARSET_MBMAXLEN; max_length= (uint32) username_char_length * SYSTEM_CHARSET_MBMAXLEN;
return FALSE; return FALSE;
@ -1209,7 +1209,7 @@ class Item_func_soundex :public Item_str_func
public: public:
Item_func_soundex(THD *thd, Item *a): Item_str_func(thd, a) {} Item_func_soundex(THD *thd, Item *a): Item_str_func(thd, a) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("soundex") }; static LEX_CSTRING name= {STRING_WITH_LEN("soundex") };
@ -1227,7 +1227,7 @@ public:
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
String *val_str(String *str) override; String *val_str(String *str) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("elt") }; static LEX_CSTRING name= {STRING_WITH_LEN("elt") };
@ -1245,7 +1245,7 @@ class Item_func_make_set :public Item_str_func
public: public:
Item_func_make_set(THD *thd, List<Item> &list): Item_str_func(thd, list) {} Item_func_make_set(THD *thd, List<Item> &list): Item_str_func(thd, list) {}
String *val_str(String *str) override; String *val_str(String *str) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("make_set") }; static LEX_CSTRING name= {STRING_WITH_LEN("make_set") };
@ -1266,7 +1266,7 @@ public:
Item_str_ascii_func(thd, org, dec, lang) {} Item_str_ascii_func(thd, org, dec, lang) {}
String *val_str_ascii(String *) override; String *val_str_ascii(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("format") }; static LEX_CSTRING name= {STRING_WITH_LEN("format") };
@ -1290,7 +1290,7 @@ public:
{ collation.set(cs); } { collation.set(cs); }
String *val_str(String *) override; String *val_str(String *) override;
void append_char(String * str, int32 num); void append_char(String * str, int32 num);
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= arg_count * 4; max_length= arg_count * 4;
return FALSE; return FALSE;
@ -1311,7 +1311,7 @@ public:
Item_func_chr(THD *thd, Item *arg1, CHARSET_INFO *cs): Item_func_chr(THD *thd, Item *arg1, CHARSET_INFO *cs):
Item_func_char(thd, arg1, cs) {} Item_func_char(thd, arg1, cs) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= 4; max_length= 4;
return FALSE; return FALSE;
@ -1332,7 +1332,7 @@ public:
Item_func_repeat(THD *thd, Item *arg1, Item *arg2): Item_func_repeat(THD *thd, Item *arg1, Item *arg2):
Item_str_func(thd, arg1, arg2) {} Item_str_func(thd, arg1, arg2) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("repeat") }; static LEX_CSTRING name= {STRING_WITH_LEN("repeat") };
@ -1348,7 +1348,7 @@ class Item_func_space :public Item_str_func
public: public:
Item_func_space(THD *thd, Item *arg1): Item_str_func(thd, arg1) {} Item_func_space(THD *thd, Item *arg1): Item_str_func(thd, arg1) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("space") }; static LEX_CSTRING name= {STRING_WITH_LEN("space") };
@ -1365,7 +1365,7 @@ public:
Item_func_binlog_gtid_pos(THD *thd, Item *arg1, Item *arg2): Item_func_binlog_gtid_pos(THD *thd, Item *arg1, Item *arg2):
Item_str_func(thd, arg1, arg2) {} Item_str_func(thd, arg1, arg2) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("binlog_gtid_pos") }; static LEX_CSTRING name= {STRING_WITH_LEN("binlog_gtid_pos") };
@ -1389,7 +1389,7 @@ public:
Item_str_func(thd, arg1, arg2, arg3) {} Item_str_func(thd, arg1, arg2, arg3) {}
Item_func_pad(THD *thd, Item *arg1, Item *arg2): Item_func_pad(THD *thd, Item *arg1, Item *arg2):
Item_str_func(thd, arg1, arg2) {} Item_str_func(thd, arg1, arg2) {}
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
}; };
@ -1421,9 +1421,9 @@ public:
Item_func_rpad(thd, arg1, arg2, arg3) {} Item_func_rpad(thd, arg1, arg2, arg3) {}
Item_func_rpad_oracle(THD *thd, Item *arg1, Item *arg2): Item_func_rpad_oracle(THD *thd, Item *arg1, Item *arg2):
Item_func_rpad(thd, arg1, arg2) {} Item_func_rpad(thd, arg1, arg2) {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
bool res= Item_func_rpad::fix_length_and_dec(); bool res= Item_func_rpad::fix_length_and_dec(thd);
set_maybe_null(); set_maybe_null();
return res; return res;
} }
@ -1464,9 +1464,9 @@ public:
Item_func_lpad(thd, arg1, arg2, arg3) {} Item_func_lpad(thd, arg1, arg2, arg3) {}
Item_func_lpad_oracle(THD *thd, Item *arg1, Item *arg2): Item_func_lpad_oracle(THD *thd, Item *arg1, Item *arg2):
Item_func_lpad(thd, arg1, arg2) {} Item_func_lpad(thd, arg1, arg2) {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
bool res= Item_func_lpad::fix_length_and_dec(); bool res= Item_func_lpad::fix_length_and_dec(thd);
set_maybe_null(); set_maybe_null();
return res; return res;
} }
@ -1491,7 +1491,7 @@ public:
return name; return name;
} }
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(default_charset()); collation.set(default_charset());
fix_char_length(64); fix_char_length(64);
@ -1530,7 +1530,7 @@ public:
DBUG_ASSERT(fixed()); DBUG_ASSERT(fixed());
return m_arg0_type_handler->Item_func_hex_val_str_ascii(this, str); return m_arg0_type_handler->Item_func_hex_val_str_ascii(this, str);
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
decimals=0; decimals=0;
@ -1557,7 +1557,7 @@ public:
return name; return name;
} }
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(&my_charset_bin); collation.set(&my_charset_bin);
decimals=0; decimals=0;
@ -1583,7 +1583,7 @@ public:
set_maybe_null(); set_maybe_null();
} }
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(args[0]->collation); collation.set(args[0]->collation);
decimals=0; decimals=0;
@ -1637,7 +1637,7 @@ public:
tmp->set_charset(&my_charset_bin); tmp->set_charset(&my_charset_bin);
return tmp; return tmp;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(&my_charset_bin); collation.set(&my_charset_bin);
max_length=args[0]->max_length; max_length=args[0]->max_length;
@ -1666,7 +1666,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("load_file") }; static LEX_CSTRING name= {STRING_WITH_LEN("load_file") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(&my_charset_bin, DERIVATION_COERCIBLE); collation.set(&my_charset_bin, DERIVATION_COERCIBLE);
set_maybe_null(); set_maybe_null();
@ -1692,7 +1692,7 @@ class Item_func_export_set: public Item_str_func
Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d, Item* e): Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d, Item* e):
Item_str_func(thd, a, b, c, d, e) {} Item_str_func(thd, a, b, c, d, e) {}
String *val_str(String *str) override; String *val_str(String *str) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("export_set") }; static LEX_CSTRING name= {STRING_WITH_LEN("export_set") };
@ -1714,7 +1714,7 @@ public:
return name; return name;
} }
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(args[0]->collation); collation.set(args[0]->collation);
ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 + ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 +
@ -1811,7 +1811,7 @@ public:
return 1; return 1;
return res; return res;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("convert") }; static LEX_CSTRING name= {STRING_WITH_LEN("convert") };
@ -1830,7 +1830,7 @@ public:
Item_func_set_collation(THD *thd, Item *a, CHARSET_INFO *set_collation): Item_func_set_collation(THD *thd, Item *a, CHARSET_INFO *set_collation):
Item_str_func(thd, a), m_set_collation(set_collation) {} Item_str_func(thd, a), m_set_collation(set_collation) {}
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool eq(const Item *item, bool binary_cmp) const override; bool eq(const Item *item, bool binary_cmp) const override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
@ -1855,7 +1855,7 @@ class Item_func_expr_str_metadata :public Item_str_func
{ {
public: public:
Item_func_expr_str_metadata(THD *thd, Item *a): Item_str_func(thd, a) { } Item_func_expr_str_metadata(THD *thd, Item *a): Item_str_func(thd, a) { }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
collation.set(system_charset_info); collation.set(system_charset_info);
max_length= 64 * collation.collation->mbmaxlen; // should be enough max_length= 64 * collation.collation->mbmaxlen; // should be enough
@ -1923,7 +1923,7 @@ public:
return name; return name;
} }
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool eq(const Item *item, bool binary_cmp) const override bool eq(const Item *item, bool binary_cmp) const override
{ {
if (!Item_str_func::eq(item, binary_cmp)) if (!Item_str_func::eq(item, binary_cmp))
@ -1966,7 +1966,7 @@ public:
static LEX_CSTRING crc32c_name= {STRING_WITH_LEN("crc32c") }; static LEX_CSTRING crc32c_name= {STRING_WITH_LEN("crc32c") };
return crc_func == my_crc32c ? crc32c_name : crc32_name; return crc_func == my_crc32c ? crc32c_name : crc32_name;
} }
bool fix_length_and_dec() override { max_length=10; return FALSE; } bool fix_length_and_dec(THD *thd) override { max_length=10; return FALSE; }
longlong val_int() override; longlong val_int() override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_crc32>(thd, this); } { return get_item_copy<Item_func_crc32>(thd, this); }
@ -1983,7 +1983,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("uncompressed_length") }; static LEX_CSTRING name= {STRING_WITH_LEN("uncompressed_length") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length=10; max_length=10;
set_maybe_null(); set_maybe_null();
@ -2005,7 +2005,7 @@ class Item_func_compress: public Item_str_binary_checksum_func
public: public:
Item_func_compress(THD *thd, Item *a) Item_func_compress(THD *thd, Item *a)
:Item_str_binary_checksum_func(thd, a) {} :Item_str_binary_checksum_func(thd, a) {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= (args[0]->max_length * 120) / 100 + 12; max_length= (args[0]->max_length * 120) / 100 + 12;
return FALSE; return FALSE;
@ -2026,7 +2026,7 @@ class Item_func_uncompress: public Item_str_binary_checksum_func
public: public:
Item_func_uncompress(THD *thd, Item *a) Item_func_uncompress(THD *thd, Item *a)
:Item_str_binary_checksum_func(thd, a) {} :Item_str_binary_checksum_func(thd, a) {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
set_maybe_null(); set_maybe_null();
max_length= MAX_BLOB_WIDTH; max_length= MAX_BLOB_WIDTH;
@ -2056,7 +2056,7 @@ protected:
public: public:
Item_func_dyncol_create(THD *thd, List<Item> &args, DYNCALL_CREATE_DEF *dfs); Item_func_dyncol_create(THD *thd, List<Item> &args, DYNCALL_CREATE_DEF *dfs);
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("column_create") }; static LEX_CSTRING name= {STRING_WITH_LEN("column_create") };
@ -2098,7 +2098,7 @@ public:
return name; return name;
} }
String *val_str(String *) override; String *val_str(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= MAX_BLOB_WIDTH; max_length= MAX_BLOB_WIDTH;
set_maybe_null(); set_maybe_null();
@ -2118,7 +2118,7 @@ class Item_dyncol_get: public Item_str_func
public: public:
Item_dyncol_get(THD *thd, Item *str, Item *num): Item_str_func(thd, str, num) Item_dyncol_get(THD *thd, Item *str, Item *num): Item_str_func(thd, str, num)
{} {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
set_maybe_null(); set_maybe_null();
max_length= MAX_BLOB_WIDTH; max_length= MAX_BLOB_WIDTH;
@ -2165,7 +2165,7 @@ class Item_func_dyncol_list: public Item_str_func
public: public:
Item_func_dyncol_list(THD *thd, Item *str): Item_str_func(thd, str) Item_func_dyncol_list(THD *thd, Item *str): Item_str_func(thd, str)
{collation.set(DYNCOL_UTF);} {collation.set(DYNCOL_UTF);}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
set_maybe_null(); set_maybe_null();
max_length= MAX_BLOB_WIDTH; max_length= MAX_BLOB_WIDTH;
@ -2202,7 +2202,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("<rowid>") }; static LEX_CSTRING name= {STRING_WITH_LEN("<rowid>") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_temptable_rowid>(thd, this); } { return get_item_copy<Item_temptable_rowid>(thd, this); }
}; };
@ -2221,7 +2221,7 @@ public:
return name; return name;
} }
String *val_str_ascii(String *) override; String *val_str_ascii(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= WSREP_GTID_STR_LEN; max_length= WSREP_GTID_STR_LEN;
set_maybe_null(); set_maybe_null();
@ -2242,7 +2242,7 @@ public:
return name; return name;
} }
String *val_str_ascii(String *) override; String *val_str_ascii(String *) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= WSREP_GTID_STR_LEN; max_length= WSREP_GTID_STR_LEN;
set_maybe_null(); set_maybe_null();

View File

@ -1141,7 +1141,7 @@ Item_sum_num::fix_fields(THD *thd, Item **ref)
result_field=0; result_field=0;
max_length=float_length(decimals); max_length=float_length(decimals);
null_value=1; null_value=1;
if (fix_length_and_dec() || if (fix_length_and_dec(thd) ||
check_sum_func(thd, ref)) check_sum_func(thd, ref))
return TRUE; return TRUE;
@ -1167,7 +1167,7 @@ Item_sum_min_max::fix_fields(THD *thd, Item **ref)
/* We should ignore FIELD's in arguments to sum functions */ /* We should ignore FIELD's in arguments to sum functions */
with_flags|= (args[0]->with_flags & ~item_with_t::FIELD); with_flags|= (args[0]->with_flags & ~item_with_t::FIELD);
if (fix_length_and_dec()) if (fix_length_and_dec(thd))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
if (!is_window_func_sum_expr()) if (!is_window_func_sum_expr())
@ -1243,7 +1243,7 @@ bool Item_sum_hybrid::fix_length_and_dec_string()
} }
bool Item_sum_min_max::fix_length_and_dec() bool Item_sum_min_max::fix_length_and_dec(THD *thd)
{ {
DBUG_ASSERT(args[0]->field_type() == args[0]->real_item()->field_type()); DBUG_ASSERT(args[0]->field_type() == args[0]->real_item()->field_type());
DBUG_ASSERT(args[0]->result_type() == args[0]->real_item()->result_type()); DBUG_ASSERT(args[0]->result_type() == args[0]->real_item()->result_type());
@ -1372,7 +1372,7 @@ Item_sum_sp::fix_fields(THD *thd, Item **ref)
result_field= NULL; result_field= NULL;
max_length= float_length(decimals); max_length= float_length(decimals);
null_value= 1; null_value= 1;
if (fix_length_and_dec()) if (fix_length_and_dec(thd))
return TRUE; return TRUE;
if (check_sum_func(thd, ref)) if (check_sum_func(thd, ref))
@ -1459,12 +1459,12 @@ Item_sum_sp::cleanup()
*/ */
bool bool
Item_sum_sp::fix_length_and_dec() Item_sum_sp::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_sum_sp::fix_length_and_dec"); DBUG_ENTER("Item_sum_sp::fix_length_and_dec");
DBUG_ASSERT(sp_result_field); DBUG_ASSERT(sp_result_field);
Type_std_attributes::set(sp_result_field->type_std_attributes()); Type_std_attributes::set(sp_result_field->type_std_attributes());
bool res= Item_sum::fix_length_and_dec(); bool res= Item_sum::fix_length_and_dec(thd);
DBUG_RETURN(res); DBUG_RETURN(res);
} }
@ -1560,7 +1560,7 @@ void Item_sum_sum::fix_length_and_dec_decimal()
} }
bool Item_sum_sum::fix_length_and_dec() bool Item_sum_sum::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_sum_sum::fix_length_and_dec"); DBUG_ENTER("Item_sum_sum::fix_length_and_dec");
set_maybe_null(); set_maybe_null();
@ -1982,7 +1982,7 @@ void Item_sum_avg::fix_length_and_dec_double()
} }
bool Item_sum_avg::fix_length_and_dec() bool Item_sum_avg::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_sum_avg::fix_length_and_dec"); DBUG_ENTER("Item_sum_avg::fix_length_and_dec");
prec_increment= current_thd->variables.div_precincrement; prec_increment= current_thd->variables.div_precincrement;
@ -2214,7 +2214,7 @@ void Item_sum_variance::fix_length_and_dec_decimal()
} }
bool Item_sum_variance::fix_length_and_dec() bool Item_sum_variance::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_sum_variance::fix_length_and_dec"); DBUG_ENTER("Item_sum_variance::fix_length_and_dec");
set_maybe_null(); set_maybe_null();
@ -3472,7 +3472,7 @@ my_decimal *Item_sum_udf_int::val_decimal(my_decimal *dec)
/** Default max_length is max argument length. */ /** Default max_length is max argument length. */
bool Item_sum_udf_str::fix_length_and_dec() bool Item_sum_udf_str::fix_length_and_dec(THD *thd)
{ {
DBUG_ENTER("Item_sum_udf_str::fix_length_and_dec"); DBUG_ENTER("Item_sum_udf_str::fix_length_and_dec");
max_length=0; max_length=0;

View File

@ -461,7 +461,7 @@ public:
Updated value is then saved in the field. Updated value is then saved in the field.
*/ */
virtual void update_field()=0; virtual void update_field()=0;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
set_maybe_null(); set_maybe_null();
null_value=1; null_value=1;
@ -783,7 +783,7 @@ public:
{ {
return get_date_from_int(thd, ltime, fuzzydate); return get_date_from_int(thd, ltime, fuzzydate);
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=21; max_length=21;
@ -805,7 +805,7 @@ protected:
my_decimal direct_sum_decimal; my_decimal direct_sum_decimal;
my_decimal dec_buffs[2]; my_decimal dec_buffs[2];
uint curr_dec_buff; uint curr_dec_buff;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
public: public:
Item_sum_sum(THD *thd, Item *item_par, bool distinct): Item_sum_sum(THD *thd, Item *item_par, bool distinct):
@ -950,7 +950,7 @@ public:
void fix_length_and_dec_double(); void fix_length_and_dec_double();
void fix_length_and_dec_decimal(); void fix_length_and_dec_decimal();
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
enum Sumfunctype sum_func () const override enum Sumfunctype sum_func () const override
{ {
return has_with_distinct() ? AVG_DISTINCT_FUNC : AVG_FUNC; return has_with_distinct() ? AVG_DISTINCT_FUNC : AVG_FUNC;
@ -1034,7 +1034,7 @@ public:
class Item_sum_variance :public Item_sum_double class Item_sum_variance :public Item_sum_double
{ {
Stddev m_stddev; Stddev m_stddev;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
public: public:
uint sample; uint sample;
@ -1149,7 +1149,7 @@ public:
cmp_sign(item->cmp_sign), was_values(item->was_values) cmp_sign(item->cmp_sign), was_values(item->was_values)
{ } { }
bool fix_fields(THD *, Item **) override; bool fix_fields(THD *, Item **) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void setup_hybrid(THD *thd, Item *item, Item *value_arg); void setup_hybrid(THD *thd, Item *item, Item *value_arg);
void clear() override; void clear() override;
void direct_add(Item *item); void direct_add(Item *item);
@ -1240,7 +1240,7 @@ public:
void update_field() override; void update_field() override;
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_ulonglong; } { return &type_handler_ulonglong; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
if (args[0]->check_type_can_return_int(func_name_cstring())) if (args[0]->check_type_can_return_int(func_name_cstring()))
return true; return true;
@ -1430,7 +1430,7 @@ public:
{ {
return create_table_field_from_handler(root, table); return create_table_field_from_handler(root, table);
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
LEX_CSTRING func_name_cstring() const override; LEX_CSTRING func_name_cstring() const override;
const Type_handler *type_handler() const override; const Type_handler *type_handler() const override;
@ -1720,7 +1720,7 @@ class Item_sum_udf_float :public Item_udf_sum
my_decimal *val_decimal(my_decimal *) override; my_decimal *val_decimal(my_decimal *) override;
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_double; } { return &type_handler_double; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ fix_num_length_and_dec(); return FALSE; } { fix_num_length_and_dec(); return FALSE; }
Item *copy_or_same(THD* thd) override; Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
@ -1748,7 +1748,7 @@ public:
return &type_handler_ulonglong; return &type_handler_ulonglong;
return &type_handler_slonglong; return &type_handler_slonglong;
} }
bool fix_length_and_dec() override { decimals=0; max_length=21; return FALSE; } bool fix_length_and_dec(THD *thd) override { decimals=0; max_length=21; return FALSE; }
Item *copy_or_same(THD* thd) override; Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_udf_int>(thd, this); } { return get_item_copy<Item_sum_udf_int>(thd, this); }
@ -1790,7 +1790,7 @@ public:
my_decimal *val_decimal(my_decimal *dec) override; my_decimal *val_decimal(my_decimal *dec) override;
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return string_type_handler(); } { return string_type_handler(); }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *copy_or_same(THD* thd) override; Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_udf_str>(thd, this); } { return get_item_copy<Item_sum_udf_str>(thd, this); }
@ -1821,7 +1821,7 @@ public:
my_decimal *val_decimal(my_decimal *) override; my_decimal *val_decimal(my_decimal *) override;
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_newdecimal; } { return &type_handler_newdecimal; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ fix_num_length_and_dec(); return FALSE; } { fix_num_length_and_dec(); return FALSE; }
Item *copy_or_same(THD* thd) override; Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
@ -1899,7 +1899,7 @@ public:
{ DBUG_ASSERT(fixed()); null_value=1; return 0; } { DBUG_ASSERT(fixed()); null_value=1; return 0; }
double val_real() { DBUG_ASSERT(fixed()); null_value=1; return 0.0; } double val_real() { DBUG_ASSERT(fixed()); null_value=1; return 0.0; }
longlong val_int() { DBUG_ASSERT(fixed()); null_value=1; return 0; } longlong val_int() { DBUG_ASSERT(fixed()); null_value=1; return 0; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ base_flags|= item_base_t::MAYBE_NULL; max_length=0; return FALSE; } { base_flags|= item_base_t::MAYBE_NULL; max_length=0; return FALSE; }
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
void clear() {} void clear() {}

View File

@ -971,9 +971,8 @@ longlong Item_func_month::val_int()
} }
bool Item_func_monthname::fix_length_and_dec() bool Item_func_monthname::fix_length_and_dec(THD *thd)
{ {
THD* thd= current_thd;
CHARSET_INFO *cs= thd->variables.collation_connection; CHARSET_INFO *cs= thd->variables.collation_connection;
locale= thd->variables.lc_time_names; locale= thd->variables.lc_time_names;
collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire()); collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
@ -1116,9 +1115,8 @@ longlong Item_func_weekday::val_int()
return dt.weekday(odbc_type) + MY_TEST(odbc_type); return dt.weekday(odbc_type) + MY_TEST(odbc_type);
} }
bool Item_func_dayname::fix_length_and_dec() bool Item_func_dayname::fix_length_and_dec(THD *thd)
{ {
THD* thd= current_thd;
CHARSET_INFO *cs= thd->variables.collation_connection; CHARSET_INFO *cs= thd->variables.collation_connection;
locale= thd->variables.lc_time_names; locale= thd->variables.lc_time_names;
collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire()); collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
@ -1735,9 +1733,8 @@ bool Item_func_sec_to_time::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fu
return false; return false;
} }
bool Item_func_date_format::fix_length_and_dec() bool Item_func_date_format::fix_length_and_dec(THD *thd)
{ {
THD* thd= current_thd;
if (!is_time_format) if (!is_time_format)
{ {
if (arg_count < 3) if (arg_count < 3)
@ -2617,9 +2614,8 @@ err_exit:
} }
bool Item_func_tochar::fix_length_and_dec() bool Item_func_tochar::fix_length_and_dec(THD *thd)
{ {
thd= current_thd;
CHARSET_INFO *cs= thd->variables.collation_connection; CHARSET_INFO *cs= thd->variables.collation_connection;
Item *arg1= args[1]->this_item(); Item *arg1= args[1]->this_item();
my_repertoire_t repertoire= arg1->collation.repertoire; my_repertoire_t repertoire= arg1->collation.repertoire;
@ -2683,6 +2679,7 @@ bool Item_func_tochar::fix_length_and_dec()
String *Item_func_tochar::val_str(String* str) String *Item_func_tochar::val_str(String* str)
{ {
THD *thd= current_thd;
StringBuffer<64> format_buffer; StringBuffer<64> format_buffer;
String *format; String *format;
MYSQL_TIME l_time; MYSQL_TIME l_time;
@ -2733,9 +2730,8 @@ null_date:
} }
bool Item_func_from_unixtime::fix_length_and_dec() bool Item_func_from_unixtime::fix_length_and_dec(THD *thd)
{ {
THD *thd= current_thd;
thd->time_zone_used= 1; thd->time_zone_used= 1;
tz= thd->variables.time_zone; tz= thd->variables.time_zone;
Type_std_attributes::set( Type_std_attributes::set(
@ -2818,7 +2814,7 @@ void Item_func_convert_tz::cleanup()
} }
bool Item_date_add_interval::fix_length_and_dec() bool Item_date_add_interval::fix_length_and_dec(THD *thd)
{ {
enum_field_types arg0_field_type; enum_field_types arg0_field_type;
@ -2947,7 +2943,7 @@ bool Item_extract::check_arguments() const
} }
bool Item_extract::fix_length_and_dec() bool Item_extract::fix_length_and_dec(THD *thd)
{ {
set_maybe_null(); // If wrong date set_maybe_null(); // If wrong date
uint32 daylen= args[0]->cmp_type() == TIME_RESULT ? 2 : uint32 daylen= args[0]->cmp_type() == TIME_RESULT ? 2 :
@ -3441,7 +3437,7 @@ err:
} }
bool Item_func_add_time::fix_length_and_dec() bool Item_func_add_time::fix_length_and_dec(THD *thd)
{ {
enum_field_types arg0_field_type; enum_field_types arg0_field_type;
@ -3852,7 +3848,7 @@ get_date_time_result_type(const char *format, uint length)
} }
bool Item_func_str_to_date::fix_length_and_dec() bool Item_func_str_to_date::fix_length_and_dec(THD *thd)
{ {
if (!args[0]->type_handler()->is_traditional_scalar_type() || if (!args[0]->type_handler()->is_traditional_scalar_type() ||
!args[1]->type_handler()->is_traditional_scalar_type()) !args[1]->type_handler()->is_traditional_scalar_type())

View File

@ -62,7 +62,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("period_add") }; static LEX_CSTRING name= {STRING_WITH_LEN("period_add") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
return FALSE; return FALSE;
@ -84,7 +84,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("period_diff") }; static LEX_CSTRING name= {STRING_WITH_LEN("period_diff") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
@ -105,7 +105,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("to_days") }; static LEX_CSTRING name= {STRING_WITH_LEN("to_days") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
@ -137,7 +137,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("to_seconds") }; static LEX_CSTRING name= {STRING_WITH_LEN("to_seconds") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
fix_char_length(12); fix_char_length(12);
@ -168,7 +168,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("dayofmonth") }; static LEX_CSTRING name= {STRING_WITH_LEN("dayofmonth") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
@ -197,7 +197,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("month") }; static LEX_CSTRING name= {STRING_WITH_LEN("month") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= 0; decimals= 0;
fix_char_length(2); fix_char_length(2);
@ -226,7 +226,7 @@ public:
return name; return name;
} }
String *val_str(String *str) override; String *val_str(String *str) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool check_partition_func_processor(void *int_arg) override {return TRUE;} bool check_partition_func_processor(void *int_arg) override {return TRUE;}
bool check_valid_arguments_processor(void *int_arg) override bool check_valid_arguments_processor(void *int_arg) override
{ {
@ -251,7 +251,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("dayofyear") }; static LEX_CSTRING name= {STRING_WITH_LEN("dayofyear") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= 0; decimals= 0;
fix_char_length(3); fix_char_length(3);
@ -279,7 +279,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("hour") }; static LEX_CSTRING name= {STRING_WITH_LEN("hour") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
@ -307,7 +307,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("minute") }; static LEX_CSTRING name= {STRING_WITH_LEN("minute") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
@ -335,7 +335,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("quarter") }; static LEX_CSTRING name= {STRING_WITH_LEN("quarter") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=1*MY_CHARSET_BIN_MB_MAXLEN; max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
@ -363,7 +363,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("second") }; static LEX_CSTRING name= {STRING_WITH_LEN("second") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
@ -397,7 +397,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("week") }; static LEX_CSTRING name= {STRING_WITH_LEN("week") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN; max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
@ -434,7 +434,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("yearweek") }; static LEX_CSTRING name= {STRING_WITH_LEN("yearweek") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN; max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
@ -464,7 +464,7 @@ public:
} }
enum_monotonicity_info get_monotonicity_info() const override; enum_monotonicity_info get_monotonicity_info() const override;
longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; longlong val_int_endpoint(bool left_endp, bool *incl_endp) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
max_length=4*MY_CHARSET_BIN_MB_MAXLEN; max_length=4*MY_CHARSET_BIN_MB_MAXLEN;
@ -499,7 +499,7 @@ public:
{ {
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals= 0; decimals= 0;
fix_char_length(1); fix_char_length(1);
@ -529,7 +529,7 @@ class Item_func_dayname :public Item_str_func
String *val_str(String *str) override; String *val_str(String *str) override;
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_varchar; } { return &type_handler_varchar; }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool check_partition_func_processor(void *int_arg) override {return TRUE;} bool check_partition_func_processor(void *int_arg) override {return TRUE;}
bool check_vcol_func_processor(void *arg) override bool check_vcol_func_processor(void *arg) override
{ {
@ -600,10 +600,10 @@ public:
return FALSE; return FALSE;
return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC);
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
fix_length_and_dec_generic(arg_count ? fix_length_and_dec_generic(arg_count ?
args[0]->datetime_precision(current_thd) : 0); args[0]->datetime_precision(thd) : 0);
return FALSE; return FALSE;
} }
longlong int_op() override; longlong int_op() override;
@ -629,9 +629,9 @@ public:
{ {
return !has_time_args(); return !has_time_args();
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
fix_length_and_dec_generic(args[0]->time_precision(current_thd)); fix_length_and_dec_generic(args[0]->time_precision(thd));
return FALSE; return FALSE;
} }
longlong int_op() override; longlong int_op() override;
@ -657,7 +657,7 @@ public:
{ return Date(this).to_string(to); } { return Date(this).to_string(to); }
my_decimal *val_decimal(my_decimal *to) override my_decimal *val_decimal(my_decimal *to) override
{ return Date(this).to_decimal(to); } { return Date(this).to_decimal(to); }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
fix_attributes_date(); fix_attributes_date();
set_maybe_null(arg_count > 0); set_maybe_null(arg_count > 0);
@ -717,7 +717,7 @@ public:
Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd), last_query_id(0) Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd), last_query_id(0)
{ decimals= dec; } { decimals= dec; }
bool fix_fields(THD *, Item **) override; bool fix_fields(THD *, Item **) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ fix_attributes_time(decimals); return FALSE; } { fix_attributes_time(decimals); return FALSE; }
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
/* /*
@ -821,7 +821,7 @@ public:
Item_func_now(THD *thd, uint dec): Item_datetimefunc(thd), last_query_id(0) Item_func_now(THD *thd, uint dec): Item_datetimefunc(thd), last_query_id(0)
{ decimals= dec; } { decimals= dec; }
bool fix_fields(THD *, Item **) override; bool fix_fields(THD *, Item **) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ fix_attributes_datetime(decimals); return FALSE;} { fix_attributes_datetime(decimals); return FALSE;}
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0;
@ -949,7 +949,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("date_format") }; static LEX_CSTRING name= {STRING_WITH_LEN("date_format") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
uint format_length(const String *format); uint format_length(const String *format);
bool eq(const Item *item, bool binary_cmp) const override; bool eq(const Item *item, bool binary_cmp) const override;
bool check_vcol_func_processor(void *arg) override bool check_vcol_func_processor(void *arg) override
@ -1014,7 +1014,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("to_char") }; static LEX_CSTRING name= {STRING_WITH_LEN("to_char") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool parse_format_string(const String *format, uint *fmt_len); bool parse_format_string(const String *format, uint *fmt_len);
bool check_vcol_func_processor(void *arg) override bool check_vcol_func_processor(void *arg) override
@ -1041,7 +1041,7 @@ class Item_func_from_unixtime :public Item_datetimefunc
static LEX_CSTRING name= {STRING_WITH_LEN("from_unixtime") }; static LEX_CSTRING name= {STRING_WITH_LEN("from_unixtime") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
bool check_vcol_func_processor(void *arg) override bool check_vcol_func_processor(void *arg) override
{ {
@ -1089,9 +1089,9 @@ class Item_func_convert_tz :public Item_datetimefunc
static LEX_CSTRING name= {STRING_WITH_LEN("convert_tz") }; static LEX_CSTRING name= {STRING_WITH_LEN("convert_tz") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
fix_attributes_datetime(args[0]->datetime_precision(current_thd)); fix_attributes_datetime(args[0]->datetime_precision(thd));
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
} }
@ -1109,7 +1109,7 @@ class Item_func_sec_to_time :public Item_timefunc
public: public:
Item_func_sec_to_time(THD *thd, Item *item): Item_timefunc(thd, item) {} Item_func_sec_to_time(THD *thd, Item *item): Item_timefunc(thd, item) {}
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
fix_attributes_time(args[0]->decimals); fix_attributes_time(args[0]->decimals);
set_maybe_null(); set_maybe_null();
@ -1139,7 +1139,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("date_add_interval") }; static LEX_CSTRING name= {STRING_WITH_LEN("date_add_interval") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool eq(const Item *item, bool binary_cmp) const override; bool eq(const Item *item, bool binary_cmp) const override;
void print(String *str, enum_query_type query_type) override; void print(String *str, enum_query_type query_type) override;
enum precedence precedence() const override { return INTERVAL_PRECEDENCE; } enum precedence precedence() const override { return INTERVAL_PRECEDENCE; }
@ -1205,7 +1205,7 @@ class Item_extract :public Item_int_func,
return name; return name;
} }
bool check_arguments() const override; bool check_arguments() const override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool eq(const Item *item, bool binary_cmp) const override; bool eq(const Item *item, bool binary_cmp) const override;
void print(String *str, enum_query_type query_type) override; void print(String *str, enum_query_type query_type) override;
bool check_partition_func_processor(void *int_arg) override {return FALSE;} bool check_partition_func_processor(void *int_arg) override {return FALSE;}
@ -1292,7 +1292,7 @@ public:
void fix_length_and_dec_numeric(); void fix_length_and_dec_numeric();
void fix_length_and_dec_str(); void fix_length_and_dec_str();
void fix_length_and_dec_native_to_binary(uint32 octet_length); void fix_length_and_dec_native_to_binary(uint32 octet_length);
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return args[0]->type_handler()->Item_char_typecast_fix_length_and_dec(this); return args[0]->type_handler()->Item_char_typecast_fix_length_and_dec(this);
} }
@ -1335,7 +1335,7 @@ public:
print_cast_temporal(str, query_type); print_cast_temporal(str, query_type);
} }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return args[0]->type_handler()->Item_date_typecast_fix_length_and_dec(this); return args[0]->type_handler()->Item_date_typecast_fix_length_and_dec(this);
} }
@ -1359,7 +1359,7 @@ public:
print_cast_temporal(str, query_type); print_cast_temporal(str, query_type);
} }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return args[0]->type_handler()-> return args[0]->type_handler()->
Item_time_typecast_fix_length_and_dec(this); Item_time_typecast_fix_length_and_dec(this);
@ -1385,7 +1385,7 @@ public:
print_cast_temporal(str, query_type); print_cast_temporal(str, query_type);
} }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
return args[0]->type_handler()-> return args[0]->type_handler()->
Item_datetime_typecast_fix_length_and_dec(this); Item_datetime_typecast_fix_length_and_dec(this);
@ -1430,9 +1430,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("timestamp") }; static LEX_CSTRING name= {STRING_WITH_LEN("timestamp") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
THD *thd= current_thd;
uint dec0= args[0]->datetime_precision(thd); uint dec0= args[0]->datetime_precision(thd);
uint dec1= Interval_DDhhmmssff::fsp(thd, args[1]); uint dec1= Interval_DDhhmmssff::fsp(thd, args[1]);
fix_attributes_datetime(MY_MAX(dec0, dec1)); fix_attributes_datetime(MY_MAX(dec0, dec1));
@ -1476,7 +1475,7 @@ public:
Item_func_add_time(THD *thd, Item *a, Item *b, bool neg_arg) Item_func_add_time(THD *thd, Item *a, Item *b, bool neg_arg)
:Item_handled_func(thd, a, b), sign(neg_arg ? -1 : 1) :Item_handled_func(thd, a, b), sign(neg_arg ? -1 : 1)
{ } { }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING addtime= { STRING_WITH_LEN("addtime") }; static LEX_CSTRING addtime= { STRING_WITH_LEN("addtime") };
@ -1499,9 +1498,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("timediff") }; static LEX_CSTRING name= {STRING_WITH_LEN("timediff") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
THD *thd= current_thd;
uint dec= MY_MAX(args[0]->time_precision(thd), uint dec= MY_MAX(args[0]->time_precision(thd),
args[1]->time_precision(thd)); args[1]->time_precision(thd));
fix_attributes_time(dec); fix_attributes_time(dec);
@ -1524,7 +1522,7 @@ public:
Item_func_maketime(THD *thd, Item *a, Item *b, Item *c): Item_func_maketime(THD *thd, Item *a, Item *b, Item *c):
Item_timefunc(thd, a, b, c) Item_timefunc(thd, a, b, c)
{} {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
fix_attributes_time(args[2]->decimals); fix_attributes_time(args[2]->decimals);
set_maybe_null(); set_maybe_null();
@ -1551,7 +1549,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("microsecond") }; static LEX_CSTRING name= {STRING_WITH_LEN("microsecond") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
set_maybe_null(); set_maybe_null();
@ -1586,7 +1584,7 @@ public:
return name; return name;
} }
longlong val_int() override; longlong val_int() override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals=0; decimals=0;
set_maybe_null(); set_maybe_null();
@ -1616,7 +1614,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("get_format") }; static LEX_CSTRING name= {STRING_WITH_LEN("get_format") };
return name; return name;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
set_maybe_null(); set_maybe_null();
decimals=0; decimals=0;
@ -1647,7 +1645,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("str_to_date") }; static LEX_CSTRING name= {STRING_WITH_LEN("str_to_date") };
return name; return name;
} }
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_str_to_date>(thd, this); } { return get_item_copy<Item_func_str_to_date>(thd, this); }
}; };

View File

@ -35,7 +35,7 @@ public:
bool val_bool() override; bool val_bool() override;
longlong val_int() override { return val_bool(); } longlong val_int() override { return val_bool(); }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
set_maybe_null(); set_maybe_null();
null_value= 0; null_value= 0;
@ -67,7 +67,7 @@ public:
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_trt_ts>(thd, this); } { return get_item_copy<Item_func_trt_ts>(thd, this); }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ fix_attributes_datetime(decimals); return FALSE; } { fix_attributes_datetime(decimals); return FALSE; }
}; };
@ -102,9 +102,9 @@ public:
return NULL_clex_str; return NULL_clex_str;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
bool res= Item_int_func::fix_length_and_dec(); bool res= Item_int_func::fix_length_and_dec(thd);
max_length= 20; max_length= 20;
return res; return res;
} }

View File

@ -126,7 +126,7 @@ Item_window_func::fix_fields(THD *thd, Item **ref)
with_flags= (with_flags & ~item_with_t::SUM_FUNC) | item_with_t::WINDOW_FUNC; with_flags= (with_flags & ~item_with_t::SUM_FUNC) | item_with_t::WINDOW_FUNC;
if (fix_length_and_dec()) if (fix_length_and_dec(thd))
return TRUE; return TRUE;
max_length= window_func()->max_length; max_length= window_func()->max_length;
@ -352,7 +352,7 @@ bool Item_sum_hybrid_simple::fix_fields(THD *thd, Item **ref)
with_flags|= args[i]->with_flags; with_flags|= args[i]->with_flags;
} }
if (fix_length_and_dec()) if (fix_length_and_dec(thd))
return TRUE; return TRUE;
setup_hybrid(thd, args[0]); setup_hybrid(thd, args[0]);
@ -368,7 +368,7 @@ bool Item_sum_hybrid_simple::fix_fields(THD *thd, Item **ref)
} }
bool Item_sum_hybrid_simple::fix_length_and_dec() bool Item_sum_hybrid_simple::fix_length_and_dec(THD *thd)
{ {
set_maybe_null(); set_maybe_null();
null_value= true; null_value= true;

View File

@ -317,7 +317,7 @@ class Item_sum_hybrid_simple : public Item_sum_hybrid
bool add() override; bool add() override;
bool fix_fields(THD *, Item **) override; bool fix_fields(THD *, Item **) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
void setup_hybrid(THD *thd, Item *item); void setup_hybrid(THD *thd, Item *item);
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
@ -554,7 +554,7 @@ class Item_sum_percent_rank: public Item_sum_double,
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_double; } { return &type_handler_double; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals = 10; // TODO-cvicentiu find out how many decimals the standard decimals = 10; // TODO-cvicentiu find out how many decimals the standard
// requires. // requires.
@ -644,7 +644,7 @@ class Item_sum_cume_dist: public Item_sum_double,
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return &type_handler_double; } { return &type_handler_double; }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals = 10; // TODO-cvicentiu find out how many decimals the standard decimals = 10; // TODO-cvicentiu find out how many decimals the standard
// requires. // requires.
@ -885,7 +885,7 @@ public:
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{return Type_handler_hybrid_field_type::type_handler();} {return Type_handler_hybrid_field_type::type_handler();}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals = 10; // TODO-cvicentiu find out how many decimals the standard decimals = 10; // TODO-cvicentiu find out how many decimals the standard
// requires. // requires.
@ -1022,7 +1022,7 @@ public:
} }
void update_field() override {} void update_field() override {}
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
decimals = 10; // TODO-cvicentiu find out how many decimals the standard decimals = 10; // TODO-cvicentiu find out how many decimals the standard
// requires. // requires.
@ -1373,7 +1373,7 @@ public:
void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
List<Item> &fields, uint flags) override; List<Item> &fields, uint flags) override;
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
Type_std_attributes::set(window_func()); Type_std_attributes::set(window_func());
return FALSE; return FALSE;

View File

@ -189,7 +189,7 @@ public:
} }
return str; return str;
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
max_length= MAX_BLOB_WIDTH; max_length= MAX_BLOB_WIDTH;
collation.collation= pxml->charset(); collation.collation= pxml->charset();
@ -469,7 +469,7 @@ public:
{ {
return nodeset->copy(*native_cache); return nodeset->copy(*native_cache);
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ max_length= MAX_BLOB_WIDTH; return FALSE; } { max_length= MAX_BLOB_WIDTH; return FALSE; }
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_context_cache>(thd, this); } { return get_item_copy<Item_nodeset_context_cache>(thd, this); }
@ -487,7 +487,7 @@ public:
{ {
return { STRING_WITH_LEN("xpath_position") }; return { STRING_WITH_LEN("xpath_position") };
} }
bool fix_length_and_dec() override { max_length=10; return FALSE; } bool fix_length_and_dec(THD *thd) override { max_length=10; return FALSE; }
longlong val_int() override longlong val_int() override
{ {
args[0]->val_native(current_thd, &tmp_native_value); args[0]->val_native(current_thd, &tmp_native_value);
@ -511,7 +511,7 @@ public:
{ {
return { STRING_WITH_LEN("xpath_count") }; return { STRING_WITH_LEN("xpath_count") };
} }
bool fix_length_and_dec() override { max_length=10; return FALSE; } bool fix_length_and_dec(THD *thd) override { max_length=10; return FALSE; }
longlong val_int() override longlong val_int() override
{ {
uint predicate_supplied_context_size; uint predicate_supplied_context_size;
@ -2766,7 +2766,7 @@ my_xpath_parse(MY_XPATH *xpath, const char *str, const char *strend)
} }
bool Item_xml_str_func::fix_length_and_dec() bool Item_xml_str_func::fix_length_and_dec(THD *thd)
{ {
max_length= MAX_BLOB_WIDTH; max_length= MAX_BLOB_WIDTH;
return agg_arg_charsets_for_comparison(collation, args, arg_count); return agg_arg_charsets_for_comparison(collation, args, arg_count);

View File

@ -118,7 +118,7 @@ public:
set_maybe_null(); set_maybe_null();
} }
bool fix_fields(THD *thd, Item **ref) override; bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec() override; bool fix_length_and_dec(THD *thd) override;
bool const_item() const override bool const_item() const override
{ {
return const_item_cache && (!nodeset_func || nodeset_func->const_item()); return const_item_cache && (!nodeset_func || nodeset_func->const_item());

View File

@ -15667,7 +15667,7 @@ COND *Item_func_eq::build_equal_items(THD *thd,
List_iterator_fast<Item_equal> it(cond_equal.current_level); List_iterator_fast<Item_equal> it(cond_equal.current_level);
while ((item_equal= it++)) while ((item_equal= it++))
{ {
if (item_equal->fix_length_and_dec()) if (item_equal->fix_length_and_dec(thd))
return NULL; return NULL;
item_equal->update_used_tables(); item_equal->update_used_tables();
set_if_bigger(thd->lex->current_select->max_equal_elems, set_if_bigger(thd->lex->current_select->max_equal_elems,

View File

@ -1537,7 +1537,7 @@ public:
str->append(type_handler_fbt()->name().lex_cstring()); str->append(type_handler_fbt()->name().lex_cstring());
str->append(')'); str->append(')');
} }
bool fix_length_and_dec() override bool fix_length_and_dec(THD *thd) override
{ {
Type_std_attributes::operator=(Type_std_attributes_fbt()); Type_std_attributes::operator=(Type_std_attributes_fbt());
if (Fbt::fix_fields_maybe_null_on_conversion_to_fbt(args[0])) if (Fbt::fix_fields_maybe_null_on_conversion_to_fbt(args[0]))