mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-16861 Split Item::update_null_value() into a new virtual method in Type_handler
This commit is contained in:
@ -7281,3 +7281,18 @@ pk i c pk i c
|
||||
1 10 foo 1 10 foo
|
||||
DROP TABLE t;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
# Start of 10.4 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16861 Split Item::update_null_value() into a new virtual method in Type_handler
|
||||
#
|
||||
SELECT ROW(1,2) = EXISTS (SELECT 1);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = 1 IN (SELECT 1 UNION SELECT 2);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
|
@ -6145,3 +6145,23 @@ SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
|
||||
DROP TABLE t;
|
||||
|
||||
--echo # End of 10.2 tests
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.4 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16861 Split Item::update_null_value() into a new virtual method in Type_handler
|
||||
--echo #
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
||||
SELECT ROW(1,2) = EXISTS (SELECT 1);
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
||||
SELECT ROW(1,2) = 1 IN (SELECT 1 UNION SELECT 2);
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
|
||||
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.4 tests
|
||||
--echo #
|
||||
|
@ -7281,6 +7281,21 @@ pk i c pk i c
|
||||
1 10 foo 1 10 foo
|
||||
DROP TABLE t;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
# Start of 10.4 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16861 Split Item::update_null_value() into a new virtual method in Type_handler
|
||||
#
|
||||
SELECT ROW(1,2) = EXISTS (SELECT 1);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = 1 IN (SELECT 1 UNION SELECT 2);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
set optimizer_switch=default;
|
||||
select @@optimizer_switch like '%exists_to_in=off%';
|
||||
@@optimizer_switch like '%exists_to_in=off%'
|
||||
|
@ -7274,6 +7274,21 @@ pk i c pk i c
|
||||
1 10 foo 1 10 foo
|
||||
DROP TABLE t;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
# Start of 10.4 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16861 Split Item::update_null_value() into a new virtual method in Type_handler
|
||||
#
|
||||
SELECT ROW(1,2) = EXISTS (SELECT 1);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = 1 IN (SELECT 1 UNION SELECT 2);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
set optimizer_switch=default;
|
||||
select @@optimizer_switch like '%materialization=on%';
|
||||
@@optimizer_switch like '%materialization=on%'
|
||||
|
@ -7272,4 +7272,19 @@ pk i c pk i c
|
||||
1 10 foo 1 10 foo
|
||||
DROP TABLE t;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
# Start of 10.4 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16861 Split Item::update_null_value() into a new virtual method in Type_handler
|
||||
#
|
||||
SELECT ROW(1,2) = EXISTS (SELECT 1);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = 1 IN (SELECT 1 UNION SELECT 2);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
set @optimizer_switch_for_subselect_test=null;
|
||||
|
@ -7287,6 +7287,21 @@ pk i c pk i c
|
||||
1 10 foo 1 10 foo
|
||||
DROP TABLE t;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
# Start of 10.4 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16861 Split Item::update_null_value() into a new virtual method in Type_handler
|
||||
#
|
||||
SELECT ROW(1,2) = EXISTS (SELECT 1);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = 1 IN (SELECT 1 UNION SELECT 2);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
set optimizer_switch=default;
|
||||
select @@optimizer_switch like '%subquery_cache=on%';
|
||||
@@optimizer_switch like '%subquery_cache=on%'
|
||||
|
@ -7272,5 +7272,20 @@ pk i c pk i c
|
||||
1 10 foo 1 10 foo
|
||||
DROP TABLE t;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
# Start of 10.4 tests
|
||||
#
|
||||
#
|
||||
# MDEV-16861 Split Item::update_null_value() into a new virtual method in Type_handler
|
||||
#
|
||||
SELECT ROW(1,2) = EXISTS (SELECT 1);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = 1 IN (SELECT 1 UNION SELECT 2);
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
SELECT ROW(1,2) = (1 = ANY (SELECT 1 UNION SELECT 2));
|
||||
ERROR HY000: Illegal parameter data types row and boolean for operation '='
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
set @optimizer_switch_for_subselect_test=null;
|
||||
set @join_cache_level_for_subselect_test=NULL;
|
||||
|
@ -276,13 +276,6 @@ bool Item::get_temporal_with_sql_mode(MYSQL_TIME *ltime)
|
||||
}
|
||||
|
||||
|
||||
bool Item::is_null_from_temporal()
|
||||
{
|
||||
MYSQL_TIME ltime;
|
||||
return get_temporal_with_sql_mode(<ime);
|
||||
}
|
||||
|
||||
|
||||
longlong Item::val_int_from_str(int *error)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
@ -7488,7 +7481,7 @@ void Item_field::update_null_value()
|
||||
|
||||
no_errors= thd->no_errors;
|
||||
thd->no_errors= 1;
|
||||
Item::update_null_value();
|
||||
type_handler()->Item_update_null_value(this);
|
||||
thd->no_errors= no_errors;
|
||||
}
|
||||
|
||||
|
34
sql/item.h
34
sql/item.h
@ -1398,8 +1398,6 @@ public:
|
||||
|
||||
// Get TIME, DATE or DATETIME using proper sql_mode flags for the field type
|
||||
bool get_temporal_with_sql_mode(MYSQL_TIME *ltime);
|
||||
// Check NULL value for a TIME, DATE or DATETIME expression
|
||||
bool is_null_from_temporal();
|
||||
|
||||
int save_time_in_field(Field *field, bool no_conversions);
|
||||
int save_date_in_field(Field *field, bool no_conversions);
|
||||
@ -1699,35 +1697,7 @@ public:
|
||||
*/
|
||||
virtual void update_null_value ()
|
||||
{
|
||||
switch (cmp_type()) {
|
||||
case INT_RESULT:
|
||||
(void) val_int();
|
||||
break;
|
||||
case REAL_RESULT:
|
||||
(void) val_real();
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
{
|
||||
my_decimal tmp;
|
||||
(void) val_decimal(&tmp);
|
||||
}
|
||||
break;
|
||||
case TIME_RESULT:
|
||||
{
|
||||
MYSQL_TIME ltime;
|
||||
(void) get_temporal_with_sql_mode(<ime);
|
||||
}
|
||||
break;
|
||||
case STRING_RESULT:
|
||||
{
|
||||
StringBuffer<MAX_FIELD_WIDTH> tmp;
|
||||
(void) val_str(&tmp);
|
||||
}
|
||||
break;
|
||||
case ROW_RESULT:
|
||||
DBUG_ASSERT(0);
|
||||
null_value= true;
|
||||
}
|
||||
return type_handler()->Item_update_null_value(this);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4653,8 +4623,6 @@ public:
|
||||
}
|
||||
|
||||
const MYSQL_TIME *const_ptr_mysql_time() const { return &cached_time; }
|
||||
bool is_null()
|
||||
{ return is_null_from_temporal(); }
|
||||
bool get_date_with_sql_mode(MYSQL_TIME *to);
|
||||
String *val_str(String *str)
|
||||
{ return val_string_from_date(str); }
|
||||
|
@ -5632,7 +5632,7 @@ void Item_func_get_system_var::update_null_value()
|
||||
THD *thd= current_thd;
|
||||
int save_no_errors= thd->no_errors;
|
||||
thd->no_errors= TRUE;
|
||||
Item::update_null_value();
|
||||
type_handler()->Item_update_null_value(this);
|
||||
thd->no_errors= save_no_errors;
|
||||
}
|
||||
|
||||
|
@ -67,11 +67,6 @@ public:
|
||||
const Type_handler *type_handler() const { return string_type_handler(); }
|
||||
void left_right_max_length();
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
void update_null_value()
|
||||
{
|
||||
StringBuffer<MAX_FIELD_WIDTH> tmp;
|
||||
(void) val_str(&tmp);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -399,7 +399,7 @@ public:
|
||||
}
|
||||
void no_rows_in_result();
|
||||
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
const Type_handler *type_handler() const { return &type_handler_bool; }
|
||||
longlong val_int();
|
||||
double val_real();
|
||||
String *val_str(String*);
|
||||
@ -627,7 +627,6 @@ public:
|
||||
double val_real();
|
||||
String *val_str(String*);
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
void update_null_value () { (void) val_bool(); }
|
||||
bool val_bool();
|
||||
bool test_limit(st_select_lex_unit *unit);
|
||||
void print(String *str, enum_query_type query_type);
|
||||
|
@ -2617,6 +2617,61 @@ uint32 Type_handler_general_purpose_int::max_display_length(const Item *item)
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
void Type_handler_row::Item_update_null_value(Item *item) const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
item->null_value= true;
|
||||
}
|
||||
|
||||
|
||||
void Type_handler_time_common::Item_update_null_value(Item *item) const
|
||||
{
|
||||
MYSQL_TIME ltime;
|
||||
(void) item->get_date(<ime, TIME_TIME_ONLY);
|
||||
}
|
||||
|
||||
|
||||
void Type_handler_temporal_with_date::Item_update_null_value(Item *item) const
|
||||
{
|
||||
MYSQL_TIME ltime;
|
||||
(void) item->get_date(<ime, sql_mode_for_dates(current_thd));
|
||||
}
|
||||
|
||||
|
||||
void Type_handler_string_result::Item_update_null_value(Item *item) const
|
||||
{
|
||||
StringBuffer<MAX_FIELD_WIDTH> tmp;
|
||||
(void) item->val_str(&tmp);
|
||||
}
|
||||
|
||||
|
||||
void Type_handler_real_result::Item_update_null_value(Item *item) const
|
||||
{
|
||||
(void) item->val_real();
|
||||
}
|
||||
|
||||
|
||||
void Type_handler_decimal_result::Item_update_null_value(Item *item) const
|
||||
{
|
||||
my_decimal tmp;
|
||||
(void) item->val_decimal(&tmp);
|
||||
}
|
||||
|
||||
|
||||
void Type_handler_int_result::Item_update_null_value(Item *item) const
|
||||
{
|
||||
(void) item->val_int();
|
||||
}
|
||||
|
||||
|
||||
void Type_handler_bool::Item_update_null_value(Item *item) const
|
||||
{
|
||||
(void) item->val_bool();
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
int Type_handler_time_common::Item_save_in_field(Item *item, Field *field,
|
||||
|
@ -1420,6 +1420,7 @@ public:
|
||||
|
||||
virtual uint32 max_display_length(const Item *item) const= 0;
|
||||
virtual uint32 calc_pack_length(uint32 length) const= 0;
|
||||
virtual void Item_update_null_value(Item *item) const= 0;
|
||||
virtual bool Item_save_in_value(Item *item, st_value *value) const= 0;
|
||||
virtual void Item_param_setup_conversion(THD *thd, Item_param *) const {}
|
||||
virtual void Item_param_set_param_func(Item_param *param,
|
||||
@ -1789,6 +1790,7 @@ public:
|
||||
DBUG_ASSERT(0);
|
||||
return true;
|
||||
}
|
||||
void Item_update_null_value(Item *item) const;
|
||||
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
@ -2041,6 +2043,7 @@ public:
|
||||
Item_param *param,
|
||||
const Type_all_attributes *attr,
|
||||
const st_value *value) const;
|
||||
void Item_update_null_value(Item *item) const;
|
||||
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
|
||||
Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
|
||||
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
|
||||
@ -2129,6 +2132,7 @@ public:
|
||||
{
|
||||
return Item_send_str(item, protocol, buf);
|
||||
}
|
||||
void Item_update_null_value(Item *item) const;
|
||||
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
|
||||
Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
|
||||
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
|
||||
@ -2330,6 +2334,7 @@ public:
|
||||
Item_param *param,
|
||||
const Type_all_attributes *attr,
|
||||
const st_value *value) const;
|
||||
void Item_update_null_value(Item *item) const;
|
||||
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
|
||||
Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
|
||||
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
|
||||
@ -2503,6 +2508,7 @@ public:
|
||||
return Item_temporal_precision(item, false);
|
||||
}
|
||||
uint Item_decimal_precision(const Item *item) const;
|
||||
void Item_update_null_value(Item *item) const;
|
||||
bool Item_save_in_value(Item *item, st_value *value) const;
|
||||
void Item_param_setup_conversion(THD *thd, Item_param *) const;
|
||||
void Item_param_set_param_func(Item_param *param,
|
||||
@ -2740,6 +2746,7 @@ class Type_handler_bool: public Type_handler_long
|
||||
public:
|
||||
const Name name() const { return m_name_bool; }
|
||||
bool is_bool_type() const { return true; }
|
||||
void Item_update_null_value(Item *item) const;
|
||||
bool Item_sum_hybrid_fix_length_and_dec(Item_sum_hybrid *) const;
|
||||
};
|
||||
|
||||
@ -3038,6 +3045,7 @@ public:
|
||||
{
|
||||
return Item_send_time(item, protocol, buf);
|
||||
}
|
||||
void Item_update_null_value(Item *item) const;
|
||||
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
|
||||
String *print_item_value(THD *thd, Item *item, String *str) const;
|
||||
Item_cache *Item_get_cache(THD *thd, const Item *item) const;
|
||||
@ -3140,6 +3148,7 @@ public:
|
||||
{
|
||||
return Item_send_date(item, protocol, buf);
|
||||
}
|
||||
void Item_update_null_value(Item *item) const;
|
||||
int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
|
||||
Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
|
||||
bool set_comparator_func(Arg_comparator *cmp) const;
|
||||
|
Reference in New Issue
Block a user