Added override to all releveant methods in Item (and a few other classes)

Other things:
- Remove inline and virtual for methods that are overrides
- Added a 'final' to some Item classes
This commit is contained in:
Monty 2020-08-19 02:53:22 +03:00 committed by Sergei Golubchik
parent 53b43f3078
commit 30f0a246a0
23 changed files with 2495 additions and 2389 deletions

View File

@ -24,12 +24,12 @@ class Item_func_sysconst_test :public Item_func_sysconst
{ {
public: public:
Item_func_sysconst_test(THD *thd): Item_func_sysconst(thd) {} Item_func_sysconst_test(THD *thd): Item_func_sysconst(thd) {}
String *val_str(String *str) String *val_str(String *str) override
{ {
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() bool fix_length_and_dec() 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();
@ -40,8 +40,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("sysconst_test") }; static LEX_CSTRING name= {STRING_WITH_LEN("sysconst_test") };
return name; return name;
} }
const char *fully_qualified_func_name() const { return "sysconst_test()"; } const char *fully_qualified_func_name() const override
Item *get_copy(THD *thd) { return "sysconst_test()"; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_sysconst_test>(thd, this); } { return get_item_copy<Item_func_sysconst_test>(thd, this); }
}; };

View File

@ -27,17 +27,17 @@
class Item_func_inet_aton : public Item_longlong_func class Item_func_inet_aton : public Item_longlong_func
{ {
bool check_arguments() const bool check_arguments() const override
{ return check_argument_types_can_return_text(0, arg_count); } { return check_argument_types_can_return_text(0, arg_count); }
public: public:
Item_func_inet_aton(THD *thd, Item *a): Item_longlong_func(thd, a) {} Item_func_inet_aton(THD *thd, Item *a): Item_longlong_func(thd, a) {}
longlong val_int(); longlong val_int() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
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() bool fix_length_and_dec() override
{ {
decimals= 0; decimals= 0;
max_length= 21; max_length= 21;
@ -45,7 +45,7 @@ public:
unsigned_flag= 1; unsigned_flag= 1;
return FALSE; return FALSE;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_inet_aton>(thd, this); } { return get_item_copy<Item_func_inet_aton>(thd, this); }
}; };
@ -59,20 +59,20 @@ class Item_func_inet_ntoa : public Item_str_func
public: public:
Item_func_inet_ntoa(THD *thd, Item *a): Item_str_func(thd, a) Item_func_inet_ntoa(THD *thd, Item *a): Item_str_func(thd, a)
{ } { }
String* val_str(String* str); String *val_str(String* str) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
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() bool fix_length_and_dec() override
{ {
decimals= 0; decimals= 0;
fix_length_and_charset(3 * 8 + 7, default_charset()); fix_length_and_charset(3 * 8 + 7, default_charset());
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_inet_ntoa>(thd, this); } { return get_item_copy<Item_func_inet_ntoa>(thd, this); }
}; };
@ -111,17 +111,17 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("inet6_aton") }; static LEX_CSTRING name= {STRING_WITH_LEN("inet6_aton") };
return name; return name;
} }
virtual bool fix_length_and_dec() bool fix_length_and_dec() override
{ {
decimals= 0; decimals= 0;
fix_length_and_charset(16, &my_charset_bin); fix_length_and_charset(16, &my_charset_bin);
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_inet6_aton>(thd, this); } { return get_item_copy<Item_func_inet6_aton>(thd, this); }
String *val_str(String *to); String *val_str(String *to) override;
}; };
@ -143,7 +143,7 @@ public:
return name; return name;
} }
virtual bool fix_length_and_dec() bool fix_length_and_dec() override
{ {
decimals= 0; decimals= 0;
@ -155,8 +155,8 @@ public:
set_maybe_null();; set_maybe_null();;
return FALSE; return FALSE;
} }
String *val_str_ascii(String *to); String *val_str_ascii(String *to) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_inet6_ntoa>(thd, this); } { return get_item_copy<Item_func_inet6_ntoa>(thd, this); }
}; };
@ -178,10 +178,10 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4") }; static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_is_ipv4>(thd, this); } { return get_item_copy<Item_func_is_ipv4>(thd, this); }
longlong val_int(); longlong val_int() override;
}; };
@ -201,10 +201,10 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv6") }; static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv6") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_is_ipv6>(thd, this); } { return get_item_copy<Item_func_is_ipv6>(thd, this); }
longlong val_int(); longlong val_int() override;
}; };
@ -223,9 +223,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_compat") }; static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_compat") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_is_ipv4_compat>(thd, this); } { return get_item_copy<Item_func_is_ipv4_compat>(thd, this); }
longlong val_int(); longlong val_int() override;
}; };
@ -244,9 +244,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_mapped") }; static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_mapped") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_is_ipv4_mapped>(thd, this); } { return get_item_copy<Item_func_is_ipv4_mapped>(thd, this); }
longlong val_int(); longlong val_int() override;
}; };
#endif // ITEM_INETFUNC_INCLUDED #endif // ITEM_INETFUNC_INCLUDED

View File

@ -1198,7 +1198,7 @@ public:
virtual uint16 key_part_flag() const { return 0; } virtual uint16 key_part_flag() const { return 0; }
virtual uint16 key_part_length_bytes() const { return 0; } virtual uint16 key_part_length_bytes() const { return 0; }
virtual uint32 key_length() const { return pack_length(); } virtual uint32 key_length() const { return pack_length(); }
virtual const Type_handler *type_handler() const= 0; virtual const Type_handler *type_handler() const = 0;
virtual enum_field_types type() const virtual enum_field_types type() const
{ {
return type_handler()->field_type(); return type_handler()->field_type();
@ -4155,7 +4155,7 @@ public:
{ {
return (uint32) field_length + sort_suffix_length(); return (uint32) field_length + sort_suffix_length();
} }
virtual uint32 sort_suffix_length() const override uint32 sort_suffix_length() const override
{ {
return (field_charset() == &my_charset_bin ? length_bytes : 0); return (field_charset() == &my_charset_bin ? length_bytes : 0);
} }
@ -4505,7 +4505,7 @@ public:
uint32 sort_length() const override; uint32 sort_length() const override;
uint32 sort_suffix_length() const override; uint32 sort_suffix_length() const override;
uint32 value_length() override { return get_length(); } uint32 value_length() override { return get_length(); }
virtual uint32 max_data_length() const override uint32 max_data_length() const override
{ {
return (uint32) (((ulonglong) 1 << (packlength*8)) -1); return (uint32) (((ulonglong) 1 << (packlength*8)) -1);
} }

View File

@ -467,7 +467,7 @@ public:
} }
Partition_share *get_part_share() { return part_share; } Partition_share *get_part_share() { return part_share; }
handler *clone(const char *name, MEM_ROOT *mem_root) override; handler *clone(const char *name, MEM_ROOT *mem_root) override;
virtual void set_part_info(partition_info *part_info) override void set_part_info(partition_info *part_info) override
{ {
m_part_info= part_info; m_part_info= part_info;
m_is_sub_partitioned= part_info->is_sub_partitioned(); m_is_sub_partitioned= part_info->is_sub_partitioned();

View File

@ -2061,7 +2061,7 @@ public:
The process of compilation is assumed to go as follows: The process of compilation is assumed to go as follows:
compile() compile()
{ {
if (this->*some_analyzer(...)) if (this->*some_analyzer(...))
{ {
compile children if any; compile children if any;
@ -2213,7 +2213,7 @@ public:
assumes that there are no multi-byte collations amongst the partition assumes that there are no multi-byte collations amongst the partition
fields. fields.
*/ */
virtual bool check_partition_func_processor(void *arg) { return 1;} virtual bool check_partition_func_processor(void *arg) { return true; }
virtual bool post_fix_fields_part_expr_processor(void *arg) { return 0; } virtual bool post_fix_fields_part_expr_processor(void *arg) { return 0; }
virtual bool rename_fields_processor(void *arg) { return 0; } virtual bool rename_fields_processor(void *arg) { return 0; }
/* /*
@ -2599,7 +2599,7 @@ public:
int get_extraction_flag() int get_extraction_flag()
{ return marker & EXTRACTION_MASK; } { return marker & EXTRACTION_MASK; }
void set_extraction_flag(int16 flags) void set_extraction_flag(int16 flags)
{ {
marker &= ~EXTRACTION_MASK; marker &= ~EXTRACTION_MASK;
marker|= flags; marker|= flags;
} }
@ -2988,7 +2988,6 @@ public:
public: public:
bool fix_fields(THD *thd, Item **) override= 0; bool fix_fields(THD *thd, Item **) override= 0;
double val_real() override; double val_real() override;
longlong val_int() override; longlong val_int() override;
String *val_str(String *sp) override; String *val_str(String *sp) override;
@ -2999,9 +2998,7 @@ public:
public: public:
void make_send_field(THD *thd, Send_field *field) override; void make_send_field(THD *thd, Send_field *field) override;
bool const_item() const override { return true; } bool const_item() const override { return true; }
Field *create_tmp_field_ex(MEM_ROOT *root, Field *create_tmp_field_ex(MEM_ROOT *root,
TABLE *table, Tmp_field_src *src, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param) override const Tmp_field_param *param) override
@ -3303,7 +3300,7 @@ public:
} }
int save_in_field(Field *field, bool no_conversions) override int save_in_field(Field *field, bool no_conversions) override
{ {
return value_item->save_in_field(field, no_conversions); return value_item->save_in_field(field, no_conversions);
} }
bool send(Protocol *protocol, st_value *buffer) override bool send(Protocol *protocol, st_value *buffer) override
@ -3849,7 +3846,7 @@ public:
{ {
save_in_field(result_field, no_conversions); save_in_field(result_field, no_conversions);
} }
bool check_partition_func_processor(void *) 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
{ {
return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE); return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE);
@ -4263,23 +4260,18 @@ public:
bool append_for_log(THD *thd, String *str) override; bool append_for_log(THD *thd, String *str) override;
bool check_vcol_func_processor(void *) override { return false; } bool check_vcol_func_processor(void *) override { return false; }
Item *get_copy(THD *) override { return nullptr; } Item *get_copy(THD *) override { return nullptr; }
bool add_as_clone(THD *thd); bool add_as_clone(THD *thd);
void sync_clones(); void sync_clones();
bool register_clone(Item_param *i) { return m_clones.push_back(i); } bool register_clone(Item_param *i) { return m_clones.push_back(i); }
private: private:
void invalid_default_param() const; void invalid_default_param() const;
bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override; bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override;
void set_out_param_info(Send_field *info) override; void set_out_param_info(Send_field *info) override;
public: public:
const Send_field *get_out_param_info() const override; const Send_field *get_out_param_info() const override;
Item_param *get_item_param() override { return this; } Item_param *get_item_param() override { return this; }
void make_send_field(THD *thd, Send_field *field) override; void make_send_field(THD *thd, Send_field *field) override;
private: private:
@ -4397,12 +4389,12 @@ public:
Item_uint(THD *thd, const char *str_arg, size_t length); Item_uint(THD *thd, const char *str_arg, size_t length);
Item_uint(THD *thd, ulonglong i): Item_int(thd, i, 10) {} Item_uint(THD *thd, ulonglong i): Item_int(thd, i, 10) {}
Item_uint(THD *thd, const char *str_arg, longlong i, uint length); Item_uint(THD *thd, const char *str_arg, longlong i, uint length);
double val_real() { return ulonglong2double((ulonglong)value); } double val_real() override { return ulonglong2double((ulonglong)value); }
Item *clone_item(THD *thd); Item *clone_item(THD *thd) override;
Item *neg(THD *thd); Item *neg(THD *thd) override;
decimal_digits_t decimal_precision() const override decimal_digits_t decimal_precision() const override
{ return decimal_digits_t(max_length); } { return decimal_digits_t(max_length); }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_uint>(thd, this); } { return get_item_copy<Item_uint>(thd, this); }
}; };
@ -4444,9 +4436,12 @@ public:
{ return &type_handler_newdecimal; } { return &type_handler_newdecimal; }
longlong val_int() override longlong val_int() override
{ return decimal_value.to_longlong(unsigned_flag); } { return decimal_value.to_longlong(unsigned_flag); }
double val_real() override { return decimal_value.to_double(); } double val_real() override
String *val_str(String *to) override { return decimal_value.to_string(to); } { return decimal_value.to_double(); }
my_decimal *val_decimal(my_decimal *val) override { return &decimal_value; } String *val_str(String *to) override
{ return decimal_value.to_string(to); }
my_decimal *val_decimal(my_decimal *val) override
{ return &decimal_value; }
const my_decimal *const_ptr_my_decimal() const override const my_decimal *const_ptr_my_decimal() const override
{ return &decimal_value; } { return &decimal_value; }
int save_in_field(Field *field, bool no_conversions) override; int save_in_field(Field *field, bool no_conversions) override;
@ -4519,12 +4514,10 @@ public:
uint decimal_par, uint length): uint decimal_par, uint length):
Item_float(thd, NullS, val_arg, decimal_par, length), func_name(str) Item_float(thd, NullS, val_arg, decimal_par, length), func_name(str)
{} {}
void print(String *str, enum_query_type) override void print(String *str, enum_query_type) override
{ {
str->append(func_name, strlen(func_name)); str->append(func_name, strlen(func_name));
} }
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override
{ {
return const_charset_converter(thd, tocs, true, func_name); return const_charset_converter(thd, tocs, true, func_name);
@ -4665,8 +4658,7 @@ public:
{ return Item::check_well_formed_result(&str_value, send_error); } { return Item::check_well_formed_result(&str_value, send_error); }
Item_basic_constant *make_string_literal_concat(THD *thd, Item_basic_constant *make_string_literal_concat(THD *thd,
const LEX_CSTRING *) const LEX_CSTRING *) override;
override;
Item *make_odbc_literal(THD *thd, const LEX_CSTRING *typestr) override; Item *make_odbc_literal(THD *thd, const LEX_CSTRING *typestr) override;
Item *get_copy(THD *thd) override Item *get_copy(THD *thd) override
@ -4804,7 +4796,7 @@ public:
{ {
unsigned_flag=1; unsigned_flag=1;
} }
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
const Type_handler *h= const Type_handler *h=
Type_handler::get_handler_by_field_type(int_field_type); Type_handler::get_handler_by_field_type(int_field_type);
@ -4830,14 +4822,15 @@ public:
{ {
hex_string_init(thd, str, str_length); hex_string_init(thd, str, str_length);
} }
const Type_handler *type_handler() const { return &type_handler_varchar; } const Type_handler *type_handler() const override
virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) { return &type_handler_varchar; }
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override
{ {
return const_charset_converter(thd, tocs, true); return const_charset_converter(thd, tocs, true);
} }
const String *const_ptr_string() const { return &str_value; } const String *const_ptr_string() const override { return &str_value; }
String *val_str(String*) { return &str_value; } String *val_str(String*) override { return &str_value; }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
} }
@ -4859,7 +4852,7 @@ public:
{ return &type_handler_hex_hybrid; } { return &type_handler_hex_hybrid; }
decimal_digits_t decimal_precision() const override; decimal_digits_t decimal_precision() const override;
double val_real() override double val_real() override
{ {
return (double) (ulonglong) Item_hex_hybrid::val_int(); return (double) (ulonglong) Item_hex_hybrid::val_int();
} }
longlong val_int() override longlong val_int() override
@ -5071,7 +5064,7 @@ public:
/** /**
TIME'10:10:10' TIME'10:10:10'
*/ */
class Item_time_literal: public Item_temporal_literal class Item_time_literal final: public Item_temporal_literal
{ {
protected: protected:
Time cached_time; Time cached_time;
@ -5114,6 +5107,7 @@ public:
/** /**
TIMESTAMP'2001-01-01 10:20:30' TIMESTAMP'2001-01-01 10:20:30'
*/ */
class Item_datetime_literal: public Item_temporal_literal class Item_datetime_literal: public Item_temporal_literal
{ {
protected: protected:
@ -5180,7 +5174,7 @@ class Item_date_literal_for_invalid_dates: public Item_date_literal
WHERE date_column='2001-01-01' ... -> WHERE date_column='2001-01-01' ... ->
WHERE date_column=DATE'2001-01-01' ... WHERE date_column=DATE'2001-01-01' ...
This is done to make the eqial field propagation code handle mixtures of This is done to make the equal field propagation code handle mixtures of
different temporal types in the same expressions easier (MDEV-8706), e.g. different temporal types in the same expressions easier (MDEV-8706), e.g.
WHERE LENGTH(date_column)=10 AND date_column=TIME'00:00:00' WHERE LENGTH(date_column)=10 AND date_column=TIME'00:00:00'
@ -5215,7 +5209,7 @@ public:
An error-safe counterpart for Item_datetime_literal An error-safe counterpart for Item_datetime_literal
(see Item_date_literal_for_invalid_dates for comments) (see Item_date_literal_for_invalid_dates for comments)
*/ */
class Item_datetime_literal_for_invalid_dates: public Item_datetime_literal class Item_datetime_literal_for_invalid_dates final: public Item_datetime_literal
{ {
public: public:
Item_datetime_literal_for_invalid_dates(THD *thd, Item_datetime_literal_for_invalid_dates(THD *thd,
@ -5501,7 +5495,7 @@ public:
enum Type type() const override { return REF_ITEM; } enum Type type() const override { return REF_ITEM; }
enum Type real_type() const override enum Type real_type() const override
{ return ref ? (*ref)->type() : REF_ITEM; } { return ref ? (*ref)->type() : REF_ITEM; }
bool eq(const Item *item, bool binary_cmp) const bool eq(const Item *item, bool binary_cmp) const override
{ {
Item *it= ((Item *) item)->real_item(); Item *it= ((Item *) item)->real_item();
return ref && (*ref)->eq(it, binary_cmp); return ref && (*ref)->eq(it, binary_cmp);
@ -5563,7 +5557,10 @@ public:
return Item_ident::build_equal_items(thd, inherited, link_item_fields, return Item_ident::build_equal_items(thd, inherited, link_item_fields,
cond_equal_ref); cond_equal_ref);
} }
bool const_item() const override { return (*ref)->const_item(); } bool const_item() const override
{
return (*ref)->const_item();
}
table_map not_null_tables() const override table_map not_null_tables() const override
{ {
return depended_from ? 0 : (*ref)->not_null_tables(); return depended_from ? 0 : (*ref)->not_null_tables();
@ -5576,7 +5573,10 @@ public:
{ {
(*ref)->save_in_field(result_field, no_conversions); (*ref)->save_in_field(result_field, no_conversions);
} }
Item *real_item() override { return ref ? (*ref)->real_item() : this; } Item *real_item() override
{
return ref ? (*ref)->real_item() : this;
}
const TYPELIB *get_typelib() const override const TYPELIB *get_typelib() const override
{ {
return ref ? (*ref)->get_typelib() : NULL; return ref ? (*ref)->get_typelib() : NULL;
@ -5611,7 +5611,7 @@ public:
} }
void cleanup() override; void cleanup() override;
Item_field *field_for_view_update() override Item_field *field_for_view_update() override
{ return (*ref)->field_for_view_update(); } { return (*ref)->field_for_view_update(); }
Load_data_outvar *get_load_data_outvar() override Load_data_outvar *get_load_data_outvar() override
{ {
return (*ref)->get_load_data_outvar(); return (*ref)->get_load_data_outvar();
@ -5821,13 +5821,10 @@ public:
Type type() const override { return EXPR_CACHE_ITEM; } Type type() const override { return EXPR_CACHE_ITEM; }
Type real_type() const override { return orig_item->type(); } Type real_type() const override { return orig_item->type(); }
bool set_cache(THD *thd); bool set_cache(THD *thd);
Expression_cache_tracker* init_tracker(MEM_ROOT *mem_root); Expression_cache_tracker* init_tracker(MEM_ROOT *mem_root);
bool fix_fields(THD *thd, Item **it) override; bool fix_fields(THD *thd, Item **it) override;
void cleanup() override; void cleanup() override;
Item *get_orig_item() const { return orig_item; } Item *get_orig_item() const { return orig_item; }
/* Methods of getting value which should be cached in the cache */ /* Methods of getting value which should be cached in the cache */
@ -5868,8 +5865,12 @@ public:
int save_in_field(Field *to, bool no_conversions) override; int save_in_field(Field *to, bool no_conversions) override;
const Type_handler *type_handler() const override const Type_handler *type_handler() const override
{ return orig_item->type_handler(); } { return orig_item->type_handler(); }
table_map used_tables() const override { return orig_item->used_tables(); } table_map used_tables() const override
void update_used_tables() override { orig_item->update_used_tables(); } { return orig_item->used_tables(); }
void update_used_tables() override
{
orig_item->update_used_tables();
}
bool const_item() const override { return orig_item->const_item(); } bool const_item() const override { return orig_item->const_item(); }
table_map not_null_tables() const override table_map not_null_tables() const override
{ return orig_item->not_null_tables(); } { return orig_item->not_null_tables(); }
@ -5979,7 +5980,7 @@ public:
table_map used_tables() const override; table_map used_tables() const override;
void update_used_tables() override; void update_used_tables() override;
table_map not_null_tables() const override; table_map not_null_tables() const override;
bool const_item() const override { return used_tables() == 0; } bool const_item() const override{ return used_tables() == 0; }
TABLE *get_null_ref_table() const { return null_ref_table; } TABLE *get_null_ref_table() const { return null_ref_table; }
bool walk(Item_processor processor, bool walk_subquery, void *arg) override bool walk(Item_processor processor, bool walk_subquery, void *arg) override
{ {
@ -6344,7 +6345,6 @@ public:
Override the methods below as pure virtual to make sure all the Override the methods below as pure virtual to make sure all the
sub-classes implement them. sub-classes implement them.
*/ */
String *val_str(String*) override = 0; String *val_str(String*) override = 0;
my_decimal *val_decimal(my_decimal *) override = 0; my_decimal *val_decimal(my_decimal *) override = 0;
double val_real() override = 0; double val_real() override = 0;
@ -6610,13 +6610,11 @@ public:
Item_field *field_for_view_update() override { return nullptr; } Item_field *field_for_view_update() override { return nullptr; }
bool update_vcol_processor(void *) override { return false; } bool update_vcol_processor(void *) override { return false; }
bool check_func_default_processor(void *) override { return true; } bool check_func_default_processor(void *) override { return true; }
bool walk(Item_processor processor, bool walk_subquery, void *args) override bool walk(Item_processor processor, bool walk_subquery, void *args) override
{ {
return (arg && arg->walk(processor, walk_subquery, args)) || return (arg && arg->walk(processor, walk_subquery, args)) ||
(this->*processor)(args); (this->*processor)(args);
} }
Item *transform(THD *thd, Item_transformer transformer, uchar *args) Item *transform(THD *thd, Item_transformer transformer, uchar *args)
override; override;
Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
@ -6970,7 +6968,7 @@ public:
virtual void keep_array() {} virtual void keep_array() {}
void print(String *str, enum_query_type query_type) override; void print(String *str, enum_query_type query_type) override;
bool eq_def(const Field *field) bool eq_def(const Field *field)
{ {
return cached_field ? cached_field->eq_def (field) : FALSE; return cached_field ? cached_field->eq_def (field) : FALSE;
} }
bool eq(const Item *item, bool binary_cmp) const override bool eq(const Item *item, bool binary_cmp) const override
@ -6981,7 +6979,8 @@ public:
{ {
if (example) if (example)
{ {
Item::vcol_func_processor_result *res= (Item::vcol_func_processor_result*)arg; Item::vcol_func_processor_result *res=
(Item::vcol_func_processor_result*) arg;
example->check_vcol_func_processor(arg); example->check_vcol_func_processor(arg);
/* /*
Item_cache of a non-deterministic function requires re-fixing Item_cache of a non-deterministic function requires re-fixing
@ -7293,8 +7292,8 @@ public:
Item_cache_double(THD *thd) Item_cache_double(THD *thd)
:Item_cache_real(thd, &type_handler_double) :Item_cache_real(thd, &type_handler_double)
{ } { }
String* val_str(String *str); String *val_str(String *str) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_cache_double>(thd, this); } { return get_item_copy<Item_cache_double>(thd, this); }
}; };
@ -7305,8 +7304,8 @@ public:
Item_cache_float(THD *thd) Item_cache_float(THD *thd)
:Item_cache_real(thd, &type_handler_float) :Item_cache_real(thd, &type_handler_float)
{ } { }
String* val_str(String *str); String *val_str(String *str) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_cache_float>(thd, this); } { return get_item_copy<Item_cache_float>(thd, this); }
}; };
@ -7370,7 +7369,7 @@ public:
Item_cache_str_for_nullif(THD *thd, const Item *item) Item_cache_str_for_nullif(THD *thd, const Item *item)
:Item_cache_str(thd, item) :Item_cache_str(thd, item)
{ } { }
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override
{ {
/** /**
Item_cache_str::safe_charset_converter() returns a new Item_cache Item_cache_str::safe_charset_converter() returns a new Item_cache
@ -7384,7 +7383,7 @@ public:
*/ */
return Item::safe_charset_converter(thd, tocs); return Item::safe_charset_converter(thd, tocs);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_cache_str_for_nullif>(thd, this); } { return get_item_copy<Item_cache_str_for_nullif>(thd, this); }
}; };
@ -7537,7 +7536,6 @@ public:
*this, table); *this, table);
} }
Item* get_copy(THD *) override { return nullptr; } Item* get_copy(THD *) override { return nullptr; }
}; };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -42,8 +42,9 @@ 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(); bool fix_length_and_dec() override;
const Type_handler *type_handler() const { return &type_handler_geometry; } const Type_handler *type_handler() const override
{ return &type_handler_geometry; }
}; };
@ -54,7 +55,7 @@ class Item_real_func_args_geometry: public Item_real_func
{ {
protected: protected:
String value; String value;
bool check_arguments() const bool check_arguments() const override
{ {
DBUG_ASSERT(arg_count == 1); DBUG_ASSERT(arg_count == 1);
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(), return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
@ -71,7 +72,7 @@ public:
*/ */
class Item_long_func_args_geometry: public Item_long_func class Item_long_func_args_geometry: public Item_long_func
{ {
bool check_arguments() const bool check_arguments() const override
{ {
DBUG_ASSERT(arg_count == 1); DBUG_ASSERT(arg_count == 1);
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(), return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
@ -92,7 +93,7 @@ class Item_bool_func_args_geometry: public Item_bool_func
{ {
protected: protected:
String value; String value;
bool check_arguments() const bool check_arguments() const override
{ {
DBUG_ASSERT(arg_count == 1); DBUG_ASSERT(arg_count == 1);
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(), return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
@ -110,7 +111,7 @@ public:
class Item_str_ascii_func_args_geometry: public Item_str_ascii_func class Item_str_ascii_func_args_geometry: public Item_str_ascii_func
{ {
protected: protected:
bool check_arguments() const bool check_arguments() const override
{ {
DBUG_ASSERT(arg_count >= 1); DBUG_ASSERT(arg_count >= 1);
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(), return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
@ -132,7 +133,7 @@ public:
class Item_binary_func_args_geometry: public Item_str_func class Item_binary_func_args_geometry: public Item_str_func
{ {
protected: protected:
bool check_arguments() const bool check_arguments() const override
{ {
DBUG_ASSERT(arg_count >= 1); DBUG_ASSERT(arg_count >= 1);
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(), return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
@ -150,7 +151,7 @@ public:
class Item_geometry_func_args_geometry: public Item_geometry_func class Item_geometry_func_args_geometry: public Item_geometry_func
{ {
protected: protected:
bool check_arguments() const bool check_arguments() const override
{ {
DBUG_ASSERT(arg_count >= 1); DBUG_ASSERT(arg_count >= 1);
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(), return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
@ -170,7 +171,7 @@ public:
class Item_real_func_args_geometry_geometry: public Item_real_func class Item_real_func_args_geometry_geometry: public Item_real_func
{ {
protected: protected:
bool check_arguments() const bool check_arguments() const override
{ {
DBUG_ASSERT(arg_count >= 2); DBUG_ASSERT(arg_count >= 2);
return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(), return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(),
@ -189,7 +190,7 @@ class Item_bool_func_args_geometry_geometry: public Item_bool_func
{ {
protected: protected:
String value; String value;
bool check_arguments() const bool check_arguments() const override
{ {
DBUG_ASSERT(arg_count >= 2); DBUG_ASSERT(arg_count >= 2);
return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(), return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(),
@ -203,7 +204,7 @@ public:
class Item_func_geometry_from_text: public Item_geometry_func class Item_func_geometry_from_text: public Item_geometry_func
{ {
bool check_arguments() const bool check_arguments() const override
{ {
return args[0]->check_type_general_purpose_string(func_name_cstring()) || return args[0]->check_type_general_purpose_string(func_name_cstring()) ||
check_argument_types_can_return_int(1, MY_MIN(2, arg_count)); check_argument_types_can_return_int(1, MY_MIN(2, arg_count));
@ -217,14 +218,14 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_geometryfromtext") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_geometryfromtext") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_geometry_from_text>(thd, this); } { return get_item_copy<Item_func_geometry_from_text>(thd, this); }
}; };
class Item_func_geometry_from_wkb: public Item_geometry_func class Item_func_geometry_from_wkb: public Item_geometry_func
{ {
bool check_arguments() const bool check_arguments() const override
{ {
return return
Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(), args[0]) || Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(), args[0]) ||
@ -239,8 +240,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_geometryfromwkb") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_geometryfromwkb") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_geometry_from_wkb>(thd, this); } { return get_item_copy<Item_func_geometry_from_wkb>(thd, this); }
}; };
@ -248,7 +249,7 @@ public:
class Item_func_geometry_from_json: public Item_geometry_func class Item_func_geometry_from_json: public Item_geometry_func
{ {
String tmp_js; String tmp_js;
bool check_arguments() const bool check_arguments() const override
{ {
// TODO: check with Alexey, for better args[1] and args[2] type control // TODO: check with Alexey, for better args[1] and args[2] type control
return args[0]->check_type_general_purpose_string(func_name_cstring()) || return args[0]->check_type_general_purpose_string(func_name_cstring()) ||
@ -265,8 +266,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_geomfromgeojson") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_geomfromgeojson") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_geometry_from_json>(thd, this); } { return get_item_copy<Item_func_geometry_from_json>(thd, this); }
}; };
@ -281,9 +282,9 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_astext") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_astext") };
return name; return name;
} }
String *val_str_ascii(String *); String *val_str_ascii(String *) override;
bool fix_length_and_dec(); bool fix_length_and_dec() override;
Item *get_copy(THD *thd) 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); }
}; };
@ -297,9 +298,10 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_aswkb") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_aswkb") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
const Type_handler *type_handler() const { return &type_handler_long_blob; } const Type_handler *type_handler() const override
bool fix_length_and_dec() { return &type_handler_long_blob; }
bool fix_length_and_dec() override
{ {
collation.set(&my_charset_bin); collation.set(&my_charset_bin);
decimals=0; decimals=0;
@ -307,14 +309,14 @@ public:
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_as_wkb>(thd, this); } { return get_item_copy<Item_func_as_wkb>(thd, this); }
}; };
class Item_func_as_geojson: public Item_str_ascii_func_args_geometry class Item_func_as_geojson: public Item_str_ascii_func_args_geometry
{ {
bool check_arguments() const bool check_arguments() const override
{ {
// TODO: check with Alexey, for better args[1] and args[2] type control // TODO: check with Alexey, for better args[1] and args[2] type control
return Item_str_ascii_func_args_geometry::check_arguments() || return Item_str_ascii_func_args_geometry::check_arguments() ||
@ -332,9 +334,9 @@ 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(); bool fix_length_and_dec() override;
String *val_str_ascii(String *); String *val_str_ascii(String *) override;
Item *get_copy(THD *thd) 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); }
}; };
@ -344,20 +346,20 @@ class Item_func_geometry_type: public Item_str_ascii_func_args_geometry
public: public:
Item_func_geometry_type(THD *thd, Item *a) Item_func_geometry_type(THD *thd, Item *a)
:Item_str_ascii_func_args_geometry(thd, a) {} :Item_str_ascii_func_args_geometry(thd, a) {}
String *val_str_ascii(String *); String *val_str_ascii(String *) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
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() bool fix_length_and_dec() override
{ {
// "GeometryCollection" is the longest // "GeometryCollection" is the longest
fix_length_and_charset(20, default_charset()); fix_length_and_charset(20, default_charset());
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
}; };
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_geometry_type>(thd, this); } { return get_item_copy<Item_func_geometry_type>(thd, this); }
}; };
@ -395,8 +397,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_convexhull") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_convexhull") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_convexhull>(thd, this); } { return get_item_copy<Item_func_convexhull>(thd, this); }
}; };
@ -411,12 +413,12 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_centroid") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_centroid") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
return &type_handler_point; return &type_handler_point;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_centroid>(thd, this); } { return get_item_copy<Item_func_centroid>(thd, this); }
}; };
@ -430,12 +432,12 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_envelope") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_envelope") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
return &type_handler_polygon; return &type_handler_polygon;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_envelope>(thd, this); } { return get_item_copy<Item_func_envelope>(thd, this); }
}; };
@ -472,15 +474,15 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_boundary") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_boundary") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_boundary>(thd, this); } { return get_item_copy<Item_func_boundary>(thd, this); }
}; };
class Item_func_point: public Item_geometry_func class Item_func_point: public Item_geometry_func
{ {
bool check_arguments() const bool check_arguments() const override
{ return check_argument_types_can_return_real(0, 2); } { return check_argument_types_can_return_real(0, 2); }
public: public:
Item_func_point(THD *thd, Item *a, Item *b): Item_geometry_func(thd, a, b) {} Item_func_point(THD *thd, Item *a, Item *b): Item_geometry_func(thd, a, b) {}
@ -491,12 +493,12 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("point") }; static LEX_CSTRING name= {STRING_WITH_LEN("point") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
return &type_handler_point; return &type_handler_point;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_point>(thd, this); } { return get_item_copy<Item_func_point>(thd, this); }
}; };
@ -524,15 +526,15 @@ public:
return unknown; return unknown;
} }
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_spatial_decomp>(thd, this); } { return get_item_copy<Item_func_spatial_decomp>(thd, this); }
}; };
class Item_func_spatial_decomp_n: public Item_geometry_func_args_geometry class Item_func_spatial_decomp_n: public Item_geometry_func_args_geometry
{ {
enum Functype decomp_func_n; enum Functype decomp_func_n;
bool check_arguments() const bool check_arguments() const override
{ {
return Item_geometry_func_args_geometry::check_arguments() || return Item_geometry_func_args_geometry::check_arguments() ||
args[1]->check_type_can_return_int(func_name_cstring()); args[1]->check_type_can_return_int(func_name_cstring());
@ -561,14 +563,14 @@ public:
return unknown; return unknown;
} }
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_spatial_decomp_n>(thd, this); } { return get_item_copy<Item_func_spatial_decomp_n>(thd, this); }
}; };
class Item_func_spatial_collection: public Item_geometry_func class Item_func_spatial_collection: public Item_geometry_func
{ {
bool check_arguments() const bool check_arguments() const override
{ {
return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(), args, return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(), args,
0, arg_count); 0, arg_count);
@ -583,8 +585,8 @@ public:
coll_type=ct; coll_type=ct;
item_type=it; item_type=it;
} }
String *val_str(String *); String *val_str(String *) override;
bool fix_length_and_dec() bool fix_length_and_dec() override
{ {
if (Item_geometry_func::fix_length_and_dec()) if (Item_geometry_func::fix_length_and_dec())
return TRUE; return TRUE;
@ -613,7 +615,7 @@ public:
Geometry::wkb_geometrycollection, Geometry::wkb_geometrycollection,
Geometry::wkb_point) Geometry::wkb_point)
{ } { }
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
return &type_handler_geometrycollection; return &type_handler_geometrycollection;
} }
@ -622,7 +624,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("geometrycollection") }; static LEX_CSTRING name= {STRING_WITH_LEN("geometrycollection") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_geometrycollection>(thd, this); } { return get_item_copy<Item_func_geometrycollection>(thd, this); }
}; };
@ -635,13 +637,14 @@ public:
Geometry::wkb_linestring, Geometry::wkb_linestring,
Geometry::wkb_point) Geometry::wkb_point)
{ } { }
const Type_handler *type_handler() const { return &type_handler_linestring; } const Type_handler *type_handler() const override
{ return &type_handler_linestring; }
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("linestring") }; static LEX_CSTRING name= {STRING_WITH_LEN("linestring") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_linestring>(thd, this); } { return get_item_copy<Item_func_linestring>(thd, this); }
}; };
@ -654,13 +657,14 @@ public:
Geometry::wkb_polygon, Geometry::wkb_polygon,
Geometry::wkb_linestring) Geometry::wkb_linestring)
{ } { }
const Type_handler *type_handler() const { return &type_handler_polygon; } const Type_handler *type_handler() const override
{ return &type_handler_polygon; }
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("polygon") }; static LEX_CSTRING name= {STRING_WITH_LEN("polygon") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_polygon>(thd, this); } { return get_item_copy<Item_func_polygon>(thd, this); }
}; };
@ -673,7 +677,7 @@ public:
Geometry::wkb_multilinestring, Geometry::wkb_multilinestring,
Geometry::wkb_linestring) Geometry::wkb_linestring)
{ } { }
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
return &type_handler_multilinestring; return &type_handler_multilinestring;
} }
@ -682,7 +686,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("multilinestring") }; static LEX_CSTRING name= {STRING_WITH_LEN("multilinestring") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_multilinestring>(thd, this); } { return get_item_copy<Item_func_multilinestring>(thd, this); }
}; };
@ -695,7 +699,7 @@ public:
Geometry::wkb_multipoint, Geometry::wkb_multipoint,
Geometry::wkb_point) Geometry::wkb_point)
{ } { }
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
return &type_handler_multipoint; return &type_handler_multipoint;
} }
@ -704,7 +708,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("multipoint") }; static LEX_CSTRING name= {STRING_WITH_LEN("multipoint") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_multipoint>(thd, this); } { return get_item_copy<Item_func_multipoint>(thd, this); }
}; };
@ -717,7 +721,7 @@ public:
Geometry::wkb_multipolygon, Geometry::wkb_multipolygon,
Geometry::wkb_polygon) Geometry::wkb_polygon)
{ } { }
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
return &type_handler_multipolygon; return &type_handler_multipolygon;
} }
@ -726,7 +730,7 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("multipolygon") }; static LEX_CSTRING name= {STRING_WITH_LEN("multipolygon") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_multipolygon>(thd, this); } { return get_item_copy<Item_func_multipolygon>(thd, this); }
}; };
@ -743,8 +747,8 @@ protected:
String tmp_value1, tmp_value2; String tmp_value1, tmp_value2;
SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field,
KEY_PART *key_part, KEY_PART *key_part,
Item_func::Functype type, Item *value); Item_func::Functype type, Item *value) override;
bool check_arguments() const bool check_arguments() const override
{ {
DBUG_ASSERT(arg_count >= 2); DBUG_ASSERT(arg_count >= 2);
return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(), return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(),
@ -756,8 +760,8 @@ public:
{ {
set_maybe_null(); set_maybe_null();
} }
enum Functype functype() const { return spatial_rel; } enum Functype functype() const override { return spatial_rel; }
enum Functype rev_functype() const enum Functype rev_functype() const override
{ {
switch (spatial_rel) switch (spatial_rel)
{ {
@ -769,16 +773,16 @@ public:
return spatial_rel; return spatial_rel;
} }
} }
bool is_null() { (void) val_int(); return null_value; } bool is_null() override { (void) val_int(); return null_value; }
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables, uint *and_level, table_map usable_tables,
SARGABLE_PARAM **sargables) SARGABLE_PARAM **sargables) override
{ {
return add_key_fields_optimize_op(join, key_fields, and_level, return add_key_fields_optimize_op(join, key_fields, and_level,
usable_tables, sargables, false); usable_tables, sargables, false);
} }
bool need_parentheses_in_default() { return false; } bool need_parentheses_in_default() override { return false; }
Item *build_clone(THD *thd) { return 0; } Item *build_clone(THD *thd) override { return 0; }
}; };
@ -788,9 +792,9 @@ public:
Item_func_spatial_mbr_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel): Item_func_spatial_mbr_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
Item_func_spatial_rel(thd, a, b, sp_rel) Item_func_spatial_rel(thd, a, b, sp_rel)
{ } { }
longlong val_int(); longlong val_int() override;
LEX_CSTRING func_name_cstring() const override; LEX_CSTRING func_name_cstring() const override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_spatial_mbr_rel>(thd, this); } { return get_item_copy<Item_func_spatial_mbr_rel>(thd, this); }
}; };
@ -804,9 +808,9 @@ public:
Item_func_spatial_precise_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel): Item_func_spatial_precise_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
Item_func_spatial_rel(thd, a, b, sp_rel), collector() Item_func_spatial_rel(thd, a, b, sp_rel), collector()
{ } { }
longlong val_int(); longlong val_int() override;
LEX_CSTRING func_name_cstring() const override; LEX_CSTRING func_name_cstring() const override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_spatial_precise_rel>(thd, this); } { return get_item_copy<Item_func_spatial_precise_rel>(thd, this); }
}; };
@ -817,7 +821,7 @@ class Item_func_spatial_relate: public Item_bool_func_args_geometry_geometry
Gcalc_scan_iterator scan_it; Gcalc_scan_iterator scan_it;
Gcalc_function func; Gcalc_function func;
String tmp_value1, tmp_value2, tmp_matrix; String tmp_value1, tmp_value2, tmp_matrix;
bool check_arguments() const bool check_arguments() const override
{ {
return Item_bool_func_args_geometry_geometry::check_arguments() || return Item_bool_func_args_geometry_geometry::check_arguments() ||
args[2]->check_type_general_purpose_string(func_name_cstring()); args[2]->check_type_general_purpose_string(func_name_cstring());
@ -826,14 +830,14 @@ public:
Item_func_spatial_relate(THD *thd, Item *a, Item *b, Item *matrix): Item_func_spatial_relate(THD *thd, Item *a, Item *b, Item *matrix):
Item_bool_func_args_geometry_geometry(thd, a, b, matrix) Item_bool_func_args_geometry_geometry(thd, a, b, matrix)
{ } { }
longlong val_int(); longlong val_int() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("st_relate") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_relate") };
return name; return name;
} }
bool need_parentheses_in_default() { return false; } bool need_parentheses_in_default() override { return false; }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_spatial_relate>(thd, this); } { return get_item_copy<Item_func_spatial_relate>(thd, this); }
}; };
@ -842,9 +846,9 @@ public:
Spatial operations Spatial operations
*/ */
class Item_func_spatial_operation: public Item_geometry_func class Item_func_spatial_operation final: public Item_geometry_func
{ {
bool check_arguments() const bool check_arguments() const override
{ {
DBUG_ASSERT(arg_count >= 2); DBUG_ASSERT(arg_count >= 2);
return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(), return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(),
@ -864,20 +868,20 @@ public:
Item_geometry_func(thd, a, b), spatial_op(sp_op) Item_geometry_func(thd, a, b), spatial_op(sp_op)
{} {}
virtual ~Item_func_spatial_operation(); virtual ~Item_func_spatial_operation();
String *val_str(String *); String *val_str(String *) override;
LEX_CSTRING func_name_cstring() const override; LEX_CSTRING func_name_cstring() const override;
virtual inline void print(String *str, enum_query_type query_type) void print(String *str, enum_query_type query_type) override
{ {
Item_func::print(str, query_type); Item_func::print(str, query_type);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_spatial_operation>(thd, this); } { return get_item_copy<Item_func_spatial_operation>(thd, this); }
}; };
class Item_func_buffer: public Item_geometry_func_args_geometry class Item_func_buffer final : public Item_geometry_func_args_geometry
{ {
bool check_arguments() const bool check_arguments() const override
{ {
return Item_geometry_func_args_geometry::check_arguments() || return Item_geometry_func_args_geometry::check_arguments() ||
args[1]->check_type_can_return_real(func_name_cstring()); args[1]->check_type_can_return_real(func_name_cstring());
@ -930,8 +934,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_buffer") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_buffer") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_buffer>(thd, this); } { return get_item_copy<Item_func_buffer>(thd, this); }
}; };
@ -963,15 +967,15 @@ class Item_func_issimple: public Item_long_func_args_geometry
public: public:
Item_func_issimple(THD *thd, Item *a) Item_func_issimple(THD *thd, Item *a)
:Item_long_func_args_geometry(thd, a) {} :Item_long_func_args_geometry(thd, a) {}
longlong val_int(); longlong val_int() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
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() { decimals=0; max_length=2; return FALSE; } bool fix_length_and_dec() 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) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_issimple>(thd, this); } { return get_item_copy<Item_func_issimple>(thd, this); }
}; };
@ -980,15 +984,15 @@ class Item_func_isclosed: public Item_long_func_args_geometry
public: public:
Item_func_isclosed(THD *thd, Item *a) Item_func_isclosed(THD *thd, Item *a)
:Item_long_func_args_geometry(thd, a) {} :Item_long_func_args_geometry(thd, a) {}
longlong val_int(); longlong val_int() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
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() { decimals=0; max_length=2; return FALSE; } bool fix_length_and_dec() 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) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_isclosed>(thd, this); } { return get_item_copy<Item_func_isclosed>(thd, this); }
}; };
@ -996,13 +1000,13 @@ class Item_func_isring: public Item_func_issimple
{ {
public: public:
Item_func_isring(THD *thd, Item *a): Item_func_issimple(thd, a) {} Item_func_isring(THD *thd, Item *a): Item_func_issimple(thd, a) {}
longlong val_int(); longlong val_int() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("st_isring") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_isring") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_isring>(thd, this); } { return get_item_copy<Item_func_isring>(thd, this); }
}; };
@ -1028,20 +1032,20 @@ class Item_func_x: public Item_real_func_args_geometry
{ {
public: public:
Item_func_x(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {} Item_func_x(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {}
double val_real(); double val_real() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
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() bool fix_length_and_dec() override
{ {
if (Item_real_func::fix_length_and_dec()) if (Item_real_func::fix_length_and_dec())
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_x>(thd, this); } { return get_item_copy<Item_func_x>(thd, this); }
}; };
@ -1050,20 +1054,20 @@ class Item_func_y: public Item_real_func_args_geometry
{ {
public: public:
Item_func_y(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {} Item_func_y(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {}
double val_real(); double val_real() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
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() bool fix_length_and_dec() override
{ {
if (Item_real_func::fix_length_and_dec()) if (Item_real_func::fix_length_and_dec())
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_y>(thd, this); } { return get_item_copy<Item_func_y>(thd, this); }
}; };
@ -1126,20 +1130,20 @@ class Item_func_area: public Item_real_func_args_geometry
{ {
public: public:
Item_func_area(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {} Item_func_area(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {}
double val_real(); double val_real() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
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() bool fix_length_and_dec() override
{ {
if (Item_real_func::fix_length_and_dec()) if (Item_real_func::fix_length_and_dec())
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_area>(thd, this); } { return get_item_copy<Item_func_area>(thd, this); }
}; };
@ -1150,20 +1154,20 @@ class Item_func_glength: public Item_real_func_args_geometry
public: public:
Item_func_glength(THD *thd, Item *a) Item_func_glength(THD *thd, Item *a)
:Item_real_func_args_geometry(thd, a) {} :Item_real_func_args_geometry(thd, a) {}
double val_real(); double val_real() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
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() bool fix_length_and_dec() override
{ {
if (Item_real_func::fix_length_and_dec()) if (Item_real_func::fix_length_and_dec())
return TRUE; return TRUE;
set_maybe_null(); set_maybe_null();
return FALSE; return FALSE;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_glength>(thd, this); } { return get_item_copy<Item_func_glength>(thd, this); }
}; };
@ -1196,13 +1200,13 @@ class Item_func_distance: public Item_real_func_args_geometry_geometry
public: public:
Item_func_distance(THD *thd, Item *a, Item *b) Item_func_distance(THD *thd, Item *a, Item *b)
:Item_real_func_args_geometry_geometry(thd, a, b) {} :Item_real_func_args_geometry_geometry(thd, a, b) {}
double val_real(); double val_real() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("st_distance") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_distance") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_distance>(thd, this); } { return get_item_copy<Item_func_distance>(thd, this); }
}; };
@ -1214,13 +1218,13 @@ class Item_func_sphere_distance: public Item_real_func
public: public:
Item_func_sphere_distance(THD *thd, List<Item> &list): Item_func_sphere_distance(THD *thd, List<Item> &list):
Item_real_func(thd, list) {} Item_real_func(thd, list) {}
double val_real(); double val_real() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("st_distance_sphere") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_distance_sphere") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_sphere_distance>(thd, this); } { return get_item_copy<Item_func_sphere_distance>(thd, this); }
}; };
@ -1239,12 +1243,12 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("st_pointonsurface") }; static LEX_CSTRING name= {STRING_WITH_LEN("st_pointonsurface") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
return &type_handler_point; return &type_handler_point;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_pointonsurface>(thd, this); } { return get_item_copy<Item_func_pointonsurface>(thd, this); }
}; };
@ -1255,18 +1259,18 @@ 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() { fix_char_length(10); return FALSE; } bool fix_length_and_dec() 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") };
return name; return name;
} }
longlong val_int(); longlong val_int() override;
bool check_vcol_func_processor(void *arg) 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);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_gis_debug>(thd, this); } { return get_item_copy<Item_func_gis_debug>(thd, this); }
}; };
#endif #endif

View File

@ -82,13 +82,13 @@ protected:
public: public:
Item_func_json_valid(THD *thd, Item *json) : Item_bool_func(thd, json) {} Item_func_json_valid(THD *thd, Item *json) : Item_bool_func(thd, json) {}
longlong val_int(); longlong val_int() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
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() bool fix_length_and_dec() override
{ {
if (Item_bool_func::fix_length_and_dec()) if (Item_bool_func::fix_length_and_dec())
return TRUE; return TRUE;
@ -96,13 +96,14 @@ public:
return FALSE; return FALSE;
} }
bool set_format_by_check_constraint(Send_field_extended_metadata *to) const bool set_format_by_check_constraint(Send_field_extended_metadata *to) const
override
{ {
static const Lex_cstring fmt(STRING_WITH_LEN("json")); static const Lex_cstring fmt(STRING_WITH_LEN("json"));
return to->set_format_name(fmt); return to->set_format_name(fmt);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_valid>(thd, this); } { return get_item_copy<Item_func_json_valid>(thd, this); }
enum Functype functype() const { return JSON_VALID_FUNC; } enum Functype functype() const override { return JSON_VALID_FUNC; }
}; };
@ -120,10 +121,10 @@ 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(); bool fix_length_and_dec() override;
Item *get_copy(THD *thd) 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(); longlong val_int() override;
}; };
@ -217,9 +218,9 @@ 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(); bool fix_length_and_dec() override;
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) 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); }
}; };
@ -236,9 +237,9 @@ 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(); bool fix_length_and_dec() override;
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) 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); }
}; };
@ -271,14 +272,14 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_extract") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_extract") };
return name; return name;
} }
enum Functype functype() const { return JSON_EXTRACT_FUNC; } enum Functype functype() const override { return JSON_EXTRACT_FUNC; }
bool fix_length_and_dec(); bool fix_length_and_dec() override;
String *val_str(String *); String *val_str(String *) override;
longlong val_int(); longlong val_int() override;
double val_real(); double val_real() override;
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
uint get_n_paths() const { return arg_count - 1; } uint get_n_paths() const override { return arg_count - 1; }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_extract>(thd, this); } { return get_item_copy<Item_func_json_extract>(thd, this); }
}; };
@ -299,9 +300,9 @@ 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(); bool fix_length_and_dec() override;
longlong val_int(); longlong val_int() override;
Item *get_copy(THD *thd) 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); }
}; };
@ -324,11 +325,11 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_contains_path") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_contains_path") };
return name; return name;
} }
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec(); bool fix_length_and_dec() override;
void cleanup(); void cleanup() override;
longlong val_int(); longlong val_int() override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_contains_path>(thd, this); } { return get_item_copy<Item_func_json_contains_path>(thd, this); }
}; };
@ -343,14 +344,14 @@ public:
Item_json_func(thd) {} Item_json_func(thd) {}
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 *); String *val_str(String *) override;
bool fix_length_and_dec(); bool fix_length_and_dec() 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") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_array>(thd, this); } { return get_item_copy<Item_func_json_array>(thd, this); }
}; };
@ -363,15 +364,15 @@ 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(); bool fix_length_and_dec() override;
String *val_str(String *); String *val_str(String *) override;
uint get_n_paths() const { 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
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("json_array_append") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_array_append") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_array_append>(thd, this); } { return get_item_copy<Item_func_json_array_append>(thd, this); }
}; };
@ -381,13 +382,13 @@ class Item_func_json_array_insert: public Item_func_json_array_append
public: public:
Item_func_json_array_insert(THD *thd, List<Item> &list): Item_func_json_array_insert(THD *thd, List<Item> &list):
Item_func_json_array_append(thd, list) {} Item_func_json_array_append(thd, list) {}
String *val_str(String *); String *val_str(String *) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("json_array_insert") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_array_insert") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_array_insert>(thd, this); } { return get_item_copy<Item_func_json_array_insert>(thd, this); }
}; };
@ -399,13 +400,13 @@ public:
Item_func_json_array(thd) {} Item_func_json_array(thd) {}
Item_func_json_object(THD *thd, List<Item> &list): Item_func_json_object(THD *thd, List<Item> &list):
Item_func_json_array(thd, list) {} Item_func_json_array(thd, list) {}
String *val_str(String *); String *val_str(String *) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("json_object") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_object") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_object>(thd, this); } { return get_item_copy<Item_func_json_object>(thd, this); }
}; };
@ -417,13 +418,13 @@ protected:
public: public:
Item_func_json_merge(THD *thd, List<Item> &list): Item_func_json_merge(THD *thd, List<Item> &list):
Item_func_json_array(thd, list) {} Item_func_json_array(thd, list) {}
String *val_str(String *); String *val_str(String *) override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("json_merge_preserve") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_merge_preserve") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_merge>(thd, this); } { return get_item_copy<Item_func_json_merge>(thd, this); }
}; };
@ -437,14 +438,14 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_merge_patch") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_merge_patch") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_merge_patch>(thd, this); } { return get_item_copy<Item_func_json_merge_patch>(thd, this); }
}; };
class Item_func_json_length: public Item_long_func class Item_func_json_length: public Item_long_func
{ {
bool check_arguments() const bool check_arguments() const override
{ {
return args[0]->check_type_can_return_text(func_name_cstring()) || return args[0]->check_type_can_return_text(func_name_cstring()) ||
(arg_count > 1 && (arg_count > 1 &&
@ -462,16 +463,16 @@ 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(); bool fix_length_and_dec() override;
longlong val_int(); longlong val_int() override;
Item *get_copy(THD *thd) 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); }
}; };
class Item_func_json_depth: public Item_long_func class Item_func_json_depth: public Item_long_func
{ {
bool check_arguments() const bool check_arguments() const override
{ return args[0]->check_type_can_return_text(func_name_cstring()); } { return args[0]->check_type_can_return_text(func_name_cstring()); }
protected: protected:
String tmp_js; String tmp_js;
@ -482,9 +483,9 @@ 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() { max_length= 10; return FALSE; } bool fix_length_and_dec() override { max_length= 10; return FALSE; }
longlong val_int(); longlong val_int() override;
Item *get_copy(THD *thd) 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); }
}; };
@ -500,9 +501,9 @@ 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(); bool fix_length_and_dec() override;
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) 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); }
}; };
@ -517,9 +518,9 @@ 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(); bool fix_length_and_dec() override;
String *val_str(String *); String *val_str(String *) override;
uint get_n_paths() const { 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
{ {
static LEX_CSTRING json_set= {STRING_WITH_LEN("json_set") }; static LEX_CSTRING json_set= {STRING_WITH_LEN("json_set") };
@ -528,7 +529,7 @@ public:
return (mode_insert ? return (mode_insert ?
(mode_replace ? json_set : json_insert) : json_update); (mode_replace ? json_set : json_insert) : json_update);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_insert>(thd, this); } { return get_item_copy<Item_func_json_insert>(thd, this); }
}; };
@ -540,15 +541,15 @@ 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(); bool fix_length_and_dec() override;
String *val_str(String *); String *val_str(String *) override;
uint get_n_paths() const { 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
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("json_remove") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_remove") };
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_remove>(thd, this); } { return get_item_copy<Item_func_json_remove>(thd, this); }
}; };
@ -567,9 +568,9 @@ 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(); bool fix_length_and_dec() override;
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) 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); }
}; };
@ -594,11 +595,11 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("json_search") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_search") };
return name; return name;
} }
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec(); bool fix_length_and_dec() override;
String *val_str(String *); String *val_str(String *) override;
uint get_n_paths() const { 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) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_search>(thd, this); } { return get_item_copy<Item_func_json_search>(thd, this); }
}; };
@ -623,10 +624,10 @@ 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(); bool fix_length_and_dec() override;
String *val_str(String *str); String *val_str(String *str) override;
String *val_json(String *str); String *val_json(String *str) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_format>(thd, this); } { return get_item_copy<Item_func_json_format>(thd, this); }
}; };
@ -638,12 +639,12 @@ protected:
Overrides Item_func_group_concat::skip_nulls() Overrides Item_func_group_concat::skip_nulls()
NULL-s should be added to the result as JSON null value. NULL-s should be added to the result as JSON null value.
*/ */
bool skip_nulls() const { return false; } bool skip_nulls() const override { return false; }
String *get_str_from_item(Item *i, String *tmp); String *get_str_from_item(Item *i, String *tmp) override;
String *get_str_from_field(Item *i, Field *f, String *tmp, String *get_str_from_field(Item *i, Field *f, String *tmp,
const uchar *key, size_t offset); const uchar *key, size_t offset) override;
void cut_max_length(String *result, void cut_max_length(String *result,
uint old_length, uint max_length) const; uint old_length, uint max_length) const override;
public: public:
String m_tmp_json; /* Used in get_str_from_*.. */ String m_tmp_json; /* Used in get_str_from_*.. */
Item_func_json_arrayagg(THD *thd, Name_resolution_context *context_arg, Item_func_json_arrayagg(THD *thd, Name_resolution_context *context_arg,
@ -655,18 +656,18 @@ public:
{ {
} }
Item_func_json_arrayagg(THD *thd, Item_func_json_arrayagg *item); Item_func_json_arrayagg(THD *thd, Item_func_json_arrayagg *item);
bool is_json_type() { return true; } bool is_json_type() override { return true; }
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("json_arrayagg(") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_arrayagg(") };
return name; return name;
} }
enum Sumfunctype sum_func() const {return JSON_ARRAYAGG_FUNC;} enum Sumfunctype sum_func() const override {return JSON_ARRAYAGG_FUNC;}
String* val_str(String *str); String* val_str(String *str) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_arrayagg>(thd, this); } { return get_item_copy<Item_func_json_arrayagg>(thd, this); }
}; };
@ -683,44 +684,44 @@ public:
} }
Item_func_json_objectagg(THD *thd, Item_func_json_objectagg *item); Item_func_json_objectagg(THD *thd, Item_func_json_objectagg *item);
bool is_json_type() { return true; } bool is_json_type() override { return true; }
void cleanup(); void cleanup() override;
enum Sumfunctype sum_func () const {return JSON_OBJECTAGG_FUNC;} enum Sumfunctype sum_func () const override { return JSON_OBJECTAGG_FUNC;}
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("json_objectagg") }; static LEX_CSTRING name= {STRING_WITH_LEN("json_objectagg") };
return name; return name;
} }
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
if (too_big_for_varchar()) if (too_big_for_varchar())
return &type_handler_blob; return &type_handler_blob;
return &type_handler_varchar; return &type_handler_varchar;
} }
void clear(); void clear() override;
bool add(); bool add() override;
void reset_field() { DBUG_ASSERT(0); } // not used void reset_field() override { DBUG_ASSERT(0); } // not used
void update_field() { DBUG_ASSERT(0); } // not used void update_field() override { DBUG_ASSERT(0); } // not used
bool fix_fields(THD *,Item **); bool fix_fields(THD *,Item **) override;
double val_real() double val_real() override
{ return 0.0; } { return 0.0; }
longlong val_int() longlong val_int() override
{ return 0; } { return 0; }
my_decimal *val_decimal(my_decimal *decimal_value) my_decimal *val_decimal(my_decimal *decimal_value) override
{ {
my_decimal_set_zero(decimal_value); my_decimal_set_zero(decimal_value);
return decimal_value; return decimal_value;
} }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
return get_date_from_string(thd, ltime, fuzzydate); return get_date_from_string(thd, ltime, fuzzydate);
} }
String* val_str(String* str); String *val_str(String* str) override;
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
void no_rows_in_result() {} void no_rows_in_result() override {}
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_json_objectagg>(thd, this); } { return get_item_copy<Item_func_json_objectagg>(thd, this); }
}; };

View File

@ -54,101 +54,103 @@ public:
not_null_tables_cache(0), with_null(0) not_null_tables_cache(0), with_null(0)
{ } { }
enum Type type() const { return ROW_ITEM; }; enum Type type() const override { return ROW_ITEM; };
const Type_handler *type_handler() const { return &type_handler_row; } const Type_handler *type_handler() const override { return &type_handler_row; }
Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param) const Tmp_field_param *param) override
{ {
return NULL; // Check with Vicentiu why it's called for Item_row return NULL; // Check with Vicentiu why it's called for Item_row
} }
void illegal_method_call(const char *); void illegal_method_call(const char *);
bool is_null() { return null_value; } bool is_null() override { return null_value; }
void make_send_field(THD *thd, Send_field *) void make_send_field(THD *thd, Send_field *) override
{ {
illegal_method_call((const char*)"make_send_field"); illegal_method_call((const char*)"make_send_field");
}; };
double val_real() double val_real() override
{ {
illegal_method_call((const char*)"val"); illegal_method_call((const char*)"val");
return 0; return 0;
}; };
longlong val_int() longlong val_int() override
{ {
illegal_method_call((const char*)"val_int"); illegal_method_call((const char*)"val_int");
return 0; return 0;
}; };
String *val_str(String *) String *val_str(String *) override
{ {
illegal_method_call((const char*)"val_str"); illegal_method_call((const char*)"val_str");
return 0; return 0;
}; };
my_decimal *val_decimal(my_decimal *) my_decimal *val_decimal(my_decimal *) override
{ {
illegal_method_call((const char*)"val_decimal"); illegal_method_call((const char*)"val_decimal");
return 0; return 0;
}; };
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
illegal_method_call((const char*)"get_date"); illegal_method_call((const char*)"get_date");
return true; return true;
} }
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref) override;
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge)
void cleanup(); override;
void cleanup() override;
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); List<Item> &fields, uint flags) override;
table_map used_tables() const { return used_tables_cache; }; table_map used_tables() const override { return used_tables_cache; };
bool const_item() const { return const_item_cache; }; bool const_item() const override { return const_item_cache; };
void update_used_tables() void update_used_tables() override
{ {
used_tables_and_const_cache_init(); used_tables_and_const_cache_init();
used_tables_and_const_cache_update_and_join(arg_count, args); used_tables_and_const_cache_update_and_join(arg_count, args);
} }
table_map not_null_tables() const { return not_null_tables_cache; } table_map not_null_tables() const override { return not_null_tables_cache; }
virtual void print(String *str, enum_query_type query_type); void print(String *str, enum_query_type query_type) override;
bool walk(Item_processor processor, bool walk_subquery, void *arg) bool walk(Item_processor processor, bool walk_subquery, void *arg) override
{ {
if (walk_args(processor, walk_subquery, arg)) if (walk_args(processor, walk_subquery, arg))
return true; return true;
return (this->*processor)(arg); return (this->*processor)(arg);
} }
Item *transform(THD *thd, Item_transformer transformer, uchar *arg); Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override;
bool eval_not_null_tables(void *opt_arg); bool eval_not_null_tables(void *opt_arg) override;
bool find_not_null_fields(table_map allowed); bool find_not_null_fields(table_map allowed) override;
uint cols() const { return arg_count; } uint cols() const override { return arg_count; }
Item* element_index(uint i) { return args[i]; } Item* element_index(uint i) override { return args[i]; }
Item** addr(uint i) { return args + i; } Item** addr(uint i) override { return args + i; }
bool check_cols(uint c); bool check_cols(uint c) override;
bool null_inside() { return with_null; }; bool null_inside() override { return with_null; };
void bring_value(); void bring_value() 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
{ {
Item_args::propagate_equal_fields(thd, Context_identity(), cond); Item_args::propagate_equal_fields(thd, Context_identity(), cond);
return this; return this;
} }
bool excl_dep_on_table(table_map tab_map) bool excl_dep_on_table(table_map tab_map) override
{ {
return Item_args::excl_dep_on_table(tab_map); return Item_args::excl_dep_on_table(tab_map);
} }
bool excl_dep_on_grouping_fields(st_select_lex *sel) bool excl_dep_on_grouping_fields(st_select_lex *sel) override
{ {
return Item_args::excl_dep_on_grouping_fields(sel); return Item_args::excl_dep_on_grouping_fields(sel);
} }
bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) override
{ {
return Item_args::excl_dep_on_in_subq_left_part(subq_pred); return Item_args::excl_dep_on_in_subq_left_part(subq_pred);
} }
bool check_vcol_func_processor(void *arg) {return FALSE; } bool check_vcol_func_processor(void *arg) override {return FALSE; }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_row>(thd, this); } { return get_item_copy<Item_row>(thd, this); }
Item *build_clone(THD *thd); Item *build_clone(THD *thd) override;
}; };
#endif /* ITEM_ROW_INCLUDED */ #endif /* ITEM_ROW_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@ -304,29 +304,30 @@ public:
Item_singlerow_subselect(THD *thd_arg): Item_subselect(thd_arg), value(0), row (0) Item_singlerow_subselect(THD *thd_arg): Item_subselect(thd_arg), value(0), row (0)
{} {}
void cleanup(); void cleanup() override;
subs_type substype() { return SINGLEROW_SUBS; } subs_type substype() override { return SINGLEROW_SUBS; }
void reset(); void reset() override;
void no_rows_in_result(); void no_rows_in_result() override;
bool select_transformer(JOIN *join); bool select_transformer(JOIN *join) override;
void store(uint i, Item* item); void store(uint i, Item* item);
double val_real(); double val_real() override;
longlong val_int (); longlong val_int() override;
String *val_str (String *); String *val_str(String *) override;
bool val_native(THD *thd, Native *); bool val_native(THD *thd, Native *) override;
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
bool val_bool(); bool val_bool() override;
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
const Type_handler *type_handler() const; const Type_handler *type_handler() const override;
bool fix_length_and_dec(); bool fix_length_and_dec() override;
uint cols() const; uint cols() const override;
Item* element_index(uint i) { return reinterpret_cast<Item*>(row[i]); } Item* element_index(uint i) override
Item** addr(uint i) { return (Item**)row + i; } { return reinterpret_cast<Item*>(row[i]); }
bool check_cols(uint c); Item** addr(uint i) override { return (Item**)row + i; }
bool null_inside(); bool check_cols(uint c) override;
void bring_value(); bool null_inside() override;
void bring_value() override;
/** /**
This method is used to implement a special case of semantic tree This method is used to implement a special case of semantic tree
@ -342,7 +343,7 @@ public:
*/ */
st_select_lex* invalidate_and_restore_select_lex(); st_select_lex* invalidate_and_restore_select_lex();
Item* expr_cache_insert_transformer(THD *thd, uchar *unused); Item* expr_cache_insert_transformer(THD *thd, uchar *unused) override;
friend class select_singlerow_subselect; friend class select_singlerow_subselect;
}; };
@ -357,12 +358,12 @@ protected:
public: public:
Item_maxmin_subselect(THD *thd, Item_subselect *parent, Item_maxmin_subselect(THD *thd, Item_subselect *parent,
st_select_lex *select_lex, bool max); st_select_lex *select_lex, bool max);
virtual void print(String *str, enum_query_type query_type); void print(String *str, enum_query_type query_type) override;
void cleanup(); void cleanup() override;
bool any_value() { return was_values; } bool any_value() { return was_values; }
void register_value() { was_values= TRUE; } void register_value() { was_values= TRUE; }
void reset_value_registration() { was_values= FALSE; } void reset_value_registration() override { was_values= FALSE; }
void no_rows_in_result(); void no_rows_in_result() override;
}; };
/* exists subselect */ /* exists subselect */

View File

@ -411,7 +411,7 @@ public:
Item_sum(THD *thd, List<Item> &list); Item_sum(THD *thd, List<Item> &list);
//Copy constructor, need to perform subselects with temporary tables //Copy constructor, need to perform subselects with temporary tables
Item_sum(THD *thd, Item_sum *item); Item_sum(THD *thd, Item_sum *item);
enum Type type() const { return SUM_FUNC_ITEM; } enum Type type() const override { return SUM_FUNC_ITEM; }
virtual enum Sumfunctype sum_func () const=0; virtual enum Sumfunctype sum_func () const=0;
bool is_aggr_sum_func() bool is_aggr_sum_func()
{ {
@ -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;
virtual bool fix_length_and_dec() bool fix_length_and_dec() override
{ {
set_maybe_null(); set_maybe_null();
null_value=1; null_value=1;
@ -469,10 +469,10 @@ public:
} }
virtual Item *result_item(THD *thd, Field *field); virtual Item *result_item(THD *thd, Field *field);
void update_used_tables (); void update_used_tables() override;
COND *build_equal_items(THD *thd, COND_EQUAL *inherited, COND *build_equal_items(THD *thd, COND_EQUAL *inherited,
bool link_item_fields, bool link_item_fields,
COND_EQUAL **cond_equal_ref) COND_EQUAL **cond_equal_ref) override
{ {
/* /*
Item_sum (and derivants) of the original WHERE/HAVING clauses Item_sum (and derivants) of the original WHERE/HAVING clauses
@ -483,7 +483,7 @@ public:
return Item::build_equal_items(thd, inherited, link_item_fields, return Item::build_equal_items(thd, inherited, link_item_fields,
cond_equal_ref); cond_equal_ref);
} }
bool is_null() { return null_value; } bool is_null() override { return null_value; }
/** /**
make_const() make_const()
Called if we've managed to calculate the value of this Item in Called if we've managed to calculate the value of this Item in
@ -496,8 +496,8 @@ public:
const_item_cache= true; const_item_cache= true;
} }
void reset_forced_const() { const_item_cache= false; } void reset_forced_const() { const_item_cache= false; }
virtual bool const_during_execution() const { return false; } bool const_during_execution() const override { return false; }
virtual void print(String *str, enum_query_type query_type); void print(String *str, enum_query_type query_type) override;
void fix_num_length_and_dec(); void fix_num_length_and_dec();
/** /**
@ -510,7 +510,7 @@ public:
may be initialized to 0 by clear() and to NULL by may be initialized to 0 by clear() and to NULL by
no_rows_in_result(). no_rows_in_result().
*/ */
virtual void no_rows_in_result() void no_rows_in_result() override
{ {
set_aggregator(current_thd, with_distinct ? set_aggregator(current_thd, with_distinct ?
Aggregator::DISTINCT_AGGREGATOR : Aggregator::DISTINCT_AGGREGATOR :
@ -518,14 +518,14 @@ public:
aggregator_clear(); aggregator_clear();
} }
virtual void make_unique() { force_copy_fields= TRUE; } virtual void make_unique() { force_copy_fields= TRUE; }
Item *get_tmp_table_item(THD *thd); Item *get_tmp_table_item(THD *thd) override;
virtual Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); virtual Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table);
Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param) const Tmp_field_param *param) override
{ {
return create_tmp_field(root, param->group(), table); return create_tmp_field(root, param->group(), table);
} }
virtual bool collect_outer_ref_processor(void *param); bool collect_outer_ref_processor(void *param) override;
bool init_sum_func_check(THD *thd); bool init_sum_func_check(THD *thd);
bool check_sum_func(THD *thd, Item **ref); bool check_sum_func(THD *thd, Item **ref);
bool register_sum_func(THD *thd, Item **ref); bool register_sum_func(THD *thd, Item **ref);
@ -585,8 +585,8 @@ public:
virtual bool supports_removal() const { return false; } virtual bool supports_removal() const { return false; }
virtual void remove() { DBUG_ASSERT(0); } virtual void remove() { DBUG_ASSERT(0); }
virtual void cleanup(); void cleanup() override;
bool check_vcol_func_processor(void *arg); bool check_vcol_func_processor(void *arg) override;
virtual void setup_window_func(THD *thd, Window_spec *window_spec) {} virtual void setup_window_func(THD *thd, Window_spec *window_spec) {}
void mark_as_window_func_sum_expr() { window_func_sum_expr_flag= true; } void mark_as_window_func_sum_expr() { window_func_sum_expr_flag= true; }
bool is_window_func_sum_expr() { return window_func_sum_expr_flag; } bool is_window_func_sum_expr() { return window_func_sum_expr_flag; }
@ -748,23 +748,24 @@ public:
Item_sum_double(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {} Item_sum_double(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {}
Item_sum_double(THD *thd, List<Item> &list): Item_sum_num(thd, list) {} Item_sum_double(THD *thd, List<Item> &list): Item_sum_num(thd, list) {}
Item_sum_double(THD *thd, Item_sum_double *item) :Item_sum_num(thd, item) {} Item_sum_double(THD *thd, Item_sum_double *item) :Item_sum_num(thd, item) {}
longlong val_int() longlong val_int() override
{ {
return val_int_from_real(); return val_int_from_real();
} }
String *val_str(String*str) String *val_str(String*str) override
{ {
return val_string_from_real(str); return val_string_from_real(str);
} }
my_decimal *val_decimal(my_decimal *to) my_decimal *val_decimal(my_decimal *to) override
{ {
return val_decimal_from_real(to); return val_decimal_from_real(to);
} }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
return get_date_from_real(thd, ltime, fuzzydate); return get_date_from_real(thd, ltime, fuzzydate);
} }
const Type_handler *type_handler() const { return &type_handler_double; } const Type_handler *type_handler() const override
{ return &type_handler_double; }
}; };
@ -775,14 +776,14 @@ public:
Item_sum_int(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {} Item_sum_int(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {}
Item_sum_int(THD *thd, List<Item> &list): Item_sum_num(thd, list) {} Item_sum_int(THD *thd, List<Item> &list): Item_sum_num(thd, list) {}
Item_sum_int(THD *thd, Item_sum_int *item) :Item_sum_num(thd, item) {} Item_sum_int(THD *thd, Item_sum_int *item) :Item_sum_num(thd, item) {}
double val_real() { DBUG_ASSERT(fixed()); return (double) val_int(); } double val_real() override { DBUG_ASSERT(fixed()); return (double) val_int(); }
String *val_str(String*str); String *val_str(String*str) override;
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) 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);
} }
bool fix_length_and_dec() bool fix_length_and_dec() override
{ {
decimals=0; decimals=0;
max_length=21; max_length=21;
@ -804,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(); bool fix_length_and_dec() override;
public: public:
Item_sum_sum(THD *thd, Item *item_par, bool distinct): Item_sum_sum(THD *thd, Item *item_par, bool distinct):
@ -814,42 +815,42 @@ public:
set_distinct(distinct); set_distinct(distinct);
} }
Item_sum_sum(THD *thd, Item_sum_sum *item); Item_sum_sum(THD *thd, Item_sum_sum *item);
enum Sumfunctype sum_func () const enum Sumfunctype sum_func() const override
{ {
return has_with_distinct() ? SUM_DISTINCT_FUNC : SUM_FUNC; return has_with_distinct() ? SUM_DISTINCT_FUNC : SUM_FUNC;
} }
void cleanup(); void cleanup() override;
void direct_add(my_decimal *add_sum_decimal); void direct_add(my_decimal *add_sum_decimal);
void direct_add(double add_sum_real, bool add_sum_is_null); void direct_add(double add_sum_real, bool add_sum_is_null);
void clear(); void clear() override;
bool add(); bool add() override;
double val_real(); double val_real() override;
longlong val_int(); longlong val_int() override;
String *val_str(String*str); String *val_str(String*str) override;
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
} }
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ return Type_handler_hybrid_field_type::type_handler(); } { return Type_handler_hybrid_field_type::type_handler(); }
void fix_length_and_dec_double(); void fix_length_and_dec_double();
void fix_length_and_dec_decimal(); void fix_length_and_dec_decimal();
void reset_field(); void reset_field() override;
void update_field(); void update_field() override;
void no_rows_in_result() {} void no_rows_in_result() override {}
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name_distinct= { STRING_WITH_LEN("sum(distinct ")}; static LEX_CSTRING name_distinct= { STRING_WITH_LEN("sum(distinct ")};
static LEX_CSTRING name_normal= { STRING_WITH_LEN("sum(") }; static LEX_CSTRING name_normal= { STRING_WITH_LEN("sum(") };
return has_with_distinct() ? name_distinct : name_normal; return has_with_distinct() ? name_distinct : name_normal;
} }
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
void remove(); void remove() override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_sum>(thd, this); } { return get_item_copy<Item_sum_sum>(thd, this); }
bool supports_removal() const bool supports_removal() const override
{ {
return true; return true;
} }
@ -869,10 +870,10 @@ class Item_sum_count :public Item_sum_int
friend class Aggregator_distinct; friend class Aggregator_distinct;
void clear(); void clear() override;
bool add(); bool add() override;
void cleanup(); void cleanup() override;
void remove(); void remove() override;
public: public:
Item_sum_count(THD *thd, Item *item_par): Item_sum_count(THD *thd, Item *item_par):
@ -898,20 +899,21 @@ public:
Item_sum_int(thd, item), direct_counted(FALSE), Item_sum_int(thd, item), direct_counted(FALSE),
direct_reseted_field(FALSE), count(item->count) direct_reseted_field(FALSE), count(item->count)
{} {}
enum Sumfunctype sum_func () const enum Sumfunctype sum_func () const override
{ {
return has_with_distinct() ? COUNT_DISTINCT_FUNC : COUNT_FUNC; return has_with_distinct() ? COUNT_DISTINCT_FUNC : COUNT_FUNC;
} }
void no_rows_in_result() { count=0; } void no_rows_in_result() override { count=0; }
void make_const(longlong count_arg) void make_const(longlong count_arg)
{ {
count=count_arg; count=count_arg;
Item_sum::make_const(); Item_sum::make_const();
} }
const Type_handler *type_handler() const { return &type_handler_slonglong; } const Type_handler *type_handler() const override
longlong val_int(); { return &type_handler_slonglong; }
void reset_field(); longlong val_int() override;
void update_field(); void reset_field() override;
void update_field() override;
void direct_add(longlong add_count); void direct_add(longlong add_count);
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
@ -919,11 +921,11 @@ public:
static LEX_CSTRING name_normal= { STRING_WITH_LEN("count(") }; static LEX_CSTRING name_normal= { STRING_WITH_LEN("count(") };
return has_with_distinct() ? name_distinct : name_normal; return has_with_distinct() ? name_distinct : name_normal;
} }
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_count>(thd, this); } { return get_item_copy<Item_sum_count>(thd, this); }
bool supports_removal() const bool supports_removal() const override
{ {
return true; return true;
} }
@ -948,40 +950,40 @@ 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(); bool fix_length_and_dec() override;
enum Sumfunctype sum_func () const enum Sumfunctype sum_func () const override
{ {
return has_with_distinct() ? AVG_DISTINCT_FUNC : AVG_FUNC; return has_with_distinct() ? AVG_DISTINCT_FUNC : AVG_FUNC;
} }
void clear(); void clear() override;
bool add(); bool add() override;
void remove(); void remove() override;
double val_real(); double val_real() override;
// In SPs we might force the "wrong" type with select into a declare variable // In SPs we might force the "wrong" type with select into a declare variable
longlong val_int() { return val_int_from_real(); } longlong val_int() override { return val_int_from_real(); }
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
String *val_str(String *str); String *val_str(String *str) override;
void reset_field(); void reset_field() override;
void update_field(); void update_field() override;
Item *result_item(THD *thd, Field *field); Item *result_item(THD *thd, Field *field) override;
void no_rows_in_result() {} void no_rows_in_result() override {}
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name_distinct= { STRING_WITH_LEN("avg(distinct ")}; static LEX_CSTRING name_distinct= { STRING_WITH_LEN("avg(distinct ")};
static LEX_CSTRING name_normal= { STRING_WITH_LEN("avg(") }; static LEX_CSTRING name_normal= { STRING_WITH_LEN("avg(") };
return has_with_distinct() ? name_distinct : name_normal; return has_with_distinct() ? name_distinct : name_normal;
} }
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override;
void cleanup() void cleanup() override
{ {
count= 0; count= 0;
Item_sum_sum::cleanup(); Item_sum_sum::cleanup();
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_avg>(thd, this); } { return get_item_copy<Item_sum_avg>(thd, this); }
bool supports_removal() const bool supports_removal() const override
{ {
return true; return true;
} }
@ -1113,7 +1115,7 @@ public:
:Item_sum(thd, item), :Item_sum(thd, item),
Type_handler_hybrid_field_type(item) Type_handler_hybrid_field_type(item)
{ } { }
const Type_handler *type_handler() const 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_generic(); bool fix_length_and_dec_generic();
bool fix_length_and_dec_numeric(const Type_handler *h); bool fix_length_and_dec_numeric(const Type_handler *h);
@ -1146,35 +1148,36 @@ public:
direct_added(FALSE), value(item->value), arg_cache(0), direct_added(FALSE), value(item->value), arg_cache(0),
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 **); bool fix_fields(THD *, Item **) override;
bool fix_length_and_dec(); bool fix_length_and_dec() override;
void setup_hybrid(THD *thd, Item *item, Item *value_arg); void setup_hybrid(THD *thd, Item *item, Item *value_arg);
void clear(); void clear() override;
void direct_add(Item *item); void direct_add(Item *item);
double val_real(); double val_real() override;
longlong val_int(); longlong val_int() override;
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
void reset_field(); void reset_field() override;
String *val_str(String *); String *val_str(String *) override;
bool val_native(THD *thd, Native *); bool val_native(THD *thd, Native *) override;
const Type_handler *real_type_handler() const const Type_handler *real_type_handler() const override
{ {
return get_arg(0)->real_type_handler(); return get_arg(0)->real_type_handler();
} }
const TYPELIB *get_typelib() const { return args[0]->get_typelib(); } const TYPELIB *get_typelib() const override { return args[0]->get_typelib(); }
void update_field(); void update_field() override;
void min_max_update_str_field(); void min_max_update_str_field();
void min_max_update_real_field(); void min_max_update_real_field();
void min_max_update_int_field(); void min_max_update_int_field();
void min_max_update_decimal_field(); void min_max_update_decimal_field();
void min_max_update_native_field(); void min_max_update_native_field();
void cleanup(); void cleanup() override;
bool any_value() { return was_values; } bool any_value() { return was_values; }
void no_rows_in_result(); void no_rows_in_result() override;
void restore_to_before_no_rows_in_result(); void restore_to_before_no_rows_in_result() override;
Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override;
void setup_caches(THD *thd) { setup_hybrid(thd, arguments()[0], NULL); } void setup_caches(THD *thd) override
{ setup_hybrid(thd, arguments()[0], NULL); }
}; };
@ -1183,16 +1186,16 @@ class Item_sum_min final :public Item_sum_min_max
public: public:
Item_sum_min(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, 1) {} Item_sum_min(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, 1) {}
Item_sum_min(THD *thd, Item_sum_min *item) :Item_sum_min_max(thd, item) {} Item_sum_min(THD *thd, Item_sum_min *item) :Item_sum_min_max(thd, item) {}
enum Sumfunctype sum_func () const {return MIN_FUNC;} enum Sumfunctype sum_func () const override {return MIN_FUNC;}
bool add(); bool add() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING sum_name= {STRING_WITH_LEN("min(") }; static LEX_CSTRING sum_name= {STRING_WITH_LEN("min(") };
return sum_name; return sum_name;
} }
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_min>(thd, this); } { return get_item_copy<Item_sum_min>(thd, this); }
}; };
@ -1202,16 +1205,16 @@ class Item_sum_max final :public Item_sum_min_max
public: public:
Item_sum_max(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, -1) {} Item_sum_max(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, -1) {}
Item_sum_max(THD *thd, Item_sum_max *item) :Item_sum_min_max(thd, item) {} Item_sum_max(THD *thd, Item_sum_max *item) :Item_sum_min_max(thd, item) {}
enum Sumfunctype sum_func () const {return MAX_FUNC;} enum Sumfunctype sum_func () const override {return MAX_FUNC;}
bool add(); bool add() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING sum_name= {STRING_WITH_LEN("max(") }; static LEX_CSTRING sum_name= {STRING_WITH_LEN("max(") };
return sum_name; return sum_name;
} }
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_max>(thd, this); } { return get_item_copy<Item_sum_max>(thd, this); }
}; };
@ -1230,13 +1233,14 @@ public:
if (as_window_function) if (as_window_function)
memcpy(bit_counters, item->bit_counters, sizeof(bit_counters)); memcpy(bit_counters, item->bit_counters, sizeof(bit_counters));
} }
enum Sumfunctype sum_func () const {return SUM_BIT_FUNC;} enum Sumfunctype sum_func () const override { return SUM_BIT_FUNC;}
void clear(); void clear() override;
longlong val_int(); longlong val_int() override;
void reset_field(); void reset_field() override;
void update_field(); void update_field() override;
const Type_handler *type_handler() const { return &type_handler_ulonglong; } const Type_handler *type_handler() const override
bool fix_length_and_dec() { return &type_handler_ulonglong; }
bool fix_length_and_dec() 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;
@ -1245,7 +1249,7 @@ public:
null_value= 0; null_value= 0;
return FALSE; return FALSE;
} }
void cleanup() void cleanup() override
{ {
bits= reset_bits; bits= reset_bits;
if (as_window_function) if (as_window_function)
@ -1254,11 +1258,12 @@ public:
} }
void setup_window_func(THD *thd __attribute__((unused)), void setup_window_func(THD *thd __attribute__((unused)),
Window_spec *window_spec __attribute__((unused))) Window_spec *window_spec __attribute__((unused)))
override
{ {
as_window_function= TRUE; as_window_function= TRUE;
clear_as_window(); clear_as_window();
} }
void remove() void remove() override
{ {
if (as_window_function) if (as_window_function)
{ {
@ -1269,7 +1274,7 @@ public:
DBUG_ASSERT(0); DBUG_ASSERT(0);
} }
bool supports_removal() const bool supports_removal() const override
{ {
return true; return true;
} }
@ -1297,18 +1302,18 @@ class Item_sum_or final :public Item_sum_bit
public: public:
Item_sum_or(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {} Item_sum_or(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {}
Item_sum_or(THD *thd, Item_sum_or *item) :Item_sum_bit(thd, item) {} Item_sum_or(THD *thd, Item_sum_or *item) :Item_sum_bit(thd, item) {}
bool add(); bool add() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING sum_name= {STRING_WITH_LEN("bit_or(") }; static LEX_CSTRING sum_name= {STRING_WITH_LEN("bit_or(") };
return sum_name; return sum_name;
} }
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_or>(thd, this); } { return get_item_copy<Item_sum_or>(thd, this); }
private: private:
void set_bits_from_counters(); void set_bits_from_counters() override;
}; };
@ -1318,18 +1323,18 @@ public:
Item_sum_and(THD *thd, Item *item_par): Item_sum_and(THD *thd, Item *item_par):
Item_sum_bit(thd, item_par, ULONGLONG_MAX) {} Item_sum_bit(thd, item_par, ULONGLONG_MAX) {}
Item_sum_and(THD *thd, Item_sum_and *item) :Item_sum_bit(thd, item) {} Item_sum_and(THD *thd, Item_sum_and *item) :Item_sum_bit(thd, item) {}
bool add(); bool add() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING sum_min_name= {STRING_WITH_LEN("bit_and(") }; static LEX_CSTRING sum_min_name= {STRING_WITH_LEN("bit_and(") };
return sum_min_name; return sum_min_name;
} }
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_and>(thd, this); } { return get_item_copy<Item_sum_and>(thd, this); }
private: private:
void set_bits_from_counters(); void set_bits_from_counters() override;
}; };
class Item_sum_xor final :public Item_sum_bit class Item_sum_xor final :public Item_sum_bit
@ -1337,18 +1342,18 @@ class Item_sum_xor final :public Item_sum_bit
public: public:
Item_sum_xor(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {} Item_sum_xor(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {}
Item_sum_xor(THD *thd, Item_sum_xor *item) :Item_sum_bit(thd, item) {} Item_sum_xor(THD *thd, Item_sum_xor *item) :Item_sum_bit(thd, item) {}
bool add(); bool add() override;
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING sum_min_name= {STRING_WITH_LEN("bit_xor(") }; static LEX_CSTRING sum_min_name= {STRING_WITH_LEN("bit_xor(") };
return sum_min_name; return sum_min_name;
} }
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_xor>(thd, this); } { return get_item_copy<Item_sum_xor>(thd, this); }
private: private:
void set_bits_from_counters(); void set_bits_from_counters() override;
}; };
class sp_head; class sp_head;
@ -1403,7 +1408,7 @@ struct st_sp_security_context;
Example: Example:
DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN ret_val; DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN ret_val;
*/ */
class Item_sum_sp final :public Item_sum, class Item_sum_sp :public Item_sum,
public Item_sp public Item_sp
{ {
private: private:
@ -1417,48 +1422,48 @@ public:
sp_head *sp, List<Item> &list); sp_head *sp, List<Item> &list);
Item_sum_sp(THD *thd, Item_sum_sp *item); Item_sum_sp(THD *thd, Item_sum_sp *item);
enum Sumfunctype sum_func () const enum Sumfunctype sum_func () const override
{ {
return SP_AGGREGATE_FUNC; return SP_AGGREGATE_FUNC;
} }
Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) override
{ {
return create_table_field_from_handler(root, table); return create_table_field_from_handler(root, table);
} }
bool fix_length_and_dec(); bool fix_length_and_dec() override;
bool fix_fields(THD *thd, Item **ref); 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; const Type_handler *type_handler() const override;
bool add(); bool add() override;
/* val_xx functions */ /* val_xx functions */
longlong val_int() longlong val_int() override
{ {
if(execute()) if(execute())
return 0; return 0;
return sp_result_field->val_int(); return sp_result_field->val_int();
} }
double val_real() double val_real() override
{ {
if(execute()) if(execute())
return 0.0; return 0.0;
return sp_result_field->val_real(); return sp_result_field->val_real();
} }
my_decimal *val_decimal(my_decimal *dec_buf) my_decimal *val_decimal(my_decimal *dec_buf) override
{ {
if(execute()) if(execute())
return NULL; return NULL;
return sp_result_field->val_decimal(dec_buf); return sp_result_field->val_decimal(dec_buf);
} }
bool val_native(THD *thd, Native *to) bool val_native(THD *thd, Native *to) override
{ {
return (null_value= execute()) || sp_result_field->val_native(to); return (null_value= execute()) || sp_result_field->val_native(to);
} }
String *val_str(String *str) String *val_str(String *str) override
{ {
String buf; String buf;
char buff[20]; char buff[20];
@ -1476,11 +1481,11 @@ public:
str->copy(buf); str->copy(buf);
return str; return str;
} }
void reset_field(){DBUG_ASSERT(0);} void reset_field() override{DBUG_ASSERT(0);}
void update_field(){DBUG_ASSERT(0);} void update_field() override{DBUG_ASSERT(0);}
void clear(); void clear() override;
void cleanup(); void cleanup() override;
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
return execute() || sp_result_field->get_date(ltime, fuzzydate); return execute() || sp_result_field->get_date(ltime, fuzzydate);
} }
@ -1488,9 +1493,9 @@ public:
{ {
return sp_result_field; return sp_result_field;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_sp>(thd, this); } { return get_item_copy<Item_sum_sp>(thd, this); }
Item *copy_or_same(THD *thd); Item *copy_or_same(THD *thd) override;
}; };
/* Items to get the value of a stored sum function */ /* Items to get the value of a stored sum function */
@ -1509,18 +1514,18 @@ public:
max_length= item->max_length; max_length= item->max_length;
unsigned_flag= item->unsigned_flag; unsigned_flag= item->unsigned_flag;
} }
table_map used_tables() const { return (table_map) 1L; } table_map used_tables() const override { return (table_map) 1L; }
Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param) const Tmp_field_param *param) override
{ {
return create_tmp_field_ex_simple(root, table, src, param); return create_tmp_field_ex_simple(root, table, src, param);
} }
void save_in_result_field(bool no_conversions) { DBUG_ASSERT(0); } void save_in_result_field(bool no_conversions) override { DBUG_ASSERT(0); }
bool check_vcol_func_processor(void *arg) bool check_vcol_func_processor(void *arg) override
{ {
return mark_unsupported_function(name.str, arg, VCOL_IMPOSSIBLE); return mark_unsupported_function(name.str, arg, VCOL_IMPOSSIBLE);
} }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
} }
@ -1535,8 +1540,8 @@ public:
Item_avg_field(THD *thd, Item_sum_avg *item) Item_avg_field(THD *thd, Item_sum_avg *item)
:Item_sum_field(thd, item), prec_increment(item->prec_increment) :Item_sum_field(thd, item), prec_increment(item->prec_increment)
{ } { }
enum Type type() const { return FIELD_AVG_ITEM; } enum Type type() const override { return FIELD_AVG_ITEM; }
bool is_null() { update_null_value(); return null_value; } bool is_null() override { update_null_value(); return null_value; }
}; };
@ -1546,12 +1551,15 @@ public:
Item_avg_field_double(THD *thd, Item_sum_avg *item) Item_avg_field_double(THD *thd, Item_sum_avg *item)
:Item_avg_field(thd, item) :Item_avg_field(thd, item)
{ } { }
const Type_handler *type_handler() const { return &type_handler_double; } const Type_handler *type_handler() const override
longlong val_int() { return val_int_from_real(); } { return &type_handler_double; }
my_decimal *val_decimal(my_decimal *dec) { return val_decimal_from_real(dec); } longlong val_int() override { return val_int_from_real(); }
String *val_str(String *str) { return val_string_from_real(str); } my_decimal *val_decimal(my_decimal *dec) override
double val_real(); { return val_decimal_from_real(dec); }
Item *get_copy(THD *thd) String *val_str(String *str) override
{ return val_string_from_real(str); }
double val_real() override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_avg_field_double>(thd, this); } { return get_item_copy<Item_avg_field_double>(thd, this); }
}; };
@ -1566,21 +1574,22 @@ public:
f_scale(item->f_scale), f_scale(item->f_scale),
dec_bin_size(item->dec_bin_size) dec_bin_size(item->dec_bin_size)
{ } { }
const Type_handler *type_handler() const { return &type_handler_newdecimal; } const Type_handler *type_handler() const override
double val_real() { return &type_handler_newdecimal; }
double val_real() override
{ {
return VDec(this).to_double(); return VDec(this).to_double();
} }
longlong val_int() longlong val_int() override
{ {
return VDec(this).to_longlong(unsigned_flag); return VDec(this).to_longlong(unsigned_flag);
} }
String *val_str(String *str) String *val_str(String *str) override
{ {
return VDec(this).to_string_round(str, decimals); return VDec(this).to_string_round(str, decimals);
} }
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_avg_field_decimal>(thd, this); } { return get_item_copy<Item_avg_field_decimal>(thd, this); }
}; };
@ -1592,16 +1601,17 @@ public:
Item_variance_field(THD *thd, Item_sum_variance *item) Item_variance_field(THD *thd, Item_sum_variance *item)
:Item_sum_field(thd, item), sample(item->sample) :Item_sum_field(thd, item), sample(item->sample)
{ } { }
enum Type type() const {return FIELD_VARIANCE_ITEM; } enum Type type() const override {return FIELD_VARIANCE_ITEM; }
double val_real(); double val_real() override;
longlong val_int() { return val_int_from_real(); } longlong val_int() override { return val_int_from_real(); }
String *val_str(String *str) String *val_str(String *str) override
{ return val_string_from_real(str); } { return val_string_from_real(str); }
my_decimal *val_decimal(my_decimal *dec_buf) my_decimal *val_decimal(my_decimal *dec_buf) override
{ return val_decimal_from_real(dec_buf); } { return val_decimal_from_real(dec_buf); }
bool is_null() { update_null_value(); return null_value; } bool is_null() override { update_null_value(); return null_value; }
const Type_handler *type_handler() const { return &type_handler_double; } const Type_handler *type_handler() const override
Item *get_copy(THD *thd) { return &type_handler_double; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_variance_field>(thd, this); } { return get_item_copy<Item_variance_field>(thd, this); }
}; };
@ -1612,9 +1622,9 @@ public:
Item_std_field(THD *thd, Item_sum_std *item) Item_std_field(THD *thd, Item_sum_std *item)
:Item_variance_field(thd, item) :Item_variance_field(thd, item)
{ } { }
enum Type type() const { return FIELD_STD_ITEM; } enum Type type() const override { return FIELD_STD_ITEM; }
double val_real(); double val_real() override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_std_field>(thd, this); } { return get_item_copy<Item_std_field>(thd, this); }
}; };
@ -1645,7 +1655,7 @@ public:
const char *tmp= udf.name(); const char *tmp= udf.name();
return {tmp, strlen(tmp) }; return {tmp, strlen(tmp) };
} }
bool fix_fields(THD *thd, Item **ref) bool fix_fields(THD *thd, Item **ref) override
{ {
DBUG_ASSERT(fixed() == 0); DBUG_ASSERT(fixed() == 0);
@ -1677,18 +1687,18 @@ public:
memcpy (orig_args, args, sizeof (Item *) * arg_count); memcpy (orig_args, args, sizeof (Item *) * arg_count);
return check_sum_func(thd, ref); return check_sum_func(thd, ref);
} }
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } enum Sumfunctype sum_func () const override { return UDF_SUM_FUNC; }
virtual bool have_field_update(void) const { return 0; } virtual bool have_field_update(void) const { return 0; }
void clear(); void clear() override;
bool add(); bool add() override;
bool supports_removal() const; bool supports_removal() const override;
void remove(); void remove() override;
void reset_field() {}; void reset_field() override {};
void update_field() {}; void update_field() override {}
void cleanup(); void cleanup() override;
virtual void print(String *str, enum_query_type query_type); void print(String *str, enum_query_type query_type) override;
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
} }
@ -1704,14 +1714,16 @@ class Item_sum_udf_float :public Item_udf_sum
Item_udf_sum(thd, udf_arg, list) {} Item_udf_sum(thd, udf_arg, list) {}
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item) Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
:Item_udf_sum(thd, item) {} :Item_udf_sum(thd, item) {}
longlong val_int() { return val_int_from_real(); } longlong val_int() override { return val_int_from_real(); }
double val_real(); double val_real() override;
String *val_str(String*str); String *val_str(String*str) override;
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
const Type_handler *type_handler() const { return &type_handler_double; } const Type_handler *type_handler() const override
bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } { return &type_handler_double; }
Item *copy_or_same(THD* thd); bool fix_length_and_dec() override
Item *get_copy(THD *thd) { fix_num_length_and_dec(); return FALSE; }
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_udf_float>(thd, this); } { return get_item_copy<Item_sum_udf_float>(thd, this); }
}; };
@ -1725,20 +1737,20 @@ public:
Item_udf_sum(thd, udf_arg, list) {} Item_udf_sum(thd, udf_arg, list) {}
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item) Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
:Item_udf_sum(thd, item) {} :Item_udf_sum(thd, item) {}
longlong val_int(); longlong val_int() override;
double val_real() double val_real() override
{ DBUG_ASSERT(fixed()); return (double) Item_sum_udf_int::val_int(); } { DBUG_ASSERT(fixed()); return (double) Item_sum_udf_int::val_int(); }
String *val_str(String*str); String *val_str(String*str) override;
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
if (unsigned_flag) if (unsigned_flag)
return &type_handler_ulonglong; return &type_handler_ulonglong;
return &type_handler_slonglong; return &type_handler_slonglong;
} }
bool fix_length_and_dec() { decimals=0; max_length=21; return FALSE; } bool fix_length_and_dec() override { decimals=0; max_length=21; return FALSE; }
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) 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); }
}; };
@ -1752,8 +1764,8 @@ public:
Item_udf_sum(thd, udf_arg, list) {} Item_udf_sum(thd, udf_arg, list) {}
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item) Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
:Item_udf_sum(thd, item) {} :Item_udf_sum(thd, item) {}
String *val_str(String *); String *val_str(String *) override;
double val_real() double val_real() override
{ {
int err_not_used; int err_not_used;
char *end_not_used; char *end_not_used;
@ -1762,7 +1774,7 @@ public:
return res ? res->charset()->strntod((char*) res->ptr(),res->length(), return res ? res->charset()->strntod((char*) res->ptr(),res->length(),
&end_not_used, &err_not_used) : 0.0; &end_not_used, &err_not_used) : 0.0;
} }
longlong val_int() longlong val_int() override
{ {
int err_not_used; int err_not_used;
char *end; char *end;
@ -1775,11 +1787,12 @@ public:
end= (char*) res->ptr()+res->length(); end= (char*) res->ptr()+res->length();
return cs->strtoll10(res->ptr(), &end, &err_not_used); return cs->strtoll10(res->ptr(), &end, &err_not_used);
} }
my_decimal *val_decimal(my_decimal *dec); my_decimal *val_decimal(my_decimal *dec) override;
const Type_handler *type_handler() const { return string_type_handler(); } const Type_handler *type_handler() const override
bool fix_length_and_dec(); { return string_type_handler(); }
Item *copy_or_same(THD* thd); bool fix_length_and_dec() override;
Item *get_copy(THD *thd) Item *copy_or_same(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); }
}; };
@ -1793,23 +1806,25 @@ public:
Item_udf_sum(thd, udf_arg, list) {} Item_udf_sum(thd, udf_arg, list) {}
Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item) Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *item)
:Item_udf_sum(thd, item) {} :Item_udf_sum(thd, item) {}
String *val_str(String *str) String *val_str(String *str) override
{ {
return VDec(this).to_string_round(str, decimals); return VDec(this).to_string_round(str, decimals);
} }
double val_real() double val_real() override
{ {
return VDec(this).to_double(); return VDec(this).to_double();
} }
longlong val_int() longlong val_int() override
{ {
return VDec(this).to_longlong(unsigned_flag); return VDec(this).to_longlong(unsigned_flag);
} }
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
const Type_handler *type_handler() const { return &type_handler_newdecimal; } const Type_handler *type_handler() const override
bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } { return &type_handler_newdecimal; }
Item *copy_or_same(THD* thd); bool fix_length_and_dec() override
Item *get_copy(THD *thd) { fix_num_length_and_dec(); return FALSE; }
Item *copy_or_same(THD* thd) override;
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_udf_decimal>(thd, this); } { return get_item_copy<Item_sum_udf_decimal>(thd, this); }
}; };
@ -2008,31 +2023,31 @@ public:
Item_func_group_concat(THD *thd, Item_func_group_concat *item); Item_func_group_concat(THD *thd, Item_func_group_concat *item);
~Item_func_group_concat(); ~Item_func_group_concat();
void cleanup(); void cleanup() override;
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;} enum Sumfunctype sum_func () const override {return GROUP_CONCAT_FUNC;}
LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING sum_name= {STRING_WITH_LEN("group_concat(") }; static LEX_CSTRING sum_name= {STRING_WITH_LEN("group_concat(") };
return sum_name; return sum_name;
} }
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
if (too_big_for_varchar()) if (too_big_for_varchar())
return &type_handler_blob; return &type_handler_blob;
return &type_handler_varchar; return &type_handler_varchar;
} }
void clear(); void clear() override;
bool add() bool add() override
{ {
return add(skip_nulls()); return add(skip_nulls());
} }
void reset_field() { DBUG_ASSERT(0); } // not used void reset_field() override { DBUG_ASSERT(0); } // not used
void update_field() { DBUG_ASSERT(0); } // not used void update_field() override { DBUG_ASSERT(0); } // not used
bool fix_fields(THD *,Item **); bool fix_fields(THD *,Item **) override;
bool setup(THD *thd); bool setup(THD *thd) override;
void make_unique(); void make_unique() override;
double val_real() double val_real() override
{ {
int error; int error;
const char *end; const char *end;
@ -2042,7 +2057,7 @@ public:
end= res->ptr() + res->length(); end= res->ptr() + res->length();
return (my_strtod(res->ptr(), (char**) &end, &error)); return (my_strtod(res->ptr(), (char**) &end, &error));
} }
longlong val_int() longlong val_int() override
{ {
String *res; String *res;
char *end_ptr; char *end_ptr;
@ -2052,21 +2067,21 @@ public:
end_ptr= (char*) res->ptr()+ res->length(); end_ptr= (char*) res->ptr()+ res->length();
return my_strtoll10(res->ptr(), &end_ptr, &error); return my_strtoll10(res->ptr(), &end_ptr, &error);
} }
my_decimal *val_decimal(my_decimal *decimal_value) my_decimal *val_decimal(my_decimal *decimal_value) override
{ {
return val_decimal_from_string(decimal_value); return val_decimal_from_string(decimal_value);
} }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
return get_date_from_string(thd, ltime, fuzzydate); return get_date_from_string(thd, ltime, fuzzydate);
} }
String* val_str(String* str); String *val_str(String *str) override;
Item *copy_or_same(THD* thd); Item *copy_or_same(THD* thd) override;
void no_rows_in_result() {} void no_rows_in_result() override {}
void print(String *str, enum_query_type query_type); void print(String *str, enum_query_type query_type) override;
bool change_context_processor(void *cntx) bool change_context_processor(void *cntx) override
{ context= (Name_resolution_context *)cntx; return FALSE; } { context= (Name_resolution_context *)cntx; return FALSE; }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_group_concat>(thd, this); } { return get_item_copy<Item_func_group_concat>(thd, this); }
qsort_cmp2 get_comparator_function_for_distinct(); qsort_cmp2 get_comparator_function_for_distinct();
qsort_cmp2 get_comparator_function_for_order_by(); qsort_cmp2 get_comparator_function_for_order_by();

File diff suppressed because it is too large Load Diff

View File

@ -33,12 +33,9 @@ public:
DBUG_ASSERT(a->type() == Item::FIELD_ITEM); DBUG_ASSERT(a->type() == Item::FIELD_ITEM);
} }
virtual bool val_bool(); bool val_bool() override;
virtual longlong val_int() longlong val_int() override { return val_bool(); }
{ bool fix_length_and_dec() override
return (val_bool() ? 1 : 0);
}
bool fix_length_and_dec()
{ {
set_maybe_null(); set_maybe_null();
null_value= 0; null_value= 0;
@ -46,13 +43,13 @@ public:
max_length= 1; max_length= 1;
return FALSE; return FALSE;
} }
virtual LEX_CSTRING func_name_cstring() const override LEX_CSTRING func_name_cstring() const override
{ {
static LEX_CSTRING name= {STRING_WITH_LEN("is_history") }; static LEX_CSTRING name= {STRING_WITH_LEN("is_history") };
return name; return name;
} }
virtual void print(String *str, enum_query_type query_type); void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_history>(thd, this); } { return get_item_copy<Item_func_history>(thd, this); }
}; };
@ -67,10 +64,10 @@ public:
static LEX_CSTRING commit_name= {STRING_WITH_LEN("trt_commit_ts") }; static LEX_CSTRING commit_name= {STRING_WITH_LEN("trt_commit_ts") };
return (trt_field == TR_table::FLD_BEGIN_TS) ? begin_name : commit_name; return (trt_field == TR_table::FLD_BEGIN_TS) ? begin_name : commit_name;
} }
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override;
Item *get_copy(THD *thd) 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() bool fix_length_and_dec() override
{ fix_attributes_datetime(decimals); return FALSE; } { fix_attributes_datetime(decimals); return FALSE; }
}; };
@ -105,15 +102,15 @@ public:
return NULL_clex_str; return NULL_clex_str;
} }
bool fix_length_and_dec() bool fix_length_and_dec() override
{ {
bool res= Item_int_func::fix_length_and_dec(); bool res= Item_int_func::fix_length_and_dec();
max_length= 20; max_length= 20;
return res; return res;
} }
longlong val_int(); longlong val_int() override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_trt_id>(thd, this); } { return get_item_copy<Item_func_trt_id>(thd, this); }
}; };
@ -129,8 +126,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("trt_trx_sees") }; static LEX_CSTRING name= {STRING_WITH_LEN("trt_trx_sees") };
return name; return name;
} }
longlong val_int(); longlong val_int() override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_trt_trx_sees>(thd, this); } { return get_item_copy<Item_func_trt_trx_sees>(thd, this); }
}; };

View File

@ -118,28 +118,29 @@ public:
Item_sum_row_number(THD *thd) Item_sum_row_number(THD *thd)
: Item_sum_int(thd), count(0) {} : Item_sum_int(thd), count(0) {}
const Type_handler *type_handler() const { return &type_handler_slonglong; } const Type_handler *type_handler() const override
{ return &type_handler_slonglong; }
void clear() void clear() override
{ {
count= 0; count= 0;
} }
bool add() bool add() override
{ {
count++; count++;
return false; return false;
} }
void reset_field() { DBUG_ASSERT(0); } void reset_field() override { DBUG_ASSERT(0); }
void update_field() {} void update_field() override {}
enum Sumfunctype sum_func() const enum Sumfunctype sum_func() const override
{ {
return ROW_NUMBER_FUNC; return ROW_NUMBER_FUNC;
} }
longlong val_int() longlong val_int() override
{ {
return count; return count;
} }
@ -149,7 +150,7 @@ public:
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_row_number>(thd, this); } { return get_item_copy<Item_sum_row_number>(thd, this); }
}; };
@ -182,26 +183,27 @@ public:
Item_sum_rank(THD *thd) : Item_sum_int(thd), peer_tracker(NULL) {} Item_sum_rank(THD *thd) : Item_sum_int(thd), peer_tracker(NULL) {}
const Type_handler *type_handler() const { return &type_handler_slonglong; } const Type_handler *type_handler() const override
{ return &type_handler_slonglong; }
void clear() void clear() override
{ {
/* This is called on partition start */ /* This is called on partition start */
cur_rank= 1; cur_rank= 1;
row_number= 0; row_number= 0;
} }
bool add(); bool add() override;
longlong val_int() longlong val_int() override
{ {
return cur_rank; return cur_rank;
} }
void reset_field() { DBUG_ASSERT(0); } void reset_field() override { DBUG_ASSERT(0); }
void update_field() {} void update_field() override {}
enum Sumfunctype sum_func () const enum Sumfunctype sum_func () const override
{ {
return RANK_FUNC; return RANK_FUNC;
} }
@ -212,9 +214,9 @@ public:
return name; return name;
} }
void setup_window_func(THD *thd, Window_spec *window_spec); void setup_window_func(THD *thd, Window_spec *window_spec) override;
void cleanup() void cleanup() override
{ {
if (peer_tracker) if (peer_tracker)
{ {
@ -223,7 +225,7 @@ public:
} }
Item_sum_int::cleanup(); Item_sum_int::cleanup();
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_rank>(thd, this); } { return get_item_copy<Item_sum_rank>(thd, this); }
}; };
@ -257,23 +259,24 @@ class Item_sum_dense_rank: public Item_sum_int
XXX(cvicentiu) This class could potentially be implemented in the rank XXX(cvicentiu) This class could potentially be implemented in the rank
class, with a switch for the DENSE case. class, with a switch for the DENSE case.
*/ */
void clear() void clear() override
{ {
dense_rank= 0; dense_rank= 0;
first_add= true; first_add= true;
} }
bool add(); bool add() override;
void reset_field() { DBUG_ASSERT(0); } void reset_field() override { DBUG_ASSERT(0); }
void update_field() {} void update_field() override {}
longlong val_int() longlong val_int() override
{ {
return dense_rank; return dense_rank;
} }
Item_sum_dense_rank(THD *thd) Item_sum_dense_rank(THD *thd)
: Item_sum_int(thd), dense_rank(0), first_add(true), peer_tracker(NULL) {} : Item_sum_int(thd), dense_rank(0), first_add(true), peer_tracker(NULL) {}
const Type_handler *type_handler() const { return &type_handler_slonglong; } const Type_handler *type_handler() const override
enum Sumfunctype sum_func () const { return &type_handler_slonglong; }
enum Sumfunctype sum_func () const override
{ {
return DENSE_RANK_FUNC; return DENSE_RANK_FUNC;
} }
@ -284,9 +287,9 @@ class Item_sum_dense_rank: public Item_sum_int
return name; return name;
} }
void setup_window_func(THD *thd, Window_spec *window_spec); void setup_window_func(THD *thd, Window_spec *window_spec) override;
void cleanup() void cleanup() override
{ {
if (peer_tracker) if (peer_tracker)
{ {
@ -295,7 +298,7 @@ class Item_sum_dense_rank: public Item_sum_int
} }
Item_sum_int::cleanup(); Item_sum_int::cleanup();
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_dense_rank>(thd, this); } { return get_item_copy<Item_sum_dense_rank>(thd, this); }
}; };
@ -312,22 +315,22 @@ class Item_sum_hybrid_simple : public Item_sum_hybrid
value(NULL) value(NULL)
{ } { }
bool add(); bool add() override;
bool fix_fields(THD *, Item **); bool fix_fields(THD *, Item **) override;
bool fix_length_and_dec(); bool fix_length_and_dec() override;
void setup_hybrid(THD *thd, Item *item); void setup_hybrid(THD *thd, Item *item);
double val_real(); double val_real() override;
longlong val_int(); longlong val_int() override;
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
void reset_field(); void reset_field() override;
String *val_str(String *); String *val_str(String *) override;
bool val_native(THD *thd, Native *to); bool val_native(THD *thd, Native *to) override;
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override;
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ return Type_handler_hybrid_field_type::type_handler(); } { return Type_handler_hybrid_field_type::type_handler(); }
void update_field(); void update_field() override;
Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override;
void clear() void clear() override
{ {
value->clear(); value->clear();
null_value= 1; null_value= 1;
@ -348,7 +351,7 @@ class Item_sum_first_value : public Item_sum_hybrid_simple
Item_sum_hybrid_simple(thd, arg_expr) {} Item_sum_hybrid_simple(thd, arg_expr) {}
enum Sumfunctype sum_func () const enum Sumfunctype sum_func () const override
{ {
return FIRST_VALUE_FUNC; return FIRST_VALUE_FUNC;
} }
@ -359,7 +362,7 @@ class Item_sum_first_value : public Item_sum_hybrid_simple
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_first_value>(thd, this); } { return get_item_copy<Item_sum_first_value>(thd, this); }
}; };
@ -375,7 +378,7 @@ class Item_sum_last_value : public Item_sum_hybrid_simple
Item_sum_last_value(THD* thd, Item* arg_expr) : Item_sum_last_value(THD* thd, Item* arg_expr) :
Item_sum_hybrid_simple(thd, arg_expr) {} Item_sum_hybrid_simple(thd, arg_expr) {}
enum Sumfunctype sum_func() const enum Sumfunctype sum_func() const override
{ {
return LAST_VALUE_FUNC; return LAST_VALUE_FUNC;
} }
@ -386,7 +389,7 @@ class Item_sum_last_value : public Item_sum_hybrid_simple
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_last_value>(thd, this); } { return get_item_copy<Item_sum_last_value>(thd, this); }
}; };
@ -397,7 +400,7 @@ class Item_sum_nth_value : public Item_sum_hybrid_simple
Item_sum_nth_value(THD *thd, Item *arg_expr, Item* offset_expr) : Item_sum_nth_value(THD *thd, Item *arg_expr, Item* offset_expr) :
Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {} Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {}
enum Sumfunctype sum_func() const enum Sumfunctype sum_func() const override
{ {
return NTH_VALUE_FUNC; return NTH_VALUE_FUNC;
} }
@ -408,7 +411,7 @@ class Item_sum_nth_value : public Item_sum_hybrid_simple
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_nth_value>(thd, this); } { return get_item_copy<Item_sum_nth_value>(thd, this); }
}; };
@ -419,7 +422,7 @@ class Item_sum_lead : public Item_sum_hybrid_simple
Item_sum_lead(THD *thd, Item *arg_expr, Item* offset_expr) : Item_sum_lead(THD *thd, Item *arg_expr, Item* offset_expr) :
Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {} Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {}
enum Sumfunctype sum_func() const enum Sumfunctype sum_func() const override
{ {
return LEAD_FUNC; return LEAD_FUNC;
} }
@ -430,7 +433,7 @@ class Item_sum_lead : public Item_sum_hybrid_simple
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_lead>(thd, this); } { return get_item_copy<Item_sum_lead>(thd, this); }
}; };
@ -441,7 +444,7 @@ class Item_sum_lag : public Item_sum_hybrid_simple
Item_sum_lag(THD *thd, Item *arg_expr, Item* offset_expr) : Item_sum_lag(THD *thd, Item *arg_expr, Item* offset_expr) :
Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {} Item_sum_hybrid_simple(thd, arg_expr, offset_expr) {}
enum Sumfunctype sum_func() const enum Sumfunctype sum_func() const override
{ {
return LAG_FUNC; return LAG_FUNC;
} }
@ -452,7 +455,7 @@ class Item_sum_lag : public Item_sum_hybrid_simple
return name; return name;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_lag>(thd, this); } { return get_item_copy<Item_sum_lag>(thd, this); }
}; };
@ -506,7 +509,7 @@ class Item_sum_percent_rank: public Item_sum_double,
Item_sum_percent_rank(THD *thd) Item_sum_percent_rank(THD *thd)
: Item_sum_double(thd), cur_rank(1), peer_tracker(NULL) {} : Item_sum_double(thd), cur_rank(1), peer_tracker(NULL) {}
longlong val_int() longlong val_int() override
{ {
/* /*
Percent rank is a real value so calling the integer value should never Percent rank is a real value so calling the integer value should never
@ -516,7 +519,7 @@ class Item_sum_percent_rank: public Item_sum_double,
return 0; return 0;
} }
double val_real() double val_real() override
{ {
/* /*
We can not get the real value without knowing the number of rows We can not get the real value without knowing the number of rows
@ -529,7 +532,7 @@ class Item_sum_percent_rank: public Item_sum_double,
static_cast<double>(cur_rank - 1) / (partition_rows - 1) : 0; static_cast<double>(cur_rank - 1) / (partition_rows - 1) : 0;
} }
enum Sumfunctype sum_func () const enum Sumfunctype sum_func () const override
{ {
return PERCENT_RANK_FUNC; return PERCENT_RANK_FUNC;
} }
@ -540,33 +543,34 @@ class Item_sum_percent_rank: public Item_sum_double,
return name; return name;
} }
void update_field() {} void update_field() override {}
void clear() void clear() override
{ {
cur_rank= 1; cur_rank= 1;
row_number= 0; row_number= 0;
} }
bool add(); bool add() override;
const Type_handler *type_handler() const { return &type_handler_double; } const Type_handler *type_handler() const override
{ return &type_handler_double; }
bool fix_length_and_dec() bool fix_length_and_dec() 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.
return FALSE; return FALSE;
} }
void setup_window_func(THD *thd, Window_spec *window_spec); void setup_window_func(THD *thd, Window_spec *window_spec) override;
void reset_field() { DBUG_ASSERT(0); } void reset_field() override { DBUG_ASSERT(0); }
void set_partition_row_count(ulonglong count) void set_partition_row_count(ulonglong count) override
{ {
Partition_row_count::set_partition_row_count(count); Partition_row_count::set_partition_row_count(count);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_percent_rank>(thd, this); } { return get_item_copy<Item_sum_percent_rank>(thd, this); }
private: private:
@ -575,7 +579,7 @@ class Item_sum_percent_rank: public Item_sum_double,
Group_bound_tracker *peer_tracker; Group_bound_tracker *peer_tracker;
void cleanup() void cleanup() override
{ {
if (peer_tracker) if (peer_tracker)
{ {
@ -608,23 +612,23 @@ class Item_sum_cume_dist: public Item_sum_double,
Item_sum_cume_dist(THD *thd) :Item_sum_double(thd) { } Item_sum_cume_dist(THD *thd) :Item_sum_double(thd) { }
Item_sum_cume_dist(THD *thd, Item *arg) :Item_sum_double(thd, arg) { } Item_sum_cume_dist(THD *thd, Item *arg) :Item_sum_double(thd, arg) { }
double val_real() double val_real() override
{ {
return calc_val_real(&null_value, current_row_count_); return calc_val_real(&null_value, current_row_count_);
} }
bool add() bool add() override
{ {
current_row_count_++; current_row_count_++;
return false; return false;
} }
enum Sumfunctype sum_func() const enum Sumfunctype sum_func() const override
{ {
return CUME_DIST_FUNC; return CUME_DIST_FUNC;
} }
void clear() void clear() override
{ {
current_row_count_= 0; current_row_count_= 0;
partition_row_count_= 0; partition_row_count_= 0;
@ -636,24 +640,25 @@ class Item_sum_cume_dist: public Item_sum_double,
return name; return name;
} }
void update_field() {} void update_field() override {}
const Type_handler *type_handler() const { return &type_handler_double; } const Type_handler *type_handler() const override
{ return &type_handler_double; }
bool fix_length_and_dec() bool fix_length_and_dec() 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.
return FALSE; return FALSE;
} }
void reset_field() { DBUG_ASSERT(0); } void reset_field() override { DBUG_ASSERT(0); }
void set_partition_row_count(ulonglong count) void set_partition_row_count(ulonglong count) override
{ {
Partition_row_count::set_partition_row_count(count); Partition_row_count::set_partition_row_count(count);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_cume_dist>(thd, this); } { return get_item_copy<Item_sum_cume_dist>(thd, this); }
}; };
@ -667,7 +672,7 @@ class Item_sum_ntile : public Item_sum_int,
Item_sum_int(thd, num_quantiles_expr), n_old_val_(0) Item_sum_int(thd, num_quantiles_expr), n_old_val_(0)
{ } { }
longlong val_int() longlong val_int() override
{ {
if (get_row_count() == 0) if (get_row_count() == 0)
{ {
@ -694,18 +699,18 @@ class Item_sum_ntile : public Item_sum_int,
return (current_row_count_ - 1 - extra_rows) / quantile_size + 1; return (current_row_count_ - 1 - extra_rows) / quantile_size + 1;
} }
bool add() bool add() override
{ {
current_row_count_++; current_row_count_++;
return false; return false;
} }
enum Sumfunctype sum_func() const enum Sumfunctype sum_func() const override
{ {
return NTILE_FUNC; return NTILE_FUNC;
} }
void clear() void clear() override
{ {
current_row_count_= 0; current_row_count_= 0;
partition_row_count_= 0; partition_row_count_= 0;
@ -718,18 +723,19 @@ class Item_sum_ntile : public Item_sum_int,
return name; return name;
} }
void update_field() {} void update_field() override {}
const Type_handler *type_handler() const { return &type_handler_slonglong; } const Type_handler *type_handler() const override
{ return &type_handler_slonglong; }
void reset_field() { DBUG_ASSERT(0); } void reset_field() override { DBUG_ASSERT(0); }
void set_partition_row_count(ulonglong count) void set_partition_row_count(ulonglong count) override
{ {
Partition_row_count::set_partition_row_count(count); Partition_row_count::set_partition_row_count(count);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_ntile>(thd, this); } { return get_item_copy<Item_sum_ntile>(thd, this); }
private: private:
@ -748,7 +754,7 @@ public:
value(NULL), val_calculated(FALSE), first_call(TRUE), value(NULL), val_calculated(FALSE), first_call(TRUE),
prev_value(0), order_item(NULL){} prev_value(0), order_item(NULL){}
double val_real() double val_real() override
{ {
if (get_row_count() == 0 || get_arg(0)->is_null()) if (get_row_count() == 0 || get_arg(0)->is_null())
{ {
@ -759,7 +765,7 @@ public:
return value->val_real(); return value->val_real();
} }
longlong val_int() longlong val_int() override
{ {
if (get_row_count() == 0 || get_arg(0)->is_null()) if (get_row_count() == 0 || get_arg(0)->is_null())
{ {
@ -770,7 +776,7 @@ public:
return value->val_int(); return value->val_int();
} }
my_decimal* val_decimal(my_decimal* dec) my_decimal* val_decimal(my_decimal* dec) override
{ {
if (get_row_count() == 0 || get_arg(0)->is_null()) if (get_row_count() == 0 || get_arg(0)->is_null())
{ {
@ -781,7 +787,7 @@ public:
return value->val_decimal(dec); return value->val_decimal(dec);
} }
String* val_str(String *str) String* val_str(String *str) override
{ {
if (get_row_count() == 0 || get_arg(0)->is_null()) if (get_row_count() == 0 || get_arg(0)->is_null())
{ {
@ -792,7 +798,7 @@ public:
return value->val_str(str); return value->val_str(str);
} }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
if (get_row_count() == 0 || get_arg(0)->is_null()) if (get_row_count() == 0 || get_arg(0)->is_null())
{ {
@ -803,7 +809,7 @@ public:
return value->get_date(thd, ltime, fuzzydate); return value->get_date(thd, ltime, fuzzydate);
} }
bool val_native(THD *thd, Native *to) bool val_native(THD *thd, Native *to) override
{ {
if (get_row_count() == 0 || get_arg(0)->is_null()) if (get_row_count() == 0 || get_arg(0)->is_null())
{ {
@ -814,7 +820,7 @@ public:
return value->val_native(thd, to); return value->val_native(thd, to);
} }
bool add() bool add() override
{ {
Item *arg= get_arg(0); Item *arg= get_arg(0);
if (arg->is_null()) if (arg->is_null())
@ -855,12 +861,12 @@ public:
return false; return false;
} }
enum Sumfunctype sum_func() const enum Sumfunctype sum_func() const override
{ {
return PERCENTILE_DISC_FUNC; return PERCENTILE_DISC_FUNC;
} }
void clear() void clear() override
{ {
val_calculated= false; val_calculated= false;
first_call= true; first_call= true;
@ -875,29 +881,29 @@ public:
return name; return name;
} }
void update_field() {} void update_field() override {}
const Type_handler *type_handler() const 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() bool fix_length_and_dec() 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.
return FALSE; return FALSE;
} }
void reset_field() { DBUG_ASSERT(0); } void reset_field() override { DBUG_ASSERT(0); }
void set_partition_row_count(ulonglong count) void set_partition_row_count(ulonglong count) override
{ {
Partition_row_count::set_partition_row_count(count); Partition_row_count::set_partition_row_count(count);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_percentile_disc>(thd, this); } { return get_item_copy<Item_sum_percentile_disc>(thd, this); }
void setup_window_func(THD *thd, Window_spec *window_spec); void setup_window_func(THD *thd, Window_spec *window_spec) override;
void setup_hybrid(THD *thd, Item *item); void setup_hybrid(THD *thd, Item *item);
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref) override;
private: private:
Item_cache *value; Item_cache *value;
@ -916,7 +922,7 @@ public:
floor_value(NULL), ceil_value(NULL), first_call(TRUE),prev_value(0), floor_value(NULL), ceil_value(NULL), first_call(TRUE),prev_value(0),
ceil_val_calculated(FALSE), floor_val_calculated(FALSE), order_item(NULL){} ceil_val_calculated(FALSE), floor_val_calculated(FALSE), order_item(NULL){}
double val_real() double val_real() override
{ {
if (get_row_count() == 0 || get_arg(0)->is_null()) if (get_row_count() == 0 || get_arg(0)->is_null())
{ {
@ -943,7 +949,7 @@ public:
return ret_val; return ret_val;
} }
bool add() bool add() override
{ {
Item *arg= get_arg(0); Item *arg= get_arg(0);
if (arg->is_null()) if (arg->is_null())
@ -993,12 +999,12 @@ public:
return false; return false;
} }
enum Sumfunctype sum_func() const enum Sumfunctype sum_func() const override
{ {
return PERCENTILE_CONT_FUNC; return PERCENTILE_CONT_FUNC;
} }
void clear() void clear() override
{ {
first_call= true; first_call= true;
floor_value->clear(); floor_value->clear();
@ -1014,27 +1020,27 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("percentile_cont") }; static LEX_CSTRING name= {STRING_WITH_LEN("percentile_cont") };
return name; return name;
} }
void update_field() {} void update_field() override {}
bool fix_length_and_dec() bool fix_length_and_dec() 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.
return FALSE; return FALSE;
} }
void reset_field() { DBUG_ASSERT(0); } void reset_field() override { DBUG_ASSERT(0); }
void set_partition_row_count(ulonglong count) void set_partition_row_count(ulonglong count) override
{ {
Partition_row_count::set_partition_row_count(count); Partition_row_count::set_partition_row_count(count);
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_percentile_cont>(thd, this); } { return get_item_copy<Item_sum_percentile_cont>(thd, this); }
void setup_window_func(THD *thd, Window_spec *window_spec); void setup_window_func(THD *thd, Window_spec *window_spec) override;
void setup_hybrid(THD *thd, Item *item); void setup_hybrid(THD *thd, Item *item);
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref) override;
private: private:
Item_cache *floor_value; Item_cache *floor_value;
@ -1072,7 +1078,7 @@ public:
Item_sum *window_func() const { return (Item_sum *) args[0]; } Item_sum *window_func() const { return (Item_sum *) args[0]; }
void update_used_tables(); void update_used_tables() override;
/* /*
This is used by filesort to mark the columns it needs to read (because they This is used by filesort to mark the columns it needs to read (because they
@ -1083,7 +1089,7 @@ public:
have been computed. In that case, window function will need to read its have been computed. In that case, window function will need to read its
temp.table field. In order to allow that, mark that field in the read_set. temp.table field. In order to allow that, mark that field in the read_set.
*/ */
bool register_field_in_read_map(void *arg) bool register_field_in_read_map(void *arg) override
{ {
TABLE *table= (TABLE*) arg; TABLE *table= (TABLE*) arg;
if (result_field && (result_field->table == table || !table)) if (result_field && (result_field->table == table || !table))
@ -1186,11 +1192,11 @@ public:
*/ */
void setup_partition_border_check(THD *thd); void setup_partition_border_check(THD *thd);
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
return ((Item_sum *) args[0])->type_handler(); return ((Item_sum *) args[0])->type_handler();
} }
enum Item::Type type() const { return Item::WINDOW_FUNC_ITEM; } enum Item::Type type() const override { return Item::WINDOW_FUNC_ITEM; }
private: private:
/* /*
@ -1233,7 +1239,7 @@ public:
read_value_from_result_field= true; read_value_from_result_field= true;
} }
bool is_null() bool is_null() override
{ {
if (force_return_blank) if (force_return_blank)
return true; return true;
@ -1244,7 +1250,7 @@ public:
return window_func()->is_null(); return window_func()->is_null();
} }
double val_real() double val_real() override
{ {
double res; double res;
if (force_return_blank) if (force_return_blank)
@ -1265,7 +1271,7 @@ public:
return res; return res;
} }
longlong val_int() longlong val_int() override
{ {
longlong res; longlong res;
if (force_return_blank) if (force_return_blank)
@ -1286,7 +1292,7 @@ public:
return res; return res;
} }
String* val_str(String* str) String* val_str(String* str) override
{ {
String *res; String *res;
if (force_return_blank) if (force_return_blank)
@ -1309,7 +1315,7 @@ public:
return res; return res;
} }
bool val_native(THD *thd, Native *to) bool val_native(THD *thd, Native *to) override
{ {
if (force_return_blank) if (force_return_blank)
return null_value= true; return null_value= true;
@ -1318,7 +1324,7 @@ public:
return val_native_from_item(thd, window_func(), to); return val_native_from_item(thd, window_func(), to);
} }
my_decimal* val_decimal(my_decimal* dec) my_decimal* val_decimal(my_decimal* dec) override
{ {
my_decimal *res; my_decimal *res;
if (force_return_blank) if (force_return_blank)
@ -1341,7 +1347,7 @@ public:
return res; return res;
} }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
bool res; bool res;
if (force_return_blank) if (force_return_blank)
@ -1365,9 +1371,9 @@ 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); List<Item> &fields, uint flags) override;
bool fix_length_and_dec() bool fix_length_and_dec() override
{ {
Type_std_attributes::set(window_func()); Type_std_attributes::set(window_func());
return FALSE; return FALSE;
@ -1379,13 +1385,13 @@ public:
return name; return name;
} }
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref) override;
bool resolve_window_name(THD *thd); bool resolve_window_name(THD *thd);
void print(String *str, enum_query_type query_type); void print(String *str, enum_query_type query_type) override;
Item *get_copy(THD *thd) { return 0; } Item *get_copy(THD *thd) override { return 0; }
}; };

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2005, 2019, Oracle and/or its affiliates. /* Copyright (c) 2005, 2019, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Copyright (c) 2009, 2021, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -141,21 +141,21 @@ public:
fltend= (MY_XPATH_FLT*) tmp_native_value.end(); fltend= (MY_XPATH_FLT*) tmp_native_value.end();
nodeset->length(0); nodeset->length(0);
} }
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
return &type_handler_xpath_nodeset; return &type_handler_xpath_nodeset;
} }
const Type_handler *fixed_type_handler() const const Type_handler *fixed_type_handler() const override
{ {
return &type_handler_xpath_nodeset; return &type_handler_xpath_nodeset;
} }
Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param) const Tmp_field_param *param) override
{ {
DBUG_ASSERT(0); DBUG_ASSERT(0);
return NULL; return NULL;
} }
String *val_str(String *str) String *val_str(String *str) override
{ {
prepare_nodes(); prepare_nodes();
val_native(current_thd, &tmp2_native_value); val_native(current_thd, &tmp2_native_value);
@ -189,7 +189,7 @@ public:
} }
return str; return str;
} }
bool fix_length_and_dec() bool fix_length_and_dec() override
{ {
max_length= MAX_BLOB_WIDTH; max_length= MAX_BLOB_WIDTH;
collation.collation= pxml->charset(); collation.collation= pxml->charset();
@ -202,7 +202,7 @@ public:
{ {
return { STRING_WITH_LEN("nodeset") }; return { STRING_WITH_LEN("nodeset") };
} }
bool check_vcol_func_processor(void *arg) 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);
} }
@ -220,8 +220,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_rootelement") }; return { STRING_WITH_LEN("xpath_rootelement") };
} }
bool val_native(THD *thd, Native *nodeset); bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_func_rootelement>(thd, this); } { return get_item_copy<Item_nodeset_func_rootelement>(thd, this); }
}; };
@ -236,8 +236,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_union") }; return { STRING_WITH_LEN("xpath_union") };
} }
bool val_native(THD *thd, Native *nodeset); bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_func_union>(thd, this); } { return get_item_copy<Item_nodeset_func_union>(thd, this); }
}; };
@ -276,8 +276,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_selfbyname") }; return { STRING_WITH_LEN("xpath_selfbyname") };
} }
bool val_native(THD *thd, Native *nodeset); bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_func_selfbyname>(thd, this); } { return get_item_copy<Item_nodeset_func_selfbyname>(thd, this); }
}; };
@ -293,8 +293,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_childbyname") }; return { STRING_WITH_LEN("xpath_childbyname") };
} }
bool val_native(THD *thd, Native *nodeset); bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_func_childbyname>(thd, this); } { return get_item_copy<Item_nodeset_func_childbyname>(thd, this); }
}; };
@ -312,8 +312,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_descendantbyname") }; return { STRING_WITH_LEN("xpath_descendantbyname") };
} }
bool val_native(THD *thd, Native *nodeset); bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_func_descendantbyname>(thd, this); } { return get_item_copy<Item_nodeset_func_descendantbyname>(thd, this); }
}; };
@ -331,8 +331,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_ancestorbyname") }; return { STRING_WITH_LEN("xpath_ancestorbyname") };
} }
bool val_native(THD *thd, Native *nodeset); bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_func_ancestorbyname>(thd, this); } { return get_item_copy<Item_nodeset_func_ancestorbyname>(thd, this); }
}; };
@ -349,8 +349,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_parentbyname") }; return { STRING_WITH_LEN("xpath_parentbyname") };
} }
bool val_native(THD *thd, Native *nodeset); bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_func_parentbyname>(thd, this); } { return get_item_copy<Item_nodeset_func_parentbyname>(thd, this); }
}; };
@ -366,8 +366,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_attributebyname") }; return { STRING_WITH_LEN("xpath_attributebyname") };
} }
bool val_native(THD *thd, Native *nodeset); bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_func_attributebyname>(thd, this); } { return get_item_copy<Item_nodeset_func_attributebyname>(thd, this); }
}; };
@ -386,8 +386,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_predicate") }; return { STRING_WITH_LEN("xpath_predicate") };
} }
bool val_native(THD *thd, Native *nodeset); bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_func_predicate>(thd, this); } { return get_item_copy<Item_nodeset_func_predicate>(thd, this); }
}; };
@ -402,8 +402,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_elementbyindex") }; return { STRING_WITH_LEN("xpath_elementbyindex") };
} }
bool val_native(THD *thd, Native *nodeset); bool val_native(THD *thd, Native *nodeset) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_func_elementbyindex>(thd, this); } { return get_item_copy<Item_nodeset_func_elementbyindex>(thd, this); }
}; };
@ -425,7 +425,7 @@ public:
{ {
return { STRING_WITH_LEN("xpath_cast_bool") }; return { STRING_WITH_LEN("xpath_cast_bool") };
} }
longlong val_int() longlong val_int() override
{ {
if (args[0]->fixed_type_handler() == &type_handler_xpath_nodeset) if (args[0]->fixed_type_handler() == &type_handler_xpath_nodeset)
{ {
@ -434,7 +434,7 @@ public:
} }
return args[0]->val_real() ? 1 : 0; return args[0]->val_real() ? 1 : 0;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_xpath_cast_bool>(thd, this); } { return get_item_copy<Item_xpath_cast_bool>(thd, this); }
}; };
@ -450,8 +450,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_cast_number") }; return { STRING_WITH_LEN("xpath_cast_number") };
} }
virtual double val_real() { return args[0]->val_real(); } double val_real() override { return args[0]->val_real(); }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_xpath_cast_number>(thd, this); } { return get_item_copy<Item_xpath_cast_number>(thd, this); }
}; };
@ -465,12 +465,13 @@ public:
Native *native_cache; Native *native_cache;
Item_nodeset_context_cache(THD *thd, Native *native_arg, String *pxml): Item_nodeset_context_cache(THD *thd, Native *native_arg, String *pxml):
Item_nodeset_func(thd, pxml), native_cache(native_arg) { } Item_nodeset_func(thd, pxml), native_cache(native_arg) { }
bool val_native(THD *thd, Native *nodeset) bool val_native(THD *, Native *nodeset) override
{ {
return nodeset->copy(*native_cache); return nodeset->copy(*native_cache);
} }
bool fix_length_and_dec() { max_length= MAX_BLOB_WIDTH;; return FALSE; } bool fix_length_and_dec() override
Item *get_copy(THD *thd) { max_length= MAX_BLOB_WIDTH; return FALSE; }
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); }
}; };
@ -486,15 +487,15 @@ public:
{ {
return { STRING_WITH_LEN("xpath_position") }; return { STRING_WITH_LEN("xpath_position") };
} }
bool fix_length_and_dec() { max_length=10; return FALSE; } bool fix_length_and_dec() override { max_length=10; return FALSE; }
longlong val_int() longlong val_int() override
{ {
args[0]->val_native(current_thd, &tmp_native_value); args[0]->val_native(current_thd, &tmp_native_value);
if (tmp_native_value.elements() == 1) if (tmp_native_value.elements() == 1)
return tmp_native_value.element(0).pos + 1; return tmp_native_value.element(0).pos + 1;
return 0; return 0;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_xpath_position>(thd, this); } { return get_item_copy<Item_func_xpath_position>(thd, this); }
}; };
@ -510,8 +511,8 @@ public:
{ {
return { STRING_WITH_LEN("xpath_count") }; return { STRING_WITH_LEN("xpath_count") };
} }
bool fix_length_and_dec() { max_length=10; return FALSE; } bool fix_length_and_dec() override { max_length=10; return FALSE; }
longlong val_int() longlong val_int() override
{ {
uint predicate_supplied_context_size; uint predicate_supplied_context_size;
args[0]->val_native(current_thd, &tmp_native_value); args[0]->val_native(current_thd, &tmp_native_value);
@ -520,7 +521,7 @@ public:
return predicate_supplied_context_size; return predicate_supplied_context_size;
return tmp_native_value.elements(); return tmp_native_value.elements();
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_xpath_count>(thd, this); } { return get_item_copy<Item_func_xpath_count>(thd, this); }
}; };
@ -537,7 +538,7 @@ public:
{ {
return { STRING_WITH_LEN("xpath_sum") }; return { STRING_WITH_LEN("xpath_sum") };
} }
double val_real() double val_real() override
{ {
double sum= 0; double sum= 0;
args[0]->val_native(current_thd, &tmp_native_value); args[0]->val_native(current_thd, &tmp_native_value);
@ -568,7 +569,7 @@ public:
} }
return sum; return sum;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_xpath_sum>(thd, this); } { return get_item_copy<Item_func_xpath_sum>(thd, this); }
}; };
@ -612,17 +613,17 @@ public:
{ {
return { STRING_WITH_LEN("xpath_nodeset_to_const_comparator") }; return { STRING_WITH_LEN("xpath_nodeset_to_const_comparator") };
} }
bool check_vcol_func_processor(void *arg) 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);
} }
Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param) const Tmp_field_param *param) override
{ {
DBUG_ASSERT(0); DBUG_ASSERT(0);
return NULL; return NULL;
} }
longlong val_int() longlong val_int() override
{ {
Item_func *comp= (Item_func*)args[1]; Item_func *comp= (Item_func*)args[1];
Item_string_xml_non_const *fake= Item_string_xml_non_const *fake=
@ -653,7 +654,7 @@ public:
} }
return 0; return 0;
} }
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_to_const_comparator>(thd, this); } { return get_item_copy<Item_nodeset_to_const_comparator>(thd, this); }
}; };

View File

@ -117,9 +117,9 @@ public:
{ {
set_maybe_null(); set_maybe_null();
} }
bool fix_fields(THD *thd, Item **ref); bool fix_fields(THD *thd, Item **ref) override;
bool fix_length_and_dec(); bool fix_length_and_dec() override;
bool const_item() const 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());
} }
@ -136,8 +136,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("extractvalue") }; static LEX_CSTRING name= {STRING_WITH_LEN("extractvalue") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_xml_extractvalue>(thd, this); } { return get_item_copy<Item_func_xml_extractvalue>(thd, this); }
}; };
@ -157,8 +157,8 @@ public:
static LEX_CSTRING name= {STRING_WITH_LEN("updatexml") }; static LEX_CSTRING name= {STRING_WITH_LEN("updatexml") };
return name; return name;
} }
String *val_str(String *); String *val_str(String *) override;
Item *get_copy(THD *thd) Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_xml_update>(thd, this); } { return get_item_copy<Item_func_xml_update>(thd, this); }
}; };

View File

@ -44,9 +44,9 @@ public:
this->name.str= name_par; this->name.str= name_par;
this->name.length= strlen(name_par); this->name.length= strlen(name_par);
} }
enum Type type() const { return Item::PROC_ITEM; } enum Type type() const override { return Item::PROC_ITEM; }
Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
const Tmp_field_param *param) const Tmp_field_param *param) override
{ {
/* /*
We can get to here when using a CURSOR for a query with PROCEDURE: We can get to here when using a CURSOR for a query with PROCEDURE:
@ -58,19 +58,19 @@ public:
virtual void set(double nr)=0; virtual void set(double nr)=0;
virtual void set(const char *str,uint length,CHARSET_INFO *cs)=0; virtual void set(const char *str,uint length,CHARSET_INFO *cs)=0;
virtual void set(longlong nr)=0; virtual void set(longlong nr)=0;
const Type_handler *type_handler() const=0; const Type_handler *type_handler() const override=0;
void set(const char *str) { set(str,(uint) strlen(str), default_charset()); } void set(const char *str) { set(str,(uint) strlen(str), default_charset()); }
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
bool check_vcol_func_processor(void *arg) bool check_vcol_func_processor(void *arg) override
{ {
DBUG_ASSERT(0); // impossible DBUG_ASSERT(0); // impossible
return mark_unsupported_function("proc", arg, VCOL_IMPOSSIBLE); return mark_unsupported_function("proc", arg, VCOL_IMPOSSIBLE);
} }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override
{ {
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate); return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
} }
Item* get_copy(THD *thd) { return 0; } Item* get_copy(THD *thd) override { return 0; }
}; };
class Item_proc_real :public Item_proc class Item_proc_real :public Item_proc
@ -82,23 +82,24 @@ public:
{ {
decimals=dec; max_length=float_length(dec); decimals=dec; max_length=float_length(dec);
} }
const Type_handler *type_handler() const { return &type_handler_double; } const Type_handler *type_handler() const override
void set(double nr) { value=nr; } { return &type_handler_double; }
void set(longlong nr) { value=(double) nr; } void set(double nr) override { value=nr; }
void set(const char *str,uint length,CHARSET_INFO *cs) void set(longlong nr) override { value=(double) nr; }
void set(const char *str,uint length,CHARSET_INFO *cs) override
{ {
int err_not_used; int err_not_used;
char *end_not_used; char *end_not_used;
value= cs->strntod((char*) str,length, &end_not_used, &err_not_used); value= cs->strntod((char*) str,length, &end_not_used, &err_not_used);
} }
double val_real() { return value; } double val_real() override { return value; }
longlong val_int() { return (longlong) value; } longlong val_int() override { return (longlong) value; }
String *val_str(String *s) String *val_str(String *s) override
{ {
s->set_real(value,decimals,default_charset()); s->set_real(value,decimals,default_charset());
return s; return s;
} }
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -108,20 +109,21 @@ class Item_proc_int :public Item_proc
public: public:
Item_proc_int(THD *thd, const char *name_par): Item_proc(thd, name_par) Item_proc_int(THD *thd, const char *name_par): Item_proc(thd, name_par)
{ max_length=11; } { max_length=11; }
const Type_handler *type_handler() const const Type_handler *type_handler() const override
{ {
if (unsigned_flag) if (unsigned_flag)
return &type_handler_ulonglong; return &type_handler_ulonglong;
return &type_handler_slonglong; return &type_handler_slonglong;
} }
void set(double nr) { value=(longlong) nr; } void set(double nr) override { value=(longlong) nr; }
void set(longlong nr) { value=nr; } void set(longlong nr) override { value=nr; }
void set(const char *str,uint length, CHARSET_INFO *cs) void set(const char *str,uint length, CHARSET_INFO *cs) override
{ int err; value= cs->strntoll(str,length,10,NULL,&err); } { int err; value= cs->strntoll(str,length,10,NULL,&err); }
double val_real() { return (double) value; } double val_real() override { return (double) value; }
longlong val_int() { return value; } longlong val_int() override { return value; }
String *val_str(String *s) { s->set(value, default_charset()); return s; } String *val_str(String *s) override
my_decimal *val_decimal(my_decimal *); { s->set(value, default_charset()); return s; }
my_decimal *val_decimal(my_decimal *) override;
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
@ -131,12 +133,13 @@ class Item_proc_string :public Item_proc
public: public:
Item_proc_string(THD *thd, const char *name_par, uint length): Item_proc_string(THD *thd, const char *name_par, uint length):
Item_proc(thd, name_par) { this->max_length=length; } Item_proc(thd, name_par) { this->max_length=length; }
const Type_handler *type_handler() const { return &type_handler_varchar; } const Type_handler *type_handler() const override
void set(double nr) { str_value.set_real(nr, 2, default_charset()); } { return &type_handler_varchar; }
void set(longlong nr) { str_value.set(nr, default_charset()); } void set(double nr) override { str_value.set_real(nr, 2, default_charset()); }
void set(const char *str, uint length, CHARSET_INFO *cs) void set(longlong nr) override { str_value.set(nr, default_charset()); }
void set(const char *str, uint length, CHARSET_INFO *cs) override
{ str_value.copy(str,length,cs); } { str_value.copy(str,length,cs); }
double val_real() double val_real() override
{ {
int err_not_used; int err_not_used;
char *end_not_used; char *end_not_used;
@ -144,17 +147,17 @@ public:
return cs->strntod((char*) str_value.ptr(), str_value.length(), return cs->strntod((char*) str_value.ptr(), str_value.length(),
&end_not_used, &err_not_used); &end_not_used, &err_not_used);
} }
longlong val_int() longlong val_int() override
{ {
int err; int err;
CHARSET_INFO *cs=str_value.charset(); CHARSET_INFO *cs=str_value.charset();
return cs->strntoll(str_value.ptr(),str_value.length(),10,NULL,&err); return cs->strntoll(str_value.ptr(),str_value.length(),10,NULL,&err);
} }
String *val_str(String*) String *val_str(String*) override
{ {
return null_value ? (String*) 0 : (String*) &str_value; return null_value ? (String*) 0 : (String*) &str_value;
} }
my_decimal *val_decimal(my_decimal *); my_decimal *val_decimal(my_decimal *) override;
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };

View File

@ -60,7 +60,8 @@ public:
Spvar_definition field_def; Spvar_definition field_def;
/// Field-type of the SP-variable. /// Field-type of the SP-variable.
const Type_handler *type_handler() const { return field_def.type_handler(); } const Type_handler *type_handler() const
{ return field_def.type_handler(); }
public: public:
sp_variable(const LEX_CSTRING *name_arg, uint offset_arg) sp_variable(const LEX_CSTRING *name_arg, uint offset_arg)

View File

@ -6985,7 +6985,8 @@ public:
~my_var_sp() { } ~my_var_sp() { }
bool set(THD *thd, Item *val); bool set(THD *thd, Item *val);
my_var_sp *get_my_var_sp() { return this; } my_var_sp *get_my_var_sp() { return this; }
const Type_handler *type_handler() const { return m_type_handler; } const Type_handler *type_handler() const
{ return m_type_handler; }
sp_rcontext *get_rcontext(sp_rcontext *local_ctx) const; sp_rcontext *get_rcontext(sp_rcontext *local_ctx) const;
}; };

View File

@ -1960,8 +1960,8 @@ class store_key_field: public store_key
} }
} }
enum Type type() const { return FIELD_STORE_KEY; } enum Type type() const override { return FIELD_STORE_KEY; }
const char *name() const { return field_name; } const char *name() const override { return field_name; }
void change_source_field(Item_field *fld_item) void change_source_field(Item_field *fld_item)
{ {
@ -1970,7 +1970,7 @@ class store_key_field: public store_key
} }
protected: protected:
enum store_key_result copy_inner() enum store_key_result copy_inner() override
{ {
TABLE *table= copy_field.to_field->table; TABLE *table= copy_field.to_field->table;
MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, MY_BITMAP *old_map= dbug_tmp_use_all_columns(table,
@ -2013,11 +2013,11 @@ public:
{} {}
enum Type type() const { return ITEM_STORE_KEY; } enum Type type() const override { return ITEM_STORE_KEY; }
const char *name() const { return "func"; } const char *name() const override { return "func"; }
protected: protected:
enum store_key_result copy_inner() enum store_key_result copy_inner() override
{ {
TABLE *table= to_field->table; TABLE *table= to_field->table;
MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, MY_BITMAP *old_map= dbug_tmp_use_all_columns(table,
@ -2066,12 +2066,12 @@ public:
:store_key_item(arg, new_item, FALSE), inited(0) :store_key_item(arg, new_item, FALSE), inited(0)
{} {}
enum Type type() const { return CONST_ITEM_STORE_KEY; } enum Type type() const override { return CONST_ITEM_STORE_KEY; }
const char *name() const { return "const"; } const char *name() const override { return "const"; }
bool store_key_is_const() { return true; } bool store_key_is_const() override { return true; }
protected: protected:
enum store_key_result copy_inner() enum store_key_result copy_inner() override
{ {
int res; int res;
if (!inited) if (!inited)

View File

@ -54,12 +54,12 @@ public:
DBUG_ENTER("analyze"); DBUG_ENTER("analyze");
DBUG_RETURN(HA_ERR_TABLE_READONLY); DBUG_RETURN(HA_ERR_TABLE_READONLY);
} }
int repair(THD *, HA_CHECK_OPT *) override int repair(THD * thd, HA_CHECK_OPT * check_opt) override
{ {
DBUG_ENTER("repair"); DBUG_ENTER("repair");
DBUG_RETURN(HA_ERR_TABLE_READONLY); DBUG_RETURN(HA_ERR_TABLE_READONLY);
} }
int preload_keys(THD *, HA_CHECK_OPT *) override int preload_keys(THD * thd, HA_CHECK_OPT * check_opt) override
{ {
DBUG_ENTER("preload_keys"); DBUG_ENTER("preload_keys");
DBUG_RETURN(HA_ERR_TABLE_READONLY); DBUG_RETURN(HA_ERR_TABLE_READONLY);