Commit 1ff79562 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-12692 Split Item_func_between::fix_length_and_dec

parent fe127562
...@@ -2032,7 +2032,6 @@ void Item_func_between::fix_after_pullout(st_select_lex *new_parent, Item **ref) ...@@ -2032,7 +2032,6 @@ void Item_func_between::fix_after_pullout(st_select_lex *new_parent, Item **ref)
void Item_func_between::fix_length_and_dec() void Item_func_between::fix_length_and_dec()
{ {
THD *thd= current_thd;
max_length= 1; max_length= 1;
/* /*
...@@ -2044,14 +2043,16 @@ void Item_func_between::fix_length_and_dec() ...@@ -2044,14 +2043,16 @@ void Item_func_between::fix_length_and_dec()
if (m_comparator.aggregate_for_comparison(Item_func_between::func_name(), if (m_comparator.aggregate_for_comparison(Item_func_between::func_name(),
args, 3, true)) args, 3, true))
{ {
DBUG_ASSERT(thd->is_error()); DBUG_ASSERT(current_thd->is_error());
return; return;
} }
if (m_comparator.cmp_type() == STRING_RESULT && m_comparator.type_handler()->Item_func_between_fix_length_and_dec(this);
agg_arg_charsets_for_comparison(cmp_collation, args, 3)) }
return;
bool Item_func_between::fix_length_and_dec_numeric(THD *thd)
{
/* See the comment about the similar block in Item_bool_func2 */ /* See the comment about the similar block in Item_bool_func2 */
if (args[0]->real_item()->type() == FIELD_ITEM && if (args[0]->real_item()->type() == FIELD_ITEM &&
!thd->lex->is_ps_or_view_context_analysis()) !thd->lex->is_ps_or_view_context_analysis())
...@@ -2069,6 +2070,7 @@ void Item_func_between::fix_length_and_dec() ...@@ -2069,6 +2070,7 @@ void Item_func_between::fix_length_and_dec()
} }
} }
} }
return false;
} }
......
...@@ -885,6 +885,11 @@ class Item_func_between :public Item_func_opt_neg ...@@ -885,6 +885,11 @@ class Item_func_between :public Item_func_opt_neg
const char *func_name() const { return "between"; } const char *func_name() const { return "between"; }
enum precedence precedence() const { return BETWEEN_PRECEDENCE; } enum precedence precedence() const { return BETWEEN_PRECEDENCE; }
void fix_length_and_dec(); void fix_length_and_dec();
bool fix_length_and_dec_string(THD *)
{
return agg_arg_charsets_for_comparison(cmp_collation, args, 3);
}
bool fix_length_and_dec_numeric(THD *);
virtual void print(String *str, enum_query_type query_type); virtual void print(String *str, enum_query_type query_type);
bool eval_not_null_tables(void *opt_arg); bool eval_not_null_tables(void *opt_arg);
void fix_after_pullout(st_select_lex *new_parent, Item **ref); void fix_after_pullout(st_select_lex *new_parent, Item **ref);
......
...@@ -2713,6 +2713,25 @@ Type_handler_string_result::Item_func_hybrid_field_type_get_date( ...@@ -2713,6 +2713,25 @@ Type_handler_string_result::Item_func_hybrid_field_type_get_date(
/***************************************************************************/ /***************************************************************************/
bool Type_handler_numeric::
Item_func_between_fix_length_and_dec(Item_func_between *func) const
{
return func->fix_length_and_dec_numeric(current_thd);
}
bool Type_handler_temporal_result::
Item_func_between_fix_length_and_dec(Item_func_between *func) const
{
return func->fix_length_and_dec_numeric(current_thd);
}
bool Type_handler_string_result::
Item_func_between_fix_length_and_dec(Item_func_between *func) const
{
return func->fix_length_and_dec_string(current_thd);
}
longlong Type_handler_row:: longlong Type_handler_row::
Item_func_between_val_int(Item_func_between *func) const Item_func_between_val_int(Item_func_between *func) const
{ {
......
...@@ -779,6 +779,8 @@ class Type_handler ...@@ -779,6 +779,8 @@ class Type_handler
virtual virtual
bool Item_func_min_max_get_date(Item_func_min_max*, bool Item_func_min_max_get_date(Item_func_min_max*,
MYSQL_TIME *, ulonglong fuzzydate) const= 0; MYSQL_TIME *, ulonglong fuzzydate) const= 0;
virtual bool
Item_func_between_fix_length_and_dec(Item_func_between *func) const= 0;
virtual longlong virtual longlong
Item_func_between_val_int(Item_func_between *func) const= 0; Item_func_between_val_int(Item_func_between *func) const= 0;
...@@ -1012,6 +1014,11 @@ class Type_handler_row: public Type_handler ...@@ -1012,6 +1014,11 @@ class Type_handler_row: public Type_handler
DBUG_ASSERT(0); DBUG_ASSERT(0);
return true; return true;
} }
bool Item_func_between_fix_length_and_dec(Item_func_between *func) const
{
DBUG_ASSERT(0);
return true;
}
longlong Item_func_between_val_int(Item_func_between *func) const; longlong Item_func_between_val_int(Item_func_between *func) const;
cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const; cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) const; in_vector *make_in_vector(THD *thd, const Item_func_in *f, uint nargs) const;
...@@ -1093,6 +1100,7 @@ class Type_handler_numeric: public Type_handler ...@@ -1093,6 +1100,7 @@ class Type_handler_numeric: public Type_handler
Item *target_expr, Item *target_value, Item *target_expr, Item *target_value,
Item_bool_func2 *source, Item_bool_func2 *source,
Item *source_expr, Item *source_const) const; Item *source_expr, Item *source_const) const;
bool Item_func_between_fix_length_and_dec(Item_func_between *func) const;
bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const; bool Item_char_typecast_fix_length_and_dec(Item_char_typecast *) const;
}; };
...@@ -1321,6 +1329,7 @@ class Type_handler_temporal_result: public Type_handler ...@@ -1321,6 +1329,7 @@ class Type_handler_temporal_result: public Type_handler
my_decimal *) const; my_decimal *) const;
bool Item_func_min_max_get_date(Item_func_min_max*, bool Item_func_min_max_get_date(Item_func_min_max*,
MYSQL_TIME *, ulonglong fuzzydate) const; MYSQL_TIME *, ulonglong fuzzydate) const;
bool Item_func_between_fix_length_and_dec(Item_func_between *func) const;
longlong Item_func_between_val_int(Item_func_between *func) const; longlong Item_func_between_val_int(Item_func_between *func) const;
bool Item_func_in_fix_comparator_compatible_types(THD *thd, bool Item_func_in_fix_comparator_compatible_types(THD *thd,
Item_func_in *) const; Item_func_in *) const;
...@@ -1406,6 +1415,7 @@ class Type_handler_string_result: public Type_handler ...@@ -1406,6 +1415,7 @@ class Type_handler_string_result: public Type_handler
my_decimal *) const; my_decimal *) const;
bool Item_func_min_max_get_date(Item_func_min_max*, bool Item_func_min_max_get_date(Item_func_min_max*,
MYSQL_TIME *, ulonglong fuzzydate) const; MYSQL_TIME *, ulonglong fuzzydate) const;
bool Item_func_between_fix_length_and_dec(Item_func_between *func) const;
longlong Item_func_between_val_int(Item_func_between *func) const; longlong Item_func_between_val_int(Item_func_between *func) const;
cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const; cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const; in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment