From ebef21cce43e66edc10cc1d34e2e90e14bbb8a8f Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 19 Aug 2020 02:53:22 +0300 Subject: 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 --- plugin/func_test/plugin.cc | 9 +- plugin/type_inet/item_inetfunc.h | 42 +- sql/field.h | 6 +- sql/ha_partition.h | 2 +- sql/item.h | 1621 +++++++++++++++++++------------------- sql/item_cmpfunc.h | 836 ++++++++++---------- sql/item_func.h | 1155 ++++++++++++++------------- sql/item_geofunc.h | 250 +++--- sql/item_jsonfunc.h | 201 ++--- sql/item_row.h | 72 +- sql/item_strfunc.h | 615 ++++++++------- sql/item_subselect.h | 51 +- sql/item_sum.h | 481 +++++------ sql/item_timefunc.h | 577 +++++++------- sql/item_vers.h | 16 +- sql/item_windowfunc.h | 262 +++--- sql/item_xmlfunc.cc | 84 +- sql/item_xmlfunc.h | 14 +- sql/procedure.h | 63 +- sql/sp_pcontext.h | 3 +- sql/sql_class.h | 3 +- sql/sql_select.h | 20 +- storage/maria/ha_s3.h | 4 +- 23 files changed, 3266 insertions(+), 3121 deletions(-) diff --git a/plugin/func_test/plugin.cc b/plugin/func_test/plugin.cc index b49f87832d6..f59ee82388c 100644 --- a/plugin/func_test/plugin.cc +++ b/plugin/func_test/plugin.cc @@ -24,12 +24,12 @@ class Item_func_sysconst_test :public Item_func_sysconst { public: 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); 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; set_maybe_null(); @@ -40,8 +40,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("sysconst_test") }; return name; } - const char *fully_qualified_func_name() const { return "sysconst_test()"; } - Item *get_copy(THD *thd) + const char *fully_qualified_func_name() const override + { return "sysconst_test()"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/plugin/type_inet/item_inetfunc.h b/plugin/type_inet/item_inetfunc.h index 5568bf55bdf..4acb42d2175 100644 --- a/plugin/type_inet/item_inetfunc.h +++ b/plugin/type_inet/item_inetfunc.h @@ -27,17 +27,17 @@ 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); } public: 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 { static LEX_CSTRING name= {STRING_WITH_LEN("inet_aton") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; max_length= 21; @@ -45,7 +45,7 @@ public: unsigned_flag= 1; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -59,20 +59,20 @@ class Item_func_inet_ntoa : public Item_str_func public: 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 { static LEX_CSTRING name= {STRING_WITH_LEN("inet_ntoa") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; fix_length_and_charset(3 * 8 + 7, default_charset()); set_maybe_null(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -111,17 +111,17 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("inet6_aton") }; return name; } - virtual bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; fix_length_and_charset(16, &my_charset_bin); set_maybe_null(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - String *val_str(String *to); + String *val_str(String *to) override; }; @@ -143,7 +143,7 @@ public: return name; } - virtual bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; @@ -155,8 +155,8 @@ public: set_maybe_null();; return FALSE; } - String *val_str_ascii(String *to); - Item *get_copy(THD *thd) + String *val_str_ascii(String *to) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -178,10 +178,10 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -201,10 +201,10 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv6") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -223,9 +223,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_compat") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -244,9 +244,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_mapped") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - longlong val_int(); + longlong val_int() override; }; #endif // ITEM_INETFUNC_INCLUDED diff --git a/sql/field.h b/sql/field.h index 6961b2dcbc0..453f6af428b 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1198,7 +1198,7 @@ public: virtual uint16 key_part_flag() const { return 0; } virtual uint16 key_part_length_bytes() const { return 0; } 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 { return type_handler()->field_type(); @@ -4151,7 +4151,7 @@ public: { 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); } @@ -4501,7 +4501,7 @@ public: uint32 sort_length() const override; uint32 sort_suffix_length() const override; 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); } diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 3c3e394d59f..2669d475ff1 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -467,7 +467,7 @@ public: } Partition_share *get_part_share() { return part_share; } 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_is_sub_partitioned= part_info->is_sub_partitioned(); diff --git a/sql/item.h b/sql/item.h index 474eed6da85..e98bffab5b2 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2,7 +2,7 @@ #define SQL_ITEM_INCLUDED /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2020, MariaDB Corporation. + Copyright (c) 2009, 2021, MariaDB Corporation. 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 @@ -1184,7 +1184,7 @@ public: { return type_handler()->field_type(); } - virtual const Type_handler *type_handler() const= 0; + virtual const Type_handler *type_handler() const = 0; /** Detects if an Item has a fixed data type which is known even before fix_fields(). @@ -1782,7 +1782,7 @@ public: inline uint float_length(uint decimals_par) const { return decimals < FLOATING_POINT_DECIMALS ? (DBL_DIG+2+decimals_par) : DBL_DIG+8;} /* Returns total number of decimal digits */ - virtual uint decimal_precision() const + uint decimal_precision() const override { return type_handler()->Item_decimal_precision(this); } @@ -2957,30 +2957,30 @@ public: Item_sp_variable(THD *thd, const LEX_CSTRING *sp_var_name); public: - bool fix_fields(THD *thd, Item **)= 0; + bool fix_fields(THD *thd, Item **) override = 0; - double val_real(); - longlong val_int(); - String *val_str(String *sp); - my_decimal *val_decimal(my_decimal *decimal_value); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to); - bool is_null(); + double val_real() override; + longlong val_int() override; + String *val_str(String *sp) override; + my_decimal *val_decimal(my_decimal *decimal_value) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool val_native(THD *thd, Native *to) override; + bool is_null() override; public: - void make_send_field(THD *thd, Send_field *field); + void make_send_field(THD *thd, Send_field *field) override; - inline bool const_item() const; + bool const_item() const override; 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); } - inline int save_in_field(Field *field, bool no_conversions); - inline bool send(Protocol *protocol, st_value *buffer); - bool check_vcol_func_processor(void *arg) + int save_in_field(Field *field, bool no_conversions) override; + bool send(Protocol *protocol, st_value *buffer) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(m_name.str, arg, VCOL_IMPOSSIBLE); } @@ -3034,41 +3034,41 @@ public: const Type_handler *handler, uint pos_in_q= 0, uint len_in_q= 0); - bool fix_fields(THD *, Item **); - Item *this_item(); - const Item *this_item() const; - Item **this_item_addr(THD *thd, Item **); + bool fix_fields(THD *, Item **) override; + Item *this_item() override; + const Item *this_item() const override; + Item **this_item_addr(THD *thd, Item **) override; - virtual void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; public: inline const LEX_CSTRING *my_name() const; inline uint get_var_idx() const; - inline enum Type type() const; - const Type_handler *type_handler() const + enum Type type() const override; + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } - uint cols() const { return this_item()->cols(); } - Item* element_index(uint i) { return this_item()->element_index(i); } - Item** addr(uint i) { return this_item()->addr(i); } - bool check_cols(uint c); + uint cols() const override { return this_item()->cols(); } + Item* element_index(uint i) override { return this_item()->element_index(i); } + Item** addr(uint i) override { return this_item()->addr(i); } + bool check_cols(uint c) override; private: - bool set_value(THD *thd, sp_rcontext *ctx, Item **it); + bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override; public: - Item_splocal *get_item_splocal() { return this; } + Item_splocal *get_item_splocal() override { return this; } - Rewritable_query_parameter *get_rewritable_query_parameter() + Rewritable_query_parameter *get_rewritable_query_parameter() override { return this; } - Settable_routine_parameter *get_settable_routine_parameter() + Settable_routine_parameter *get_settable_routine_parameter() override { return this; } - bool append_for_log(THD *thd, String *str); + bool append_for_log(THD *thd, String *str) override; - Item *get_copy(THD *thd) { return 0; } + Item *get_copy(THD *thd) override { return 0; } /* Override the inherited create_field_for_create_select(), @@ -3079,7 +3079,7 @@ public: The inherited implementation would create a column based on result_type(), which is less exact. */ - 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); } bool is_valid_limit_clause_variable_with_error() const @@ -3197,13 +3197,14 @@ public: Item_case_expr(THD *thd, uint case_expr_id); public: - bool fix_fields(THD *thd, Item **); - Item *this_item(); - const Item *this_item() const; - Item **this_item_addr(THD *thd, Item **); + bool fix_fields(THD *thd, Item **) override; + Item *this_item() override; + const Item *this_item() const override; + Item **this_item_addr(THD *thd, Item **) override; - inline enum Type type() const; - const Type_handler *type_handler() const { return this_item()->type_handler(); } + enum Type type() const override; + const Type_handler *type_handler() const override + { return this_item()->type_handler(); } public: /* @@ -3211,8 +3212,8 @@ public: Item_case_expr can not occur in views, so here it is only for debug purposes. */ - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) { return 0; } + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return 0; } private: uint m_case_expr_id; @@ -3248,31 +3249,31 @@ class Item_name_const : public Item_fixed_hybrid public: Item_name_const(THD *thd, Item *name_arg, Item *val); - bool fix_fields(THD *, Item **); + bool fix_fields(THD *, Item **) override; - enum Type type() const; - double val_real(); - longlong val_int(); - String *val_str(String *sp); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to); - bool is_null(); - virtual void print(String *str, enum_query_type query_type); + enum Type type() const override; + double val_real() override; + longlong val_int() override; + String *val_str(String *sp) override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool val_native(THD *thd, Native *to) override; + bool is_null() override; + void print(String *str, enum_query_type query_type) override; - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return value_item->type_handler(); } - bool const_item() const + bool const_item() const override { return TRUE; } 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 NAME_CONST(): @@ -3282,20 +3283,20 @@ public: return tmp_table_field_from_field_type_maybe_null(root, table, src, param, type() == Item::NULL_ITEM); } - int save_in_field(Field *field, bool no_conversions) + 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) + bool send(Protocol *protocol, st_value *buffer) override { return value_item->send(protocol, buffer); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function("name_const()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3305,12 +3306,12 @@ class Item_literal: public Item_basic_constant public: Item_literal(THD *thd): Item_basic_constant(thd) { } - enum Type type() const { return CONST_ITEM; } - bool check_partition_func_processor(void *int_arg) { return false;} - bool const_item() const { return true; } - bool basic_const_item() const { return true; } - bool is_expensive() { return false; } - bool cleanup_is_expensive_cache_processor(void *arg) { return 0; } + enum Type type() const override { return CONST_ITEM; } + bool check_partition_func_processor(void *int_arg) override { return false;} + bool const_item() const override { return true; } + bool basic_const_item() const override { return true; } + bool is_expensive() override { return false; } + bool cleanup_is_expensive_cache_processor(void *arg) override { return 0; } }; @@ -3345,9 +3346,9 @@ public: Item_fixed_hybrid(thd, item), result_field(item->result_field) {} ~Item_result_field() {} /* Required with gcc 2.95 */ - Field *get_tmp_table_field() { return result_field; } + Field *get_tmp_table_field() override { return result_field; } 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(fixed()); const Type_handler *h= type_handler()->type_handler_for_tmp_table(this); @@ -3359,14 +3360,14 @@ public: Item_variance_field which work when only temporary table left, so theu return table map of the temporary table. */ - table_map used_tables() const { return 1; } - bool is_result_field() { return true; } - void save_in_result_field(bool no_conversions) + table_map used_tables() const override { return 1; } + bool is_result_field() override { return true; } + void save_in_result_field(bool no_conversions) override { save_in_field(result_field, no_conversions); } - void cleanup(); - bool check_vcol_func_processor(void *arg) { return FALSE;} + void cleanup() override; + bool check_vcol_func_processor(void *arg) override { return FALSE;} }; @@ -3424,16 +3425,16 @@ public: Item_ident(THD *thd, Item_ident *item); Item_ident(THD *thd, TABLE_LIST *view_arg, const LEX_CSTRING &field_name_arg); LEX_CSTRING full_name_cstring() const override; - void cleanup(); + void cleanup() override; st_select_lex *get_depended_from() const; - bool remove_dependence_processor(void * arg); - virtual void print(String *str, enum_query_type query_type); - virtual bool change_context_processor(void *cntx) + bool remove_dependence_processor(void * arg) override; + void print(String *str, enum_query_type query_type) override; + bool change_context_processor(void *cntx) override { context= (Name_resolution_context *)cntx; return FALSE; } /** Collect outer references */ - virtual bool collect_outer_ref_processor(void *arg); + bool collect_outer_ref_processor(void *arg) override; friend bool insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, const char *table_name, List_iterator *it, @@ -3482,62 +3483,64 @@ public: reset_field() before fix_fields() for all fields created this way. */ Item_field(THD *thd, Field *field); - enum Type type() const { return FIELD_ITEM; } - bool eq(const Item *item, bool binary_cmp) const; - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - String *val_str(String*); - void save_result(Field *to); - double val_result(); - longlong val_int_result(); - bool val_native(THD *thd, Native *to); - bool val_native_result(THD *thd, Native *to); - String *str_result(String* tmp); - my_decimal *val_decimal_result(my_decimal *); - bool val_bool_result(); - bool is_null_result(); - bool is_json_type(); - bool send(Protocol *protocol, st_value *buffer); - Load_data_outvar *get_load_data_outvar() + enum Type type() const override { return FIELD_ITEM; } + bool eq(const Item *item, bool binary_cmp) const override; + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal *) override; + String *val_str(String*) override; + void save_result(Field *to) override; + double val_result() override; + longlong val_int_result() override; + bool val_native(THD *thd, Native *to) override; + bool val_native_result(THD *thd, Native *to) override; + String *str_result(String* tmp) override; + my_decimal *val_decimal_result(my_decimal *) override; + bool val_bool_result() override; + bool is_null_result() override; + bool is_json_type() override; + bool send(Protocol *protocol, st_value *buffer) override; + Load_data_outvar *get_load_data_outvar() override { return this; } - bool load_data_set_null(THD *thd, const Load_data_param *param) + bool load_data_set_null(THD *thd, const Load_data_param *param) override { return field->load_data_set_null(thd); } bool load_data_set_value(THD *thd, const char *pos, uint length, - const Load_data_param *param) + const Load_data_param *param) override { field->load_data_set_value(pos, length, param->charset()); return false; } - bool load_data_set_no_data(THD *thd, const Load_data_param *param); - void load_data_print_for_log_event(THD *thd, String *to) const; - bool load_data_add_outvar(THD *thd, Load_data_param *param) const + bool load_data_set_no_data(THD *thd, const Load_data_param *param) override; + void load_data_print_for_log_event(THD *thd, String *to) const override; + bool load_data_add_outvar(THD *thd, Load_data_param *param) const override { return param->add_outvar_field(thd, field); } - uint load_data_fixed_length() const + uint load_data_fixed_length() const override { return field->field_length; } void reset_field(Field *f); - bool fix_fields(THD *, Item **); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - void make_send_field(THD *thd, Send_field *tmp_field); - int save_in_field(Field *field,bool no_conversions); - void save_org_in_field(Field *field, fast_field_copier optimizer_data); - fast_field_copier setup_fast_field_copier(Field *field); - table_map used_tables() const; - table_map all_used_tables() const; - const Type_handler *type_handler() const + bool fix_fields(THD *, Item **) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) + override; + void make_send_field(THD *thd, Send_field *tmp_field) override; + int save_in_field(Field *field,bool no_conversions) override; + void save_org_in_field(Field *field, fast_field_copier optimizer_data) + override; + fast_field_copier setup_fast_field_copier(Field *field) override; + table_map used_tables() const override; + table_map all_used_tables() const override; + const Type_handler *type_handler() const override { const Type_handler *handler= field->type_handler(); return handler->type_handler_for_item_field(); } - const Type_handler *real_type_handler() const + const Type_handler *real_type_handler() const override { if (field->is_created_from_null_item) return &type_handler_null; @@ -3548,23 +3551,24 @@ public: const Tmp_field_param *param); Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param); - const TYPELIB *get_typelib() const { return field->get_typelib(); } - enum_monotonicity_info get_monotonicity_info() const + const Tmp_field_param *param) override; + const TYPELIB *get_typelib() const override { return field->get_typelib(); } + enum_monotonicity_info get_monotonicity_info() const override { return MONOTONIC_STRICT_INCREASING; } - Sql_mode_dependency value_depends_on_sql_mode() const + Sql_mode_dependency value_depends_on_sql_mode() const override { return Sql_mode_dependency(0, field->value_depends_on_sql_mode()); } - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool get_date_result(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate); - longlong val_datetime_packed(THD *thd); - longlong val_time_packed(THD *thd); - bool is_null() { return field->is_null(); } - void update_null_value(); + longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool get_date_result(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate) + override; + longlong val_datetime_packed(THD *thd) override; + longlong val_time_packed(THD *thd) override; + bool is_null() override { return field->is_null(); } + void update_null_value() override; void update_table_bitmaps() { if (field && field->table) @@ -3575,13 +3579,13 @@ public: tab->mark_column_with_deps(field); } } - void update_used_tables() + void update_used_tables() override { update_table_bitmaps(); } COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref) + COND_EQUAL **cond_equal_ref) override { /* normilize_cond() replaced all conditions of type @@ -3600,28 +3604,28 @@ public: return Item_ident::build_equal_items(thd, inherited, link_item_fields, cond_equal_ref); } - bool is_result_field() { return false; } - void save_in_result_field(bool no_conversions); - Item *get_tmp_table_item(THD *thd); - bool find_not_null_fields(table_map allowed); - bool collect_item_field_processor(void * arg); - bool unknown_splocal_processor(void *arg); - bool add_field_to_set_processor(void * arg); - bool find_item_in_field_list_processor(void *arg); - bool register_field_in_read_map(void *arg); - bool register_field_in_write_map(void *arg); - bool register_field_in_bitmap(void *arg); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool post_fix_fields_part_expr_processor(void *bool_arg); - bool check_valid_arguments_processor(void *bool_arg); - bool check_field_expression_processor(void *arg); - bool enumerate_field_refs_processor(void *arg); - bool update_table_bitmaps_processor(void *arg); - bool switch_to_nullable_fields_processor(void *arg); - bool update_vcol_processor(void *arg); - bool rename_fields_processor(void *arg); - bool check_vcol_func_processor(void *arg); - bool set_fields_as_dependent_processor(void *arg) + bool is_result_field() override { return false; } + void save_in_result_field(bool no_conversions) override; + Item *get_tmp_table_item(THD *thd) override; + bool find_not_null_fields(table_map allowed) override; + bool collect_item_field_processor(void * arg) override; + bool unknown_splocal_processor(void *arg) override; + bool add_field_to_set_processor(void * arg) override; + bool find_item_in_field_list_processor(void *arg) override; + bool register_field_in_read_map(void *arg) override; + bool register_field_in_write_map(void *arg) override; + bool register_field_in_bitmap(void *arg) override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool post_fix_fields_part_expr_processor(void *bool_arg) override; + bool check_valid_arguments_processor(void *bool_arg) override; + bool check_field_expression_processor(void *arg) override; + bool enumerate_field_refs_processor(void *arg) override; + bool update_table_bitmaps_processor(void *arg) override; + bool switch_to_nullable_fields_processor(void *arg) override; + bool update_vcol_processor(void *arg) override; + bool rename_fields_processor(void *arg) override; + bool check_vcol_func_processor(void *arg) override; + bool set_fields_as_dependent_processor(void *arg) override { if (!(used_tables() & OUTER_REF_TABLE_BIT)) { @@ -3630,38 +3634,39 @@ public: } return 0; } - void cleanup(); - Item_equal *get_item_equal() { return item_equal; } - void set_item_equal(Item_equal *item_eq) { item_equal= item_eq; } - Item_equal *find_item_equal(COND_EQUAL *cond_equal); - Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *); - Item *replace_equal_field(THD *thd, uchar *arg); - uint32 max_display_length() const { return field->max_display_length(); } - Item_field *field_for_view_update() { return this; } + void cleanup() override; + Item_equal *get_item_equal() override { return item_equal; } + void set_item_equal(Item_equal *item_eq) override { item_equal= item_eq; } + Item_equal *find_item_equal(COND_EQUAL *cond_equal) override; + Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *) override; + Item *replace_equal_field(THD *thd, uchar *arg) override; + uint32 max_display_length() const override + { return field->max_display_length(); } + Item_field *field_for_view_update() override { return this; } int fix_outer_field(THD *thd, Field **field, Item **reference); - virtual Item *update_value_transformer(THD *thd, uchar *select_arg); - Item *derived_field_transformer_for_having(THD *thd, uchar *arg); - Item *derived_field_transformer_for_where(THD *thd, uchar *arg); - Item *grouping_field_transformer_for_where(THD *thd, uchar *arg); - Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg); - Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg); - virtual void print(String *str, enum_query_type query_type); - bool excl_dep_on_table(table_map tab_map); - bool excl_dep_on_grouping_fields(st_select_lex *sel); - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred); - bool cleanup_excluding_fields_processor(void *arg) + Item *update_value_transformer(THD *thd, uchar *select_arg) override; + Item *derived_field_transformer_for_having(THD *thd, uchar *arg) override; + Item *derived_field_transformer_for_where(THD *thd, uchar *arg) override; + Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) override; + Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) override; + Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) override; + void print(String *str, enum_query_type query_type) override; + bool excl_dep_on_table(table_map tab_map) override; + bool excl_dep_on_grouping_fields(st_select_lex *sel) override; + bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) override; + bool cleanup_excluding_fields_processor(void *arg) override { return field ? 0 : cleanup_processor(arg); } - bool cleanup_excluding_const_fields_processor(void *arg) + bool cleanup_excluding_const_fields_processor(void *arg) override { return field && const_item() ? 0 : cleanup_processor(arg); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool is_outer_field() const + bool is_outer_field() const override { DBUG_ASSERT(fixed()); return field->table->pos_in_table_list->outer_join; } - bool check_index_dependence(void *arg); + bool check_index_dependence(void *arg) override; friend class Item_default_value; friend class Item_insert_value; friend class st_select_lex_unit; @@ -3679,14 +3684,14 @@ public: :Item_field(thd, field), Item_args() { } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - const Type_handler *type_handler() const { return &type_handler_row; } - uint cols() const { return arg_count; } - Item* element_index(uint i) { return arg_count ? args[i] : this; } - Item** addr(uint i) { return arg_count ? args + i : NULL; } - bool check_cols(uint c) + const Type_handler *type_handler() const override { return &type_handler_row; } + uint cols() const override { return arg_count; } + Item* element_index(uint i) override { return arg_count ? args[i] : this; } + Item** addr(uint i) override { return arg_count ? args + i : NULL; } + bool check_cols(uint c) override { if (cols() != c) { @@ -3752,34 +3757,35 @@ public: name.length= strlen(name.str); collation.set(cs, DERIVATION_IGNORABLE, MY_REPERTOIRE_ASCII); } - enum Type type() const { return NULL_ITEM; } - bool vcol_assignment_allowed_value() const { return true; } - double val_real(); - longlong val_int(); - String *val_str(String *str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - longlong val_datetime_packed(THD *); - longlong val_time_packed(THD *); - int save_in_field(Field *field, bool no_conversions); - int save_safe_in_field(Field *field); - bool send(Protocol *protocol, st_value *buffer); - const Type_handler *type_handler() const { return &type_handler_null; } - bool basic_const_item() const { return 1; } - Item *clone_item(THD *thd); - bool const_is_null() const { return true; } - bool is_null() { return 1; } - - virtual inline void print(String *str, enum_query_type query_type) + enum Type type() const override { return NULL_ITEM; } + bool vcol_assignment_allowed_value() const override { return true; } + double val_real() override; + longlong val_int() override; + String *val_str(String *str) override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + longlong val_datetime_packed(THD *) override; + longlong val_time_packed(THD *) override; + int save_in_field(Field *field, bool no_conversions) override; + int save_safe_in_field(Field *field) override; + bool send(Protocol *protocol, st_value *buffer) override; + const Type_handler *type_handler() const override + { return &type_handler_null; } + bool basic_const_item() const override { return 1; } + Item *clone_item(THD *thd) override; + bool const_is_null() const override { return true; } + bool is_null() override { return 1; } + + void print(String *str, enum_query_type query_type) override { str->append(NULL_clex_str); } - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); - bool check_partition_func_processor(void *int_arg) {return FALSE;} + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} Item_basic_constant *make_string_literal_concat(THD *thd, - const LEX_CSTRING *); - Item *get_copy(THD *thd) + const LEX_CSTRING *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3788,25 +3794,25 @@ class Item_null_result :public Item_null public: Field *result_field; Item_null_result(THD *thd): Item_null(thd), result_field(0) {} - bool is_result_field() { return result_field != 0; } - const Type_handler *type_handler() const + bool is_result_field() override { return result_field != 0; } + const Type_handler *type_handler() const override { if (result_field) return result_field->type_handler(); return &type_handler_null; } 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); return NULL; } - void save_in_result_field(bool no_conversions) + void save_in_result_field(bool no_conversions) override { save_in_field(result_field, no_conversions); } - bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool check_vcol_func_processor(void *arg) + bool check_partition_func_processor(void *int_arg) override {return TRUE;} + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE); } @@ -3990,7 +3996,7 @@ class Item_param :public Item_basic_value, const String *value_query_val_str(THD *thd, String* str) const; Item *value_clone_item(THD *thd); - bool is_evaluable_expression() const; + bool is_evaluable_expression() const override; bool can_return_value() const; public: @@ -3999,10 +4005,10 @@ public: */ enum enum_indicator_type indicator; - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } - bool vcol_assignment_allowed_value() const + bool vcol_assignment_allowed_value() const override { switch (state) { case NULL_VALUE: @@ -4020,7 +4026,7 @@ public: Item_param(THD *thd, const LEX_CSTRING *name_arg, uint pos_in_query_arg, uint len_in_query_arg); - enum Type type() const + enum Type type() const override { // Don't pretend to be a constant unless value for this item is set. switch (state) { @@ -4035,13 +4041,13 @@ public: return PARAM_ITEM; } - bool is_order_clause_position() const + bool is_order_clause_position() const override { return state == SHORT_DATA_VALUE && type_handler()->is_order_clause_position_type(); } - const Item_const *get_item_const() const + const Item_const *get_item_const() const override { switch (state) { case SHORT_DATA_VALUE: @@ -4056,47 +4062,47 @@ public: return NULL; } - bool const_is_null() const { return state == NULL_VALUE; } + bool const_is_null() const override { return state == NULL_VALUE; } bool can_return_const_value(Item_result type) const { return can_return_value() && value.type_handler()->cmp_type() == type && type_handler()->cmp_type() == type; } - const longlong *const_ptr_longlong() const + const longlong *const_ptr_longlong() const override { return can_return_const_value(INT_RESULT) ? &value.integer : NULL; } - const double *const_ptr_double() const + const double *const_ptr_double() const override { return can_return_const_value(REAL_RESULT) ? &value.real : NULL; } - const my_decimal *const_ptr_my_decimal() const + const my_decimal *const_ptr_my_decimal() const override { return can_return_const_value(DECIMAL_RESULT) ? &value.m_decimal : NULL; } - const MYSQL_TIME *const_ptr_mysql_time() const + const MYSQL_TIME *const_ptr_mysql_time() const override { return can_return_const_value(TIME_RESULT) ? &value.time : NULL; } - const String *const_ptr_string() const + const String *const_ptr_string() const override { return can_return_const_value(STRING_RESULT) ? &value.m_string : NULL; } - double val_real() + double val_real() override { return can_return_value() ? value.val_real() : 0e0; } - longlong val_int() + longlong val_int() override { return can_return_value() ? value.val_int(this) : 0; } - my_decimal *val_decimal(my_decimal *dec) + my_decimal *val_decimal(my_decimal *dec) override { return can_return_value() ? value.val_decimal(dec, this) : NULL; } - String *val_str(String *str) + String *val_str(String *str) override { return can_return_value() ? value.val_str(str, this) : NULL; } - bool get_date(THD *thd, MYSQL_TIME *tm, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to) + bool get_date(THD *thd, MYSQL_TIME *tm, date_mode_t fuzzydate) override; + bool val_native(THD *thd, Native *to) override { return Item_param::type_handler()->Item_param_val_native(thd, this, to); } - int save_in_field(Field *field, bool no_conversions); + int save_in_field(Field *field, bool no_conversions) override; void set_default(); void set_ignore(); @@ -4172,18 +4178,18 @@ public: so no one will use parameters value in fix_fields still parameter is constant during execution. */ - bool const_item() const + bool const_item() const override { return state != NO_VALUE; } - virtual table_map used_tables() const + table_map used_tables() const override { return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; } - virtual void print(String *str, enum_query_type query_type); - bool is_null() + void print(String *str, enum_query_type query_type) override; + bool is_null() override { DBUG_ASSERT(state != NO_VALUE); return state == NULL_VALUE; } - bool basic_const_item() const; + bool basic_const_item() const override; bool has_no_value() const { return state == NO_VALUE; @@ -4207,18 +4213,18 @@ public: constant, assert otherwise. This method is called only if basic_const_item returned TRUE. */ - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); - Item *clone_item(THD *thd); + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override; + Item *clone_item(THD *thd) override; void set_param_type_and_swap_value(Item_param *from); - Rewritable_query_parameter *get_rewritable_query_parameter() + Rewritable_query_parameter *get_rewritable_query_parameter() override { return this; } - Settable_routine_parameter *get_settable_routine_parameter() + Settable_routine_parameter *get_settable_routine_parameter() override { return m_is_settable_routine_parameter ? this : NULL; } - bool append_for_log(THD *thd, String *str); - bool check_vcol_func_processor(void *int_arg) {return FALSE;} - Item *get_copy(THD *thd) { return 0; } + bool append_for_log(THD *thd, String *str) override; + bool check_vcol_func_processor(void *int_arg) override {return FALSE;} + Item *get_copy(THD *thd) override { return 0; } bool add_as_clone(THD *thd); void sync_clones(); @@ -4226,17 +4232,15 @@ public: private: void invalid_default_param() const; - - virtual bool set_value(THD *thd, sp_rcontext *ctx, Item **it); - - virtual void set_out_param_info(Send_field *info); + bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override; + void set_out_param_info(Send_field *info) override; public: - virtual const Send_field *get_out_param_info() const; + const Send_field *get_out_param_info() const override; - Item_param *get_item_param() { return this; } + Item_param *get_item_param() override { return this; } - virtual void make_send_field(THD *thd, Send_field *field); + void make_send_field(THD *thd, Send_field *field) override; private: Send_field *m_out_param_info; @@ -4277,24 +4281,24 @@ public: unsigned_flag= flag; } Item_int(THD *thd, const char *str_arg, size_t length=64); - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return type_handler_long_or_longlong(); } - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) + Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) override { return tmp_table_field_from_field_type(root, table); } - const longlong *const_ptr_longlong() const { return &value; } - longlong val_int() { return value; } - longlong val_int_min() const { return value; } - double val_real() { return (double) value; } - my_decimal *val_decimal(my_decimal *); - String *val_str(String*); - int save_in_field(Field *field, bool no_conversions); - bool is_order_clause_position() const { return true; } - Item *clone_item(THD *thd); - virtual void print(String *str, enum_query_type query_type); - Item *neg(THD *thd); - uint decimal_precision() const + const longlong *const_ptr_longlong() const override { return &value; } + longlong val_int() override { return value; } + longlong val_int_min() const override { return value; } + double val_real() override { return (double) value; } + my_decimal *val_decimal(my_decimal *) override; + String *val_str(String*) override; + int save_in_field(Field *field, bool no_conversions) override; + bool is_order_clause_position() const override { return true; } + Item *clone_item(THD *thd) override; + void print(String *str, enum_query_type query_type) override; + Item *neg(THD *thd) override; + uint decimal_precision() const override { return (uint) (max_length - MY_TEST(value < 0)); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4310,14 +4314,14 @@ public: Item_bool(THD *thd, const char *str_arg, longlong i): Item_int(thd, str_arg, i, 1) {} Item_bool(THD *thd, bool i) :Item_int(thd, (longlong) i, 1) { } - bool is_bool_literal() const { return true; } - void print(String *str, enum_query_type query_type); - Item *neg_transformer(THD *thd); - const Type_handler *type_handler() const + bool is_bool_literal() const override { return true; } + void print(String *str, enum_query_type query_type) override; + Item *neg_transformer(THD *thd) override; + const Type_handler *type_handler() const override { return &type_handler_bool; } - const Type_handler *fixed_type_handler() const + const Type_handler *fixed_type_handler() const override { return &type_handler_bool; } - void quick_fix_field() + void quick_fix_field() override { /* We can get here when Item_bool is created instead of a constant @@ -4345,11 +4349,11 @@ public: Item_uint(THD *thd, const char *str_arg, size_t length); Item_uint(THD *thd, ulonglong i): Item_int(thd, i, 10) {} Item_uint(THD *thd, const char *str_arg, longlong i, uint length); - double val_real() { return ulonglong2double((ulonglong)value); } - Item *clone_item(THD *thd); - Item *neg(THD *thd); - uint decimal_precision() const { return max_length; } - Item *get_copy(THD *thd) + double val_real() override { return ulonglong2double((ulonglong)value); } + Item *clone_item(THD *thd) override; + Item *neg(THD *thd) override; + uint decimal_precision() const override{ return max_length; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4360,11 +4364,11 @@ protected: MYSQL_TIME ltime; public: Item_datetime(THD *thd): Item_int(thd, 0) { unsigned_flag=0; } - int save_in_field(Field *field, bool no_conversions); - longlong val_int(); - double val_real() { return (double)val_int(); } + int save_in_field(Field *field, bool no_conversions) override; + longlong val_int() override; + double val_real() override { return (double)val_int(); } void set(longlong packed, enum_mysql_timestamp_type ts_type); - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) override { *to= ltime; return false; @@ -4387,23 +4391,30 @@ public: Item_decimal(THD *thd, double val, int precision, int scale); Item_decimal(THD *thd, const uchar *bin, int precision, int scale); - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - longlong val_int() { return decimal_value.to_longlong(unsigned_flag); } - double val_real() { return decimal_value.to_double(); } - String *val_str(String *to) { return decimal_value.to_string(to); } - my_decimal *val_decimal(my_decimal *val) { return &decimal_value; } - const my_decimal *const_ptr_my_decimal() const { return &decimal_value; } - int save_in_field(Field *field, bool no_conversions); - Item *clone_item(THD *thd); - virtual void print(String *str, enum_query_type query_type) + const Type_handler *type_handler() const override + { return &type_handler_newdecimal; } + longlong val_int() override + { return decimal_value.to_longlong(unsigned_flag); } + double val_real() override + { return decimal_value.to_double(); } + 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 + { return &decimal_value; } + int save_in_field(Field *field, bool no_conversions) override; + Item *clone_item(THD *thd) override; + void print(String *str, enum_query_type query_type) override { decimal_value.to_string(&str_value); str->append(str_value); } - Item *neg(THD *thd); - uint decimal_precision() const { return decimal_value.precision(); } + Item *neg(THD *thd) override; + uint decimal_precision() const override + { return decimal_value.precision(); } void set_decimal_value(my_decimal *value_par); - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4427,11 +4438,12 @@ public: { decimals= (uint8) decimal_par; } - int save_in_field(Field *field, bool no_conversions); - const Type_handler *type_handler() const { return &type_handler_double; } - const double *const_ptr_double() const { return &value; } - double val_real() { return value; } - longlong val_int() + int save_in_field(Field *field, bool no_conversions) override; + const Type_handler *type_handler() const override + { return &type_handler_double; } + const double *const_ptr_double() const override { return &value; } + double val_real() override { return value; } + longlong val_int() override { if (value <= (double) LONGLONG_MIN) { @@ -4443,12 +4455,12 @@ public: } return (longlong) rint(value); } - String *val_str(String*); - my_decimal *val_decimal(my_decimal *); - Item *clone_item(THD *thd); - Item *neg(THD *thd); - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + String *val_str(String*) override; + my_decimal *val_decimal(my_decimal *) override; + Item *clone_item(THD *thd) override; + Item *neg(THD *thd) override; + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4462,12 +4474,12 @@ public: Item_float(thd, NullS, val_arg, decimal_par, length), func_name(str) {} - virtual inline void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { str->append(func_name, strlen(func_name)); } - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override { return const_charset_converter(thd, tocs, true, func_name); } @@ -4552,25 +4564,26 @@ public: { str_value.print(to); } - double val_real(); - longlong val_int(); - const String *const_ptr_string() const + double val_real() override; + longlong val_int() override; + const String *const_ptr_string() const override { return &str_value; } - String *val_str(String*) + String *val_str(String*) override { return (String*) &str_value; } - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_string(thd, ltime, fuzzydate); } - int save_in_field(Field *field, bool no_conversions); - const Type_handler *type_handler() const { return &type_handler_varchar; } - Item *clone_item(THD *thd); - Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) + int save_in_field(Field *field, bool no_conversions) override; + const Type_handler *type_handler() const override + { return &type_handler_varchar; } + Item *clone_item(THD *thd) override; + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override { return const_charset_converter(thd, tocs, true); } @@ -4579,7 +4592,7 @@ public: str_value.append(str, length); max_length= str_value.numchars() * collation.collation->mbmaxlen; } - virtual void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; /** Return TRUE if character-set-introducer was explicitly specified in the @@ -4609,10 +4622,10 @@ public: { return Item::check_well_formed_result(&str_value, send_error); } Item_basic_constant *make_string_literal_concat(THD *thd, - const LEX_CSTRING *); - Item *make_odbc_literal(THD *thd, const LEX_CSTRING *typestr); + const LEX_CSTRING *) override; + Item *make_odbc_literal(THD *thd, const LEX_CSTRING *typestr) override; - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4747,7 +4760,7 @@ public: { unsigned_flag=1; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { const Type_handler *h= Type_handler::get_handler_by_field_type(int_field_type); @@ -4773,14 +4786,15 @@ public: { hex_string_init(thd, str, str_length); } - const Type_handler *type_handler() const { return &type_handler_varchar; } - virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) + const Type_handler *type_handler() const override + { return &type_handler_varchar; } + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override { return const_charset_converter(thd, tocs, true); } - const String *const_ptr_string() const { return &str_value; } - String *val_str(String*) { return &str_value; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + const String *const_ptr_string() const override { return &str_value; } + String *val_str(String*) override { return &str_value; } + 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); } @@ -4798,29 +4812,30 @@ public: Item_hex_hybrid(THD *thd): Item_hex_constant(thd) {} Item_hex_hybrid(THD *thd, const char *str, size_t str_length): Item_hex_constant(thd, str, str_length) {} - const Type_handler *type_handler() const { return &type_handler_hex_hybrid; } - uint decimal_precision() const; - double val_real() + const Type_handler *type_handler() const override + { return &type_handler_hex_hybrid; } + uint decimal_precision() const override; + double val_real() override { return (double) (ulonglong) Item_hex_hybrid::val_int(); } - longlong val_int() + longlong val_int() override { return longlong_from_hex_hybrid(str_value.ptr(), str_value.length()); } - my_decimal *val_decimal(my_decimal *decimal_value) + my_decimal *val_decimal(my_decimal *decimal_value) override { longlong value= Item_hex_hybrid::val_int(); int2my_decimal(E_DEC_FATAL_ERROR, value, TRUE, decimal_value); return decimal_value; } - int save_in_field(Field *field, bool no_conversions) + int save_in_field(Field *field, bool no_conversions) override { field->set_notnull(); return field->store_hex_hybrid(str_value.ptr(), str_value.length()); } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4840,26 +4855,26 @@ public: Item_hex_string(THD *thd): Item_hex_constant(thd) {} Item_hex_string(THD *thd, const char *str, size_t str_length): Item_hex_constant(thd, str, str_length) {} - longlong val_int() + longlong val_int() override { return longlong_from_string_with_check(&str_value); } - double val_real() + double val_real() override { return double_from_string_with_check(&str_value); } - my_decimal *val_decimal(my_decimal *decimal_value) + my_decimal *val_decimal(my_decimal *decimal_value) override { return val_decimal_from_string(decimal_value); } - int save_in_field(Field *field, bool no_conversions) + int save_in_field(Field *field, bool no_conversions) override { field->set_notnull(); return field->store(str_value.ptr(), str_value.length(), collation.collation); } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4878,35 +4893,35 @@ public: Item_timestamp_literal(THD *thd) :Item_literal(thd) { } - const Type_handler *type_handler() const { return &type_handler_timestamp2; } - int save_in_field(Field *field, bool no_conversions) + const Type_handler *type_handler() const override { return &type_handler_timestamp2; } + int save_in_field(Field *field, bool no_conversions) override { Timestamp_or_zero_datetime_native native(m_value, decimals); return native.save_in_field(field, decimals); } - longlong val_int() + longlong val_int() override { return m_value.to_datetime(current_thd).to_longlong(); } - double val_real() + double val_real() override { return m_value.to_datetime(current_thd).to_double(); } - String *val_str(String *to) + String *val_str(String *to) override { return m_value.to_datetime(current_thd).to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { return m_value.to_datetime(current_thd).to_decimal(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 { bool res= m_value.to_TIME(thd, ltime, fuzzydate); DBUG_ASSERT(!res); return res; } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { return m_value.to_native(to, decimals); } @@ -4914,7 +4929,7 @@ public: { m_value= value; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4975,35 +4990,37 @@ public: set_maybe_null(cached_time.check_date(TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)); } - const Type_handler *type_handler() const { return &type_handler_newdate; } - void print(String *str, enum_query_type query_type); - const MYSQL_TIME *const_ptr_mysql_time() const +// <<<<<<< HEAD + const Type_handler *type_handler() const override + { return &type_handler_newdate; } + void print(String *str, enum_query_type query_type) override; + const MYSQL_TIME *const_ptr_mysql_time() const override { return cached_time.get_mysql_time(); } - Item *clone_item(THD *thd); - longlong val_int() + Item *clone_item(THD *thd) override; + longlong val_int() override { return update_null() ? 0 : cached_time.to_longlong(); } - double val_real() + double val_real() override { return update_null() ? 0 : cached_time.to_double(); } - String *val_str(String *to) + String *val_str(String *to) override { return update_null() ? 0 : cached_time.to_string(to); } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { return update_null() ? 0 : cached_time.to_decimal(to); } - longlong val_datetime_packed(THD *thd) + longlong val_datetime_packed(THD *thd) override { return update_null() ? 0 : cached_time.valid_date_to_packed(); } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -5011,7 +5028,7 @@ public: /** TIME'10:10:10' */ -class Item_time_literal: public Item_temporal_literal +class Item_time_literal final: public Item_temporal_literal { protected: Time cached_time; @@ -5023,27 +5040,30 @@ public: DBUG_ASSERT(cached_time.is_valid_time()); max_length= MIN_TIME_WIDTH + (decimals ? decimals + 1 : 0); } - const Type_handler *type_handler() const { return &type_handler_time2; } - void print(String *str, enum_query_type query_type); - const MYSQL_TIME *const_ptr_mysql_time() const + const Type_handler *type_handler() const override + { return &type_handler_time2; } + void print(String *str, enum_query_type query_type) override; + const MYSQL_TIME *const_ptr_mysql_time() const override { return cached_time.get_mysql_time(); } - Item *clone_item(THD *thd); - longlong val_int() { return cached_time.to_longlong(); } - double val_real() { return cached_time.to_double(); } - String *val_str(String *to) { return cached_time.to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) { return cached_time.to_decimal(to); } - longlong val_time_packed(THD *thd) + Item *clone_item(THD *thd) override; + longlong val_int() override { return cached_time.to_longlong(); } + double val_real() override { return cached_time.to_double(); } + String *val_str(String *to) override + { return cached_time.to_string(to, decimals); } + my_decimal *val_decimal(my_decimal *to) override + { return cached_time.to_decimal(to); } + longlong val_time_packed(THD *thd) override { return cached_time.valid_time_to_packed(); } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to) + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + bool val_native(THD *thd, Native *to) override { return Time(thd, this).to_native(to, decimals); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -5051,7 +5071,7 @@ public: /** TIMESTAMP'2001-01-01 10:20:30' */ -class Item_datetime_literal: public Item_temporal_literal +class Item_datetime_literal : public Item_temporal_literal { protected: Datetime cached_time; @@ -5071,35 +5091,36 @@ public: set_maybe_null(cached_time.check_date(TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)); } - const Type_handler *type_handler() const { return &type_handler_datetime2; } - void print(String *str, enum_query_type query_type); - const MYSQL_TIME *const_ptr_mysql_time() const + const Type_handler *type_handler() const override + { return &type_handler_datetime2; } + void print(String *str, enum_query_type query_type) override; + const MYSQL_TIME *const_ptr_mysql_time() const override { return cached_time.get_mysql_time(); } - Item *clone_item(THD *thd); - longlong val_int() + Item *clone_item(THD *thd) override; + longlong val_int() override { return update_null() ? 0 : cached_time.to_longlong(); } - double val_real() + double val_real() override { return update_null() ? 0 : cached_time.to_double(); } - String *val_str(String *to) + String *val_str(String *to) override { return update_null() ? NULL : cached_time.to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { return update_null() ? NULL : cached_time.to_decimal(to); } - longlong val_datetime_packed(THD *thd) + longlong val_datetime_packed(THD *thd) override { return update_null() ? 0 : cached_time.valid_datetime_to_packed(); } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -5115,7 +5136,7 @@ class Item_date_literal_for_invalid_dates: public Item_date_literal WHERE date_column='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. WHERE LENGTH(date_column)=10 AND date_column=TIME'00:00:00' @@ -5150,7 +5171,7 @@ public: An error-safe counterpart for Item_datetime_literal (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: Item_datetime_literal_for_invalid_dates(THD *thd, @@ -5317,7 +5338,7 @@ public: Used_tables_and_const_cache(item) { } Item_func_or_sum(THD *thd, List &list): Item_result_field(thd), Item_args(thd, list) { } - 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)) return true; @@ -5344,10 +5365,10 @@ public: { return (char*) func_name_cstring().str; } virtual LEX_CSTRING func_name_cstring() const= 0; virtual bool fix_length_and_dec()= 0; - bool const_item() const { return const_item_cache; } - table_map used_tables() const { return used_tables_cache; } - Item* build_clone(THD *thd); - Sql_mode_dependency value_depends_on_sql_mode() const + bool const_item() const override { return const_item_cache; } + table_map used_tables() const override { return used_tables_cache; } + Item* build_clone(THD *thd) override; + Sql_mode_dependency value_depends_on_sql_mode() const override { return Item_args::value_depends_on_sql_mode_bit_or().soft_to_hard(); } @@ -5432,55 +5453,58 @@ public: /* Constructor need to process subselect with temporary tables (see Item) */ Item_ref(THD *thd, Item_ref *item) :Item_ident(thd, item), set_properties_only(0), ref(item->ref) {} - enum Type type() const { return REF_ITEM; } - enum Type real_type() const { return ref ? (*ref)->type() : + enum Type type() const override { return REF_ITEM; } + enum Type real_type() const override { 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(); return ref && (*ref)->eq(it, binary_cmp); } - void save_val(Field *to); - void save_result(Field *to); - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - String *val_str(String* tmp); - bool val_native(THD *thd, Native *to); - bool is_null(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - longlong val_datetime_packed(THD *); - longlong val_time_packed(THD *); - double val_result(); - longlong val_int_result(); - String *str_result(String* tmp); - bool val_native_result(THD *thd, Native *to); - my_decimal *val_decimal_result(my_decimal *); - bool val_bool_result(); - bool is_null_result(); - bool send(Protocol *prot, st_value *buffer); - void make_send_field(THD *thd, Send_field *field); - bool fix_fields(THD *, Item **); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - int save_in_field(Field *field, bool no_conversions); - void save_org_in_field(Field *field, fast_field_copier optimizer_data); - fast_field_copier setup_fast_field_copier(Field *field) + void save_val(Field *to) override; + void save_result(Field *to) override; + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal *) override; + bool val_bool() override; + String *val_str(String* tmp) override; + bool val_native(THD *thd, Native *to) override; + bool is_null() override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + longlong val_datetime_packed(THD *) override; + longlong val_time_packed(THD *) override; + double val_result() override; + longlong val_int_result() override; + String *str_result(String* tmp) override; + bool val_native_result(THD *thd, Native *to) override; + my_decimal *val_decimal_result(my_decimal *) override; + bool val_bool_result() override; + bool is_null_result() override; + bool send(Protocol *prot, st_value *buffer) override; + void make_send_field(THD *thd, Send_field *field) override; + bool fix_fields(THD *, Item **) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) + override; + int save_in_field(Field *field, bool no_conversions) override; + void save_org_in_field(Field *field, fast_field_copier optimizer_data) + override; + fast_field_copier setup_fast_field_copier(Field *field) override { return (*ref)->setup_fast_field_copier(field); } - const Type_handler *type_handler() const { return (*ref)->type_handler(); } - const Type_handler *real_type_handler() const + const Type_handler *type_handler() const override + { return (*ref)->type_handler(); } + const Type_handler *real_type_handler() const override { return (*ref)->real_type_handler(); } - Field *get_tmp_table_field() + Field *get_tmp_table_field() override { return result_field ? result_field : (*ref)->get_tmp_table_field(); } - Item *get_tmp_table_item(THD *thd); + Item *get_tmp_table_item(THD *thd) override; Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param); - Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *); - table_map used_tables() const; - void update_used_tables(); + const Tmp_field_param *param) override; + Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *) override; + table_map used_tables() const override; + void update_used_tables() override; COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref) + COND_EQUAL **cond_equal_ref) override { /* normilize_cond() replaced all conditions of type @@ -5494,33 +5518,33 @@ public: return Item_ident::build_equal_items(thd, inherited, link_item_fields, cond_equal_ref); } - bool const_item() const + bool const_item() const override { return (*ref)->const_item(); } - table_map not_null_tables() const + table_map not_null_tables() const override { return depended_from ? 0 : (*ref)->not_null_tables(); } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return depended_from ? false : (*ref)->find_not_null_fields(allowed); } - void save_in_result_field(bool no_conversions) + void save_in_result_field(bool no_conversions) override { (*ref)->save_in_field(result_field, no_conversions); } - Item *real_item() + Item *real_item() override { return ref ? (*ref)->real_item() : this; } - const TYPELIB *get_typelib() const + const TYPELIB *get_typelib() const override { return ref ? (*ref)->get_typelib() : NULL; } - bool is_json_type() { return (*ref)->is_json_type(); } + bool is_json_type() override { return (*ref)->is_json_type(); } - bool walk(Item_processor processor, bool walk_subquery, void *arg) + bool walk(Item_processor processor, bool walk_subquery, void *arg) override { if (ref && *ref) return (*ref)->walk(processor, walk_subquery, arg) || @@ -5528,86 +5552,87 @@ public: else return FALSE; } - Item* transform(THD *thd, Item_transformer, uchar *arg); + Item* transform(THD *thd, Item_transformer, uchar *arg) override; Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, - Item_transformer transformer, uchar *arg_t); - bool enumerate_field_refs_processor(void *arg) + Item_transformer transformer, uchar *arg_t) override; + bool enumerate_field_refs_processor(void *arg) override { return (*ref)->enumerate_field_refs_processor(arg); } - void no_rows_in_result() + void no_rows_in_result() override { (*ref)->no_rows_in_result(); } - void restore_to_before_no_rows_in_result() + void restore_to_before_no_rows_in_result() override { (*ref)->restore_to_before_no_rows_in_result(); } - void print(String *str, enum_query_type query_type); - enum precedence precedence() const + void print(String *str, enum_query_type query_type) override; + enum precedence precedence() const override { return ref ? (*ref)->precedence() : DEFAULT_PRECEDENCE; } - void cleanup(); - Item_field *field_for_view_update() - { return (*ref)->field_for_view_update(); } - Load_data_outvar *get_load_data_outvar() + void cleanup() override; + Item_field *field_for_view_update() override + { return (*ref)->field_for_view_update(); } + Load_data_outvar *get_load_data_outvar() override { return (*ref)->get_load_data_outvar(); } virtual Ref_Type ref_type() { return REF; } // Row emulation: forwarding of ROW-related calls to ref - uint cols() const + uint cols() const override { return ref && result_type() == ROW_RESULT ? (*ref)->cols() : 1; } - Item* element_index(uint i) + Item* element_index(uint i) override { return ref && result_type() == ROW_RESULT ? (*ref)->element_index(i) : this; } - Item** addr(uint i) + Item** addr(uint i) override { return ref && result_type() == ROW_RESULT ? (*ref)->addr(i) : 0; } - bool check_cols(uint c) + bool check_cols(uint c) override { return ref && result_type() == ROW_RESULT ? (*ref)->check_cols(c) : Item::check_cols(c); } - bool null_inside() + bool null_inside() override { return ref && result_type() == ROW_RESULT ? (*ref)->null_inside() : 0; } - void bring_value() + void bring_value() override { if (ref && result_type() == ROW_RESULT) (*ref)->bring_value(); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function("ref", arg, VCOL_IMPOSSIBLE); } - bool basic_const_item() const { return ref && (*ref)->basic_const_item(); } - bool is_outer_field() const + bool basic_const_item() const override + { return ref && (*ref)->basic_const_item(); } + bool is_outer_field() const override { DBUG_ASSERT(fixed()); DBUG_ASSERT(ref); return (*ref)->is_outer_field(); } - Item* build_clone(THD *thd); - Item *get_copy(THD *thd) + Item* build_clone(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool excl_dep_on_table(table_map tab_map) + bool excl_dep_on_table(table_map tab_map) override { table_map used= used_tables(); if (used & OUTER_REF_TABLE_BIT) return false; return (used == tab_map) || (*ref)->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 (*ref)->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 (*ref)->excl_dep_on_in_subq_left_part(subq_pred); } - bool cleanup_excluding_fields_processor(void *arg) + bool cleanup_excluding_fields_processor(void *arg) override { Item *item= real_item(); if (item && item->type() == FIELD_ITEM && @@ -5615,7 +5640,7 @@ public: return 0; return cleanup_processor(arg); } - bool cleanup_excluding_const_fields_processor(void *arg) + bool cleanup_excluding_const_fields_processor(void *arg) override { Item *item= real_item(); if (item && item->type() == FIELD_ITEM && @@ -5623,9 +5648,9 @@ public: return 0; return cleanup_processor(arg); } - Item *field_transformer_for_having_pushdown(THD *thd, uchar *arg) + Item *field_transformer_for_having_pushdown(THD *thd, uchar *arg) override { return (*ref)->field_transformer_for_having_pushdown(thd, arg); } - Item *remove_item_direct_ref() + Item *remove_item_direct_ref() override { *ref= (*ref)->remove_item_direct_ref(); return this; @@ -5656,25 +5681,25 @@ public: alias_name_used_arg) {} - bool fix_fields(THD *thd, Item **it) + bool fix_fields(THD *thd, Item **it) override { if ((*ref)->fix_fields_if_needed_for_scalar(thd, ref)) return TRUE; return Item_ref::fix_fields(thd, it); } - void save_val(Field *to); - double val_real(); - longlong val_int(); - String *val_str(String* tmp); - bool val_native(THD *thd, Native *to); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - bool is_null(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - virtual Ref_Type ref_type() { return DIRECT_REF; } - Item *get_copy(THD *thd) + void save_val(Field *to) override; + double val_real() override; + longlong val_int() override; + String *val_str(String* tmp) override; + bool val_native(THD *thd, Native *to) override; + my_decimal *val_decimal(my_decimal *) override; + bool val_bool() override; + bool is_null() override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + Ref_Type ref_type() override { return DIRECT_REF; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *remove_item_direct_ref() + Item *remove_item_direct_ref() override { return (*ref)->remove_item_direct_ref(); } /* Should be called if ref is changed */ @@ -5749,104 +5774,109 @@ public: Item_cache_wrapper(THD *thd, Item *item_arg); ~Item_cache_wrapper(); - enum Type type() const { return EXPR_CACHE_ITEM; } - enum Type real_type() const { return orig_item->type(); } + enum Type type() const override { return EXPR_CACHE_ITEM; } + enum Type real_type() const override { return orig_item->type(); } bool set_cache(THD *thd); Expression_cache_tracker* init_tracker(MEM_ROOT *mem_root); - bool fix_fields(THD *thd, Item **it); - void cleanup(); + bool fix_fields(THD *thd, Item **it) override; + void cleanup() override; Item *get_orig_item() const { return orig_item; } /* Methods of getting value which should be cached in the cache */ - void save_val(Field *to); - double val_real(); - longlong val_int(); - String *val_str(String* tmp); - bool val_native(THD *thd, Native *to); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - bool is_null(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool send(Protocol *protocol, st_value *buffer); + void save_val(Field *to) override; + double val_real() override; + longlong val_int() override; + String *val_str(String* tmp) override; + bool val_native(THD *thd, Native *to) override; + my_decimal *val_decimal(my_decimal *) override; + bool val_bool() override; + bool is_null() override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool send(Protocol *protocol, st_value *buffer) override; void save_org_in_field(Field *field, fast_field_copier data __attribute__ ((__unused__))) + override { save_val(field); } - void save_in_result_field(bool no_conversions) + void save_in_result_field(bool no_conversions) override { save_val(result_field); } - Item* get_tmp_table_item(THD *thd_arg); + Item* get_tmp_table_item(THD *thd_arg) override; /* Following methods make this item transparent as much as possible */ - virtual void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; LEX_CSTRING full_name_cstring() const override { return orig_item->full_name_cstring(); } - virtual void make_send_field(THD *thd, Send_field *field) + void make_send_field(THD *thd, Send_field *field) override { orig_item->make_send_field(thd, field); } - 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(); return orig_item->eq(it, binary_cmp); } void fix_after_pullout(st_select_lex *new_parent, Item **refptr, bool merge) + override { orig_item->fix_after_pullout(new_parent, &orig_item, merge); } - int save_in_field(Field *to, bool no_conversions); - const Type_handler *type_handler() const { return orig_item->type_handler(); } - table_map used_tables() const { return orig_item->used_tables(); } - void update_used_tables() + int save_in_field(Field *to, bool no_conversions) override; + const Type_handler *type_handler() const override + { return orig_item->type_handler(); } + table_map used_tables() const override + { return orig_item->used_tables(); } + void update_used_tables() override { orig_item->update_used_tables(); } - bool const_item() const { return orig_item->const_item(); } - table_map not_null_tables() const { return orig_item->not_null_tables(); } - bool walk(Item_processor processor, bool walk_subquery, void *arg) + bool const_item() const override { return orig_item->const_item(); } + table_map not_null_tables() const override + { return orig_item->not_null_tables(); } + bool walk(Item_processor processor, bool walk_subquery, void *arg) override { return orig_item->walk(processor, walk_subquery, arg) || (this->*processor)(arg); } - bool enumerate_field_refs_processor(void *arg) + bool enumerate_field_refs_processor(void *arg) override { return orig_item->enumerate_field_refs_processor(arg); } - Item_field *field_for_view_update() + Item_field *field_for_view_update() override { return orig_item->field_for_view_update(); } /* Row emulation: forwarding of ROW-related calls to orig_item */ - uint cols() const + uint cols() const override { return result_type() == ROW_RESULT ? orig_item->cols() : 1; } - Item* element_index(uint i) + Item* element_index(uint i) override { return result_type() == ROW_RESULT ? orig_item->element_index(i) : this; } - Item** addr(uint i) + Item** addr(uint i) override { return result_type() == ROW_RESULT ? orig_item->addr(i) : 0; } - bool check_cols(uint c) + bool check_cols(uint c) override { return (result_type() == ROW_RESULT ? orig_item->check_cols(c) : Item::check_cols(c)); } - bool null_inside() + bool null_inside() override { return result_type() == ROW_RESULT ? orig_item->null_inside() : 0; } - void bring_value() + void bring_value() override { if (result_type() == ROW_RESULT) orig_item->bring_value(); } - bool is_expensive() { return orig_item->is_expensive(); } - bool is_expensive_processor(void *arg) + bool is_expensive() override { return orig_item->is_expensive(); } + bool is_expensive_processor(void *arg) override { return orig_item->is_expensive_processor(arg); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function("cache", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *build_clone(THD *thd) { return 0; } + Item *build_clone(THD *thd) override { return 0; } }; @@ -5894,9 +5924,9 @@ public: set_null_ref_table(); } - bool fix_fields(THD *, Item **); - bool eq(const Item *item, bool binary_cmp) const; - Item *get_tmp_table_item(THD *thd) + bool fix_fields(THD *, Item **) override; + bool eq(const Item *item, bool binary_cmp) const override; + Item *get_tmp_table_item(THD *thd) override { if (const_item()) return copy_or_same(thd); @@ -5904,94 +5934,94 @@ public: item->name= name; return item; } - virtual Ref_Type ref_type() { return VIEW_REF; } - Item_equal *get_item_equal() { return item_equal; } - void set_item_equal(Item_equal *item_eq) { item_equal= item_eq; } - Item_equal *find_item_equal(COND_EQUAL *cond_equal); - Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *); - Item *replace_equal_field(THD *thd, uchar *arg); - table_map used_tables() const; - void update_used_tables(); - table_map not_null_tables() const; - bool const_item() const { return used_tables() == 0; } + Ref_Type ref_type() override { return VIEW_REF; } + Item_equal *get_item_equal() override { return item_equal; } + void set_item_equal(Item_equal *item_eq) override { item_equal= item_eq; } + Item_equal *find_item_equal(COND_EQUAL *cond_equal) override; + Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *) override; + Item *replace_equal_field(THD *thd, uchar *arg) override; + table_map used_tables() const override; + void update_used_tables() override; + table_map not_null_tables() const override; + bool const_item() const override{ return used_tables() == 0; } TABLE *get_null_ref_table() const { return null_ref_table; } - bool walk(Item_processor processor, bool walk_subquery, void *arg) + bool walk(Item_processor processor, bool walk_subquery, void *arg) override { return (*ref)->walk(processor, walk_subquery, arg) || (this->*processor)(arg); } - bool view_used_tables_processor(void *arg) + bool view_used_tables_processor(void *arg) override { TABLE_LIST *view_arg= (TABLE_LIST *) arg; if (view_arg == view) view_arg->view_used_tables|= (*ref)->used_tables(); return 0; } - bool excl_dep_on_table(table_map tab_map); - bool excl_dep_on_grouping_fields(st_select_lex *sel); - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred); - Item *derived_field_transformer_for_having(THD *thd, uchar *arg); - Item *derived_field_transformer_for_where(THD *thd, uchar *arg); - Item *grouping_field_transformer_for_where(THD *thd, uchar *arg); - Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg); - Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg); + bool excl_dep_on_table(table_map tab_map) override; + bool excl_dep_on_grouping_fields(st_select_lex *sel) override; + bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) override; + Item *derived_field_transformer_for_having(THD *thd, uchar *arg) override; + Item *derived_field_transformer_for_where(THD *thd, uchar *arg) override; + Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) override; + Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) override; + Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) override; - void save_val(Field *to) + void save_val(Field *to) override { if (check_null_ref()) to->set_null(); else Item_direct_ref::save_val(to); } - double val_real() + double val_real() override { if (check_null_ref()) return 0; else return Item_direct_ref::val_real(); } - longlong val_int() + longlong val_int() override { if (check_null_ref()) return 0; else return Item_direct_ref::val_int(); } - String *val_str(String* tmp) + String *val_str(String* tmp) override { if (check_null_ref()) return NULL; else return Item_direct_ref::val_str(tmp); } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { if (check_null_ref()) return true; return Item_direct_ref::val_native(thd, to); } - my_decimal *val_decimal(my_decimal *tmp) + my_decimal *val_decimal(my_decimal *tmp) override { if (check_null_ref()) return NULL; else return Item_direct_ref::val_decimal(tmp); } - bool val_bool() + bool val_bool() override { if (check_null_ref()) return 0; else return Item_direct_ref::val_bool(); } - bool is_null() + bool is_null() override { if (check_null_ref()) return 1; else return Item_direct_ref::is_null(); } - 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 (check_null_ref()) { @@ -6000,16 +6030,17 @@ public: } return Item_direct_ref::get_date(thd, ltime, fuzzydate); } - bool send(Protocol *protocol, st_value *buffer); + bool send(Protocol *protocol, st_value *buffer) override; void save_org_in_field(Field *field, fast_field_copier data __attribute__ ((__unused__))) + override { if (check_null_ref()) field->set_null(); else Item_direct_ref::save_val(field); } - void save_in_result_field(bool no_conversions) + void save_in_result_field(bool no_conversions) override { if (check_null_ref()) result_field->set_null(); @@ -6017,7 +6048,7 @@ public: Item_direct_ref::save_in_result_field(no_conversions); } - void cleanup() + void cleanup() override { null_ref_table= NULL; item_equal= NULL; @@ -6026,17 +6057,17 @@ public: /* TODO move these val_*_result function to Item_dierct_ref (maybe) */ - double val_result(); - longlong val_int_result(); - String *str_result(String* tmp); - my_decimal *val_decimal_result(my_decimal *val); - bool val_bool_result(); + double val_result() override; + longlong val_int_result() override; + String *str_result(String* tmp) override; + my_decimal *val_decimal_result(my_decimal *val) override; + bool val_bool_result() override; - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *field_transformer_for_having_pushdown(THD *thd, uchar *arg) + Item *field_transformer_for_having_pushdown(THD *thd, uchar *arg) override { return this; } - Item *remove_item_direct_ref() { return this; } + Item *remove_item_direct_ref() override { return this; } }; @@ -6121,17 +6152,17 @@ public: const LEX_CSTRING &field_name_arg): Item_ref(thd, context_arg, item, table_name_arg, field_name_arg), owner(master) {} - void save_val(Field *to); - double val_real(); - longlong val_int(); - String* val_str(String* s); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to); - virtual void print(String *str, enum_query_type query_type); - table_map used_tables() const; - Item *get_copy(THD *thd) + void save_val(Field *to) override; + double val_real() override; + longlong val_int() override; + String* val_str(String* s) override; + my_decimal *val_decimal(my_decimal *) override; + bool val_bool() override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool val_native(THD *thd, Native *to) override; + void print(String *str, enum_query_type query_type) override; + table_map used_tables() const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -6239,23 +6270,23 @@ public: Item *get_item() { return item; } /** All of the subclasses should have the same type tag */ - enum Type type() const { return COPY_STR_ITEM; } + enum Type type() const override { return COPY_STR_ITEM; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } 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); return NULL; } - void make_send_field(THD *thd, Send_field *field) + void make_send_field(THD *thd, Send_field *field) override { item->make_send_field(thd, field); } - table_map used_tables() const { return (table_map) 1L; } - bool const_item() const { return 0; } - bool is_null() { return null_value; } - bool check_vcol_func_processor(void *arg) + table_map used_tables() const override { return (table_map) 1L; } + bool const_item() const override { return 0; } + bool is_null() override { return null_value; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function("copy", arg, VCOL_IMPOSSIBLE); } @@ -6264,13 +6295,12 @@ public: Override the methods below as pure virtual to make sure all the sub-classes implement them. */ - - virtual String *val_str(String*) = 0; - virtual my_decimal *val_decimal(my_decimal *) = 0; - virtual double val_real() = 0; - virtual longlong val_int() = 0; - virtual int save_in_field(Field *field, bool no_conversions) = 0; - bool walk(Item_processor processor, bool walk_subquery, void *args) + String *val_str(String*) override = 0; + my_decimal *val_decimal(my_decimal *) override = 0; + double val_real() override = 0; + longlong val_int() override = 0; + int save_in_field(Field *field, bool no_conversions) override = 0; + bool walk(Item_processor processor, bool walk_subquery, void *args) override { return (item->walk(processor, walk_subquery, args)) || (this->*processor)(args); @@ -6287,15 +6317,15 @@ class Item_copy_string : public Item_copy public: Item_copy_string(THD *thd, Item *item_arg): Item_copy(thd, item_arg) {} - String *val_str(String*); - my_decimal *val_decimal(my_decimal *); - double val_real(); - longlong val_int(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + String *val_str(String*) override; + my_decimal *val_decimal(my_decimal *) override; + double val_real() override; + longlong val_int() override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_string(thd, ltime, fuzzydate); } - void copy(); - int save_in_field(Field *field, bool no_conversions); - Item *get_copy(THD *thd) + void copy() override; + int save_in_field(Field *field, bool no_conversions) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -6313,15 +6343,16 @@ class Item_copy_timestamp: public Item_copy bool sane() const { return !null_value || m_value.is_zero_datetime(); } public: Item_copy_timestamp(THD *thd, Item *arg): Item_copy(thd, arg) { } - const Type_handler *type_handler() const { return &type_handler_timestamp2; } - void copy() + const Type_handler *type_handler() const override + { return &type_handler_timestamp2; } + void copy() override { Timestamp_or_zero_datetime_native_null tmp(current_thd, item, false); null_value= tmp.is_null(); m_value= tmp.is_null() ? Timestamp_or_zero_datetime() : Timestamp_or_zero_datetime(tmp); } - int save_in_field(Field *field, bool no_conversions) + int save_in_field(Field *field, bool no_conversions) override { DBUG_ASSERT(sane()); if (null_value) @@ -6329,43 +6360,43 @@ public: Timestamp_or_zero_datetime_native native(m_value, decimals); return native.save_in_field(field, decimals); } - longlong val_int() + longlong val_int() override { DBUG_ASSERT(sane()); return null_value ? 0 : m_value.to_datetime(current_thd).to_longlong(); } - double val_real() + double val_real() override { DBUG_ASSERT(sane()); return null_value ? 0e0 : m_value.to_datetime(current_thd).to_double(); } - String *val_str(String *to) + String *val_str(String *to) override { DBUG_ASSERT(sane()); return null_value ? NULL : m_value.to_datetime(current_thd).to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { DBUG_ASSERT(sane()); return null_value ? NULL : m_value.to_datetime(current_thd).to_decimal(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 { DBUG_ASSERT(sane()); bool res= m_value.to_TIME(thd, ltime, fuzzydate); DBUG_ASSERT(!res); return null_value || res; } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { DBUG_ASSERT(sane()); return null_value || m_value.to_native(to, decimals); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -6486,45 +6517,45 @@ public: Field *cached_field= nullptr; Item_default_value(THD *thd, Name_resolution_context *context_arg, Item *a) : Item_field(thd, context_arg), arg(a) {} - enum Type type() const { return DEFAULT_VALUE_ITEM; } - bool eq(const Item *item, bool binary_cmp) const; - bool fix_fields(THD *, Item **); - void cleanup(); - void print(String *str, enum_query_type query_type); - String *val_str(String *str); - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *decimal_value); - bool get_date(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate); - bool val_native(THD *thd, Native *to); - bool send(Protocol *protocol, st_value *buffer); - int save_in_field(Field *field_arg, bool no_conversions); - bool save_in_param(THD *thd, Item_param *param) + enum Type type() const override { return DEFAULT_VALUE_ITEM; } + bool eq(const Item *item, bool binary_cmp) const override; + bool fix_fields(THD *, Item **) override; + void cleanup() override; + void print(String *str, enum_query_type query_type) override; + String *val_str(String *str) override; + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal *decimal_value) override; + bool get_date(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate) override; + bool val_native(THD *thd, Native *to) override; + bool send(Protocol *protocol, st_value *buffer) override; + int save_in_field(Field *field_arg, bool no_conversions) override; + bool save_in_param(THD *thd, Item_param *param) override { // It should not be possible to have "EXECUTE .. USING DEFAULT(a)" DBUG_ASSERT(0); param->set_default(); return false; } - table_map used_tables() const; - virtual void update_used_tables() + table_map used_tables() const override; + void update_used_tables() override { if (field && field->default_value) field->default_value->expr->update_used_tables(); } - Field *get_tmp_table_field() { return 0; } - Item *get_tmp_table_item(THD *thd) { return this; } - Item_field *field_for_view_update() { return 0; } - bool update_vcol_processor(void *arg) { return 0; } - bool check_func_default_processor(void *arg) { return true; } + Field *get_tmp_table_field() override { return 0; } + Item *get_tmp_table_item(THD *thd) override { return this; } + Item_field *field_for_view_update() override { return 0; } + bool update_vcol_processor(void *arg) override { return 0; } + bool check_func_default_processor(void *arg) override { return true; } - bool walk(Item_processor processor, bool walk_subquery, void *args) + bool walk(Item_processor processor, bool walk_subquery, void *args) override { return (arg && arg->walk(processor, walk_subquery, args)) || (this->*processor)(args); } - Item *transform(THD *thd, Item_transformer transformer, uchar *args); + Item *transform(THD *thd, Item_transformer transformer, uchar *args) override; }; @@ -6533,55 +6564,55 @@ class Item_contextually_typed_value_specification: public Item public: Item_contextually_typed_value_specification(THD *thd) :Item(thd) { } - enum Type type() const { return CONTEXTUALLY_TYPED_VALUE_ITEM; } - bool vcol_assignment_allowed_value() const { return true; } - bool eq(const Item *item, bool binary_cmp) const + enum Type type() const override { return CONTEXTUALLY_TYPED_VALUE_ITEM; } + bool vcol_assignment_allowed_value() const override { return true; } + bool eq(const Item *item, bool binary_cmp) const override { return false; } - bool is_evaluable_expression() const { return false; } + bool is_evaluable_expression() const override { return false; } 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); return NULL; } - String *val_str(String *str) + String *val_str(String *str) override { DBUG_ASSERT(0); // never should be called null_value= true; return 0; } - double val_real() + double val_real() override { DBUG_ASSERT(0); // never should be called null_value= true; return 0.0; } - longlong val_int() + longlong val_int() override { DBUG_ASSERT(0); // never should be called null_value= true; return 0; } - my_decimal *val_decimal(my_decimal *decimal_value) + my_decimal *val_decimal(my_decimal *decimal_value) override { DBUG_ASSERT(0); // never should be called null_value= true; 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 { DBUG_ASSERT(0); // never should be called return (null_value= true); } - bool send(Protocol *protocol, st_value *buffer) + bool send(Protocol *protocol, st_value *buffer) override { DBUG_ASSERT(0); return true; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { DBUG_ASSERT(0); return &type_handler_null; @@ -6599,20 +6630,20 @@ public: Item_default_specification(THD *thd) :Item_contextually_typed_value_specification(thd) { } - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { str->append(STRING_WITH_LEN("default")); } - int save_in_field(Field *field_arg, bool no_conversions) + int save_in_field(Field *field_arg, bool no_conversions) override { return field_arg->save_in_field_default_value(false); } - bool save_in_param(THD *thd, Item_param *param) + bool save_in_param(THD *thd, Item_param *param) override { param->set_default(); return false; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -6632,21 +6663,21 @@ public: Item_ignore_specification(THD *thd) :Item_contextually_typed_value_specification(thd) { } - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { str->append(STRING_WITH_LEN("ignore")); } - int save_in_field(Field *field_arg, bool no_conversions) + int save_in_field(Field *field_arg, bool no_conversions) override { return field_arg->save_in_field_ignore_value(false); } - bool save_in_param(THD *thd, Item_param *param) + bool save_in_param(THD *thd, Item_param *param) override { param->set_ignore(); return false; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -6668,30 +6699,30 @@ public: Item_insert_value(THD *thd, Name_resolution_context *context_arg, Item *a) :Item_field(thd, context_arg), arg(a) {} - bool eq(const Item *item, bool binary_cmp) const; - bool fix_fields(THD *, Item **); - virtual void print(String *str, enum_query_type query_type); - int save_in_field(Field *field_arg, bool no_conversions) + bool eq(const Item *item, bool binary_cmp) const override; + bool fix_fields(THD *, Item **) override; + void print(String *str, enum_query_type query_type) override; + int save_in_field(Field *field_arg, bool no_conversions) override { return Item_field::save_in_field(field_arg, no_conversions); } - enum Type type() const { return INSERT_VALUE_ITEM; } + enum Type type() const override { return INSERT_VALUE_ITEM; } /* We use RAND_TABLE_BIT to prevent Item_insert_value from being treated as a constant and precalculated before execution */ - table_map used_tables() const { return RAND_TABLE_BIT; } + table_map used_tables() const override { return RAND_TABLE_BIT; } - Item_field *field_for_view_update() { return 0; } + Item_field *field_for_view_update() override { return 0; } - bool walk(Item_processor processor, bool walk_subquery, void *args) + bool walk(Item_processor processor, bool walk_subquery, void *args) override { return arg->walk(processor, walk_subquery, args) || (this->*processor)(args); } - bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool update_vcol_processor(void *arg) { return 0; } - bool check_vcol_func_processor(void *arg) + bool check_partition_func_processor(void *int_arg) override {return TRUE;} + bool update_vcol_processor(void *arg) override { return 0; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function("value()", arg, VCOL_IMPOSSIBLE); } @@ -6759,22 +6790,22 @@ Item_trigger_field(THD *thd, Name_resolution_context *context_arg, { } void setup_field(THD *thd, TABLE *table, GRANT_INFO *table_grant_info); - enum Type type() const { return TRIGGER_FIELD_ITEM; } - bool eq(const Item *item, bool binary_cmp) const; - bool fix_fields(THD *, Item **); - virtual void print(String *str, enum_query_type query_type); - table_map used_tables() const { return (table_map)0L; } - Field *get_tmp_table_field() { return 0; } - Item *copy_or_same(THD *thd) { return this; } - Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); } - void cleanup(); + enum Type type() const override { return TRIGGER_FIELD_ITEM; } + bool eq(const Item *item, bool binary_cmp) const override; + bool fix_fields(THD *, Item **) override; + void print(String *str, enum_query_type query_type) override; + table_map used_tables() const override { return (table_map)0L; } + Field *get_tmp_table_field() override { return 0; } + Item *copy_or_same(THD *thd) override { return this; } + Item *get_tmp_table_item(THD *thd) override { return copy_or_same(thd); } + void cleanup() override; private: - void set_required_privilege(bool rw); - bool set_value(THD *thd, sp_rcontext *ctx, Item **it); + void set_required_privilege(bool rw) override; + bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override; public: - Settable_routine_parameter *get_settable_routine_parameter() + Settable_routine_parameter *get_settable_routine_parameter() override { return (read_only ? 0 : this); } @@ -6785,8 +6816,8 @@ public: } public: - bool unknown_splocal_processor(void *arg) { return false; } - bool check_vcol_func_processor(void *arg); + bool unknown_splocal_processor(void *arg) override { return false; } + bool check_vcol_func_processor(void *arg) override; }; @@ -6853,28 +6884,28 @@ public: }; void set_used_tables(table_map map) { used_table_map= map; } - table_map used_tables() const { return used_table_map; } - enum Type type() const { return CACHE_ITEM; } + table_map used_tables() const override { return used_table_map; } + enum Type type() const override { return CACHE_ITEM; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } 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); } virtual void keep_array() {} - virtual void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; bool eq_def(const Field *field) { return cached_field ? cached_field->eq_def (field) : FALSE; } - bool eq(const Item *item, bool binary_cmp) const + bool eq(const Item *item, bool binary_cmp) const override { return this == item; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { if (example) { @@ -6890,7 +6921,7 @@ public: } return mark_unsupported_function("cache", arg, VCOL_IMPOSSIBLE); } - void cleanup() + void cleanup() override { clear(); Item::cleanup(); @@ -6908,17 +6939,17 @@ public: virtual void store(Item *item); virtual Item *get_item() { return example; } virtual bool cache_value()= 0; - bool basic_const_item() const + bool basic_const_item() const override { return example && example->basic_const_item(); } virtual void clear() { null_value= TRUE; value_cached= FALSE; } - bool is_null() { return !has_value(); } - virtual bool is_expensive() + bool is_null() override { return !has_value(); } + bool is_expensive() override { if (value_cached) return false; return example->is_expensive(); } - bool is_expensive_processor(void *arg) + bool is_expensive_processor(void *arg) override { DBUG_ASSERT(example); if (value_cached) @@ -6926,7 +6957,7 @@ public: return example->is_expensive_processor(arg); } virtual void set_null(); - bool walk(Item_processor processor, bool walk_subquery, void *arg) + bool walk(Item_processor processor, bool walk_subquery, void *arg) override { if (arg == STOP_PTR) return FALSE; @@ -6934,7 +6965,7 @@ public: return TRUE; return (this->*processor)(arg); } - virtual Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs); + Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override; void split_sum_func2_example(THD *thd, Ref_ptr_array ref_pointer_array, List &fields, uint flags) { @@ -6943,15 +6974,15 @@ public: Item *get_example() const { return example; } virtual Item *convert_to_basic_const_item(THD *thd) { return 0; }; - Item *derived_field_transformer_for_having(THD *thd, uchar *arg) + Item *derived_field_transformer_for_having(THD *thd, uchar *arg) override { return convert_to_basic_const_item(thd); } - Item *derived_field_transformer_for_where(THD *thd, uchar *arg) + Item *derived_field_transformer_for_where(THD *thd, uchar *arg) override { return convert_to_basic_const_item(thd); } - Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) + Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) override { return convert_to_basic_const_item(thd); } - Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) + Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) override { return convert_to_basic_const_item(thd); } - Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) + Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) override { return convert_to_basic_const_item(thd); } }; @@ -6964,16 +6995,16 @@ public: Item_cache_int(THD *thd, const Type_handler *handler): Item_cache(thd, handler), value(0) {} - double val_real(); - longlong val_int(); - String* val_str(String *str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + double val_real() override; + longlong val_int() override; + String* val_str(String *str) override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_int(thd, ltime, fuzzydate); } - bool cache_value(); - int save_in_field(Field *field, bool no_conversions); - Item *convert_to_basic_const_item(THD *thd); - Item *get_copy(THD *thd) + bool cache_value() override; + int save_in_field(Field *field, bool no_conversions) override; + Item *convert_to_basic_const_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -7022,36 +7053,36 @@ class Item_cache_time: public Item_cache_temporal public: Item_cache_time(THD *thd) :Item_cache_temporal(thd, &type_handler_time2) { } - bool cache_value(); - Item *get_copy(THD *thd) + bool cache_value() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *make_literal(THD *); - longlong val_datetime_packed(THD *thd) + Item *make_literal(THD *) override; + longlong val_datetime_packed(THD *thd) override { Datetime::Options_cmp opt(thd); return has_value() ? Datetime(thd, this, opt).to_packed() : 0; } - longlong val_time_packed(THD *thd) + longlong val_time_packed(THD *thd) override { return has_value() ? value : 0; } - longlong val_int() + longlong val_int() override { return has_value() ? Time(this).to_longlong() : 0; } - double val_real() + double val_real() override { return has_value() ? Time(this).to_double() : 0; } - String *val_str(String *to) + String *val_str(String *to) override { return has_value() ? Time(this).to_string(to, decimals) : NULL; } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { return has_value() ? Time(this).to_decimal(to) : NULL; } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { return has_value() ? Time(thd, this).to_native(to, decimals) : true; } @@ -7063,30 +7094,30 @@ class Item_cache_datetime: public Item_cache_temporal public: Item_cache_datetime(THD *thd) :Item_cache_temporal(thd, &type_handler_datetime2) { } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *make_literal(THD *); - longlong val_datetime_packed(THD *thd) + Item *make_literal(THD *) override; + longlong val_datetime_packed(THD *thd) override { return has_value() ? value : 0; } - longlong val_time_packed(THD *thd) + longlong val_time_packed(THD *thd) override { return Time(thd, this, Time::Options_cmp(thd)).to_packed(); } - longlong val_int() + longlong val_int() override { return has_value() ? Datetime(this).to_longlong() : 0; } - double val_real() + double val_real() override { return has_value() ? Datetime(this).to_double() : 0; } - String *val_str(String *to) + String *val_str(String *to) override { return has_value() ? Datetime(this).to_string(to, decimals) : NULL; } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { return has_value() ? Datetime(this).to_decimal(to) : NULL; } @@ -7098,24 +7129,26 @@ class Item_cache_date: public Item_cache_temporal public: Item_cache_date(THD *thd) :Item_cache_temporal(thd, &type_handler_newdate) { } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *make_literal(THD *); - longlong val_datetime_packed(THD *thd) + Item *make_literal(THD *) override; + longlong val_datetime_packed(THD *thd) override { return has_value() ? value : 0; } - longlong val_time_packed(THD *thd) + longlong val_time_packed(THD *thd) override { return Time(thd, this, Time::Options_cmp(thd)).to_packed(); } - longlong val_int() { return has_value() ? Date(this).to_longlong() : 0; } - double val_real() { return has_value() ? Date(this).to_double() : 0; } - String *val_str(String *to) + longlong val_int() override + { return has_value() ? Date(this).to_longlong() : 0; } + double val_real() override + { return has_value() ? Date(this).to_double() : 0; } + String *val_str(String *to) override { return has_value() ? Date(this).to_string(to) : NULL; } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { return has_value() ? Date(this).to_decimal(to) : NULL; } @@ -7129,37 +7162,37 @@ class Item_cache_timestamp: public Item_cache public: Item_cache_timestamp(THD *thd) :Item_cache(thd, &type_handler_timestamp2) { } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool cache_value(); - String* val_str(String *to) + bool cache_value() override; + String *val_str(String *to) override { return to_datetime(current_thd).to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { return to_datetime(current_thd).to_decimal(to); } - longlong val_int() + longlong val_int() override { return to_datetime(current_thd).to_longlong(); } - double val_real() + double val_real() override { return to_datetime(current_thd).to_double(); } - longlong val_datetime_packed(THD *thd) + longlong val_datetime_packed(THD *thd) override { return to_datetime(current_thd).to_packed(); } - longlong val_time_packed(THD *thd) + longlong val_time_packed(THD *thd) override { DBUG_ASSERT(0); return 0; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - int save_in_field(Field *field, bool no_conversions); - bool val_native(THD *thd, Native *to); + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + int save_in_field(Field *field, bool no_conversions) override; + bool val_native(THD *thd, Native *to) override; }; @@ -7172,13 +7205,13 @@ public: :Item_cache(thd, h), value(0) {} - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_real(thd, ltime, fuzzydate); } - bool cache_value(); - Item *convert_to_basic_const_item(THD *thd); + bool cache_value() override; + Item *convert_to_basic_const_item(THD *thd) override; }; @@ -7188,8 +7221,8 @@ public: Item_cache_double(THD *thd) :Item_cache_real(thd, &type_handler_double) { } - String* val_str(String *str); - Item *get_copy(THD *thd) + String *val_str(String *str) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -7200,8 +7233,8 @@ public: Item_cache_float(THD *thd) :Item_cache_real(thd, &type_handler_float) { } - String* val_str(String *str); - Item *get_copy(THD *thd) + String *val_str(String *str) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -7213,18 +7246,18 @@ protected: public: Item_cache_decimal(THD *thd): Item_cache(thd, &type_handler_newdecimal) {} - double val_real(); - longlong val_int(); - String* val_str(String *str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) + double val_real() override; + longlong val_int() override; + String* val_str(String *str) override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) override { return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, NULL, NULL); } - bool cache_value(); - Item *convert_to_basic_const_item(THD *thd); - Item *get_copy(THD *thd) + bool cache_value() override; + Item *convert_to_basic_const_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -7244,17 +7277,17 @@ public: { collation.set(const_cast(item->collation)); } - double val_real(); - longlong val_int(); - String* val_str(String *); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + double val_real() override; + longlong val_int() override; + String* val_str(String *) override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_string(thd, ltime, fuzzydate); } CHARSET_INFO *charset() const { return value->charset(); }; - int save_in_field(Field *field, bool no_conversions); - bool cache_value(); - Item *convert_to_basic_const_item(THD *thd); - Item *get_copy(THD *thd) + int save_in_field(Field *field, bool no_conversions) override; + bool cache_value() override; + Item *convert_to_basic_const_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -7265,7 +7298,7 @@ public: Item_cache_str_for_nullif(THD *thd, const Item *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 @@ -7279,7 +7312,7 @@ public: */ return Item::safe_charset_converter(thd, tocs); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -7298,52 +7331,52 @@ public: 'allocate' used only in row transformer, to preallocate space for row cache. */ - bool allocate(THD *thd, uint num); + bool allocate(THD *thd, uint num) override; /* 'setup' is needed only by row => it not called by simple row subselect (only by IN subselect (in subselect optimizer)) */ - bool setup(THD *thd, Item *item); - void store(Item *item); + bool setup(THD *thd, Item *item) override; + void store(Item *item) override; void illegal_method_call(const char *); - 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"); }; - double val_real() + double val_real() override { illegal_method_call((const char*)"val"); return 0; }; - longlong val_int() + longlong val_int() override { illegal_method_call((const char*)"val_int"); return 0; }; - String *val_str(String *) + String *val_str(String *) override { illegal_method_call((const char*)"val_str"); return 0; }; - my_decimal *val_decimal(my_decimal *val) + my_decimal *val_decimal(my_decimal *val) override { illegal_method_call((const char*)"val_decimal"); 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*)"val_decimal"); return true; } - uint cols() const { return item_count; } - Item *element_index(uint i) { return values[i]; } - Item **addr(uint i) { return (Item **) (values + i); } - bool check_cols(uint c); - bool null_inside(); - void bring_value(); - void keep_array() { save_array= 1; } - void cleanup() + uint cols() const override { return item_count; } + Item *element_index(uint i) override { return values[i]; } + Item **addr(uint i) override { return (Item **) (values + i); } + bool check_cols(uint c) override; + bool null_inside() override; + void bring_value() override; + void keep_array() override { save_array= 1; } + void cleanup() override { DBUG_ENTER("Item_cache_row::cleanup"); Item_cache::cleanup(); @@ -7353,9 +7386,9 @@ public: values= 0; DBUG_VOID_RETURN; } - bool cache_value(); - virtual void set_null(); - Item *get_copy(THD *thd) + bool cache_value() override; + void set_null() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -7390,18 +7423,18 @@ public: item_base_t::IS_IN_WITH_CYCLE); } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler()-> type_handler_for_item_field(); } - const Type_handler *real_type_handler() const + const Type_handler *real_type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } - enum Type type() const { return TYPE_HOLDER; } - const TYPELIB *get_typelib() const { return enum_set_typelib; } + enum Type type() const override { return TYPE_HOLDER; } + const TYPELIB *get_typelib() const override { return enum_set_typelib; } /* When handling a query like this: VALUES ('') UNION VALUES( _utf16 0x0020 COLLATE utf16_bin); @@ -7417,21 +7450,21 @@ public: So st_select_lex_unit::join_union_type_attributes() could ask it to do (a) only, without (b). */ - bool const_item() const { return false; } - bool is_expensive() { return true; } - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - String *val_str(String*); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); + bool const_item() const override { return false; } + bool is_expensive() override { return true; } + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal *) override; + String *val_str(String*) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; 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 Item_type_holder::real_type_handler()-> make_and_init_table_field(root, &name, Record_addr(maybe_null()), *this, table); } - Item* get_copy(THD *thd) { return 0; } + Item* get_copy(THD *thd) override { return 0; } }; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 74484fd91fe..500ff9a3e40 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -222,12 +222,14 @@ public: Item_bool_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {} Item_bool_func(THD *thd, List &list): Item_int_func(thd, list) { } Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {} - const Type_handler *type_handler() const { return &type_handler_bool; } - const Type_handler *fixed_type_handler() const { return &type_handler_bool; } - CHARSET_INFO *compare_collation() const { return NULL; } - bool fix_length_and_dec() { decimals=0; max_length=1; return FALSE; } - uint decimal_precision() const { return 1; } - bool need_parentheses_in_default() { return true; } + const Type_handler *type_handler() const override + { return &type_handler_bool; } + const Type_handler *fixed_type_handler() const override + { return &type_handler_bool; } + CHARSET_INFO *compare_collation() const override { return NULL; } + bool fix_length_and_dec() override { decimals=0; max_length=1; return FALSE; } + uint decimal_precision() const override { return 1; } + bool need_parentheses_in_default() override { return true; } }; @@ -239,11 +241,11 @@ public: class Item_func_truth : public Item_bool_func { public: - virtual bool val_bool(); - virtual longlong val_int(); - virtual bool fix_length_and_dec(); - virtual void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return CMP_PRECEDENCE; } + bool val_bool() override; + longlong val_int() override; + bool fix_length_and_dec() override; + void print(String *str, enum_query_type query_type) override; + enum precedence precedence() const override { return CMP_PRECEDENCE; } protected: Item_func_truth(THD *thd, Item *a, bool a_value, bool a_affirmative): @@ -279,7 +281,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("istrue") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -299,10 +301,11 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("isnottrue") }; return name; } - bool find_not_null_fields(table_map allowed) { return false; } - Item *get_copy(THD *thd) + bool find_not_null_fields(table_map allowed) override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool eval_not_null_tables(void *) { not_null_tables_cache= 0; return false; } + bool eval_not_null_tables(void *) override + { not_null_tables_cache= 0; return false; } }; @@ -320,7 +323,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("isfalse") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -340,10 +343,11 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("isnotfalse") }; return name; } - bool find_not_null_fields(table_map allowed) { return false; } - Item *get_copy(THD *thd) + bool find_not_null_fields(table_map allowed) override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool eval_not_null_tables(void *) { not_null_tables_cache= 0; return false; } + bool eval_not_null_tables(void *) override + { not_null_tables_cache= 0; return false; } }; @@ -533,7 +537,7 @@ class Item_bool_rowready_func2 :public Item_bool_func2_with_rev { protected: Arg_comparator cmp; - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_like_args0(); } @@ -541,15 +545,16 @@ public: Item_bool_rowready_func2(THD *thd, Item *a, Item *b): Item_bool_func2_with_rev(thd, a, b), cmp(tmp_arg, tmp_arg + 1) { } - Sql_mode_dependency value_depends_on_sql_mode() const; - void print(String *str, enum_query_type query_type) + Sql_mode_dependency value_depends_on_sql_mode() const override; + void print(String *str, enum_query_type query_type) override { Item_func::print_op(str, query_type); } - enum precedence precedence() const { return CMP_PRECEDENCE; } - Item *neg_transformer(THD *thd); + enum precedence precedence() const override { return CMP_PRECEDENCE; } + Item *neg_transformer(THD *thd) override; virtual Item *negated_item(THD *thd); - 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(ANY_SUBST, @@ -558,30 +563,31 @@ public: cond); return this; } - bool fix_length_and_dec(); + bool fix_length_and_dec() override; int set_cmp_func(THD *thd) { return cmp.set_cmp_func(thd, this, tmp_arg, tmp_arg + 1, true); } - CHARSET_INFO *compare_collation() const { return cmp.compare_collation(); } - const Type_handler *compare_type_handler() const + CHARSET_INFO *compare_collation() const override + { return cmp.compare_collation(); } + const Type_handler *compare_type_handler() const override { return cmp.compare_type_handler(); } Arg_comparator *get_comparator() { return &cmp; } - void cleanup() + void cleanup() override { Item_bool_func2::cleanup(); cmp.cleanup(); } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, 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, usable_tables, sargables, false); } - Item *build_clone(THD *thd) + Item *build_clone(THD *thd) override { Item_bool_rowready_func2 *clone= (Item_bool_rowready_func2 *) Item_func::build_clone(thd); @@ -602,24 +608,24 @@ class Item_func_xor :public Item_bool_func { public: Item_func_xor(THD *thd, Item *i1, Item *i2): Item_bool_func(thd, i1, i2) {} - enum Functype functype() const { return XOR_FUNC; } + enum Functype functype() const override { return XOR_FUNC; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("xor") }; return name; } - enum precedence precedence() const { return XOR_PRECEDENCE; } - void print(String *str, enum_query_type query_type) + enum precedence precedence() const override { return XOR_PRECEDENCE; } + void print(String *str, enum_query_type query_type) override { Item_func::print_op(str, query_type); } - longlong val_int(); - bool find_not_null_fields(table_map allowed) { return false; } - Item *neg_transformer(THD *thd); - Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + longlong val_int() override; + bool find_not_null_fields(table_map allowed) override { return false; } + Item *neg_transformer(THD *thd) override; + Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) override { Item_args::propagate_equal_fields(thd, Context_boolean(), cond); return this; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -684,19 +690,19 @@ class Item_func_trig_cond: public Item_bool_func public: Item_func_trig_cond(THD *thd, Item *a, bool *f): Item_bool_func(thd, a) { trig_var= f; } - longlong val_int() { return *trig_var ? args[0]->val_int() : 1; } - enum Functype functype() const { return TRIG_COND_FUNC; }; + longlong val_int() override { return *trig_var ? args[0]->val_int() : 1; } + enum Functype functype() const override { return TRIG_COND_FUNC; }; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("trigcond") }; return name; } - bool const_item() const { return FALSE; } + bool const_item() const override { return FALSE; } bool *get_trig_var() { return trig_var; } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - Item *get_copy(THD *thd) + SARGABLE_PARAM **sargables) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -712,21 +718,21 @@ public: Item_func_not_all(THD *thd, Item *a): Item_func_not(thd, a), test_sum_item(0), test_sub_item(0), show(0) {} - table_map not_null_tables() const { return 0; } - longlong val_int(); - enum Functype functype() const { return NOT_ALL_FUNC; } + table_map not_null_tables() const override { return 0; } + longlong val_int() override; + enum Functype functype() const override { return NOT_ALL_FUNC; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("") }; return name; } - bool fix_fields(THD *thd, Item **ref) - {return Item_func::fix_fields(thd, ref);} - virtual void print(String *str, enum_query_type query_type); + bool fix_fields(THD *thd, Item **ref) override + { return Item_func::fix_fields(thd, ref);} + void print(String *str, enum_query_type query_type) override; void set_sum_test(Item_sum_min_max *item) { test_sum_item= item; test_sub_item= 0; }; void set_sub_test(Item_maxmin_subselect *item) { test_sub_item= item; test_sum_item= 0;}; bool empty_underlying_subquery(); - Item *neg_transformer(THD *thd); + Item *neg_transformer(THD *thd) override; }; @@ -735,14 +741,14 @@ class Item_func_nop_all :public Item_func_not_all public: Item_func_nop_all(THD *thd, Item *a): Item_func_not_all(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("") }; return name; } - Item *neg_transformer(THD *thd); - Item *get_copy(THD *thd) + Item *neg_transformer(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -755,28 +761,28 @@ public: Item_bool_rowready_func2(thd, a, b), abort_on_null(false), in_equality_no(UINT_MAX) {} - longlong val_int(); - enum Functype functype() const { return EQ_FUNC; } - enum Functype rev_functype() const { return EQ_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } + longlong val_int() override; + enum Functype functype() const override { return EQ_FUNC; } + enum Functype rev_functype() const override { return EQ_FUNC; } + cond_result eq_cmp_result() const override { return COND_TRUE; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("=") }; return name; } - void top_level_item() { abort_on_null= true; } - Item *negated_item(THD *thd); + void top_level_item() override { abort_on_null= true; } + Item *negated_item(THD *thd) override; COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref); + COND_EQUAL **cond_equal_ref) override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, 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, usable_tables, sargables, true); } - bool check_equality(THD *thd, COND_EQUAL *cond, List *eq_list); + bool check_equality(THD *thd, COND_EQUAL *cond, List *eq_list) override; /* - If this equality is created from the subquery's IN-equality: number of the item it was created from, e.g. for @@ -785,9 +791,9 @@ public: - Otherwise, UINT_MAX */ uint in_equality_no; - virtual uint exists2in_reserved_items() { return 1; }; + uint exists2in_reserved_items() override { return 1; }; friend class Arg_comparator; - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -796,27 +802,27 @@ class Item_func_equal final :public Item_bool_rowready_func2 public: Item_func_equal(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {} - longlong val_int(); - bool fix_length_and_dec(); - table_map not_null_tables() const { return 0; } - bool find_not_null_fields(table_map allowed) { return false; } - enum Functype functype() const { return EQUAL_FUNC; } - enum Functype rev_functype() const { return EQUAL_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } + longlong val_int() override; + bool fix_length_and_dec() override; + table_map not_null_tables() const override { return 0; } + bool find_not_null_fields(table_map allowed) override { return false; } + enum Functype functype() const override { return EQUAL_FUNC; } + enum Functype rev_functype() const override { return EQUAL_FUNC; } + cond_result eq_cmp_result() const override { return COND_TRUE; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("<=>") }; return name; } - Item *neg_transformer(THD *thd) { return 0; } + Item *neg_transformer(THD *thd) override { return 0; } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, 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, usable_tables, sargables, true); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -826,17 +832,17 @@ class Item_func_ge :public Item_bool_rowready_func2 public: Item_func_ge(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {}; - longlong val_int(); - enum Functype functype() const { return GE_FUNC; } - enum Functype rev_functype() const { return LE_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } + longlong val_int() override; + enum Functype functype() const override { return GE_FUNC; } + enum Functype rev_functype() const override { return LE_FUNC; } + cond_result eq_cmp_result() const override { return COND_TRUE; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN(">=") }; return name; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) + Item *negated_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -846,17 +852,17 @@ class Item_func_gt :public Item_bool_rowready_func2 public: Item_func_gt(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {}; - longlong val_int(); - enum Functype functype() const { return GT_FUNC; } - enum Functype rev_functype() const { return LT_FUNC; } - cond_result eq_cmp_result() const { return COND_FALSE; } + longlong val_int() override; + enum Functype functype() const override { return GT_FUNC; } + enum Functype rev_functype() const override { return LT_FUNC; } + cond_result eq_cmp_result() const override { return COND_FALSE; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN(">") }; return name; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) + Item *negated_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -866,17 +872,17 @@ class Item_func_le :public Item_bool_rowready_func2 public: Item_func_le(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {}; - longlong val_int(); - enum Functype functype() const { return LE_FUNC; } - enum Functype rev_functype() const { return GE_FUNC; } - cond_result eq_cmp_result() const { return COND_TRUE; } + longlong val_int() override; + enum Functype functype() const override { return LE_FUNC; } + enum Functype rev_functype() const override { return GE_FUNC; } + cond_result eq_cmp_result() const override { return COND_TRUE; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("<=") }; return name; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) + Item *negated_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -886,17 +892,17 @@ class Item_func_lt :public Item_bool_rowready_func2 public: Item_func_lt(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {} - longlong val_int(); - enum Functype functype() const { return LT_FUNC; } - enum Functype rev_functype() const { return GT_FUNC; } - cond_result eq_cmp_result() const { return COND_FALSE; } + longlong val_int() override; + enum Functype functype() const override { return LT_FUNC; } + enum Functype rev_functype() const override { return GT_FUNC; } + cond_result eq_cmp_result() const override { return COND_FALSE; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("<") }; return name; } - Item *negated_item(THD *thd); - Item *get_copy(THD *thd) + Item *negated_item(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -905,7 +911,7 @@ class Item_func_ne :public Item_bool_rowready_func2 { protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) + Field *field, Item *value) override { DBUG_ENTER("Item_func_ne::get_func_mm_tree"); DBUG_RETURN(get_ne_mm_tree(param, field, value, value)); @@ -913,19 +919,19 @@ protected: public: Item_func_ne(THD *thd, Item *a, Item *b): Item_bool_rowready_func2(thd, a, b) {} - longlong val_int(); - enum Functype functype() const { return NE_FUNC; } - enum Functype rev_functype() const { return NE_FUNC; } - cond_result eq_cmp_result() const { return COND_FALSE; } + longlong val_int() override; + enum Functype functype() const override { return NE_FUNC; } + enum Functype rev_functype() const override { return NE_FUNC; } + cond_result eq_cmp_result() const override { return COND_FALSE; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("<>") }; return name; } - Item *negated_item(THD *thd); + Item *negated_item(THD *thd) override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - Item *get_copy(THD *thd) + table_map usable_tables, SARGABLE_PARAM **sargables) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -981,41 +987,43 @@ class Item_func_between :public Item_func_opt_neg { protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value); + Field *field, Item *value) override; bool val_int_cmp_int_finalize(longlong value, longlong a, longlong b); public: String value0,value1,value2; Item_func_between(THD *thd, Item *a, Item *b, Item *c): Item_func_opt_neg(thd, a, b, c) { } - longlong val_int() + longlong val_int() override { DBUG_ASSERT(fixed()); return m_comparator.type_handler()->Item_func_between_val_int(this); } - enum Functype functype() const { return BETWEEN; } + enum Functype functype() const override { return BETWEEN; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("between") }; return name; } - enum precedence precedence() const { return BETWEEN_PRECEDENCE; } - bool fix_length_and_dec(); + enum precedence precedence() const override { return BETWEEN_PRECEDENCE; } + bool fix_length_and_dec() override; bool fix_length_and_dec_string(THD *) { return agg_arg_charsets_for_comparison(cmp_collation, args, 3); } bool fix_length_and_dec_temporal(THD *); bool fix_length_and_dec_numeric(THD *); - virtual void print(String *str, enum_query_type query_type); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - bool count_sargable_conds(void *arg); + void print(String *str, enum_query_type query_type) override; + bool eval_not_null_tables(void *opt_arg) override; + bool find_not_null_fields(table_map allowed) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) + override; + bool count_sargable_conds(void *arg) override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); + SARGABLE_PARAM **sargables) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override { Item_args::propagate_equal_fields(thd, Context(ANY_SUBST, @@ -1024,7 +1032,7 @@ public: cond); return this; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } longlong val_int_cmp_string(); @@ -1039,28 +1047,28 @@ public: class Item_func_strcmp :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_str(0, 2); } String value1, value2; DTCollation cmp_collation; public: Item_func_strcmp(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - longlong val_int(); - uint decimal_precision() const { return 1; } + longlong val_int() override; + uint decimal_precision() const override { return 1; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("strcmp") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { if (agg_arg_charsets_for_comparison(cmp_collation, args, 2)) return TRUE; fix_char_length(2); // returns "1" or "0" or "-1" return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1077,7 +1085,7 @@ class Item_func_interval :public Item_long_func Item_row *row; bool use_decimal_comparison; interval_range *intervals; - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_like_args0(); } @@ -1085,21 +1093,21 @@ public: Item_func_interval(THD *thd, Item_row *a): Item_long_func(thd, a), row(a), intervals(0) { } - bool fix_fields(THD *, Item **); - longlong val_int(); - bool fix_length_and_dec(); + bool fix_fields(THD *, Item **) override; + longlong val_int() override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("interval") }; return name; } - uint decimal_precision() const { return 2; } - void print(String *str, enum_query_type query_type) + uint decimal_precision() const override { return 2; } + void print(String *str, enum_query_type query_type) override { str->append(func_name_cstring()); print_args(str, 0, query_type); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1111,14 +1119,14 @@ public: Item_func_case_expression(thd, a, b) {} Item_func_coalesce(THD *thd, List &list): Item_func_case_expression(thd, list) {} - double real_op(); - longlong int_op(); - String *str_op(String *); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to); - bool fix_length_and_dec() + double real_op() override; + longlong int_op() override; + String *str_op(String *) override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + bool native_op(THD *thd, Native *to) override; + bool fix_length_and_dec() override { if (aggregate_for_result(func_name_cstring(), args, arg_count, true)) return TRUE; @@ -1130,8 +1138,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("coalesce") }; return name; } - table_map not_null_tables() const { return 0; } - Item *get_copy(THD *thd) + table_map not_null_tables() const override { return 0; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1195,14 +1203,14 @@ class Item_func_ifnull :public Item_func_case_abbreviation2 public: Item_func_ifnull(THD *thd, Item *a, Item *b): Item_func_case_abbreviation2(thd, a, b) {} - double real_op(); - longlong int_op(); - String *str_op(String *str); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to); - bool fix_length_and_dec() + double real_op() override; + longlong int_op() override; + String *str_op(String *str) override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + bool native_op(THD *thd, Native *to) override; + bool fix_length_and_dec() override { /* Set nullability from args[1] by default. @@ -1225,8 +1233,8 @@ public: return name; } - table_map not_null_tables() const { return 0; } - Item *get_copy(THD *thd) + table_map not_null_tables() const override { return 0; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1285,14 +1293,15 @@ public: class Item_func_if :public Item_func_case_abbreviation2_switch { protected: - Item *find_item() const { return args[0]->val_bool() ? args[1] : args[2]; } + Item *find_item() const override + { return args[0]->val_bool() ? args[1] : args[2]; } public: Item_func_if(THD *thd, Item *a, Item *b, Item *c): Item_func_case_abbreviation2_switch(thd, a, b, c) {} - bool fix_fields(THD *, Item **); - bool fix_length_and_dec() + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override { return fix_length_and_dec2_eliminate_null(args + 1); } @@ -1301,9 +1310,10 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("if") }; return name; } - bool eval_not_null_tables(void *opt_arg); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - Item *get_copy(THD *thd) + bool eval_not_null_tables(void *opt_arg) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) + override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: void cache_type_info(Item *source); @@ -1313,7 +1323,8 @@ private: class Item_func_nvl2 :public Item_func_case_abbreviation2_switch { protected: - Item *find_item() const { return args[0]->is_null() ? args[2] : args[1]; } + Item *find_item() const override + { return args[0]->is_null() ? args[2] : args[1]; } public: Item_func_nvl2(THD *thd, Item *a, Item *b, Item *c): @@ -1324,11 +1335,11 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("nvl2") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { return fix_length_and_dec2_eliminate_null(args + 1); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1375,32 +1386,33 @@ public: m_cache(NULL), m_arg0(NULL) { arg_count--; } - void cleanup() + void cleanup() override { Item_func_hybrid_field_type::cleanup(); arg_count= 2; // See the comment to the constructor } - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - double real_op(); - longlong int_op(); - String *str_op(String *str); - my_decimal *decimal_op(my_decimal *); - bool native_op(THD *thd, Native *to); - bool fix_length_and_dec(); - bool walk(Item_processor processor, bool walk_subquery, void *arg); + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + double real_op() override; + longlong int_op() override; + String *str_op(String *str) override; + my_decimal *decimal_op(my_decimal *) override; + bool native_op(THD *thd, Native *to) override; + bool fix_length_and_dec() override; + bool walk(Item_processor processor, bool walk_subquery, void *arg) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("nullif") }; return name; } - void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); - void update_used_tables(); - table_map not_null_tables() const { return 0; } - bool is_null(); + List &fields, uint flags) override; + void update_used_tables() override; + table_map not_null_tables() const override { return 0; } + bool is_null() override; Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override { Context cmpctx(ANY_SUBST, cmp.compare_type_handler(), cmp.compare_collation()); @@ -1421,17 +1433,17 @@ public: cond, &args[2]); return this; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *derived_field_transformer_for_having(THD *thd, uchar *arg) + Item *derived_field_transformer_for_having(THD *thd, uchar *arg) override { reset_first_arg_if_needed(); return this; } - Item *derived_field_transformer_for_where(THD *thd, uchar *arg) + Item *derived_field_transformer_for_where(THD *thd, uchar *arg) override { reset_first_arg_if_needed(); return this; } - Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) + Item *grouping_field_transformer_for_where(THD *thd, uchar *arg) override { reset_first_arg_if_needed(); return this; } - Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) + Item *in_subq_field_transformer_for_where(THD *thd, uchar *arg) override { reset_first_arg_if_needed(); return this; } - Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) + Item *in_subq_field_transformer_for_having(THD *thd, uchar *arg) override { reset_first_arg_if_needed(); return this; } }; @@ -1512,16 +1524,17 @@ class in_string :public in_vector public: in_string(THD *thd, uint elements, qsort2_cmp cmp_func, CHARSET_INFO *cs); ~in_string(); - void set(uint pos,Item *item); - uchar *get_value(Item *item); - Item* create_item(THD *thd); - void value_to_item(uint pos, Item *item) + void set(uint pos,Item *item) override; + uchar *get_value(Item *item) override; + Item* create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override { String *str=((String*) base)+pos; Item_string_for_in_vector *to= (Item_string_for_in_vector*) item; to->set_value(str); } - const Type_handler *type_handler() const { return &type_handler_varchar; } + const Type_handler *type_handler() const override + { return &type_handler_varchar; } }; class in_longlong :public in_vector @@ -1539,16 +1552,17 @@ protected: } tmp; public: in_longlong(THD *thd, uint elements); - void set(uint pos,Item *item); - uchar *get_value(Item *item); - Item* create_item(THD *thd); - void value_to_item(uint pos, Item *item) + void set(uint pos,Item *item) override; + uchar *get_value(Item *item) override; + Item* create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override { ((Item_int*) item)->value= ((packed_longlong*) base)[pos].val; ((Item_int*) item)->unsigned_flag= (bool) ((packed_longlong*) base)[pos].unsigned_flag; } - const Type_handler *type_handler() const { return &type_handler_slonglong; } + const Type_handler *type_handler() const override + { return &type_handler_slonglong; } friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b); }; @@ -1559,11 +1573,12 @@ class in_timestamp :public in_vector Timestamp_or_zero_datetime tmp; public: in_timestamp(THD *thd, uint elements); - void set(uint pos,Item *item); - uchar *get_value(Item *item); - Item* create_item(THD *thd); - void value_to_item(uint pos, Item *item); - const Type_handler *type_handler() const { return &type_handler_timestamp2; } + void set(uint pos,Item *item) override; + uchar *get_value(Item *item) override; + Item* create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override; + const Type_handler *type_handler() const override + { return &type_handler_timestamp2; } }; @@ -1594,9 +1609,10 @@ public: in_datetime(THD *thd, uint elements) :in_temporal(thd, elements) {} - void set(uint pos,Item *item); - uchar *get_value(Item *item); - const Type_handler *type_handler() const { return &type_handler_datetime2; } + void set(uint pos,Item *item) override; + uchar *get_value(Item *item) override; + const Type_handler *type_handler() const override + { return &type_handler_datetime2; } }; @@ -1606,9 +1622,10 @@ public: in_time(THD *thd, uint elements) :in_temporal(thd, elements) {} - void set(uint pos,Item *item); - uchar *get_value(Item *item); - const Type_handler *type_handler() const { return &type_handler_time2; } + void set(uint pos,Item *item) override; + uchar *get_value(Item *item) override; + const Type_handler *type_handler() const override + { return &type_handler_time2; } }; @@ -1617,14 +1634,15 @@ class in_double :public in_vector double tmp; public: in_double(THD *thd, uint elements); - void set(uint pos,Item *item); - uchar *get_value(Item *item); - Item *create_item(THD *thd); - void value_to_item(uint pos, Item *item) + void set(uint pos,Item *item) override; + uchar *get_value(Item *item) override; + Item *create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override { ((Item_float*)item)->value= ((double*) base)[pos]; } - const Type_handler *type_handler() const { return &type_handler_double; } + const Type_handler *type_handler() const override + { return &type_handler_double; } }; @@ -1633,16 +1651,17 @@ class in_decimal :public in_vector my_decimal val; public: in_decimal(THD *thd, uint elements); - void set(uint pos, Item *item); - uchar *get_value(Item *item); - Item *create_item(THD *thd); - void value_to_item(uint pos, Item *item) + void set(uint pos, Item *item) override; + uchar *get_value(Item *item) override; + Item *create_item(THD *thd) override; + void value_to_item(uint pos, Item *item) override { my_decimal *dec= ((my_decimal *)base) + pos; Item_decimal *item_dec= (Item_decimal*)item; item_dec->set_decimal_value(dec); } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } + const Type_handler *type_handler() const override + { return &type_handler_newdecimal; } }; @@ -2298,22 +2317,22 @@ public: Item_func_case(THD *thd, List &list) :Item_func_case_expression(thd, list) { } - double real_op(); - longlong int_op(); - String *str_op(String *); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to); - bool fix_fields(THD *thd, Item **ref); - table_map not_null_tables() const { return 0; } + double real_op() override; + longlong int_op() override; + String *str_op(String *) override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + bool native_op(THD *thd, Native *to) override; + bool fix_fields(THD *thd, Item **ref) override; + table_map not_null_tables() const override { return 0; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("case") }; return name; } CHARSET_INFO *compare_collation() const { return cmp_collation.collation; } - bool need_parentheses_in_default() { return true; } + bool need_parentheses_in_default() override { return true; } }; @@ -2328,7 +2347,8 @@ class Item_func_case_searched: public Item_func_case { uint when_count() const { return arg_count / 2; } bool with_else() const { return arg_count % 2; } - Item **else_expr_addr() const { return with_else() ? &args[arg_count - 1] : 0; } + Item **else_expr_addr() const override + { return with_else() ? &args[arg_count - 1] : 0; } public: Item_func_case_searched(THD *thd, List &list) :Item_func_case(thd, list) @@ -2336,17 +2356,18 @@ public: DBUG_ASSERT(arg_count >= 2); reorder_args(0); } - enum Functype functype() const { return CASE_SEARCHED_FUNC; } - void print(String *str, enum_query_type query_type); - bool fix_length_and_dec(); + enum Functype functype() const override { return CASE_SEARCHED_FUNC; } + void print(String *str, enum_query_type query_type) override; + bool fix_length_and_dec() override; Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override { // None of the arguments are in a comparison context Item_args::propagate_equal_fields(thd, Context_identity(), cond); return this; } - Item *find_item(); - Item *get_copy(THD *thd) + Item *find_item() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2369,7 +2390,8 @@ protected: uint m_found_types; uint when_count() const { return (arg_count - 1) / 2; } bool with_else() const { return arg_count % 2 == 0; } - Item **else_expr_addr() const { return with_else() ? &args[arg_count - 1] : 0; } + Item **else_expr_addr() const override + { return with_else() ? &args[arg_count - 1] : 0; } bool aggregate_switch_and_when_arguments(THD *thd, bool nulls_equal); bool prepare_predicant_and_values(THD *thd, uint *found_types, bool nulls_equal); @@ -2382,19 +2404,20 @@ public: DBUG_ASSERT(arg_count >= 3); reorder_args(1); } - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_case_simple::cleanup"); Item_func::cleanup(); Predicant_to_list_comparator::cleanup(); DBUG_VOID_RETURN; } - enum Functype functype() const { return CASE_SIMPLE_FUNC; } - void print(String *str, enum_query_type query_type); - bool fix_length_and_dec(); - Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond); - Item *find_item(); - Item *build_clone(THD *thd) + enum Functype functype() const override { return CASE_SIMPLE_FUNC; } + void print(String *str, enum_query_type query_type) override; + bool fix_length_and_dec() override; + Item *propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override; + Item *find_item() override; + Item *build_clone(THD *thd) override { Item_func_case_simple *clone= (Item_func_case_simple *) Item_func_case::build_clone(thd); @@ -2403,7 +2426,7 @@ public: return NULL; return clone; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2419,10 +2442,10 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("decode_oracle") }; return name; } - void print(String *str, enum_query_type query_type); - bool fix_length_and_dec(); - Item *find_item(); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + bool fix_length_and_dec() override; + Item *find_item() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2473,13 +2496,13 @@ class Item_func_in :public Item_func_opt_neg, return true; } bool prepare_predicant_and_values(THD *thd, uint *found_types); - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_like_args0(); } protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value); + Field *field, Item *value) override; bool transform_into_subq; public: /// An array of values, created when the bisection lookup method is used @@ -2506,9 +2529,9 @@ public: array(0), have_null(0), arg_types_compatible(FALSE), emb_on_expr_nest(0) { } - longlong val_int(); - bool fix_fields(THD *, Item **); - bool fix_length_and_dec(); + longlong val_int() override; + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override; bool compatible_types_scalar_bisection_possible() { DBUG_ASSERT(m_comparator.cmp_type() != ROW_RESULT); @@ -2540,7 +2563,7 @@ public: bool fix_for_row_comparison_using_cmp_items(THD *thd); bool fix_for_row_comparison_using_bisection(THD *thd); - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_in::cleanup"); Item_int_func::cleanup(); @@ -2550,10 +2573,12 @@ public: DBUG_VOID_RETURN; } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); + table_map usable_tables, SARGABLE_PARAM **sargables) + override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; SEL_TREE *get_func_row_mm_tree(RANGE_OPT_PARAM *param, Item_row *key_row); Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override { /* Note, we pass ANY_SUBST, this makes sure that non of the args @@ -2577,21 +2602,22 @@ public: } return this; } - virtual void print(String *str, enum_query_type query_type); - enum Functype functype() const { return IN_FUNC; } + void print(String *str, enum_query_type query_type) override; + enum Functype functype() const override { return IN_FUNC; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("in") }; return name; } - enum precedence precedence() const { return IN_PRECEDENCE; } - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - bool count_sargable_conds(void *arg); - Item *get_copy(THD *thd) + enum precedence precedence() const override { return IN_PRECEDENCE; } + bool eval_not_null_tables(void *opt_arg) override; + bool find_not_null_fields(table_map allowed) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) + override; + bool count_sargable_conds(void *arg) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *build_clone(THD *thd) + Item *build_clone(THD *thd) override { Item_func_in *clone= (Item_func_in *) Item_func::build_clone(thd); if (clone) @@ -2602,10 +2628,10 @@ public: } return clone; } - void mark_as_condition_AND_part(TABLE_LIST *embedding); + void mark_as_condition_AND_part(TABLE_LIST *embedding) override; bool to_be_transformed_into_in_subq(THD *thd); bool create_value_list_for_tvc(THD *thd, List< List > *values); - Item *in_predicate_to_in_subs_transformer(THD *thd, uchar *arg); + Item *in_predicate_to_in_subs_transformer(THD *thd, uchar *arg) override; uint32 max_length_of_left_expr(); }; @@ -2646,10 +2672,10 @@ class in_row :public in_vector public: in_row(THD *thd, uint elements, Item *); ~in_row(); - void set(uint pos,Item *item); - uchar *get_value(Item *item); + void set(uint pos,Item *item) override; + uchar *get_value(Item *item) override; friend class Item_func_in; - const Type_handler *type_handler() const { return &type_handler_row; } + const Type_handler *type_handler() const override { return &type_handler_row; } cmp_item *get_cmp_item() { return &tmp; } }; @@ -2658,19 +2684,20 @@ class Item_func_null_predicate :public Item_bool_func { protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) + Field *field, Item *value) override { DBUG_ENTER("Item_func_null_predicate::get_func_mm_tree"); DBUG_RETURN(get_mm_parts(param, field, functype(), value)); } SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, KEY_PART *key_part, - Item_func::Functype type, Item *value); + Item_func::Functype type, Item *value) override; public: Item_func_null_predicate(THD *thd, Item *a): Item_bool_func(thd, a) { } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) + table_map usable_tables, SARGABLE_PARAM **sargables) + override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override { DBUG_ENTER("Item_func_null_predicate::get_mm_tree"); SEL_TREE *ftree= get_full_func_mm_tree_for_args(param, args[0], NULL); @@ -2678,16 +2705,16 @@ public: ftree= Item_func::get_mm_tree(param, cond_ptr); DBUG_RETURN(ftree); } - CHARSET_INFO *compare_collation() const + CHARSET_INFO *compare_collation() const override { return args[0]->collation.collation; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=1; base_flags&= ~item_base_t::MAYBE_NULL; return FALSE; } - bool count_sargable_conds(void *arg); + bool count_sargable_conds(void *arg) override; }; @@ -2695,15 +2722,15 @@ class Item_func_isnull :public Item_func_null_predicate { public: Item_func_isnull(THD *thd, Item *a): Item_func_null_predicate(thd, a) {} - longlong val_int(); - enum Functype functype() const { return ISNULL_FUNC; } + longlong val_int() override; + enum Functype functype() const override { return ISNULL_FUNC; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("isnull") }; return name; } - void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return CMP_PRECEDENCE; } + void print(String *str, enum_query_type query_type) override; + enum precedence precedence() const override { return CMP_PRECEDENCE; } bool arg_is_datetime_notnull_field() { @@ -2720,7 +2747,7 @@ public: } /* Optimize case of not_null_column IS NULL */ - virtual void update_used_tables() + void update_used_tables() override { if (!args[0]->maybe_null() && !arg_is_datetime_notnull_field()) { @@ -2735,11 +2762,11 @@ public: } } COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, - bool top_level); - table_map not_null_tables() const { return 0; } - bool find_not_null_fields(table_map allowed); - Item *neg_transformer(THD *thd); - Item *get_copy(THD *thd) + bool top_level) override; + table_map not_null_tables() const override { return 0; } + bool find_not_null_fields(table_map allowed) override; + Item *neg_transformer(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2758,20 +2785,20 @@ public: Item_is_not_null_test(THD *thd, Item_in_subselect* ow, Item *a): Item_func_isnull(thd, a), owner(ow) {} - enum Functype functype() const { return ISNOTNULLTEST_FUNC; } - longlong val_int(); + enum Functype functype() const override { return ISNOTNULLTEST_FUNC; } + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("") }; return name; } - void update_used_tables(); + void update_used_tables() override; /* we add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE */ - table_map used_tables() const + table_map used_tables() const override { return used_tables_cache | RAND_TABLE_BIT; } - bool const_item() const { return FALSE; } + bool const_item() const override { return FALSE; } }; @@ -2782,20 +2809,20 @@ public: Item_func_isnotnull(THD *thd, Item *a): Item_func_null_predicate(thd, a), abort_on_null(0) { } - longlong val_int(); - enum Functype functype() const { return ISNOTNULL_FUNC; } + longlong val_int() override; + enum Functype functype() const override { return ISNOTNULL_FUNC; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("isnotnull") }; return name; } - enum precedence precedence() const { return CMP_PRECEDENCE; } - table_map not_null_tables() const + enum precedence precedence() const override { return CMP_PRECEDENCE; } + table_map not_null_tables() const override { return abort_on_null ? not_null_tables_cache : 0; } - Item *neg_transformer(THD *thd); - void print(String *str, enum_query_type query_type); - void top_level_item() { abort_on_null=1; } - Item *get_copy(THD *thd) + Item *neg_transformer(THD *thd) override; + void print(String *str, enum_query_type query_type) override; + void top_level_item() override { abort_on_null=1; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2827,14 +2854,14 @@ class Item_func_like :public Item_bool_func2 bool with_sargable_pattern() const; protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, - Field *field, Item *value) + Field *field, Item *value) override { DBUG_ENTER("Item_func_like::get_func_mm_tree"); DBUG_RETURN(get_mm_parts(param, field, LIKE_FUNC, value)); } SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, KEY_PART *key_part, - Item_func::Functype type, Item *value); + Item_func::Functype type, Item *value) override; public: int escape; bool negated; @@ -2846,13 +2873,13 @@ public: bool get_negated() const { return negated; } // Used by ColumnStore - Sql_mode_dependency value_depends_on_sql_mode() const; - longlong val_int(); - enum Functype functype() const { return LIKE_FUNC; } - void print(String *str, enum_query_type query_type); - CHARSET_INFO *compare_collation() const + Sql_mode_dependency value_depends_on_sql_mode() const override; + longlong val_int() override; + enum Functype functype() const override { return LIKE_FUNC; } + void print(String *str, enum_query_type query_type) override; + CHARSET_INFO *compare_collation() const override { return cmp_collation.collation; } - cond_result eq_cmp_result() const + cond_result eq_cmp_result() const override { /** We cannot always rewrite conditions as follows: @@ -2888,9 +2915,11 @@ public: return compare_collation() == &my_charset_bin ? COND_TRUE : COND_OK; } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); + table_map usable_tables, SARGABLE_PARAM **sargables) + override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override { /* LIKE differs from the regular comparison operator ('=') in the following: @@ -2928,31 +2957,31 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("like") }; return name; } - enum precedence precedence() const { return IN_PRECEDENCE; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() + enum precedence precedence() const override { return IN_PRECEDENCE; } + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override { max_length= 1; return agg_arg_charsets_for_comparison(cmp_collation, args, 2); } - void cleanup(); + void cleanup() override; - Item *neg_transformer(THD *thd) + Item *neg_transformer(THD *thd) override { negated= !negated; return this; } - bool walk(Item_processor processor, bool walk_subquery, void *arg) + bool walk(Item_processor processor, bool walk_subquery, void *arg) override { - return walk_args(processor, walk_subquery, arg) - || escape_item->walk(processor, walk_subquery, arg) - || (this->*processor)(arg); + return (walk_args(processor, walk_subquery, arg) || + escape_item->walk(processor, walk_subquery, arg) || + (this->*processor)(arg)); } - bool find_selective_predicates_list_processor(void *arg); + bool find_selective_predicates_list_processor(void *arg) override; - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3034,28 +3063,29 @@ class Item_func_regex :public Item_bool_func public: Item_func_regex(THD *thd, Item *a, Item *b): Item_bool_func(thd, a, b) {} - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_regex::cleanup"); Item_bool_func::cleanup(); re.cleanup(); DBUG_VOID_RETURN; } - longlong val_int(); - bool fix_length_and_dec(); + longlong val_int() override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("regexp") }; return name; } - enum precedence precedence() const { return IN_PRECEDENCE; } - Item *get_copy(THD *) { return 0; } - void print(String *str, enum_query_type query_type) + enum precedence precedence() const override { return IN_PRECEDENCE; } + Item *get_copy(THD *) override { return 0; } + void print(String *str, enum_query_type query_type) override { print_op(str, query_type); } - CHARSET_INFO *compare_collation() const { return cmp_collation.collation; } + CHARSET_INFO *compare_collation() const override + { return cmp_collation.collation; } }; @@ -3067,7 +3097,7 @@ public: */ class Item_func_regexp_instr :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return (args[0]->check_type_can_return_str(func_name_cstring()) || args[1]->check_type_can_return_text(func_name_cstring())); @@ -3078,21 +3108,21 @@ public: Item_func_regexp_instr(THD *thd, Item *a, Item *b) :Item_long_func(thd, a, b) {} - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_regexp_instr::cleanup"); Item_int_func::cleanup(); re.cleanup(); DBUG_VOID_RETURN; } - longlong val_int(); - bool fix_length_and_dec(); + longlong val_int() override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("regexp_instr") }; return name; } - Item *get_copy(THD *thd) { return 0; } + Item *get_copy(THD *thd) override { return 0; } }; @@ -3133,46 +3163,47 @@ public: DBUG_ASSERT(nlist->elements); list.append(nlist); } - bool fix_fields(THD *, Item **ref); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); + bool fix_fields(THD *, Item **ref) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) + override; - enum Type type() const { return COND_ITEM; } + enum Type type() const override { return COND_ITEM; } List* argument_list() { return &list; } - table_map used_tables() const; - void update_used_tables() + table_map used_tables() const override; + void update_used_tables() override { used_tables_and_const_cache_init(); used_tables_and_const_cache_update_and_join(list); } COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref); + COND_EQUAL **cond_equal_ref) override; COND *remove_eq_conds(THD *thd, Item::cond_result *cond_value, - bool top_level); + bool top_level) override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - virtual void print(String *str, enum_query_type query_type); + SARGABLE_PARAM **sargables) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; + void print(String *str, enum_query_type query_type) override; void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); + List &fields, uint flags) override; friend int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, COND **conds); - void top_level_item() { abort_on_null=1; } + void top_level_item() override { abort_on_null=1; } bool top_level() { return abort_on_null; } void copy_andor_arguments(THD *thd, Item_cond *item); - bool walk(Item_processor processor, bool walk_subquery, void *arg); - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); - void traverse_cond(Cond_traverser, void *arg, traverse_order order); + bool walk(Item_processor processor, bool walk_subquery, void *arg) override; + Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override; + void traverse_cond(Cond_traverser, void *arg, traverse_order order) override; void neg_arguments(THD *thd); - Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *); + Item* propagate_equal_fields(THD *, const Context &, COND_EQUAL *) override; Item *compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, - Item_transformer transformer, uchar *arg_t); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); - Item *build_clone(THD *thd); - bool excl_dep_on_table(table_map tab_map); - bool excl_dep_on_grouping_fields(st_select_lex *sel); + Item_transformer transformer, uchar *arg_t) override; + bool eval_not_null_tables(void *opt_arg) override; + bool find_not_null_fields(table_map allowed) override; + Item *build_clone(THD *thd) override; + bool excl_dep_on_table(table_map tab_map) override; + bool excl_dep_on_grouping_fields(st_select_lex *sel) override; }; template class LI, class T> class Item_equal_iterator; @@ -3323,57 +3354,58 @@ public: void merge_into_list(THD *thd, List *list, bool save_merged, bool only_intersected); void update_const(THD *thd); - enum Functype functype() const { return MULT_EQUAL_FUNC; } - longlong val_int(); + enum Functype functype() const override { return MULT_EQUAL_FUNC; } + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("multiple equal") }; return name; } void sort(Item_field_cmpfunc compare, void *arg); - bool fix_length_and_dec(); - bool fix_fields(THD *thd, Item **ref); - void cleanup() + bool fix_length_and_dec() override; + bool fix_fields(THD *thd, Item **ref) override; + void cleanup() override { delete eval_item; eval_item= NULL; } - void update_used_tables(); - bool find_not_null_fields(table_map allowed); + void update_used_tables() override; + bool find_not_null_fields(table_map allowed) override; COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref); + COND_EQUAL **cond_equal_ref) override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, - SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - bool walk(Item_processor processor, bool walk_subquery, void *arg); - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); - virtual void print(String *str, enum_query_type query_type); + SARGABLE_PARAM **sargables) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; + bool walk(Item_processor processor, bool walk_subquery, void *arg) override; + Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override; + void print(String *str, enum_query_type query_type) override; const Type_handler *compare_type_handler() const { return m_compare_handler; } - CHARSET_INFO *compare_collation() const { return m_compare_collation; } + CHARSET_INFO *compare_collation() const override + { return m_compare_collation; } void set_context_field(Item_field *ctx_field) { context_field= ctx_field; } void set_link_equal_fields(bool flag) { link_equal_fields= flag; } - Item* get_copy(THD *thd) { return 0; } + Item* get_copy(THD *thd) override { return 0; } /* This does not comply with the specification of the virtual method, but Item_equal items are processed distinguishly anyway */ - bool excl_dep_on_table(table_map tab_map) + bool excl_dep_on_table(table_map tab_map) override { return used_tables() & tab_map; } - bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred); - bool excl_dep_on_grouping_fields(st_select_lex *sel); + bool excl_dep_on_in_subq_left_part(Item_in_subselect *subq_pred) override; + bool excl_dep_on_grouping_fields(st_select_lex *sel) override; bool create_pushable_equalities(THD *thd, List *equalities, Pushdown_checker checker, uchar *arg, bool clone_const); /* Return the number of elements in this multiple equality */ uint elements_count() { return equal_items.elements; } friend class Item_equal_fields_iterator; - bool count_sargable_conds(void *arg); - Item *multiple_equality_transformer(THD *thd, uchar *arg); + bool count_sargable_conds(void *arg) override; + Item *multiple_equality_transformer(THD *thd, uchar *arg) override; friend class Item_equal_iterator; friend class Item_equal_iterator; friend Item *eliminate_item_equal(THD *thd, COND *cond, @@ -3505,28 +3537,30 @@ public: Item_cond_and(THD *thd, Item *i1,Item *i2): Item_cond(thd, i1, i2) {} Item_cond_and(THD *thd, Item_cond_and *item): Item_cond(thd, item) {} Item_cond_and(THD *thd, List &list_arg): Item_cond(thd, list_arg) {} - enum Functype functype() const { return COND_AND_FUNC; } - longlong val_int(); + enum Functype functype() const override { return COND_AND_FUNC; } + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("and") }; return name; } - enum precedence precedence() const { return AND_PRECEDENCE; } - table_map not_null_tables() const + enum precedence precedence() const override { return AND_PRECEDENCE; } + table_map not_null_tables() const override { return abort_on_null ? not_null_tables_cache: and_tables_cache; } - Item *copy_andor_structure(THD *thd); - Item *neg_transformer(THD *thd); - void mark_as_condition_AND_part(TABLE_LIST *embedding); - virtual uint exists2in_reserved_items() { return list.elements; }; + Item *copy_andor_structure(THD *thd) override; + Item *neg_transformer(THD *thd) override; + void mark_as_condition_AND_part(TABLE_LIST *embedding) override; + uint exists2in_reserved_items() override { return list.elements; }; COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref); - bool set_format_by_check_constraint(Send_field_extended_metadata *to) const; + COND_EQUAL **cond_equal_ref) override; + bool set_format_by_check_constraint(Send_field_extended_metadata *to) const + override; void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, - table_map usable_tables, SARGABLE_PARAM **sargables); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); - Item *get_copy(THD *thd) + table_map usable_tables, SARGABLE_PARAM **sargables) + override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3543,18 +3577,18 @@ public: Item_cond_or(THD *thd, Item *i1,Item *i2): Item_cond(thd, i1, i2) {} Item_cond_or(THD *thd, Item_cond_or *item): Item_cond(thd, item) {} Item_cond_or(THD *thd, List &list_arg): Item_cond(thd, list_arg) {} - enum Functype functype() const { return COND_OR_FUNC; } - longlong val_int(); + enum Functype functype() const override { return COND_OR_FUNC; } + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("or") }; return name; } - enum precedence precedence() const { return OR_PRECEDENCE; } - table_map not_null_tables() const { return and_tables_cache; } - Item *copy_andor_structure(THD *thd); - Item *neg_transformer(THD *thd); - Item *get_copy(THD *thd) + enum precedence precedence() const override { return OR_PRECEDENCE; } + table_map not_null_tables() const override { return and_tables_cache; } + Item *copy_andor_structure(THD *thd) override; + Item *neg_transformer(THD *thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3562,14 +3596,14 @@ class Item_func_dyncol_check :public Item_bool_func { public: Item_func_dyncol_check(THD *thd, Item *str): Item_bool_func(thd, str) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("column_check") }; return name; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) + bool need_parentheses_in_default() override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3578,14 +3612,14 @@ class Item_func_dyncol_exists :public Item_bool_func public: Item_func_dyncol_exists(THD *thd, Item *str, Item *num): Item_bool_func(thd, str, num) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("column_exists") }; return name; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) + bool need_parentheses_in_default() override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3617,8 +3651,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("%ISOPEN") }; return name; } - longlong val_int(); - Item *get_copy(THD *thd) + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3636,8 +3670,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("%FOUND") }; return name; } - longlong val_int(); - Item *get_copy(THD *thd) + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3655,8 +3689,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("%NOTFOUND") }; return name; } - longlong val_int(); - Item *get_copy(THD *thd) + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/item_func.h b/sql/item_func.h index fed0266f62a..53c236bbce7 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1,7 +1,7 @@ #ifndef ITEM_FUNC_INCLUDED #define ITEM_FUNC_INCLUDED /* Copyright (c) 2000, 2016, 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 it under the terms of the GNU General Public License as published by @@ -93,7 +93,7 @@ public: DBUG_ASSERT(0); return SCALAR_CMP_EQ; } - enum Type type() const { return FUNC_ITEM; } + enum Type type() const override { return FUNC_ITEM; } virtual enum Functype functype() const { return UNKNOWN_FUNC; } Item_func(THD *thd): Item_func_or_sum(thd) { @@ -135,8 +135,8 @@ public: Item_func_or_sum(thd, item), not_null_tables_cache(item->not_null_tables_cache) { } - bool fix_fields(THD *, Item **ref); - void cleanup() + bool fix_fields(THD *, Item **ref) override; + void cleanup() override { Item_func_or_sum::cleanup(); used_tables_and_const_cache_init(); @@ -152,13 +152,13 @@ public: } COND *build_equal_items(THD *thd, COND_EQUAL *inherited, bool link_item_fields, - COND_EQUAL **cond_equal_ref); - SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) + COND_EQUAL **cond_equal_ref) override; + SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr) override { DBUG_ENTER("Item_func::get_mm_tree"); DBUG_RETURN(const_item() ? get_mm_tree_for_const(param) : NULL); } - bool eq(const Item *item, bool binary_cmp) const; + bool eq(const Item *item, bool binary_cmp) const override; virtual Item *key_item() const { return args[0]; } void set_arguments(THD *thd, List &list) { @@ -167,11 +167,12 @@ public: list.empty(); // Fields are used } void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); + List &fields, uint flags) override; void print(String *str, enum_query_type query_type) override; void print_op(String *str, enum_query_type query_type); void print_args(String *str, uint from, enum_query_type query_type); - bool is_null() { + bool is_null() override + { update_null_value(); return null_value; } @@ -179,9 +180,9 @@ public: void signal_divide_by_null(); friend class udf_handler; - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) + Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) override { return tmp_table_field_from_field_type(root, table); } - Item *get_tmp_table_item(THD *thd); + Item *get_tmp_table_item(THD *thd) override; void fix_char_length_ulonglong(ulonglong max_char_length_arg) { @@ -195,13 +196,13 @@ public: else max_length= (uint32) max_result_length; } - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); + Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override; Item* compile(THD *thd, Item_analyzer analyzer, uchar **arg_p, - Item_transformer transformer, uchar *arg_t); + Item_transformer transformer, uchar *arg_t) override; void traverse_cond(Cond_traverser traverser, - void * arg, traverse_order order); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); + void * arg, traverse_order order) override; + bool eval_not_null_tables(void *opt_arg) override; + bool find_not_null_fields(table_map allowed) override; // bool is_expensive_processor(void *arg); // virtual bool is_expensive() { return 0; } inline void raise_numeric_overflow(const char *type_name) @@ -307,6 +308,7 @@ public: } Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override { /* By default only substitution for a field whose two different values @@ -322,7 +324,7 @@ public: return used_tables() & RAND_TABLE_BIT; } - bool excl_dep_on_table(table_map tab_map) + bool excl_dep_on_table(table_map tab_map) override { if (used_tables() & OUTER_REF_TABLE_BIT) return false; @@ -330,14 +332,14 @@ public: 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 { if (has_rand_bit() || with_subquery()) return false; 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); } @@ -350,24 +352,24 @@ public: representation of a TIMESTAMP argument verbatim, and thus does not depend on the timezone. */ - virtual bool check_valid_arguments_processor(void *bool_arg) + bool check_valid_arguments_processor(void *bool_arg) override { return has_timestamp_args(); } - virtual bool find_function_processor (void *arg) + bool find_function_processor (void *arg) override { return functype() == *(Functype *) arg; } - void no_rows_in_result() + void no_rows_in_result() override { for (uint i= 0; i < arg_count; i++) { args[i]->no_rows_in_result(); } } - void restore_to_before_no_rows_in_result() + void restore_to_before_no_rows_in_result() override { for (uint i= 0; i < arg_count; i++) { @@ -384,8 +386,8 @@ public: - or replaced to an Item_int_with_ref */ bool setup_args_and_comparator(THD *thd, Arg_comparator *cmp); - Item_func *get_item_func() { return this; } - bool is_simplified_cond_processor(void *arg) + Item_func *get_item_func() override { return this; } + bool is_simplified_cond_processor(void *arg) override { return const_item() && !val_int(); } }; @@ -400,17 +402,18 @@ public: { collation= DTCollation_numeric(); } Item_real_func(THD *thd, List &list): Item_func(thd, list) { collation= DTCollation_numeric(); } - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *decimal_value); - longlong val_int() + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *decimal_value) override; + longlong val_int() override { DBUG_ASSERT(fixed()); return Converter_double_to_longlong(val_real(), unsigned_flag).result(); } - 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); } - const Type_handler *type_handler() const { return &type_handler_double; } - bool fix_length_and_dec() + const Type_handler *type_handler() const override + { return &type_handler_double; } + bool fix_length_and_dec() override { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); @@ -436,7 +439,7 @@ public: Item_hybrid_func(THD *thd, List &list): Item_func(thd, list) { } Item_hybrid_func(THD *thd, Item_hybrid_func *item) :Item_func(thd, 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(); } void fix_length_and_dec_long_or_longlong(uint char_length, bool unsigned_arg) { @@ -750,11 +753,11 @@ public: { m_func_handler= handler; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return m_func_handler->return_type_handler(this); } - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) + Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) override { DBUG_ASSERT(fixed()); const Type_handler *h= m_func_handler->type_handler_for_create_select(this); @@ -762,31 +765,31 @@ public: Record_addr(maybe_null()), *this, table); } - String *val_str(String *to) + String *val_str(String *to) override { return m_func_handler->val_str(this, to); } - String *val_str_ascii(String *to) + String *val_str_ascii(String *to) override { return m_func_handler->val_str_ascii(this, to); } - double val_real() + double val_real() override { return m_func_handler->val_real(this); } - longlong val_int() + longlong val_int() override { return m_func_handler->val_int(this); } - my_decimal *val_decimal(my_decimal *to) + my_decimal *val_decimal(my_decimal *to) override { return m_func_handler->val_decimal(this, to); } - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) + bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t fuzzydate) override { return m_func_handler->get_date(thd, this, to, fuzzydate); } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { return m_func_handler->val_native(thd, this, to); } @@ -889,25 +892,25 @@ public: Item_hybrid_func(thd, list) { collation= DTCollation_numeric(); } - double val_real() + double val_real() override { DBUG_ASSERT(fixed()); return Item_func_hybrid_field_type::type_handler()-> Item_func_hybrid_field_type_val_real(this); } - longlong val_int() + longlong val_int() override { DBUG_ASSERT(fixed()); return Item_func_hybrid_field_type::type_handler()-> Item_func_hybrid_field_type_val_int(this); } - my_decimal *val_decimal(my_decimal *dec) + my_decimal *val_decimal(my_decimal *dec) override { DBUG_ASSERT(fixed()); return Item_func_hybrid_field_type::type_handler()-> Item_func_hybrid_field_type_val_decimal(this, dec); } - String *val_str(String*str) + String *val_str(String*str) override { DBUG_ASSERT(fixed()); String *res= Item_func_hybrid_field_type::type_handler()-> @@ -915,14 +918,14 @@ public: DBUG_ASSERT(null_value == (res == NULL)); return res; } - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) + bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) override { DBUG_ASSERT(fixed()); return Item_func_hybrid_field_type::type_handler()-> Item_func_hybrid_field_type_get_date_with_warn(thd, this, to, mode); } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { DBUG_ASSERT(fixed()); return native_op(thd, to); @@ -1090,7 +1093,7 @@ public: class Item_num_op :public Item_func_numhybrid { protected: - bool check_arguments() const + bool check_arguments() const override { return false; // Checked by aggregate_for_num_op() } @@ -1098,7 +1101,7 @@ public: Item_num_op(THD *thd, Item *a, Item *b): Item_func_numhybrid(thd, a, b) {} virtual void result_precision()= 0; - virtual inline void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { print_op(str, query_type); } @@ -1128,7 +1131,7 @@ public: if (decimals == 0 && downcast_decimal_to_int) set_handler(type_handler_long_or_longlong()); } - bool need_parentheses_in_default() { return true; } + bool need_parentheses_in_default() override { return true; } }; @@ -1156,16 +1159,16 @@ public: { collation= DTCollation_numeric(); fix_char_length(21); } Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) { collation= DTCollation_numeric(); } - double val_real(); - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *decimal_value) + double val_real() override; + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *decimal_value) override { return val_decimal_from_int(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_int(thd, ltime, fuzzydate); } - const Type_handler *type_handler() const= 0; - bool fix_length_and_dec() { return FALSE; } + const Type_handler *type_handler() const override= 0; + bool fix_length_and_dec() override { return FALSE; } }; @@ -1178,13 +1181,13 @@ public: Item_long_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {} Item_long_func(THD *thd, List &list): Item_int_func(thd, list) { } Item_long_func(THD *thd, Item_long_func *item) :Item_int_func(thd, item) {} - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { if (unsigned_flag) return &type_handler_ulong; return &type_handler_slong; } - bool fix_length_and_dec() { max_length= 11; return FALSE; } + bool fix_length_and_dec() override { max_length= 11; return FALSE; } }; @@ -1193,10 +1196,11 @@ class Item_func_hash: public Item_int_func public: Item_func_hash(THD *thd, List &item): Item_int_func(thd, item) {} - longlong val_int(); - bool fix_length_and_dec(); - const Type_handler *type_handler() const { return &type_handler_slong; } - Item *get_copy(THD *thd) + longlong val_int() override; + bool fix_length_and_dec() override; + const Type_handler *type_handler() const override + { return &type_handler_slong; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } LEX_CSTRING func_name_cstring() const override { @@ -1216,7 +1220,7 @@ public: Item_int_func(thd, a, b, c, d) {} Item_longlong_func(THD *thd, List &list): Item_int_func(thd, list) { } Item_longlong_func(THD *thd, Item_longlong_func *item) :Item_int_func(thd, item) {} - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { if (unsigned_flag) return &type_handler_ulonglong; @@ -1253,16 +1257,16 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("%ROWCOUNT") }; return name; } - longlong val_int(); - bool check_vcol_func_processor(void *arg) + longlong val_int() override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), arg, VCOL_SESSION_FUNC); } - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { return Cursor_ref::print_func(str, func_name_cstring()); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1279,15 +1283,15 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("connection_id") }; return name; } - bool fix_length_and_dec(); - bool fix_fields(THD *thd, Item **ref); - longlong val_int() { DBUG_ASSERT(fixed()); return value; } - bool check_vcol_func_processor(void *arg) + bool fix_length_and_dec() override; + bool fix_fields(THD *thd, Item **ref) override; + longlong val_int() override { DBUG_ASSERT(fixed()); return value; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1304,12 +1308,12 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_signed") }; return name; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler::type_handler_long_or_longlong(max_char_length(), false); } - longlong val_int() + longlong val_int() override { longlong value= args[0]->val_int_signed_typecast(); null_value= args[0]->null_value; @@ -1344,14 +1348,15 @@ public: set_if_bigger(char_length, 1U + (unsigned_flag ? 0 : 1)); fix_char_length(char_length); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_func_signed_fix_length_and_dec(this); } - virtual void print(String *str, enum_query_type query_type); - uint decimal_precision() const { return args[0]->decimal_precision(); } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + uint decimal_precision() const override + { return args[0]->decimal_precision(); } + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1368,25 +1373,25 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_unsigned") }; return name; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { if (max_char_length() <= MY_INT32_NUM_DECIMAL_DIGITS - 1) return &type_handler_ulong; return &type_handler_ulonglong; } - longlong val_int() + longlong val_int() override { longlong value= args[0]->val_int_unsigned_typecast(); null_value= args[0]->null_value; return value; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_func_unsigned_fix_length_and_dec(this); } - uint decimal_precision() const { return max_length; } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + uint decimal_precision() const override { return max_length; } + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1403,18 +1408,19 @@ public: fix_char_length(my_decimal_precision_to_length_no_truncation(len, dec, unsigned_flag)); } - String *val_str(String *str) { return VDec(this).to_string(str); } - double val_real() { return VDec(this).to_double(); } - longlong val_int() { return VDec(this).to_longlong(unsigned_flag); } - my_decimal *val_decimal(my_decimal*); - bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) + String *val_str(String *str) override { return VDec(this).to_string(str); } + double val_real() override { return VDec(this).to_double(); } + longlong val_int() override { return VDec(this).to_longlong(unsigned_flag); } + my_decimal *val_decimal(my_decimal*) override; + bool get_date(THD *thd, MYSQL_TIME *to, date_mode_t mode) override { return decimal_to_datetime_with_warn(thd, VDec(this).ptr(), to, mode, NULL, NULL); } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } + const Type_handler *type_handler() const override + { return &type_handler_newdecimal; } void fix_length_and_dec_generic() {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_decimal_typecast_fix_length_and_dec(this); @@ -1424,9 +1430,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("decimal_typecast") }; return name; } - virtual void print(String *str, enum_query_type query_type); - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1457,8 +1463,9 @@ public: Item_float_typecast(THD *thd, Item *a) :Item_real_typecast(thd, a, MAX_FLOAT_STR_LENGTH, NOT_FIXED_DEC) { } - const Type_handler *type_handler() const { return &type_handler_float; } - bool fix_length_and_dec() + const Type_handler *type_handler() const override + { return &type_handler_float; } + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_float_typecast_fix_length_and_dec(this); @@ -1468,11 +1475,11 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("float_typecast") }; return name; } - double val_real() + double val_real() override { return (double) (float) val_real_with_truncate(FLT_MAX); } - String *val_str(String*str) + String *val_str(String*str) override { Float nr(Item_float_typecast::val_real()); if (null_value) @@ -1480,7 +1487,7 @@ public: nr.to_string(str, decimals); return str; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1491,7 +1498,7 @@ public: Item_double_typecast(THD *thd, Item *a, uint len, uint dec): Item_real_typecast(thd, a, len, dec) { } - bool fix_length_and_dec() + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_double_typecast_fix_length_and_dec(this); @@ -1501,8 +1508,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("double_typecast") }; return name; } - double val_real() { return val_real_with_truncate(DBL_MAX); } - Item *get_copy(THD *thd) + double val_real() override { return val_real_with_truncate(DBL_MAX); } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1527,12 +1534,12 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("+") }; return name; } - enum precedence precedence() const { return ADD_PRECEDENCE; } - bool fix_length_and_dec(); - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - Item *get_copy(THD *thd) + enum precedence precedence() const override { return ADD_PRECEDENCE; } + bool fix_length_and_dec() override; + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1549,12 +1556,12 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("-") }; return name; } - enum precedence precedence() const { return ADD_PRECEDENCE; } - Sql_mode_dependency value_depends_on_sql_mode() const; - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - bool fix_length_and_dec(); + enum precedence precedence() const override { return ADD_PRECEDENCE; } + Sql_mode_dependency value_depends_on_sql_mode() const override; + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + bool fix_length_and_dec() override; void fix_unsigned_flag(); void fix_length_and_dec_double() { @@ -1571,7 +1578,7 @@ public: Item_func_additive_op::fix_length_and_dec_int(); fix_unsigned_flag(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1586,15 +1593,15 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("*") }; return name; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - void result_precision(); - bool fix_length_and_dec(); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - Item *get_copy(THD *thd) + enum precedence precedence() const override { return MUL_PRECEDENCE; } + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + void result_precision() override; + bool fix_length_and_dec() override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1604,20 +1611,20 @@ class Item_func_div :public Item_num_op public: uint prec_increment; Item_func_div(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {} - longlong int_op() { DBUG_ASSERT(0); return 0; } - double real_op(); - my_decimal *decimal_op(my_decimal *); + longlong int_op() override { DBUG_ASSERT(0); return 0; } + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("/") }; return name; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - bool fix_length_and_dec(); + enum precedence precedence() const override { return MUL_PRECEDENCE; } + bool fix_length_and_dec() override; void fix_length_and_dec_double(); void fix_length_and_dec_int(); - void result_precision(); - Item *get_copy(THD *thd) + void result_precision() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1627,25 +1634,25 @@ class Item_func_int_div :public Item_int_func public: Item_func_int_div(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("DIV") }; return name; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - const Type_handler *type_handler() const + enum precedence precedence() const override { return MUL_PRECEDENCE; } + const Type_handler *type_handler() const override { return type_handler_long_or_longlong(); } - bool fix_length_and_dec(); - void print(String *str, enum_query_type query_type) + bool fix_length_and_dec() override; + void print(String *str, enum_query_type query_type) override { print_op(str, query_type); } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1654,17 +1661,17 @@ class Item_func_mod :public Item_num_op { public: Item_func_mod(THD *thd, Item *a, Item *b): Item_num_op(thd, a, b) {} - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("MOD") }; return name; } - enum precedence precedence() const { return MUL_PRECEDENCE; } - void result_precision(); - bool fix_length_and_dec(); + enum precedence precedence() const override { return MUL_PRECEDENCE; } + void result_precision() override; + bool fix_length_and_dec() override; void fix_length_and_dec_double() { Item_num_op::fix_length_and_dec_double(); @@ -1681,9 +1688,9 @@ public: DBUG_ASSERT(decimals == 0); set_handler(type_handler_long_or_longlong()); } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - Item *get_copy(THD *thd) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1692,17 +1699,17 @@ class Item_func_neg :public Item_func_num1 { public: Item_func_neg(THD *thd, Item *a): Item_func_num1(thd, a) {} - double real_op(); - longlong int_op(); - my_decimal *decimal_op(my_decimal *); + double real_op() override; + longlong int_op() override; + my_decimal *decimal_op(my_decimal *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("-") }; return name; } - enum Functype functype() const { return NEG_FUNC; } - enum precedence precedence() const { return NEG_PRECEDENCE; } - void print(String *str, enum_query_type query_type) + enum Functype functype() const override { return NEG_FUNC; } + enum precedence precedence() const override { return NEG_PRECEDENCE; } + void print(String *str, enum_query_type query_type) override { str->append(func_name_cstring()); args[0]->print_parenthesised(str, query_type, precedence()); @@ -1710,10 +1717,11 @@ public: void fix_length_and_dec_int(); void fix_length_and_dec_double(); void fix_length_and_dec_decimal(); - bool fix_length_and_dec(); - uint decimal_precision() const { return args[0]->decimal_precision(); } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + uint decimal_precision() const override + { return args[0]->decimal_precision(); } + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1722,9 +1730,9 @@ class Item_func_abs :public Item_func_num1 { public: Item_func_abs(THD *thd, Item *a): Item_func_num1(thd, a) {} - double real_op(); - longlong int_op(); - my_decimal *decimal_op(my_decimal *); + double real_op() override; + longlong int_op() override; + my_decimal *decimal_op(my_decimal *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("abs") }; @@ -1733,8 +1741,8 @@ public: void fix_length_and_dec_int(); void fix_length_and_dec_double(); void fix_length_and_dec_decimal(); - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1742,12 +1750,12 @@ public: class Item_dec_func :public Item_real_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_real(0, arg_count); } public: Item_dec_func(THD *thd, Item *a): Item_real_func(thd, a) {} Item_dec_func(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); @@ -1760,13 +1768,13 @@ class Item_func_exp :public Item_dec_func { public: Item_func_exp(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("exp") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1775,13 +1783,13 @@ class Item_func_ln :public Item_dec_func { public: Item_func_ln(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("ln") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1791,13 +1799,13 @@ class Item_func_log :public Item_dec_func public: Item_func_log(THD *thd, Item *a): Item_dec_func(thd, a) {} Item_func_log(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("log") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1806,13 +1814,13 @@ class Item_func_log2 :public Item_dec_func { public: Item_func_log2(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("log2") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1821,13 +1829,13 @@ class Item_func_log10 :public Item_dec_func { public: Item_func_log10(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("log10") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1836,13 +1844,13 @@ class Item_func_sqrt :public Item_dec_func { public: Item_func_sqrt(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("sqrt") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1851,13 +1859,13 @@ class Item_func_pow :public Item_dec_func { public: Item_func_pow(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("pow") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1866,13 +1874,13 @@ class Item_func_acos :public Item_dec_func { public: Item_func_acos(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("acos") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1880,13 +1888,13 @@ class Item_func_asin :public Item_dec_func { public: Item_func_asin(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("asin") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1895,13 +1903,13 @@ class Item_func_atan :public Item_dec_func public: Item_func_atan(THD *thd, Item *a): Item_dec_func(thd, a) {} Item_func_atan(THD *thd, Item *a, Item *b): Item_dec_func(thd, a, b) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("atan") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1909,13 +1917,13 @@ class Item_func_cos :public Item_dec_func { public: Item_func_cos(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("cos") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1923,13 +1931,13 @@ class Item_func_sin :public Item_dec_func { public: Item_func_sin(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("sin") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1937,13 +1945,13 @@ class Item_func_tan :public Item_dec_func { public: Item_func_tan(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("tan") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1951,13 +1959,13 @@ class Item_func_cot :public Item_dec_func { public: Item_func_cot(THD *thd, Item *a): Item_dec_func(thd, a) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("cot") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1966,8 +1974,8 @@ class Item_func_int_val :public Item_func_hybrid_field_type { public: Item_func_int_val(THD *thd, Item *a): Item_func_hybrid_field_type(thd, a) {} - bool check_partition_func_processor(void *int_arg) { return FALSE; } - bool check_vcol_func_processor(void *arg) { return FALSE; } + bool check_partition_func_processor(void *int_arg) override { return FALSE; } + bool check_vcol_func_processor(void *arg) override { return FALSE; } virtual decimal_round_mode round_mode() const= 0; void fix_length_and_dec_double(); void fix_length_and_dec_int_or_decimal(); @@ -1983,9 +1991,9 @@ public: // Thinks like CEILING(TIMESTAMP'0000-01-01 23:59:59.9') returns NULL set_maybe_null(); } - bool fix_length_and_dec(); - String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool native_op(THD *thd, Native *to) + bool fix_length_and_dec() override; + String *str_op(String *str) override { DBUG_ASSERT(0); return 0; } + bool native_op(THD *thd, Native *to) override { DBUG_ASSERT(0); return true; @@ -2002,13 +2010,13 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("ceiling") }; return name; } - decimal_round_mode round_mode() const { return CEILING; } - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - Item *get_copy(THD *thd) + decimal_round_mode round_mode() const override { return CEILING; } + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2022,13 +2030,13 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("floor") }; return name; } - decimal_round_mode round_mode() const { return FLOOR; } - longlong int_op(); - double real_op(); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - Item *get_copy(THD *thd) + decimal_round_mode round_mode() const override { return FLOOR; } + longlong int_op() override; + double real_op() override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2049,17 +2057,17 @@ public: static LEX_CSTRING round_name= {STRING_WITH_LEN("round") }; return truncate ? truncate_name : round_name; } - double real_op(); - longlong int_op(); - my_decimal *decimal_op(my_decimal *); - bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool time_op(THD *thd, MYSQL_TIME *ltime); - bool native_op(THD *thd, Native *to) + double real_op() override; + longlong int_op() override; + my_decimal *decimal_op(my_decimal *) override; + bool date_op(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool time_op(THD *thd, MYSQL_TIME *ltime) override; + bool native_op(THD *thd, Native *to) override { DBUG_ASSERT(0); return true; } - String *str_op(String *str) + String *str_op(String *str) override { DBUG_ASSERT(0); return NULL; @@ -2073,7 +2081,7 @@ public: void fix_arg_time(); void fix_arg_datetime(); void fix_arg_temporal(const Type_handler *h, uint int_part_length); - bool fix_length_and_dec() + bool fix_length_and_dec() override { /* We don't want to translate ENUM/SET to CHAR here. @@ -2081,7 +2089,7 @@ public: */ return args[0]->real_type_handler()->Item_func_round_fix_length_and_dec(this); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2090,36 +2098,36 @@ class Item_func_rand :public Item_real_func { struct my_rnd_struct *rand; bool first_eval; // TRUE if val_real() is called 1st time - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, arg_count); } void seed_random (Item * val); public: Item_func_rand(THD *thd, Item *a): Item_real_func(thd, a), rand(0), first_eval(TRUE) {} Item_func_rand(THD *thd): Item_real_func(thd) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("rand") }; return name; } - bool const_item() const { return 0; } - void update_used_tables(); - bool fix_fields(THD *thd, Item **ref); - void cleanup() { first_eval= TRUE; Item_real_func::cleanup(); } - bool check_vcol_func_processor(void *arg) + bool const_item() const override { return 0; } + void update_used_tables() override; + bool fix_fields(THD *thd, Item **ref) override; + void cleanup() override { first_eval= TRUE; Item_real_func::cleanup(); } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_sign :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_real(func_name_cstring()); } public: Item_func_sign(THD *thd, Item *a): Item_long_func(thd, a) {} @@ -2128,10 +2136,10 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("sign") }; return name; } - uint decimal_precision() const { return 1; } - bool fix_length_and_dec() { fix_char_length(2); return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) + uint decimal_precision() const override { return 1; } + bool fix_length_and_dec() override { fix_char_length(2); return FALSE; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2140,7 +2148,7 @@ class Item_func_units :public Item_real_func { LEX_CSTRING name; double mul,add; - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_real(0, arg_count); } public: Item_func_units(THD *thd, char *name_arg, Item *a, double mul_arg, @@ -2150,15 +2158,15 @@ public: name.str= name_arg; name.length= strlen(name_arg); } - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2179,7 +2187,7 @@ class Item_func_min_max :public Item_hybrid_func String tmp_value; int cmp_sign; protected: - bool check_arguments() const + bool check_arguments() const override { return false; // Checked by aggregate_for_min_max() } @@ -2195,37 +2203,37 @@ public: bool get_date_native(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); bool get_time_native(THD *thd, MYSQL_TIME *res); - double val_real() + double val_real() override { DBUG_ASSERT(fixed()); return Item_func_min_max::type_handler()-> Item_func_min_max_val_real(this); } - longlong val_int() + longlong val_int() override { DBUG_ASSERT(fixed()); return Item_func_min_max::type_handler()-> Item_func_min_max_val_int(this); } - String *val_str(String *str) + String *val_str(String *str) override { DBUG_ASSERT(fixed()); return Item_func_min_max::type_handler()-> Item_func_min_max_val_str(this, str); } - my_decimal *val_decimal(my_decimal *dec) + my_decimal *val_decimal(my_decimal *dec) override { DBUG_ASSERT(fixed()); return Item_func_min_max::type_handler()-> Item_func_min_max_val_decimal(this, dec); } - 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 { DBUG_ASSERT(fixed()); return Item_func_min_max::type_handler()-> Item_func_min_max_get_date(thd, this, res, fuzzydate); } - bool val_native(THD *thd, Native *to); + bool val_native(THD *thd, Native *to) override; void aggregate_attributes_real(Item **items, uint nitems) { /* @@ -2246,7 +2254,7 @@ public: Item_func::aggregate_attributes_real(items, nitems); max_length= float_length(decimals); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { if (aggregate_for_min_max(func_name_cstring(), args, arg_count)) return true; @@ -2264,7 +2272,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("least") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2277,7 +2285,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("greatest") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2294,39 +2302,41 @@ public: { name= a->name; } - double val_real() { return val_real_from_item(args[0]); } - longlong val_int() { return val_int_from_item(args[0]); } - String *val_str(String *str) { return val_str_from_item(args[0], str); } - bool val_native(THD *thd, Native *to) - { return val_native_from_item(thd, args[0], to); } - my_decimal *val_decimal(my_decimal *dec) + double val_real() override { return val_real_from_item(args[0]); } + longlong val_int() override { return val_int_from_item(args[0]); } + String *val_str(String *str) override + { return val_str_from_item(args[0], str); } + bool val_native(THD *thd, Native *to) override + { return val_native_from_item(thd, args[0], to); } + my_decimal *val_decimal(my_decimal *dec) override { return val_decimal_from_item(args[0], dec); } - 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_item(thd, args[0], ltime, fuzzydate); } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("rollup_const") }; return name; } - bool const_item() const { return 0; } - const Type_handler *type_handler() const { return args[0]->type_handler(); } - bool fix_length_and_dec() + bool const_item() const override { return 0; } + const Type_handler *type_handler() const override + { return args[0]->type_handler(); } + bool fix_length_and_dec() override { Type_std_attributes::set(*args[0]); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_long_func_length: public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_str(func_name_cstring()); } public: Item_long_func_length(THD *thd, Item *a): Item_long_func(thd, a) {} - bool fix_length_and_dec() { max_length=10; return FALSE; } + bool fix_length_and_dec() override { max_length=10; return FALSE; } }; @@ -2335,13 +2345,13 @@ class Item_func_octet_length :public Item_long_func_length String value; public: Item_func_octet_length(THD *thd, Item *a): Item_long_func_length(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("octet_length") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2350,18 +2360,18 @@ class Item_func_bit_length :public Item_longlong_func String value; public: Item_func_bit_length(THD *thd, Item *a): Item_longlong_func(thd, a) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= 11; // 0x100000000*8 = 34,359,738,368 return FALSE; } - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("bit_length") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2370,47 +2380,48 @@ class Item_func_char_length :public Item_long_func_length String value; public: Item_func_char_length(THD *thd, Item *a): Item_long_func_length(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("char_length") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_coercibility :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_str(func_name_cstring()); } public: Item_func_coercibility(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("coercibility") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length=10; base_flags&= ~item_base_t::MAYBE_NULL; return FALSE; } - bool eval_not_null_tables(void *) + bool eval_not_null_tables(void *) override { not_null_tables_cache= 0; return false; } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return false; } Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override { return this; } - bool const_item() const { return true; } - Item *get_copy(THD *thd) + bool const_item() const override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2423,7 +2434,7 @@ public: */ class Item_func_locate :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_str(0, 2) || (arg_count > 2 && args[2]->check_type_can_return_int(func_name_cstring())); @@ -2440,14 +2451,14 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("locate") }; return name; } - longlong val_int(); - bool fix_length_and_dec() + longlong val_int() override; + bool fix_length_and_dec() override { max_length= MY_INT32_NUM_DECIMAL_DIGITS; return agg_arg_charsets_for_comparison(cmp_collation, args, 2); } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2459,57 +2470,57 @@ class Item_func_field :public Item_long_func DTCollation cmp_collation; public: Item_func_field(THD *thd, List &list): Item_long_func(thd, list) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("field") }; return name; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_ascii :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_str(0, arg_count); } String value; public: Item_func_ascii(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("ascii") }; return name; } - bool fix_length_and_dec() { max_length=3; return FALSE; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { max_length=3; return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_ord :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_str(func_name_cstring()); } String value; public: Item_func_ord(THD *thd, Item *a): Item_long_func(thd, a) {} - bool fix_length_and_dec() { fix_char_length(7); return FALSE; } - longlong val_int(); + bool fix_length_and_dec() override { fix_char_length(7); return FALSE; } + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("ord") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_find_in_set :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_str(0, 2); } String value,value2; uint enum_value; @@ -2518,14 +2529,14 @@ class Item_func_find_in_set :public Item_long_func public: Item_func_find_in_set(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b), enum_value(0) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("find_in_set") }; return name; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2533,7 +2544,7 @@ public: class Item_func_bit_operator: public Item_handled_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, arg_count); } protected: bool fix_length_and_dec_op1_std(const Handler *ha_int, const Handler *ha_dec) @@ -2552,11 +2563,11 @@ public: :Item_handled_func(thd, a) {} Item_func_bit_operator(THD *thd, Item *a, Item *b) :Item_handled_func(thd, a, b) {} - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { print_op(str, query_type); } - bool need_parentheses_in_default() { return true; } + bool need_parentheses_in_default() override { return true; } }; class Item_func_bit_or :public Item_func_bit_operator @@ -2564,14 +2575,14 @@ class Item_func_bit_or :public Item_func_bit_operator public: Item_func_bit_or(THD *thd, Item *a, Item *b) :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("|") }; return name; } - enum precedence precedence() const { return BITOR_PRECEDENCE; } - Item *get_copy(THD *thd) + enum precedence precedence() const override { return BITOR_PRECEDENCE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2580,20 +2591,20 @@ class Item_func_bit_and :public Item_func_bit_operator public: Item_func_bit_and(THD *thd, Item *a, Item *b) :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("&") }; return name; } - enum precedence precedence() const { return BITAND_PRECEDENCE; } - Item *get_copy(THD *thd) + enum precedence precedence() const override { return BITAND_PRECEDENCE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_bit_count :public Item_handled_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_int(func_name_cstring()); } public: Item_func_bit_count(THD *thd, Item *a): Item_handled_func(thd, a) {} @@ -2602,8 +2613,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("bit_count") }; return name; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2612,14 +2623,14 @@ class Item_func_shift_left :public Item_func_bit_operator public: Item_func_shift_left(THD *thd, Item *a, Item *b) :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("<<") }; return name; } - enum precedence precedence() const { return SHIFT_PRECEDENCE; } - Item *get_copy(THD *thd) + enum precedence precedence() const override { return SHIFT_PRECEDENCE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2628,14 +2639,14 @@ class Item_func_shift_right :public Item_func_bit_operator public: Item_func_shift_right(THD *thd, Item *a, Item *b) :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN(">>") }; return name; } - enum precedence precedence() const { return SHIFT_PRECEDENCE; } - Item *get_copy(THD *thd) + enum precedence precedence() const override { return SHIFT_PRECEDENCE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2643,56 +2654,56 @@ class Item_func_bit_neg :public Item_func_bit_operator { public: Item_func_bit_neg(THD *thd, Item *a): Item_func_bit_operator(thd, a) {} - bool fix_length_and_dec(); + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("~") }; return name; } - enum precedence precedence() const { return NEG_PRECEDENCE; } - void print(String *str, enum_query_type query_type) + enum precedence precedence() const override { return NEG_PRECEDENCE; } + void print(String *str, enum_query_type query_type) override { str->append(func_name_cstring()); args[0]->print_parenthesised(str, query_type, precedence()); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_last_insert_id :public Item_longlong_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, arg_count); } public: Item_func_last_insert_id(THD *thd): Item_longlong_func(thd) {} Item_func_last_insert_id(THD *thd, Item *a): Item_longlong_func(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("last_insert_id") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { unsigned_flag= true; if (arg_count) max_length= args[0]->max_length; return FALSE; } - bool fix_fields(THD *thd, Item **ref); - bool check_vcol_func_processor(void *arg) + bool fix_fields(THD *thd, Item **ref) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_benchmark :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_int(func_name_cstring()) || args[1]->check_type_scalar(func_name_cstring()); @@ -2701,24 +2712,24 @@ public: Item_func_benchmark(THD *thd, Item *count_expr, Item *expr): Item_long_func(thd, count_expr, expr) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("benchmark") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length=1; base_flags&= ~item_base_t::MAYBE_NULL; return FALSE; } - virtual void print(String *str, enum_query_type query_type); - bool check_vcol_func_processor(void *arg) + void print(String *str, enum_query_type query_type) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2728,28 +2739,28 @@ void item_func_sleep_free(void); class Item_func_sleep :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_real(func_name_cstring()); } public: Item_func_sleep(THD *thd, Item *a): Item_long_func(thd, a) {} - bool fix_length_and_dec() { fix_char_length(1); return FALSE; } - bool const_item() const { return 0; } + bool fix_length_and_dec() override { fix_char_length(1); return FALSE; } + bool const_item() const override { return 0; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("sleep") }; return name; } - table_map used_tables() const + table_map used_tables() const override { return used_tables_cache | RAND_TABLE_BIT; } - bool is_expensive() { return 1; } - longlong val_int(); - bool check_vcol_func_processor(void *arg) + bool is_expensive() override { return 1; } + longlong val_int() override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2770,7 +2781,7 @@ class Item_udf_func :public Item_func } protected: udf_handler udf; - bool is_expensive_processor(void *arg) { return TRUE; } + bool is_expensive_processor(void *arg) override { return TRUE; } class VDec_udf: public Dec_ptr_and_buffer { @@ -2794,8 +2805,8 @@ public: const char *tmp= udf.name(); return { tmp, strlen(tmp) }; } - enum Functype functype() const { return UDF_FUNC; } - bool fix_fields(THD *thd, Item **ref) + enum Functype functype() const override { return UDF_FUNC; } + bool fix_fields(THD *thd, Item **ref) override { DBUG_ASSERT(fixed() == 0); bool res= udf.fix_fields(thd, this, arg_count, args); @@ -2804,7 +2815,7 @@ public: return res; } void fix_num_length_and_dec(); - void update_used_tables() + void update_used_tables() override { /* TODO: Make a member in UDF_INIT and return if a UDF is deterministic or @@ -2853,28 +2864,28 @@ public: set_non_deterministic_if_needed(); } } - void cleanup(); - bool eval_not_null_tables(void *opt_arg) + void cleanup() override; + bool eval_not_null_tables(void *opt_arg) override { not_null_tables_cache= 0; return 0; } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return false; } - bool is_expensive() { return 1; } - virtual void print(String *str, enum_query_type query_type); - bool check_vcol_func_processor(void *arg) + bool is_expensive() override { return 1; } + void print(String *str, enum_query_type query_type) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); } - 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); } - bool excl_dep_on_grouping_fields(st_select_lex *sel) + bool excl_dep_on_grouping_fields(st_select_lex *sel) override { return false; } }; @@ -2887,13 +2898,13 @@ class Item_func_udf_float :public Item_udf_func Item_func_udf_float(THD *thd, udf_func *udf_arg, List &list): Item_udf_func(thd, udf_arg, list) {} - longlong val_int() + longlong val_int() override { DBUG_ASSERT(fixed()); return Converter_double_to_longlong(Item_func_udf_float::val_real(), unsigned_flag).result(); } - my_decimal *val_decimal(my_decimal *dec_buf) + my_decimal *val_decimal(my_decimal *dec_buf) override { double res=val_real(); if (null_value) @@ -2901,11 +2912,12 @@ class Item_func_udf_float :public Item_udf_func double2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf); return dec_buf; } - double val_real(); - String *val_str(String *str); - const Type_handler *type_handler() const { return &type_handler_double; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *get_copy(THD *thd) + double val_real() override; + String *val_str(String *str) override; + const Type_handler *type_handler() const override + { return &type_handler_double; } + bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2918,21 +2930,21 @@ public: Item_func_udf_int(THD *thd, udf_func *udf_arg, List &list): Item_udf_func(thd, udf_arg, list) {} - longlong val_int(); - double val_real() { return (double) Item_func_udf_int::val_int(); } - my_decimal *val_decimal(my_decimal *decimal_value) + longlong val_int() override; + double val_real() override { return (double) Item_func_udf_int::val_int(); } + my_decimal *val_decimal(my_decimal *decimal_value) override { return val_decimal_from_int(decimal_value); } - String *val_str(String *str); - const Type_handler *type_handler() const + String *val_str(String *str) override; + const Type_handler *type_handler() const override { if (unsigned_flag) return &type_handler_ulonglong; return &type_handler_slonglong; } - bool fix_length_and_dec() { decimals= 0; max_length= 21; return FALSE; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { decimals= 0; max_length= 21; return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2944,22 +2956,23 @@ public: Item_udf_func(thd, udf_arg) {} Item_func_udf_decimal(THD *thd, udf_func *udf_arg, List &list): Item_udf_func(thd, udf_arg, list) {} - longlong val_int() + longlong val_int() override { return VDec_udf(this, &udf).to_longlong(unsigned_flag); } - double val_real() + double val_real() override { return VDec_udf(this, &udf).to_double(); } - my_decimal *val_decimal(my_decimal *); - String *val_str(String *str) + my_decimal *val_decimal(my_decimal *) override; + String *val_str(String *str) override { return VDec_udf(this, &udf).to_string_round(str, decimals); } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override + { return &type_handler_newdecimal; } + bool fix_length_and_dec() override { fix_num_length_and_dec(); return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2971,8 +2984,8 @@ public: Item_udf_func(thd, udf_arg) {} Item_func_udf_str(THD *thd, udf_func *udf_arg, List &list): Item_udf_func(thd, udf_arg, list) {} - String *val_str(String *); - double val_real() + String *val_str(String *) override; + double val_real() override { int err_not_used; char *end_not_used; @@ -2981,14 +2994,14 @@ public: return res ? res->charset()->strntod((char*) res->ptr(), res->length(), &end_not_used, &err_not_used) : 0.0; } - longlong val_int() + longlong val_int() override { int err_not_used; String *res; res=val_str(&str_value); return res ? res->charset()->strntoll(res->ptr(),res->length(),10, (char**) 0, &err_not_used) : (longlong) 0; } - my_decimal *val_decimal(my_decimal *dec_buf) + my_decimal *val_decimal(my_decimal *dec_buf) override { String *res=val_str(&str_value); if (!res) @@ -2996,9 +3009,10 @@ public: string2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf); return dec_buf; } - const Type_handler *type_handler() const { return string_type_handler(); } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override + { return string_type_handler(); } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3022,7 +3036,8 @@ public: Item_int_func(thd) {} Item_func_udf_int(THD *thd, udf_func *udf_arg, List &list): Item_int_func(thd, list) {} - const Type_handler *type_handler() const { return &type_handler_slonglong; } + const Type_handler *type_handler() const override + { return &type_handler_slonglong; } longlong val_int() { DBUG_ASSERT(fixed()); return 0; } }; @@ -3034,7 +3049,8 @@ public: Item_int_func(thd) {} Item_func_udf_decimal(THD *thd, udf_func *udf_arg, List &list): Item_int_func(thd, list) {} - const Type_handler *type_handler() const { return &type_handler_slonglong; } + const Type_handler *type_handler() const override + { return &type_handler_slonglong; } my_decimal *val_decimal(my_decimal *) { DBUG_ASSERT(fixed()); return 0; } }; @@ -3066,13 +3082,13 @@ class Item_func_lock :public Item_long_func Item_func_lock(THD *thd): Item_long_func(thd) { } Item_func_lock(THD *thd, Item *a): Item_long_func(thd, a) {} Item_func_lock(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - table_map used_tables() const + table_map used_tables() const override { return used_tables_cache | RAND_TABLE_BIT; } - bool const_item() const { return 0; } - bool is_expensive() { return 1; } - bool check_vcol_func_processor(void *arg) + bool const_item() const override { return 0; } + bool is_expensive() override { return 1; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } @@ -3081,7 +3097,7 @@ class Item_func_lock :public Item_long_func class Item_func_get_lock final :public Item_func_lock { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name_cstring()) || args[1]->check_type_can_return_real(func_name_cstring()); @@ -3095,7 +3111,7 @@ class Item_func_get_lock final :public Item_func_lock static LEX_CSTRING name= {STRING_WITH_LEN("get_lock") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= 1; set_maybe_null(); @@ -3124,7 +3140,7 @@ public: class Item_func_release_lock final :public Item_func_lock { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name_cstring()); } String value; public: @@ -3135,7 +3151,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("release_lock") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= 1; set_maybe_null(); @@ -3150,7 +3166,7 @@ public: class Item_master_pos_wait :public Item_longlong_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name_cstring()) || @@ -3166,30 +3182,30 @@ public: Item_longlong_func(thd, a, b, c) {} Item_master_pos_wait(THD *thd, Item *a, Item *b, Item *c, Item *d): Item_longlong_func(thd, a, b, c, d) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("master_pos_wait") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length=21; set_maybe_null(); return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_master_gtid_wait :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name_cstring()) || (arg_count > 1 && args[1]->check_type_can_return_real(func_name_cstring())); @@ -3200,18 +3216,18 @@ public: :Item_long_func(thd, a) {} Item_master_gtid_wait(THD *thd, Item *a, Item *b) :Item_long_func(thd, a, b) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("master_gtid_wait") }; return name; } - bool fix_length_and_dec() { max_length=2; return FALSE; } - bool check_vcol_func_processor(void *arg) + bool fix_length_and_dec() override { max_length=2; return FALSE; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3290,28 +3306,28 @@ public: null_item(item->null_item), save_result(item->save_result) {} - enum Functype functype() const { return SUSERVAR_FUNC; } - double val_real(); - longlong val_int(); - String *val_str(String *str); - my_decimal *val_decimal(my_decimal *); - double val_result(); - longlong val_int_result(); - bool val_bool_result(); - String *str_result(String *str); - my_decimal *val_decimal_result(my_decimal *); - bool is_null_result(); + enum Functype functype() const override { return SUSERVAR_FUNC; } + double val_real() override; + longlong val_int() override; + String *val_str(String *str) override; + my_decimal *val_decimal(my_decimal *) override; + double val_result() override; + longlong val_int_result() override; + bool val_bool_result() override; + String *str_result(String *str) override; + my_decimal *val_decimal_result(my_decimal *) override; + bool is_null_result() override; bool update_hash(void *ptr, size_t length, enum Item_result type, CHARSET_INFO *cs, bool unsigned_arg); - bool send(Protocol *protocol, st_value *buffer); - void make_send_field(THD *thd, Send_field *tmp_field); + bool send(Protocol *protocol, st_value *buffer) override; + void make_send_field(THD *thd, Send_field *tmp_field) override; bool check(bool use_result_field); void save_item_result(Item *item); bool update(); - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return ASSIGN_PRECEDENCE; } + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override; + void print(String *str, enum_query_type query_type) override; + enum precedence precedence() const override { return ASSIGN_PRECEDENCE; } void print_as_stmt(String *str, enum_query_type query_type); LEX_CSTRING func_name_cstring() const override { @@ -3320,20 +3336,21 @@ public: } int save_in_field(Field *field, bool no_conversions, bool can_use_result_field); - int save_in_field(Field *field, bool no_conversions) + int save_in_field(Field *field, bool no_conversions) override { return save_in_field(field, no_conversions, 1); } void save_org_in_field(Field *field, fast_field_copier data __attribute__ ((__unused__))) - { (void)save_in_field(field, 1, 0); } - bool register_field_in_read_map(void *arg); - bool register_field_in_bitmap(void *arg); + override + { (void) save_in_field(field, 1, 0); } + bool register_field_in_read_map(void *arg) override; + bool register_field_in_bitmap(void *arg) override; bool set_entry(THD *thd, bool create_if_not_exists); - void cleanup(); - Item *get_copy(THD *thd) + void cleanup() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool excl_dep_on_table(table_map tab_map) { return false; } + bool excl_dep_on_table(table_map tab_map) override { return false; } }; @@ -3343,14 +3360,14 @@ class Item_func_get_user_var :public Item_func_user_var, public: Item_func_get_user_var(THD *thd, const LEX_CSTRING *a): Item_func_user_var(thd, a) {} - enum Functype functype() const { return GUSERVAR_FUNC; } + enum Functype functype() const override { return GUSERVAR_FUNC; } LEX_CSTRING get_name() { return name; } - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal*); - String *val_str(String* str); - bool fix_length_and_dec(); - virtual void print(String *str, enum_query_type query_type); + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal*) override; + String *val_str(String* str) override; + bool fix_length_and_dec() override; + void print(String *str, enum_query_type query_type) override; /* We must always return variables as strings to guard against selects of type select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b) @@ -3360,17 +3377,17 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("get_user_var") }; return name; } - bool const_item() const; - table_map used_tables() const + bool const_item() const override; + table_map used_tables() const override { return const_item() ? 0 : RAND_TABLE_BIT; } - bool eq(const Item *item, bool binary_cmp) const; - Item *get_copy(THD *thd) + bool eq(const Item *item, bool binary_cmp) const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: - bool set_value(THD *thd, sp_rcontext *ctx, Item **it); + bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override; public: - Settable_routine_parameter *get_settable_routine_parameter() + Settable_routine_parameter *get_settable_routine_parameter() override { return this; } @@ -3399,54 +3416,55 @@ public: org_name= *a; set_name(thd, a->str, a->length, system_charset_info); } - Load_data_outvar *get_load_data_outvar() + Load_data_outvar *get_load_data_outvar() override { return this; } - bool load_data_set_null(THD *thd, const Load_data_param *param) + bool load_data_set_null(THD *thd, const Load_data_param *param) override { set_null_value(param->charset()); return false; } - bool load_data_set_no_data(THD *thd, const Load_data_param *param) + bool load_data_set_no_data(THD *thd, const Load_data_param *param) override { set_null_value(param->charset()); return false; } bool load_data_set_value(THD *thd, const char *pos, uint length, - const Load_data_param *param) + const Load_data_param *param) override { set_value(pos, length, param->charset()); return false; } - void load_data_print_for_log_event(THD *thd, String *to) const; - bool load_data_add_outvar(THD *thd, Load_data_param *param) const + void load_data_print_for_log_event(THD *thd, String *to) const override; + bool load_data_add_outvar(THD *thd, Load_data_param *param) const override { return param->add_outvar_user_var(thd); } - uint load_data_fixed_length() const + uint load_data_fixed_length() const override { return 0; } 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); return NULL; } /* We should return something different from FIELD_ITEM here */ - enum Type type() const { return CONST_ITEM;} - double val_real(); - longlong val_int(); - String *val_str(String *str); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - my_decimal *val_decimal(my_decimal *decimal_buffer); + enum Type type() const override { return CONST_ITEM;} + double val_real() override; + longlong val_int() override; + String *val_str(String *str) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + my_decimal *val_decimal(my_decimal *decimal_buffer) override; /* fix_fields() binds variable name with its entry structure */ - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; void set_null_value(CHARSET_INFO* cs); void set_value(const char *str, uint length, CHARSET_INFO* cs); - const Type_handler *type_handler() const { return &type_handler_double; } - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override + { return &type_handler_double; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3474,19 +3492,19 @@ public: enum_var_type var_type_arg, LEX_CSTRING *component_arg, const char *name_arg, size_t name_len_arg); - enum Functype functype() const { return GSYSVAR_FUNC; } - void update_null_value(); - bool fix_length_and_dec(); - void print(String *str, enum_query_type query_type); - bool const_item() const { return true; } - table_map used_tables() const { return 0; } - const Type_handler *type_handler() const; - double val_real(); - longlong val_int(); - String* val_str(String*); - my_decimal *val_decimal(my_decimal *dec_buf) + enum Functype functype() const override { return GSYSVAR_FUNC; } + void update_null_value() override; + bool fix_length_and_dec() override; + void print(String *str, enum_query_type query_type) override; + bool const_item() const override { return true; } + table_map used_tables() const override { return 0; } + const Type_handler *type_handler() const override; + double val_real() override; + longlong val_int() override; + String* val_str(String*) override; + my_decimal *val_decimal(my_decimal *dec_buf) override { return val_decimal_from_real(dec_buf); } - 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); } @@ -3505,11 +3523,11 @@ public: @return true if the variable is written to the binlog, false otherwise. */ bool is_written_to_binlog(); - bool eq(const Item *item, bool binary_cmp) const; + bool eq(const Item *item, bool binary_cmp) const override; - void cleanup(); - bool check_vcol_func_processor(void *arg); - Item *get_copy(THD *thd) + void cleanup() override; + bool check_vcol_func_processor(void *arg) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3532,7 +3550,7 @@ public: Item_func_match(THD *thd, List &a, uint b): Item_real_func(thd, a), key(0), match_flags(b), join_key(0), ft_handler(0), table(0), master(0), concat_ws(0) { } - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_match::cleanup"); Item_real_func::cleanup(); @@ -3543,38 +3561,38 @@ public: table= 0; // required by Item_func_match::eq() DBUG_VOID_RETURN; } - bool is_expensive_processor(void *arg) { return TRUE; } - enum Functype functype() const { return FT_FUNC; } + bool is_expensive_processor(void *arg) override { return TRUE; } + enum Functype functype() const override { return FT_FUNC; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("match") }; return name; } - bool eval_not_null_tables(void *opt_arg) + bool eval_not_null_tables(void *opt_arg) override { not_null_tables_cache= 0; return 0; } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return false; } - bool fix_fields(THD *thd, Item **ref); - bool eq(const Item *, bool binary_cmp) const; + bool fix_fields(THD *thd, Item **ref) override; + bool eq(const Item *, bool binary_cmp) const override; /* The following should be safe, even if we compare doubles */ - longlong val_int() { DBUG_ASSERT(fixed()); return val_real() != 0.0; } - double val_real(); + longlong val_int() override { DBUG_ASSERT(fixed()); return val_real() != 0.0; } + double val_real() override; void print(String *str, enum_query_type query_type) override; bool fix_index(); bool init_search(THD *thd, bool no_order); - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function("match ... against()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *build_clone(THD *thd) { return 0; } + Item *build_clone(THD *thd) override { return 0; } private: /** Check whether storage engine for given table, @@ -3617,69 +3635,69 @@ class Item_func_bit_xor : public Item_func_bit_operator public: Item_func_bit_xor(THD *thd, Item *a, Item *b) :Item_func_bit_operator(thd, a, b) {} - bool fix_length_and_dec(); + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("^") }; return name; } - enum precedence precedence() const { return BITXOR_PRECEDENCE; } - Item *get_copy(THD *thd) + enum precedence precedence() const override { return BITXOR_PRECEDENCE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_is_free_lock :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name_cstring()); } String value; public: Item_func_is_free_lock(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("is_free_lock") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=1; set_maybe_null(); return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_is_used_lock :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name_cstring()); } String value; public: Item_func_is_used_lock(THD *thd, Item *a): Item_long_func(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("is_used_lock") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=10; set_maybe_null(); return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3724,23 +3742,23 @@ class Item_func_row_count :public Item_longlong_func { public: Item_func_row_count(THD *thd): Item_longlong_func(thd) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("row_count") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; base_flags&= ~item_base_t::MAYBE_NULL; return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3760,10 +3778,10 @@ private: bool execute(); protected: - bool is_expensive_processor(void *arg) + bool is_expensive_processor(void *arg) override { return is_expensive(); } - bool check_arguments() const + bool check_arguments() const override { // sp_prepare_func_item() checks that the number of columns is correct return false; @@ -3779,53 +3797,53 @@ public: virtual ~Item_func_sp() {} - void update_used_tables(); + void update_used_tables() override; - void cleanup(); + void cleanup() override; LEX_CSTRING func_name_cstring() const override; - const Type_handler *type_handler() const; + const Type_handler *type_handler() const override; Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src, - const Tmp_field_param *param); - Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) + const Tmp_field_param *param) override; + Field *create_field_for_create_select(MEM_ROOT *root, TABLE *table) override { return result_type() != STRING_RESULT ? sp_result_field : create_table_field_from_handler(root, table); } - void make_send_field(THD *thd, Send_field *tmp_field); + void make_send_field(THD *thd, Send_field *tmp_field) override; - longlong val_int() + longlong val_int() override { if (execute()) return (longlong) 0; return sp_result_field->val_int(); } - double val_real() + double val_real() override { if (execute()) return 0.0; 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()) return NULL; return sp_result_field->val_decimal(dec_buf); } - 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 (execute()) return true; return sp_result_field->get_date(ltime, fuzzydate); } - String *val_str(String *str) + String *val_str(String *str) override { String buf; char buff[20]; @@ -3844,26 +3862,26 @@ public: return str; } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { if (execute()) return true; return (null_value= sp_result_field->val_native(to)); } - void update_null_value() + void update_null_value() override { execute(); } - virtual bool change_context_processor(void *cntx) - { context= (Name_resolution_context *)cntx; return FALSE; } + bool change_context_processor(void *cntx) override + { context= (Name_resolution_context *)cntx; return FALSE; } - virtual enum Functype functype() const { return FUNC_SP; } + enum Functype functype() const override { return FUNC_SP; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(void); - bool is_expensive(); + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec(void) override; + bool is_expensive() override; inline Field *get_sp_result_field() { @@ -3874,20 +3892,20 @@ public: return m_name; } - bool check_vcol_func_processor(void *arg); - bool limit_index_condition_pushdown_processor(void *opt_arg) + bool check_vcol_func_processor(void *arg) override; + bool limit_index_condition_pushdown_processor(void *opt_arg) override { return TRUE; } - Item *get_copy(THD *) { return 0; } - bool eval_not_null_tables(void *opt_arg) + Item *get_copy(THD *) override { return 0; } + bool eval_not_null_tables(void *opt_arg) override { not_null_tables_cache= 0; return 0; } - bool excl_dep_on_grouping_fields(st_select_lex *sel) + bool excl_dep_on_grouping_fields(st_select_lex *sel) override { return false; } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return false; } @@ -3898,23 +3916,23 @@ class Item_func_found_rows :public Item_longlong_func { public: Item_func_found_rows(THD *thd): Item_longlong_func(thd) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("found_rows") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; base_flags&= ~item_base_t::MAYBE_NULL; return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3923,21 +3941,21 @@ class Item_func_oracle_sql_rowcount :public Item_longlong_func { public: Item_func_oracle_sql_rowcount(THD *thd): Item_longlong_func(thd) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("SQL%ROWCOUNT") }; return name; } - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { str->append(func_name_cstring()); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3946,28 +3964,28 @@ class Item_func_sqlcode: public Item_long_func { public: Item_func_sqlcode(THD *thd): Item_long_func(thd) { } - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("SQLCODE") }; return name; } - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { str->append(func_name_cstring()); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { base_flags&= ~item_base_t::MAYBE_NULL; null_value= false; max_length= 11; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -3983,17 +4001,17 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("uuid_short") }; return name; } - longlong val_int(); - bool const_item() const { return false; } - bool fix_length_and_dec() + longlong val_int() override; + bool const_item() const override { return false; } + bool fix_length_and_dec() override { max_length= 21; unsigned_flag=1; return FALSE; } - table_map used_tables() const { return RAND_TABLE_BIT; } - bool check_vcol_func_processor(void *arg) + table_map used_tables() const override { return RAND_TABLE_BIT; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4004,36 +4022,37 @@ protected: Item *last_value; public: Item_func_last_value(THD *thd, List &list): Item_func(thd, list) {} - double val_real(); - longlong val_int(); - String *val_str(String *); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool val_native(THD *thd, Native *); - bool fix_length_and_dec(); + double val_real() override; + longlong val_int() override; + String *val_str(String *) override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool val_native(THD *thd, Native *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("last_value") }; return name; } - const Type_handler *type_handler() const { return last_value->type_handler(); } - bool eval_not_null_tables(void *) + const Type_handler *type_handler() const override + { return last_value->type_handler(); } + bool eval_not_null_tables(void *) override { not_null_tables_cache= 0; return 0; } - bool find_not_null_fields(table_map allowed) + bool find_not_null_fields(table_map allowed) override { return false; } - bool const_item() const { return 0; } + bool const_item() const override { return 0; } void evaluate_sideeffects(); - void update_used_tables() + void update_used_tables() override { Item_func::update_used_tables(); copy_flags(last_value, item_base_t::MAYBE_NULL); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4048,13 +4067,13 @@ protected: public: Item_func_nextval(THD *thd, TABLE_LIST *table_list_arg): Item_longlong_func(thd), table_list(table_list_arg) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("nextval") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { unsigned_flag= 0; max_length= MAX_BIGINT_WIDTH; @@ -4077,11 +4096,11 @@ public: table= table_list->next_local->table; } } - bool const_item() const { return 0; } - Item *get_copy(THD *thd) + bool const_item() const override { return 0; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - void print(String *str, enum_query_type query_type); - bool check_vcol_func_processor(void *arg) + void print(String *str, enum_query_type query_type) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, (VCOL_NON_DETERMINISTIC | @@ -4097,13 +4116,13 @@ class Item_func_lastval :public Item_func_nextval public: Item_func_lastval(THD *thd, TABLE_LIST *table_list_arg): Item_func_nextval(thd, table_list_arg) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("lastval") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -4121,14 +4140,14 @@ public: : Item_func_nextval(thd, table_list_arg), nextval(nextval_arg), round(round_arg), is_used(is_used_arg) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("setval") }; return name; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index ee846f21ab2..e94ff312910 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -42,8 +42,9 @@ public: Item_geometry_func(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c) {} Item_geometry_func(THD *thd, List &list): Item_str_func(thd, list) {} - bool fix_length_and_dec(); - const Type_handler *type_handler() const { return &type_handler_geometry; } + bool fix_length_and_dec() override; + 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: String value; - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count == 1); 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 { - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count == 1); 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: String value; - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count == 1); 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 { protected: - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 1); 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 { protected: - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 1); 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 { protected: - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 1); 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 { protected: - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 2); 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: String value; - bool check_arguments() const + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 2); 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 { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_general_purpose_string(func_name_cstring()) || 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") }; return name; } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_geometry_from_wkb: public Item_geometry_func { - bool check_arguments() const + bool check_arguments() const override { return 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") }; return name; } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -248,7 +249,7 @@ public: class Item_func_geometry_from_json: public Item_geometry_func { 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 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") }; return name; } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -281,9 +282,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("st_astext") }; return name; } - String *val_str_ascii(String *); - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -297,9 +298,10 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("st_aswkb") }; return name; } - String *val_str(String *); - const Type_handler *type_handler() const { return &type_handler_long_blob; } - bool fix_length_and_dec() + String *val_str(String *) override; + const Type_handler *type_handler() const override + { return &type_handler_long_blob; } + bool fix_length_and_dec() override { collation.set(&my_charset_bin); decimals=0; @@ -307,14 +309,14 @@ public: set_maybe_null(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; 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 return Item_str_ascii_func_args_geometry::check_arguments() || @@ -332,9 +334,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("st_asgeojson") }; return name; } - bool fix_length_and_dec(); - String *val_str_ascii(String *); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + String *val_str_ascii(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -344,20 +346,20 @@ class Item_func_geometry_type: public Item_str_ascii_func_args_geometry public: Item_func_geometry_type(THD *thd, Item *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 { static LEX_CSTRING name= {STRING_WITH_LEN("st_geometrytype") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { // "GeometryCollection" is the longest fix_length_and_charset(20, default_charset()); set_maybe_null(); return FALSE; }; - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -395,8 +397,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("st_convexhull") }; return name; } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -411,12 +413,12 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("st_centroid") }; return name; } - String *val_str(String *); - const Type_handler *type_handler() const + String *val_str(String *) override; + const Type_handler *type_handler() const override { return &type_handler_point; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -430,12 +432,12 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("st_envelope") }; return name; } - String *val_str(String *); - const Type_handler *type_handler() const + String *val_str(String *) override; + const Type_handler *type_handler() const override { return &type_handler_polygon; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -472,15 +474,15 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("st_boundary") }; return name; } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; 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); } public: 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") }; return name; } - String *val_str(String *); - const Type_handler *type_handler() const + String *val_str(String *) override; + const Type_handler *type_handler() const override { return &type_handler_point; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -524,15 +526,15 @@ public: return unknown; } } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_spatial_decomp_n: public Item_geometry_func_args_geometry { enum Functype decomp_func_n; - bool check_arguments() const + bool check_arguments() const override { return Item_geometry_func_args_geometry::check_arguments() || args[1]->check_type_can_return_int(func_name_cstring()); @@ -561,14 +563,14 @@ public: return unknown; } } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; 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, 0, arg_count); @@ -583,8 +585,8 @@ public: coll_type=ct; item_type=it; } - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { if (Item_geometry_func::fix_length_and_dec()) return TRUE; @@ -613,7 +615,7 @@ public: Geometry::wkb_geometrycollection, Geometry::wkb_point) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return &type_handler_geometrycollection; } @@ -622,7 +624,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("geometrycollection") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -635,13 +637,14 @@ public: Geometry::wkb_linestring, 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 { static LEX_CSTRING name= {STRING_WITH_LEN("linestring") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -654,13 +657,14 @@ public: Geometry::wkb_polygon, 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 { static LEX_CSTRING name= {STRING_WITH_LEN("polygon") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -673,7 +677,7 @@ public: Geometry::wkb_multilinestring, Geometry::wkb_linestring) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return &type_handler_multilinestring; } @@ -682,7 +686,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("multilinestring") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -695,7 +699,7 @@ public: Geometry::wkb_multipoint, Geometry::wkb_point) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return &type_handler_multipoint; } @@ -704,7 +708,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("multipoint") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -717,7 +721,7 @@ public: Geometry::wkb_multipolygon, Geometry::wkb_polygon) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return &type_handler_multipolygon; } @@ -726,7 +730,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("multipolygon") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -743,8 +747,8 @@ protected: String tmp_value1, tmp_value2; SEL_ARG *get_mm_leaf(RANGE_OPT_PARAM *param, Field *field, KEY_PART *key_part, - Item_func::Functype type, Item *value); - bool check_arguments() const + Item_func::Functype type, Item *value) override; + bool check_arguments() const override { DBUG_ASSERT(arg_count >= 2); return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(), @@ -756,8 +760,8 @@ public: { set_maybe_null(); } - enum Functype functype() const { return spatial_rel; } - enum Functype rev_functype() const + enum Functype functype() const override { return spatial_rel; } + enum Functype rev_functype() const override { switch (spatial_rel) { @@ -769,16 +773,16 @@ public: 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, 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, usable_tables, sargables, false); } - bool need_parentheses_in_default() { return false; } - Item *build_clone(THD *thd) { return 0; } + bool need_parentheses_in_default() override { return false; } + 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_rel(thd, a, b, sp_rel) { } - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override; - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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_rel(thd, a, b, sp_rel), collector() { } - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override; - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -817,7 +821,7 @@ class Item_func_spatial_relate: public Item_bool_func_args_geometry_geometry Gcalc_scan_iterator scan_it; Gcalc_function func; 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() || 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_bool_func_args_geometry_geometry(thd, a, b, matrix) { } - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("st_relate") }; return name; } - bool need_parentheses_in_default() { return false; } - Item *get_copy(THD *thd) + bool need_parentheses_in_default() override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -842,9 +846,9 @@ public: 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); 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) {} virtual ~Item_func_spatial_operation(); - String *val_str(String *); + String *val_str(String *) 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 *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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() || args[1]->check_type_can_return_real(func_name_cstring()); @@ -930,8 +934,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("st_buffer") }; return name; } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -963,15 +967,15 @@ class Item_func_issimple: public Item_long_func_args_geometry public: Item_func_issimple(THD *thd, Item *a) :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("st_issimple") }; return name; } - bool fix_length_and_dec() { decimals=0; max_length=2; return FALSE; } - uint decimal_precision() const { return 1; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; } + uint decimal_precision() const override { return 1; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -980,15 +984,15 @@ class Item_func_isclosed: public Item_long_func_args_geometry public: Item_func_isclosed(THD *thd, Item *a) :Item_long_func_args_geometry(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("st_isclosed") }; return name; } - bool fix_length_and_dec() { decimals=0; max_length=2; return FALSE; } - uint decimal_precision() const { return 1; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; } + uint decimal_precision() const override { return 1; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -996,13 +1000,13 @@ class Item_func_isring: public Item_func_issimple { public: 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 { static LEX_CSTRING name= {STRING_WITH_LEN("st_isring") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1028,20 +1032,20 @@ class Item_func_x: public Item_real_func_args_geometry { public: 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 { static LEX_CSTRING name= {STRING_WITH_LEN("st_x") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { if (Item_real_func::fix_length_and_dec()) return TRUE; set_maybe_null(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1050,20 +1054,20 @@ class Item_func_y: public Item_real_func_args_geometry { public: 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 { static LEX_CSTRING name= {STRING_WITH_LEN("st_y") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { if (Item_real_func::fix_length_and_dec()) return TRUE; set_maybe_null(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1126,20 +1130,20 @@ class Item_func_area: public Item_real_func_args_geometry { public: 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 { static LEX_CSTRING name= {STRING_WITH_LEN("st_area") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { if (Item_real_func::fix_length_and_dec()) return TRUE; set_maybe_null(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1150,20 +1154,20 @@ class Item_func_glength: public Item_real_func_args_geometry public: Item_func_glength(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 { static LEX_CSTRING name= {STRING_WITH_LEN("st_length") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { if (Item_real_func::fix_length_and_dec()) return TRUE; set_maybe_null(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1196,13 +1200,13 @@ class Item_func_distance: public Item_real_func_args_geometry_geometry public: Item_func_distance(THD *thd, Item *a, Item *b) :Item_real_func_args_geometry_geometry(thd, a, b) {} - double val_real(); + double val_real() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("st_distance") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1221,12 +1225,12 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("st_pointonsurface") }; return name; } - String *val_str(String *); - const Type_handler *type_handler() const + String *val_str(String *) override; + const Type_handler *type_handler() const override { return &type_handler_point; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1237,18 +1241,18 @@ class Item_func_gis_debug: public Item_long_func public: Item_func_gis_debug(THD *thd, Item *a): Item_long_func(thd, a) { 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 { static LEX_CSTRING name= {STRING_WITH_LEN("st_gis_debug") }; return name; } - longlong val_int(); - bool check_vcol_func_processor(void *arg) + longlong val_int() override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; #endif diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h index e06f5ff7bfb..fe6d1a4f1f9 100644 --- a/sql/item_jsonfunc.h +++ b/sql/item_jsonfunc.h @@ -75,13 +75,13 @@ protected: public: 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 { static LEX_CSTRING name= {STRING_WITH_LEN("json_valid") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { if (Item_bool_func::fix_length_and_dec()) return TRUE; @@ -89,13 +89,14 @@ public: return FALSE; } bool set_format_by_check_constraint(Send_field_extended_metadata *to) const + override { static const Lex_cstring fmt(STRING_WITH_LEN("json")); return to->set_format_name(fmt); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - enum Functype functype() const { return JSON_VALID_FUNC; } + enum Functype functype() const override { return JSON_VALID_FUNC; } }; @@ -113,10 +114,10 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_exists") }; return name; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -210,9 +211,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_quote") }; return name; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -229,9 +230,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_unquote") }; return name; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -264,14 +265,14 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_extract") }; return name; } - enum Functype functype() const { return JSON_EXTRACT_FUNC; } - bool fix_length_and_dec(); - String *val_str(String *); - longlong val_int(); - double val_real(); - my_decimal *val_decimal(my_decimal *); - uint get_n_paths() const { return arg_count - 1; } - Item *get_copy(THD *thd) + enum Functype functype() const override { return JSON_EXTRACT_FUNC; } + bool fix_length_and_dec() override; + String *val_str(String *) override; + longlong val_int() override; + double val_real() override; + my_decimal *val_decimal(my_decimal *) override; + uint get_n_paths() const override { return arg_count - 1; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -292,9 +293,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_contains") }; return name; } - bool fix_length_and_dec(); - longlong val_int(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -317,11 +318,11 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_contains_path") }; return name; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - void cleanup(); - longlong val_int(); - Item *get_copy(THD *thd) + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override; + void cleanup() override; + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -336,14 +337,14 @@ public: Item_json_func(thd) {} Item_func_json_array(THD *thd, List &list): Item_json_func(thd, list) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("json_array") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -356,15 +357,15 @@ protected: public: Item_func_json_array_append(THD *thd, List &list): Item_json_str_multipath(thd, list) {} - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count/2; } + bool fix_length_and_dec() override; + String *val_str(String *) override; + uint get_n_paths() const override { return arg_count/2; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("json_array_append") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -374,13 +375,13 @@ class Item_func_json_array_insert: public Item_func_json_array_append public: Item_func_json_array_insert(THD *thd, List &list): Item_func_json_array_append(thd, list) {} - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("json_array_insert") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -392,13 +393,13 @@ public: Item_func_json_array(thd) {} Item_func_json_object(THD *thd, List &list): Item_func_json_array(thd, list) {} - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("json_object") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -410,13 +411,13 @@ protected: public: Item_func_json_merge(THD *thd, List &list): Item_func_json_array(thd, list) {} - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("json_merge_preserve") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -430,14 +431,14 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_merge_patch") }; return name; } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; 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()) || (arg_count > 1 && @@ -455,16 +456,16 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_length") }; return name; } - bool fix_length_and_dec(); - longlong val_int(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; 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()); } protected: String tmp_js; @@ -475,9 +476,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_depth") }; return name; } - bool fix_length_and_dec() { max_length= 10; return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { max_length= 10; return FALSE; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -493,9 +494,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_type") }; return name; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -510,9 +511,9 @@ public: Item_func_json_insert(bool i_mode, bool r_mode, THD *thd, List &list): Item_json_str_multipath(thd, list), mode_insert(i_mode), mode_replace(r_mode) {} - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count/2; } + bool fix_length_and_dec() override; + String *val_str(String *) override; + uint get_n_paths() const override { return arg_count/2; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING json_set= {STRING_WITH_LEN("json_set") }; @@ -521,7 +522,7 @@ public: return (mode_insert ? (mode_replace ? json_set : json_insert) : json_update); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -533,15 +534,15 @@ protected: public: Item_func_json_remove(THD *thd, List &list): Item_json_str_multipath(thd, list) {} - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count - 1; } + bool fix_length_and_dec() override; + String *val_str(String *) override; + uint get_n_paths() const override { return arg_count - 1; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("json_remove") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -560,9 +561,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_keys") }; return name; } - bool fix_length_and_dec(); - String *val_str(String *); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -587,11 +588,11 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("json_search") }; return name; } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - String *val_str(String *); - uint get_n_paths() const { return arg_count > 4 ? arg_count - 4 : 0; } - Item *get_copy(THD *thd) + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override; + String *val_str(String *) override; + uint get_n_paths() const override { return arg_count > 4 ? arg_count - 4 : 0; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -616,10 +617,10 @@ public: Item_json_func(thd, list), fmt(DETAILED) {} LEX_CSTRING func_name_cstring() const override; - bool fix_length_and_dec(); - String *val_str(String *str); - String *val_json(String *str); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + String *val_str(String *str) override; + String *val_json(String *str) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -631,12 +632,12 @@ protected: Overrides Item_func_group_concat::skip_nulls() NULL-s should be added to the result as JSON null value. */ - bool skip_nulls() const { return false; } - String *get_str_from_item(Item *i, String *tmp); + bool skip_nulls() const override { return false; } + String *get_str_from_item(Item *i, String *tmp) override; 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, - uint old_length, uint max_length) const; + uint old_length, uint max_length) const override; public: String m_tmp_json; /* Used in get_str_from_*.. */ Item_func_json_arrayagg(THD *thd, Name_resolution_context *context_arg, @@ -648,18 +649,18 @@ public: { } 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 { static LEX_CSTRING name= {STRING_WITH_LEN("json_arrayagg(") }; 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(thd, this); } }; @@ -676,44 +677,44 @@ public: } Item_func_json_objectagg(THD *thd, Item_func_json_objectagg *item); - bool is_json_type() { return true; } - void cleanup(); + bool is_json_type() override { return true; } + 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 { static LEX_CSTRING name= {STRING_WITH_LEN("json_objectagg") }; return name; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { if (too_big_for_varchar()) return &type_handler_blob; return &type_handler_varchar; } - void clear(); - bool add(); - void reset_field() { DBUG_ASSERT(0); } // not used - void update_field() { DBUG_ASSERT(0); } // not used - bool fix_fields(THD *,Item **); + void clear() override; + bool add() override; + void reset_field() override { DBUG_ASSERT(0); } // not used + void update_field() override { DBUG_ASSERT(0); } // not used + bool fix_fields(THD *,Item **) override; - double val_real() + double val_real() override { return 0.0; } - longlong val_int() + longlong val_int() override { 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); 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); } - String* val_str(String* str); - Item *copy_or_same(THD* thd); - void no_rows_in_result() {} - Item *get_copy(THD *thd) + String *val_str(String* str) override; + Item *copy_or_same(THD* thd) override; + void no_rows_in_result() override {} + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/item_row.h b/sql/item_row.h index 9b8620836b2..fbf632ba3b7 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -54,101 +54,103 @@ public: not_null_tables_cache(0), with_null(0) { } - enum Type type() const { return ROW_ITEM; }; - const Type_handler *type_handler() const { return &type_handler_row; } + enum Type type() const override { return ROW_ITEM; }; + 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, - const Tmp_field_param *param) + const Tmp_field_param *param) override { return NULL; // Check with Vicentiu why it's called for Item_row } void illegal_method_call(const char *); - bool is_null() { return null_value; } - void make_send_field(THD *thd, Send_field *) + bool is_null() override { return null_value; } + void make_send_field(THD *thd, Send_field *) override { illegal_method_call((const char*)"make_send_field"); }; - double val_real() + double val_real() override { illegal_method_call((const char*)"val"); return 0; }; - longlong val_int() + longlong val_int() override { illegal_method_call((const char*)"val_int"); return 0; }; - String *val_str(String *) + String *val_str(String *) override { illegal_method_call((const char*)"val_str"); return 0; }; - my_decimal *val_decimal(my_decimal *) + my_decimal *val_decimal(my_decimal *) override { illegal_method_call((const char*)"val_decimal"); 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"); return true; } - bool fix_fields(THD *thd, Item **ref); - void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge); - void cleanup(); + bool fix_fields(THD *thd, Item **ref) override; + void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge) + override; + void cleanup() override; void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); - table_map used_tables() const { return used_tables_cache; }; - bool const_item() const { return const_item_cache; }; - void update_used_tables() + List &fields, uint flags) override; + table_map used_tables() const override { return used_tables_cache; }; + bool const_item() const override { return const_item_cache; }; + void update_used_tables() override { used_tables_and_const_cache_init(); used_tables_and_const_cache_update_and_join(arg_count, args); } - table_map not_null_tables() const { return not_null_tables_cache; } - virtual void print(String *str, enum_query_type query_type); + table_map not_null_tables() const override { return not_null_tables_cache; } + 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)) return true; return (this->*processor)(arg); } - Item *transform(THD *thd, Item_transformer transformer, uchar *arg); - bool eval_not_null_tables(void *opt_arg); - bool find_not_null_fields(table_map allowed); + Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override; + bool eval_not_null_tables(void *opt_arg) override; + bool find_not_null_fields(table_map allowed) override; - uint cols() const { return arg_count; } - Item* element_index(uint i) { return args[i]; } - Item** addr(uint i) { return args + i; } - bool check_cols(uint c); - bool null_inside() { return with_null; }; - void bring_value(); + uint cols() const override { return arg_count; } + Item* element_index(uint i) override { return args[i]; } + Item** addr(uint i) override { return args + i; } + bool check_cols(uint c) override; + bool null_inside() override { return with_null; }; + void bring_value() override; Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override { Item_args::propagate_equal_fields(thd, Context_identity(), cond); 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); } - 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); } - 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); } - bool check_vcol_func_processor(void *arg) {return FALSE; } - Item *get_copy(THD *thd) + bool check_vcol_func_processor(void *arg) override {return FALSE; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - Item *build_clone(THD *thd); + Item *build_clone(THD *thd) override; }; #endif /* ITEM_ROW_INCLUDED */ diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index ef49029ac30..eb98fc83f87 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -59,14 +59,15 @@ public: Item_func(thd, a, b, c, d, e) { decimals=NOT_FIXED_DEC; } Item_str_func(THD *thd, List &list): Item_func(thd, list) { decimals=NOT_FIXED_DEC; } - longlong val_int(); - double val_real(); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + longlong val_int() override; + double val_real() override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_string(thd, ltime, fuzzydate); } - const Type_handler *type_handler() const { return string_type_handler(); } + const Type_handler *type_handler() const override + { return string_type_handler(); } void left_right_max_length(); - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; }; @@ -83,11 +84,11 @@ public: Item_str_ascii_func(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} Item_str_ascii_func(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c) {} - String *val_str(String *str) + String *val_str(String *str) override { return val_str_from_val_str_ascii(str, &ascii_buf); } - String *val_str_ascii(String *)= 0; + String *val_str_ascii(String *) override= 0; }; @@ -138,8 +139,8 @@ class Item_func_md5 :public Item_str_ascii_checksum_func { public: Item_func_md5(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {} - String *val_str_ascii(String *); - bool fix_length_and_dec() + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override { fix_length_and_charset(32, default_charset()); return FALSE; @@ -149,7 +150,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("md5") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -158,14 +159,14 @@ class Item_func_sha :public Item_str_ascii_checksum_func { public: Item_func_sha(THD *thd, Item *a): Item_str_ascii_checksum_func(thd, a) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("sha") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -174,14 +175,14 @@ class Item_func_sha2 :public Item_str_ascii_checksum_func public: Item_func_sha2(THD *thd, Item *a, Item *b) :Item_str_ascii_checksum_func(thd, a, b) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("sha2") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -191,14 +192,14 @@ class Item_func_to_base64 :public Item_str_ascii_checksum_func public: Item_func_to_base64(THD *thd, Item *a) :Item_str_ascii_checksum_func(thd, a) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("to_base64") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -208,14 +209,14 @@ class Item_func_from_base64 :public Item_str_binary_checksum_func public: Item_func_from_base64(THD *thd, Item *a) :Item_str_binary_checksum_func(thd, a) { } - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("from_base64") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -240,13 +241,13 @@ class Item_func_aes_encrypt :public Item_aes_crypt public: Item_func_aes_encrypt(THD *thd, Item *a, Item *b) :Item_aes_crypt(thd, a, b) {} - bool fix_length_and_dec(); + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("aes_encrypt") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -255,13 +256,13 @@ class Item_func_aes_decrypt :public Item_aes_crypt public: Item_func_aes_decrypt(THD *thd, Item *a, Item *b): Item_aes_crypt(thd, a, b) {} - bool fix_length_and_dec(); + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("aes_decrypt") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -282,14 +283,14 @@ protected: public: Item_func_concat(THD *thd, List &list): Item_str_func(thd, list) {} Item_func_concat(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("concat") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -307,13 +308,13 @@ public: Item_func_concat_operator_oracle(THD *thd, Item *a, Item *b) :Item_func_concat(thd, a, b) { } - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("concat_operator_oracle") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } @@ -325,8 +326,8 @@ class Item_func_decode_histogram :public Item_str_func public: Item_func_decode_histogram(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { collation.set(system_charset_info); max_length= MAX_BLOB_WIDTH; @@ -338,7 +339,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("decode_histogram") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -347,15 +348,15 @@ class Item_func_concat_ws :public Item_str_func String tmp_value; public: Item_func_concat_ws(THD *thd, List &list): Item_str_func(thd, list) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("concat_ws") }; return name; } - table_map not_null_tables() const { return 0; } - Item *get_copy(THD *thd) + table_map not_null_tables() const override { return 0; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -364,14 +365,14 @@ class Item_func_reverse :public Item_str_func String tmp_value; public: Item_func_reverse(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("reverse") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -382,15 +383,15 @@ class Item_func_replace :public Item_str_func public: Item_func_replace(THD *thd, Item *org, Item *find, Item *replace): Item_str_func(thd, org, find, replace) {} - String *val_str(String *to) { return val_str_internal(to, NULL); }; - bool fix_length_and_dec(); + String *val_str(String *to) override { return val_str_internal(to, NULL); }; + bool fix_length_and_dec() override; String *val_str_internal(String *str, String *empty_string_for_null); LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("replace") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -401,13 +402,14 @@ class Item_func_replace_oracle :public Item_func_replace public: Item_func_replace_oracle(THD *thd, Item *org, Item *find, Item *replace): Item_func_replace(thd, org, find, replace) {} - String *val_str(String *to) { return val_str_internal(to, &tmp_emtpystr); }; + String *val_str(String *to) override + { return val_str_internal(to, &tmp_emtpystr); }; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("replace_oracle") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -422,21 +424,21 @@ public: Item_func_regexp_replace(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c) {} - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_regexp_replace::cleanup"); Item_str_func::cleanup(); re.cleanup(); DBUG_VOID_RETURN; } - String *val_str(String *str); - bool fix_length_and_dec(); + String *val_str(String *str) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("regexp_replace") }; return name; } - Item *get_copy(THD *thd) { return 0;} + Item *get_copy(THD *thd) override { return 0;} }; @@ -447,21 +449,21 @@ public: Item_func_regexp_substr(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - void cleanup() + void cleanup() override { DBUG_ENTER("Item_func_regexp_substr::cleanup"); Item_str_func::cleanup(); re.cleanup(); DBUG_VOID_RETURN; } - String *val_str(String *str); - bool fix_length_and_dec(); + String *val_str(String *str) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("regexp_substr") }; return name; } - Item *get_copy(THD *thd) { return 0; } + Item *get_copy(THD *thd) override { return 0; } }; @@ -472,14 +474,14 @@ public: Item_func_insert(THD *thd, Item *org, Item *start, Item *length, Item *new_str): Item_str_func(thd, org, start, length, new_str) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("insert") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -492,7 +494,7 @@ protected: String tmp_value; public: Item_str_conv(THD *thd, Item *item): Item_str_func(thd, item) {} - String *val_str(String *); + String *val_str(String *) override; }; @@ -505,8 +507,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("lcase") }; return name; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -519,8 +521,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("ucase") }; return name; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -530,14 +532,14 @@ class Item_func_left :public Item_str_func String tmp_value; public: Item_func_left(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("left") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -547,14 +549,14 @@ class Item_func_right :public Item_str_func String tmp_value; public: Item_func_right(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("right") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -568,30 +570,30 @@ public: Item_func_substr(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} Item_func_substr(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("substr") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_substr_oracle :public Item_func_substr { protected: - longlong get_position() + longlong get_position() override { longlong pos= args[1]->val_int(); return pos == 0 ? 1 : pos; } - String *make_empty_result() + String *make_empty_result() override { null_value= 1; return NULL; } public: Item_func_substr_oracle(THD *thd, Item *a, Item *b): Item_func_substr(thd, a, b) {} Item_func_substr_oracle(THD *thd, Item *a, Item *b, Item *c): Item_func_substr(thd, a, b, c) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_func_substr::fix_length_and_dec(); set_maybe_null(); @@ -602,7 +604,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("substr_oracle") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -612,14 +614,14 @@ class Item_func_substr_index :public Item_str_func public: Item_func_substr_index(THD *thd, Item *a,Item *b,Item *c): Item_str_func(thd, a, b, c) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("substring_index") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -656,17 +658,17 @@ protected: public: Item_func_trim(THD *thd, Item *a, Item *b): Item_str_func(thd, a, b) {} Item_func_trim(THD *thd, Item *a): Item_str_func(thd, a) {} - Sql_mode_dependency value_depends_on_sql_mode() const; - String *val_str(String *); - bool fix_length_and_dec(); + Sql_mode_dependency value_depends_on_sql_mode() const override; + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("trim") }; return name; } - void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; virtual LEX_CSTRING mode_name() const { return { "both", 4}; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -674,7 +676,7 @@ public: class Item_func_trim_oracle :public Item_func_trim { protected: - String *make_empty_result() + String *make_empty_result() override { null_value= 1; return NULL; } LEX_CSTRING func_name_ext() const override { @@ -690,13 +692,13 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("trim_oracle") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_func_trim::fix_length_and_dec(); set_maybe_null(); return res; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -706,11 +708,11 @@ class Item_func_ltrim :public Item_func_trim public: Item_func_ltrim(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {} Item_func_ltrim(THD *thd, Item *a): Item_func_trim(thd, a) {} - Sql_mode_dependency value_depends_on_sql_mode() const + Sql_mode_dependency value_depends_on_sql_mode() const override { return Item_func::value_depends_on_sql_mode(); } - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("ltrim") }; @@ -718,7 +720,7 @@ public: } LEX_CSTRING mode_name() const override { return { STRING_WITH_LEN("leading") }; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -726,7 +728,7 @@ public: class Item_func_ltrim_oracle :public Item_func_ltrim { protected: - String *make_empty_result() + String *make_empty_result() override { null_value= 1; return NULL; } LEX_CSTRING func_name_ext() const override { @@ -742,13 +744,13 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("ltrim_oracle") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_func_ltrim::fix_length_and_dec(); set_maybe_null(); return res; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -758,7 +760,7 @@ class Item_func_rtrim :public Item_func_trim public: Item_func_rtrim(THD *thd, Item *a, Item *b): Item_func_trim(thd, a, b) {} Item_func_rtrim(THD *thd, Item *a): Item_func_trim(thd, a) {} - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("rtrim") }; @@ -766,7 +768,7 @@ public: } LEX_CSTRING mode_name() const override { return { STRING_WITH_LEN("trailing") }; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -774,7 +776,7 @@ public: class Item_func_rtrim_oracle :public Item_func_rtrim { protected: - String *make_empty_result() + String *make_empty_result() override { null_value= 1; return NULL; } LEX_CSTRING func_name_ext() const override { @@ -790,13 +792,13 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("rtrim_oracle") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_func_rtrim::fix_length_and_dec(); set_maybe_null(); return res; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -821,9 +823,9 @@ public: Item_str_ascii_checksum_func(thd, a), alg(NEW), deflt(1) {} Item_func_password(THD *thd, Item *a, PW_Alg al): Item_str_ascii_checksum_func(thd, a), alg(al), deflt(0) {} - String *val_str_ascii(String *str); - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() + String *val_str_ascii(String *str) override; + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override { fix_length_and_charset((alg == 1 ? SCRAMBLED_PASSWORD_CHAR_LENGTH : @@ -839,7 +841,7 @@ public: } static char *alloc(THD *thd, const char *password, size_t pass_len, enum PW_Alg al); - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -853,8 +855,8 @@ public: :Item_str_binary_checksum_func(thd, a) {} Item_func_des_encrypt(THD *thd, Item *a, Item *b) :Item_str_binary_checksum_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { set_maybe_null(); /* 9 = MAX ((8- (arg_len % 8)) + 1) */ @@ -866,7 +868,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("des_encrypt") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -878,8 +880,8 @@ public: :Item_str_binary_checksum_func(thd, a) {} Item_func_des_decrypt(THD *thd, Item *a, Item *b) :Item_str_binary_checksum_func(thd, a, b) {} - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { set_maybe_null(); /* 9 = MAX ((8- (arg_len % 8)) + 1) */ @@ -893,7 +895,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("des_decrypt") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -922,8 +924,8 @@ public: { constructor_helper(); } - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { set_maybe_null(); max_length = 13; @@ -934,11 +936,11 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("encrypt") }; return name; } - bool check_vcol_func_processor(void *arg) + 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(thd, this); } }; @@ -955,14 +957,14 @@ protected: public: Item_func_encode(THD *thd, Item *a, Item *seed_arg): Item_str_binary_checksum_func(thd, a, seed_arg) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("encode") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } protected: virtual void crypto_transform(String *); @@ -981,10 +983,10 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("decode") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } protected: - void crypto_transform(String *); + void crypto_transform(String *) override; }; @@ -1013,8 +1015,8 @@ class Item_func_database :public Item_func_sysconst { public: Item_func_database(THD *thd): Item_func_sysconst(thd) {} - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen; set_maybe_null(); @@ -1025,8 +1027,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("database") }; return name; } - const char *fully_qualified_func_name() const { return "database()"; } - Item *get_copy(THD *thd) + const char *fully_qualified_func_name() const override + { return "database()"; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1035,25 +1038,26 @@ class Item_func_sqlerrm :public Item_func_sysconst { public: Item_func_sqlerrm(THD *thd): Item_func_sysconst(thd) {} - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("SQLERRM") }; return name; } - const char *fully_qualified_func_name() const { return "SQLERRM"; } - void print(String *str, enum_query_type query_type) + const char *fully_qualified_func_name() const override + { return "SQLERRM"; } + void print(String *str, enum_query_type query_type) override { str->append(func_name_cstring()); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= 512 * system_charset_info->mbmaxlen; null_value= false; base_flags&= ~item_base_t::MAYBE_NULL; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1068,13 +1072,13 @@ public: { str_value.set("", 0, system_charset_info); } - String *val_str(String *) + String *val_str(String *) override { DBUG_ASSERT(fixed()); return (null_value ? 0 : &str_value); } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override { max_length= (uint32) (username_char_length + HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN; @@ -1085,12 +1089,13 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("user") }; return name; } - const char *fully_qualified_func_name() const { return "user()"; } - int save_in_field(Field *field, bool no_conversions) + const char *fully_qualified_func_name() const override + { return "user()"; } + int save_in_field(Field *field, bool no_conversions) override { return save_str_value_in_field(field, &str_value); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1102,14 +1107,15 @@ class Item_func_current_user :public Item_func_user public: Item_func_current_user(THD *thd, Name_resolution_context *context_arg): Item_func_user(thd), context(context_arg) {} - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("current_user") }; return name; } - const char *fully_qualified_func_name() const { return "current_user()"; } - bool check_vcol_func_processor(void *arg) + const char *fully_qualified_func_name() const override + { return "current_user()"; } + bool check_vcol_func_processor(void *arg) override { context= 0; return mark_unsupported_function(fully_qualified_func_name(), arg, @@ -1125,32 +1131,33 @@ class Item_func_current_role :public Item_func_sysconst public: Item_func_current_role(THD *thd, Name_resolution_context *context_arg): Item_func_sysconst(thd), context(context_arg) {} - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec() + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override { max_length= (uint32) username_char_length * SYSTEM_CHARSET_MBMAXLEN; return FALSE; } - int save_in_field(Field *field, bool no_conversions) + int save_in_field(Field *field, bool no_conversions) override { return save_str_value_in_field(field, &str_value); } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("current_role") }; return name; } - const char *fully_qualified_func_name() const { return "current_role()"; } - String *val_str(String *) + const char *fully_qualified_func_name() const override + { return "current_role()"; } + String *val_str(String *) override { DBUG_ASSERT(fixed()); return null_value ? NULL : &str_value; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { context= 0; return mark_unsupported_function(fully_qualified_func_name(), arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1160,14 +1167,14 @@ class Item_func_soundex :public Item_str_func String tmp_value; public: Item_func_soundex(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("soundex") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1176,16 +1183,16 @@ class Item_func_elt :public Item_str_func { public: Item_func_elt(THD *thd, List &list): Item_str_func(thd, list) {} - double val_real(); - longlong val_int(); - String *val_str(String *str); - bool fix_length_and_dec(); + double val_real() override; + longlong val_int() override; + String *val_str(String *str) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("elt") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1196,14 +1203,14 @@ class Item_func_make_set :public Item_str_func public: Item_func_make_set(THD *thd, List &list): Item_str_func(thd, list) {} - String *val_str(String *str); - bool fix_length_and_dec(); + String *val_str(String *str) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("make_set") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1217,14 +1224,14 @@ public: Item_func_format(THD *thd, Item *org, Item *dec, Item *lang): Item_str_ascii_func(thd, org, dec, lang) {} - String *val_str_ascii(String *); - bool fix_length_and_dec(); + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("format") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1240,9 +1247,9 @@ public: Item_func_char(THD *thd, Item *arg1, CHARSET_INFO *cs): Item_str_func(thd, arg1) { collation.set(cs); } - String *val_str(String *); + String *val_str(String *) override; void append_char(String * str, int32 num); - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= arg_count * 4; return FALSE; @@ -1252,8 +1259,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("char") }; return name; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1262,8 +1269,8 @@ class Item_func_chr :public Item_func_char public: Item_func_chr(THD *thd, Item *arg1, CHARSET_INFO *cs): Item_func_char(thd, arg1, cs) {} - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { max_length= 4; return FALSE; @@ -1273,7 +1280,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("chr") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1283,14 +1290,14 @@ class Item_func_repeat :public Item_str_func public: Item_func_repeat(THD *thd, Item *arg1, Item *arg2): Item_str_func(thd, arg1, arg2) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("repeat") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1299,14 +1306,14 @@ class Item_func_space :public Item_str_func { public: Item_func_space(THD *thd, Item *arg1): Item_str_func(thd, arg1) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("space") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1316,18 +1323,18 @@ class Item_func_binlog_gtid_pos :public Item_str_func public: Item_func_binlog_gtid_pos(THD *thd, Item *arg1, Item *arg2): Item_str_func(thd, arg1, arg2) {} - String *val_str(String *); - bool fix_length_and_dec(); + String *val_str(String *) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("binlog_gtid_pos") }; return name; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1341,7 +1348,7 @@ public: Item_str_func(thd, arg1, arg2, arg3) {} Item_func_pad(THD *thd, Item *arg1, Item *arg2): Item_str_func(thd, arg1, arg2) {} - bool fix_length_and_dec(); + bool fix_length_and_dec() override; }; @@ -1352,28 +1359,28 @@ public: Item_func_pad(thd, arg1, arg2, arg3) {} Item_func_rpad(THD *thd, Item *arg1, Item *arg2): Item_func_pad(thd, arg1, arg2) {} - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("rpad") }; return name; } - Sql_mode_dependency value_depends_on_sql_mode() const; - Item *get_copy(THD *thd) + Sql_mode_dependency value_depends_on_sql_mode() const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_rpad_oracle :public Item_func_rpad { - String *make_empty_result() + String *make_empty_result() override { null_value= 1; return NULL; } public: Item_func_rpad_oracle(THD *thd, Item *arg1, Item *arg2, Item *arg3): Item_func_rpad(thd, arg1, arg2, arg3) {} Item_func_rpad_oracle(THD *thd, Item *arg1, Item *arg2): Item_func_rpad(thd, arg1, arg2) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_func_rpad::fix_length_and_dec(); set_maybe_null(); @@ -1384,7 +1391,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("rpad_oracle") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1396,27 +1403,27 @@ public: Item_func_pad(thd, arg1, arg2, arg3) {} Item_func_lpad(THD *thd, Item *arg1, Item *arg2): Item_func_pad(thd, arg1, arg2) {} - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("lpad") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_lpad_oracle :public Item_func_lpad { - String *make_empty_result() + String *make_empty_result() override { null_value= 1; return NULL; } public: Item_func_lpad_oracle(THD *thd, Item *arg1, Item *arg2, Item *arg3): Item_func_lpad(thd, arg1, arg2, arg3) {} Item_func_lpad_oracle(THD *thd, Item *arg1, Item *arg2): Item_func_lpad(thd, arg1, arg2) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_func_lpad::fix_length_and_dec(); set_maybe_null(); @@ -1427,7 +1434,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("lpad_oracle") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1442,15 +1449,15 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("conv") }; return name; } - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { collation.set(default_charset()); fix_char_length(64); set_maybe_null(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1477,12 +1484,12 @@ public: String *val_str_ascii_from_val_int(String *str); String *val_str_ascii_from_val_real(String *str); String *val_str_ascii_from_val_str(String *str); - String *val_str_ascii(String *str) + String *val_str_ascii(String *str) override { DBUG_ASSERT(fixed()); return m_arg0_type_handler->Item_func_hex_val_str_ascii(this, str); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); decimals=0; @@ -1490,7 +1497,7 @@ public: m_arg0_type_handler= args[0]->type_handler(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1508,15 +1515,15 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("unhex") }; return name; } - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { collation.set(&my_charset_bin); decimals=0; max_length=(1+args[0]->max_length)/2; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1534,8 +1541,8 @@ public: { set_maybe_null(); } - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { collation.set(args[0]->collation); decimals=0; @@ -1555,7 +1562,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("like_range_min") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1570,7 +1577,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("like_range_max") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; #endif @@ -1580,7 +1587,7 @@ class Item_func_binary :public Item_str_func { public: Item_func_binary(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *a) + String *val_str(String *a) override { DBUG_ASSERT(fixed()); String *tmp=args[0]->val_str(a); @@ -1589,20 +1596,20 @@ public: tmp->set_charset(&my_charset_bin); return tmp; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { collation.set(&my_charset_bin); max_length=args[0]->max_length; return FALSE; } - void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_binary") }; return name; } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1612,24 +1619,24 @@ class Item_load_file :public Item_str_func String tmp_value; public: Item_load_file(THD *thd, Item *a): Item_str_func(thd, a) {} - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("load_file") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { collation.set(&my_charset_bin, DERIVATION_COERCIBLE); set_maybe_null(); max_length=MAX_BLOB_WIDTH; return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1643,14 +1650,14 @@ class Item_func_export_set: public Item_str_func Item_str_func(thd, a, b, c, d) {} Item_func_export_set(THD *thd, Item *a, Item *b, Item* c, Item* d, Item* e): Item_str_func(thd, a, b, c, d, e) {} - String *val_str(String *str); - bool fix_length_and_dec(); + String *val_str(String *str) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("export_set") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1665,8 +1672,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("quote") }; return name; } - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { collation.set(args[0]->collation); ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 + @@ -1674,7 +1681,7 @@ public: max_length= (uint32) MY_MIN(max_result_length, MAX_BLOB_WIDTH); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1726,9 +1733,9 @@ public: (cs->mbmaxlen > 1 || !(cs->state & MY_CS_NONASCII)))); } } - bool is_json_type() { return args[0]->is_json_type(); } - String *val_str(String *); - longlong val_int() + bool is_json_type() override { return args[0]->is_json_type(); } + String *val_str(String *) override; + longlong val_int() override { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_int(); @@ -1737,7 +1744,7 @@ public: return 0; return res; } - double val_real() + double val_real() override { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_real(); @@ -1746,7 +1753,7 @@ public: return 0; return res; } - my_decimal *val_decimal(my_decimal *d) + my_decimal *val_decimal(my_decimal *d) override { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::val_decimal(d); @@ -1755,7 +1762,7 @@ public: return NULL; 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 { if (args[0]->result_type() == STRING_RESULT) return Item_str_func::get_date(thd, ltime, fuzzydate); @@ -1764,14 +1771,14 @@ public: return 1; return res; } - bool fix_length_and_dec(); + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("convert") }; return name; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1781,24 +1788,24 @@ class Item_func_set_collation :public Item_str_func public: Item_func_set_collation(THD *thd, Item *a, CHARSET_INFO *set_collation): Item_str_func(thd, a), m_set_collation(set_collation) {} - String *val_str(String *); - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const; + String *val_str(String *) override; + bool fix_length_and_dec() override; + bool eq(const Item *item, bool binary_cmp) const override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("collate") }; return name; } - enum precedence precedence() const { return COLLATE_PRECEDENCE; } - enum Functype functype() const { return COLLATE_FUNC; } - void print(String *str, enum_query_type query_type); - Item_field *field_for_view_update() + enum precedence precedence() const override { return COLLATE_PRECEDENCE; } + enum Functype functype() const override { return COLLATE_FUNC; } + void print(String *str, enum_query_type query_type) override; + Item_field *field_for_view_update() override { /* this function is transparent for view updating */ return args[0]->field_for_view_update(); } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1807,17 +1814,18 @@ class Item_func_expr_str_metadata :public Item_str_func { public: Item_func_expr_str_metadata(THD *thd, Item *a): Item_str_func(thd, a) { } - bool fix_length_and_dec() + bool fix_length_and_dec() override { collation.set(system_charset_info); max_length= 64 * collation.collation->mbmaxlen; // should be enough base_flags&= ~item_base_t::MAYBE_NULL; return FALSE; }; - table_map not_null_tables() const { return 0; } + table_map not_null_tables() const override { return 0; } Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override { return this; } - bool const_item() const { return true; } + bool const_item() const override { return true; } }; @@ -1826,13 +1834,13 @@ class Item_func_charset :public Item_func_expr_str_metadata public: Item_func_charset(THD *thd, Item *a) :Item_func_expr_str_metadata(thd, a) { } - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("charset") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1842,13 +1850,13 @@ class Item_func_collation :public Item_func_expr_str_metadata public: Item_func_collation(THD *thd, Item *a) :Item_func_expr_str_metadata(thd, a) {} - String *val_str(String *); + String *val_str(String *) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("collation") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1873,9 +1881,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("weight_string") }; return name; } - String *val_str(String *); - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const + String *val_str(String *) override; + bool fix_length_and_dec() override; + bool eq(const Item *item, bool binary_cmp) const override { if (!Item_str_func::eq(item, binary_cmp)) return false; @@ -1885,15 +1893,16 @@ public: this->result_length == that->result_length; } Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond) + override { return this; } - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_crc32 :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_str(func_name_cstring()); } String value; public: @@ -1904,9 +1913,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("crc32") }; return name; } - bool fix_length_and_dec() { max_length=10; return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { max_length=10; return FALSE; } + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1921,13 +1930,13 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("uncompressed_length") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length=10; set_maybe_null(); return FALSE; } - longlong val_int(); - Item *get_copy(THD *thd) + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1943,7 +1952,7 @@ class Item_func_compress: public Item_str_binary_checksum_func public: Item_func_compress(THD *thd, Item *a) :Item_str_binary_checksum_func(thd, a) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= (args[0]->max_length * 120) / 100 + 12; return FALSE; @@ -1953,8 +1962,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("compress") }; return name; } - String *val_str(String *) ZLIB_DEPENDED_FUNCTION - Item *get_copy(THD *thd) + String *val_str(String *) override ZLIB_DEPENDED_FUNCTION + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1964,7 +1973,7 @@ class Item_func_uncompress: public Item_str_binary_checksum_func public: Item_func_uncompress(THD *thd, Item *a) :Item_str_binary_checksum_func(thd, a) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { set_maybe_null(); max_length= MAX_BLOB_WIDTH; @@ -1975,8 +1984,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("uncompress") }; return name; } - String *val_str(String *) ZLIB_DEPENDED_FUNCTION - Item *get_copy(THD *thd) + String *val_str(String *) override ZLIB_DEPENDED_FUNCTION + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1985,26 +1994,26 @@ class Item_func_uuid: public Item_str_func { public: Item_func_uuid(THD *thd): Item_str_func(thd) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { collation.set(DTCollation_numeric()); fix_char_length(MY_UUID_STRING_LENGTH); return FALSE; } - bool const_item() const { return false; } - table_map used_tables() const { return RAND_TABLE_BIT; } + bool const_item() const override { return false; } + table_map used_tables() const override { return RAND_TABLE_BIT; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("uuid") }; return name; } - String *val_str(String *); - bool check_vcol_func_processor(void *arg) + String *val_str(String *) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_NON_DETERMINISTIC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2021,17 +2030,17 @@ protected: void print_arguments(String *str, enum_query_type query_type); public: Item_func_dyncol_create(THD *thd, List &args, DYNCALL_CREATE_DEF *dfs); - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("column_create") }; return name; } - String *val_str(String *); - void print(String *str, enum_query_type query_type); - enum Functype functype() const { return DYNCOL_FUNC; } - Item *get_copy(THD *thd) + String *val_str(String *) override; + void print(String *str, enum_query_type query_type) override; + enum Functype functype() const override { return DYNCOL_FUNC; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2047,9 +2056,9 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("column_add") }; return name; } - String *val_str(String *); - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + String *val_str(String *) override; + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2063,15 +2072,15 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("column_json") }; return name; } - String *val_str(String *); - bool fix_length_and_dec() + String *val_str(String *) override; + bool fix_length_and_dec() override { max_length= MAX_BLOB_WIDTH; set_maybe_null(); decimals= 0; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2084,23 +2093,23 @@ class Item_dyncol_get: public Item_str_func public: Item_dyncol_get(THD *thd, Item *str, Item *num): Item_str_func(thd, str, num) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { set_maybe_null(); max_length= MAX_BLOB_WIDTH; return FALSE; } /* Mark that collation can change between calls */ - bool dynamic_result() { return 1; } + bool dynamic_result() override { return 1; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("column_get") }; return name; } - String *val_str(String *); - longlong val_int(); - longlong val_int_signed_typecast() + String *val_str(String *) override; + longlong val_int() override; + longlong val_int_signed_typecast() override { unsigned_flag= false; // Mark that we want to have a signed value longlong value= val_int(); // val_int() can change unsigned_flag @@ -2108,7 +2117,7 @@ public: push_note_converted_to_negative_complement(current_thd); return value; } - longlong val_int_unsigned_typecast() + longlong val_int_unsigned_typecast() override { unsigned_flag= true; // Mark that we want to have an unsigned value longlong value= val_int(); // val_int() can change unsigned_flag @@ -2116,12 +2125,12 @@ public: push_note_converted_to_positive_complement(current_thd); return value; } - double val_real(); - my_decimal *val_decimal(my_decimal *); + double val_real() override; + my_decimal *val_decimal(my_decimal *) override; bool get_dyn_value(THD *thd, DYNAMIC_COLUMN_VALUE *val, String *tmp); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2131,7 +2140,7 @@ class Item_func_dyncol_list: public Item_str_func public: Item_func_dyncol_list(THD *thd, Item *str): Item_str_func(thd, str) {collation.set(DYNCOL_UTF);} - bool fix_length_and_dec() + bool fix_length_and_dec() override { set_maybe_null(); max_length= MAX_BLOB_WIDTH; @@ -2142,8 +2151,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("column_list") }; return name; } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2157,18 +2166,19 @@ class Item_temptable_rowid :public Item_str_func public: TABLE *table; Item_temptable_rowid(TABLE *table_arg); - const Type_handler *type_handler() const { return &type_handler_string; } + const Type_handler *type_handler() const override + { return &type_handler_string; } Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) { return create_table_field_from_handler(root, table); } - String *val_str(String *str); - enum Functype functype() const { return TEMPTABLE_ROWID; } + String *val_str(String *str) override; + enum Functype functype() const override { return TEMPTABLE_ROWID; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("") }; return name; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; #ifdef WITH_WSREP @@ -2185,14 +2195,14 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("wsrep_last_written_gtid") }; return name; } - String *val_str_ascii(String *); - bool fix_length_and_dec() + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override { max_length= WSREP_GTID_STR_LEN; set_maybe_null(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2206,14 +2216,14 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("wsrep_last_seen_gtid") }; return name; } - String *val_str_ascii(String *); - bool fix_length_and_dec() + String *val_str_ascii(String *) override; + bool fix_length_and_dec() override { max_length= WSREP_GTID_STR_LEN; set_maybe_null(); return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2223,14 +2233,15 @@ class Item_func_wsrep_sync_wait_upto: public Item_int_func public: Item_func_wsrep_sync_wait_upto(THD *thd, Item *a): Item_int_func(thd, a) {} Item_func_wsrep_sync_wait_upto(THD *thd, Item *a, Item* b): Item_int_func(thd, a, b) {} - const Type_handler *type_handler() const { return &type_handler_string; } + const Type_handler *type_handler() const override + { return &type_handler_string; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("wsrep_sync_wait_upto_gtid") }; return name; } - longlong val_int(); - Item *get_copy(THD *thd) + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; #endif /* WITH_WSREP */ diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 636eae37c12..fa03018991e 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -298,29 +298,30 @@ public: Item_singlerow_subselect(THD *thd_arg): Item_subselect(thd_arg), value(0), row (0) {} - void cleanup(); - subs_type substype() { return SINGLEROW_SUBS; } + void cleanup() override; + subs_type substype() override { return SINGLEROW_SUBS; } - void reset(); - void no_rows_in_result(); - bool select_transformer(JOIN *join); + void reset() override; + void no_rows_in_result() override; + bool select_transformer(JOIN *join) override; void store(uint i, Item* item); - double val_real(); - longlong val_int (); - String *val_str (String *); - bool val_native(THD *thd, Native *); - my_decimal *val_decimal(my_decimal *); - bool val_bool(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - const Type_handler *type_handler() const; - bool fix_length_and_dec(); + double val_real() override; + longlong val_int() override; + String *val_str(String *) override; + bool val_native(THD *thd, Native *) override; + my_decimal *val_decimal(my_decimal *) override; + bool val_bool() override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + const Type_handler *type_handler() const override; + bool fix_length_and_dec() override; - uint cols() const; - Item* element_index(uint i) { return reinterpret_cast(row[i]); } - Item** addr(uint i) { return (Item**)row + i; } - bool check_cols(uint c); - bool null_inside(); - void bring_value(); + uint cols() const override; + Item* element_index(uint i) override + { return reinterpret_cast(row[i]); } + Item** addr(uint i) override { return (Item**)row + i; } + bool check_cols(uint c) override; + bool null_inside() override; + void bring_value() override; /** This method is used to implement a special case of semantic tree @@ -336,7 +337,7 @@ public: */ 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; }; @@ -351,12 +352,12 @@ protected: public: Item_maxmin_subselect(THD *thd, Item_subselect *parent, st_select_lex *select_lex, bool max); - virtual void print(String *str, enum_query_type query_type); - void cleanup(); + void print(String *str, enum_query_type query_type) override; + void cleanup() override; bool any_value() { return was_values; } void register_value() { was_values= TRUE; } - void reset_value_registration() { was_values= FALSE; } - void no_rows_in_result(); + void reset_value_registration() override { was_values= FALSE; } + void no_rows_in_result() override; }; /* exists subselect */ diff --git a/sql/item_sum.h b/sql/item_sum.h index 4f8cf996f55..414658fd830 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -411,7 +411,7 @@ public: Item_sum(THD *thd, List &list); //Copy constructor, need to perform subselects with temporary tables 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; bool is_aggr_sum_func() { @@ -461,7 +461,7 @@ public: Updated value is then saved in the field. */ virtual void update_field()=0; - virtual bool fix_length_and_dec() + bool fix_length_and_dec() override { set_maybe_null(); null_value=1; @@ -469,10 +469,10 @@ public: } 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, 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 @@ -483,7 +483,7 @@ public: return Item::build_equal_items(thd, inherited, link_item_fields, cond_equal_ref); } - bool is_null() { return null_value; } + bool is_null() override { return null_value; } /** make_const() Called if we've managed to calculate the value of this Item in @@ -496,8 +496,8 @@ public: const_item_cache= true; } void reset_forced_const() { const_item_cache= false; } - virtual bool const_during_execution() const { return false; } - virtual void print(String *str, enum_query_type query_type); + bool const_during_execution() const override { return false; } + void print(String *str, enum_query_type query_type) override; void fix_num_length_and_dec(); /** @@ -510,7 +510,7 @@ public: may be initialized to 0 by clear() and to NULL by no_rows_in_result(). */ - virtual void no_rows_in_result() + void no_rows_in_result() override { set_aggregator(current_thd, with_distinct ? Aggregator::DISTINCT_AGGREGATOR : @@ -518,14 +518,14 @@ public: aggregator_clear(); } 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); 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); } - virtual bool collect_outer_ref_processor(void *param); + bool collect_outer_ref_processor(void *param) override; bool init_sum_func_check(THD *thd); bool check_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 void remove() { DBUG_ASSERT(0); } - virtual void cleanup(); - bool check_vcol_func_processor(void *arg); + void cleanup() override; + bool check_vcol_func_processor(void *arg) override; virtual void setup_window_func(THD *thd, Window_spec *window_spec) {} 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; } @@ -748,23 +748,24 @@ public: Item_sum_double(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {} Item_sum_double(THD *thd, List &list): Item_sum_num(thd, list) {} 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(); } - String *val_str(String*str) + String *val_str(String*str) override { 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); } - 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); } - 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, List &list): Item_sum_num(thd, list) {} Item_sum_int(THD *thd, Item_sum_int *item) :Item_sum_num(thd, item) {} - double val_real() { DBUG_ASSERT(fixed()); return (double) val_int(); } - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + double val_real() override { DBUG_ASSERT(fixed()); return (double) val_int(); } + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return get_date_from_int(thd, ltime, fuzzydate); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=21; @@ -804,7 +805,7 @@ protected: my_decimal direct_sum_decimal; my_decimal dec_buffs[2]; uint curr_dec_buff; - bool fix_length_and_dec(); + bool fix_length_and_dec() override; public: Item_sum_sum(THD *thd, Item *item_par, bool distinct): @@ -814,42 +815,42 @@ public: set_distinct(distinct); } 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; } - void cleanup(); + void cleanup() override; void direct_add(my_decimal *add_sum_decimal); void direct_add(double add_sum_real, bool add_sum_is_null); - void clear(); - bool add(); - double val_real(); - longlong val_int(); - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + void clear() override; + bool add() override; + double val_real() override; + longlong val_int() override; + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *) override; + 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); } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } void fix_length_and_dec_double(); void fix_length_and_dec_decimal(); - void reset_field(); - void update_field(); - void no_rows_in_result() {} + void reset_field() override; + void update_field() override; + void no_rows_in_result() override {} LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name_distinct= { STRING_WITH_LEN("sum(distinct ")}; static LEX_CSTRING name_normal= { STRING_WITH_LEN("sum(") }; return has_with_distinct() ? name_distinct : name_normal; } - Item *copy_or_same(THD* thd); - void remove(); - Item *get_copy(THD *thd) + Item *copy_or_same(THD* thd) override; + void remove() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool supports_removal() const + bool supports_removal() const override { return true; } @@ -869,10 +870,10 @@ class Item_sum_count :public Item_sum_int friend class Aggregator_distinct; - void clear(); - bool add(); - void cleanup(); - void remove(); + void clear() override; + bool add() override; + void cleanup() override; + void remove() override; public: Item_sum_count(THD *thd, Item *item_par): @@ -898,20 +899,21 @@ public: Item_sum_int(thd, item), direct_counted(FALSE), 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; } - void no_rows_in_result() { count=0; } + void no_rows_in_result() override { count=0; } void make_const(longlong count_arg) { count=count_arg; Item_sum::make_const(); } - const Type_handler *type_handler() const { return &type_handler_slonglong; } - longlong val_int(); - void reset_field(); - void update_field(); + const Type_handler *type_handler() const override + { return &type_handler_slonglong; } + longlong val_int() override; + void reset_field() override; + void update_field() override; void direct_add(longlong add_count); LEX_CSTRING func_name_cstring() const override { @@ -919,11 +921,11 @@ public: static LEX_CSTRING name_normal= { STRING_WITH_LEN("count(") }; return has_with_distinct() ? name_distinct : name_normal; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool supports_removal() const + bool supports_removal() const override { return true; } @@ -948,40 +950,40 @@ public: void fix_length_and_dec_double(); void fix_length_and_dec_decimal(); - bool fix_length_and_dec(); - enum Sumfunctype sum_func () const + bool fix_length_and_dec() override; + enum Sumfunctype sum_func () const override { return has_with_distinct() ? AVG_DISTINCT_FUNC : AVG_FUNC; } - void clear(); - bool add(); - void remove(); - double val_real(); + void clear() override; + bool add() override; + void remove() override; + double val_real() override; // In SPs we might force the "wrong" type with select into a declare variable - longlong val_int() { return val_int_from_real(); } - my_decimal *val_decimal(my_decimal *); - String *val_str(String *str); - void reset_field(); - void update_field(); - Item *result_item(THD *thd, Field *field); - void no_rows_in_result() {} + longlong val_int() override { return val_int_from_real(); } + my_decimal *val_decimal(my_decimal *) override; + String *val_str(String *str) override; + void reset_field() override; + void update_field() override; + Item *result_item(THD *thd, Field *field) override; + void no_rows_in_result() override {} LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name_distinct= { STRING_WITH_LEN("avg(distinct ")}; static LEX_CSTRING name_normal= { STRING_WITH_LEN("avg(") }; return has_with_distinct() ? name_distinct : name_normal; } - Item *copy_or_same(THD* thd); - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - void cleanup() + Item *copy_or_same(THD* thd) override; + Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override; + void cleanup() override { count= 0; Item_sum_sum::cleanup(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool supports_removal() const + bool supports_removal() const override { return true; } @@ -1113,7 +1115,7 @@ public: :Item_sum(thd, 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(); } bool fix_length_and_dec_generic(); bool fix_length_and_dec_numeric(const Type_handler *h); @@ -1146,35 +1148,36 @@ public: direct_added(FALSE), value(item->value), arg_cache(0), cmp_sign(item->cmp_sign), was_values(item->was_values) { } - bool fix_fields(THD *, Item **); - bool fix_length_and_dec(); + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override; void setup_hybrid(THD *thd, Item *item, Item *value_arg); - void clear(); + void clear() override; void direct_add(Item *item); - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - void reset_field(); - String *val_str(String *); - bool val_native(THD *thd, Native *); - const Type_handler *real_type_handler() const + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal *) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + void reset_field() override; + String *val_str(String *) override; + bool val_native(THD *thd, Native *) override; + const Type_handler *real_type_handler() const override { return get_arg(0)->real_type_handler(); } - const TYPELIB *get_typelib() const { return args[0]->get_typelib(); } - void update_field(); + const TYPELIB *get_typelib() const override { return args[0]->get_typelib(); } + void update_field() override; void min_max_update_str_field(); void min_max_update_real_field(); void min_max_update_int_field(); void min_max_update_decimal_field(); void min_max_update_native_field(); - void cleanup(); + void cleanup() override; bool any_value() { return was_values; } - void no_rows_in_result(); - void restore_to_before_no_rows_in_result(); - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - void setup_caches(THD *thd) { setup_hybrid(thd, arguments()[0], NULL); } + void no_rows_in_result() override; + void restore_to_before_no_rows_in_result() override; + Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override; + 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: 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) {} - 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 { static LEX_CSTRING sum_name= {STRING_WITH_LEN("min(") }; return sum_name; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1202,16 +1205,16 @@ class Item_sum_max final :public Item_sum_min_max public: 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) {} - 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 { static LEX_CSTRING sum_name= {STRING_WITH_LEN("max(") }; return sum_name; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1230,13 +1233,14 @@ public: if (as_window_function) memcpy(bit_counters, item->bit_counters, sizeof(bit_counters)); } - enum Sumfunctype sum_func () const {return SUM_BIT_FUNC;} - void clear(); - longlong val_int(); - void reset_field(); - void update_field(); - const Type_handler *type_handler() const { return &type_handler_ulonglong; } - bool fix_length_and_dec() + enum Sumfunctype sum_func () const override { return SUM_BIT_FUNC;} + void clear() override; + longlong val_int() override; + void reset_field() override; + void update_field() override; + const Type_handler *type_handler() const override + { return &type_handler_ulonglong; } + bool fix_length_and_dec() override { if (args[0]->check_type_can_return_int(func_name_cstring())) return true; @@ -1245,7 +1249,7 @@ public: null_value= 0; return FALSE; } - void cleanup() + void cleanup() override { bits= reset_bits; if (as_window_function) @@ -1254,11 +1258,12 @@ public: } void setup_window_func(THD *thd __attribute__((unused)), Window_spec *window_spec __attribute__((unused))) + override { as_window_function= TRUE; clear_as_window(); } - void remove() + void remove() override { if (as_window_function) { @@ -1269,7 +1274,7 @@ public: DBUG_ASSERT(0); } - bool supports_removal() const + bool supports_removal() const override { return true; } @@ -1297,18 +1302,18 @@ class Item_sum_or final :public Item_sum_bit public: 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) {} - bool add(); + bool add() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING sum_name= {STRING_WITH_LEN("bit_or(") }; return sum_name; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } 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_bit(thd, item_par, ULONGLONG_MAX) {} 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 { static LEX_CSTRING sum_min_name= {STRING_WITH_LEN("bit_and(") }; return sum_min_name; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: - void set_bits_from_counters(); + void set_bits_from_counters() override; }; class Item_sum_xor final :public Item_sum_bit @@ -1337,18 +1342,18 @@ class Item_sum_xor final :public Item_sum_bit public: 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) {} - bool add(); + bool add() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING sum_min_name= {STRING_WITH_LEN("bit_xor(") }; return sum_min_name; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: - void set_bits_from_counters(); + void set_bits_from_counters() override; }; class sp_head; @@ -1403,7 +1408,7 @@ struct st_sp_security_context; Example: 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 { private: @@ -1417,48 +1422,48 @@ public: sp_head *sp, List &list); Item_sum_sp(THD *thd, Item_sum_sp *item); - enum Sumfunctype sum_func () const + enum Sumfunctype sum_func () const override { 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); } - bool fix_length_and_dec(); - bool fix_fields(THD *thd, Item **ref); + bool fix_length_and_dec() override; + bool fix_fields(THD *thd, Item **ref) override; LEX_CSTRING func_name_cstring() const override; - const Type_handler *type_handler() const; - bool add(); + const Type_handler *type_handler() const override; + bool add() override; /* val_xx functions */ - longlong val_int() + longlong val_int() override { if(execute()) return 0; return sp_result_field->val_int(); } - double val_real() + double val_real() override { if(execute()) return 0.0; 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()) return NULL; 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); } - String *val_str(String *str) + String *val_str(String *str) override { String buf; char buff[20]; @@ -1476,11 +1481,11 @@ public: str->copy(buf); return str; } - void reset_field(){DBUG_ASSERT(0);} - void update_field(){DBUG_ASSERT(0);} - void clear(); - void cleanup(); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + void reset_field() override{DBUG_ASSERT(0);} + void update_field() override{DBUG_ASSERT(0);} + void clear() override; + void cleanup() override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override { return execute() || sp_result_field->get_date(ltime, fuzzydate); } @@ -1488,9 +1493,9 @@ public: { return sp_result_field; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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 */ @@ -1509,18 +1514,18 @@ public: max_length= item->max_length; 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, - const Tmp_field_param *param) + const Tmp_field_param *param) override { return create_tmp_field_ex_simple(root, table, src, param); } - void save_in_result_field(bool no_conversions) { DBUG_ASSERT(0); } - bool check_vcol_func_processor(void *arg) + void save_in_result_field(bool no_conversions) override { DBUG_ASSERT(0); } + bool check_vcol_func_processor(void *arg) override { 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); } @@ -1535,8 +1540,8 @@ public: Item_avg_field(THD *thd, Item_sum_avg *item) :Item_sum_field(thd, item), prec_increment(item->prec_increment) { } - enum Type type() const { return FIELD_AVG_ITEM; } - bool is_null() { update_null_value(); return null_value; } + enum Type type() const override { return FIELD_AVG_ITEM; } + 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(thd, item) { } - const Type_handler *type_handler() const { return &type_handler_double; } - longlong val_int() { return val_int_from_real(); } - my_decimal *val_decimal(my_decimal *dec) { return val_decimal_from_real(dec); } - String *val_str(String *str) { return val_string_from_real(str); } - double val_real(); - Item *get_copy(THD *thd) + const Type_handler *type_handler() const override + { return &type_handler_double; } + longlong val_int() override { return val_int_from_real(); } + my_decimal *val_decimal(my_decimal *dec) override + { return val_decimal_from_real(dec); } + 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(thd, this); } }; @@ -1566,21 +1574,22 @@ public: f_scale(item->f_scale), dec_bin_size(item->dec_bin_size) { } - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - double val_real() + const Type_handler *type_handler() const override + { return &type_handler_newdecimal; } + double val_real() override { return VDec(this).to_double(); } - longlong val_int() + longlong val_int() override { 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); } - my_decimal *val_decimal(my_decimal *); - Item *get_copy(THD *thd) + my_decimal *val_decimal(my_decimal *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1592,16 +1601,17 @@ public: Item_variance_field(THD *thd, Item_sum_variance *item) :Item_sum_field(thd, item), sample(item->sample) { } - enum Type type() const {return FIELD_VARIANCE_ITEM; } - double val_real(); - longlong val_int() { return val_int_from_real(); } - String *val_str(String *str) + enum Type type() const override {return FIELD_VARIANCE_ITEM; } + double val_real() override; + longlong val_int() override { return val_int_from_real(); } + String *val_str(String *str) override { 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); } - bool is_null() { update_null_value(); return null_value; } - const Type_handler *type_handler() const { return &type_handler_double; } - Item *get_copy(THD *thd) + bool is_null() override { update_null_value(); return null_value; } + const Type_handler *type_handler() const override + { return &type_handler_double; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1612,9 +1622,9 @@ public: Item_std_field(THD *thd, Item_sum_std *item) :Item_variance_field(thd, item) { } - enum Type type() const { return FIELD_STD_ITEM; } - double val_real(); - Item *get_copy(THD *thd) + enum Type type() const override { return FIELD_STD_ITEM; } + double val_real() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1645,7 +1655,7 @@ public: const char *tmp= udf.name(); return {tmp, strlen(tmp) }; } - bool fix_fields(THD *thd, Item **ref) + bool fix_fields(THD *thd, Item **ref) override { DBUG_ASSERT(fixed() == 0); @@ -1677,18 +1687,18 @@ public: memcpy (orig_args, args, sizeof (Item *) * arg_count); 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; } - void clear(); - bool add(); - bool supports_removal() const; - void remove(); - void reset_field() {}; - void update_field() {}; - void cleanup(); - virtual void print(String *str, enum_query_type query_type); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) + void clear() override; + bool add() override; + bool supports_removal() const override; + void remove() override; + void reset_field() override {}; + void update_field() override {} + void cleanup() override; + void print(String *str, enum_query_type query_type) override; + 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); } @@ -1704,14 +1714,16 @@ class Item_sum_udf_float :public Item_udf_sum Item_udf_sum(thd, udf_arg, list) {} Item_sum_udf_float(THD *thd, Item_sum_udf_float *item) :Item_udf_sum(thd, item) {} - longlong val_int() { return val_int_from_real(); } - double val_real(); - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - const Type_handler *type_handler() const { return &type_handler_double; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + longlong val_int() override { return val_int_from_real(); } + double val_real() override; + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *) override; + const Type_handler *type_handler() const override + { return &type_handler_double; } + bool fix_length_and_dec() override + { fix_num_length_and_dec(); return FALSE; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1725,20 +1737,20 @@ public: Item_udf_sum(thd, udf_arg, list) {} Item_sum_udf_int(THD *thd, Item_sum_udf_int *item) :Item_udf_sum(thd, item) {} - longlong val_int(); - double val_real() + longlong val_int() override; + double val_real() override { DBUG_ASSERT(fixed()); return (double) Item_sum_udf_int::val_int(); } - String *val_str(String*str); - my_decimal *val_decimal(my_decimal *); - const Type_handler *type_handler() const + String *val_str(String*str) override; + my_decimal *val_decimal(my_decimal *) override; + const Type_handler *type_handler() const override { if (unsigned_flag) return &type_handler_ulonglong; return &type_handler_slonglong; } - bool fix_length_and_dec() { decimals=0; max_length=21; return FALSE; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override { decimals=0; max_length=21; return FALSE; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1752,8 +1764,8 @@ public: Item_udf_sum(thd, udf_arg, list) {} Item_sum_udf_str(THD *thd, Item_sum_udf_str *item) :Item_udf_sum(thd, item) {} - String *val_str(String *); - double val_real() + String *val_str(String *) override; + double val_real() override { int err_not_used; char *end_not_used; @@ -1762,7 +1774,7 @@ public: return res ? res->charset()->strntod((char*) res->ptr(),res->length(), &end_not_used, &err_not_used) : 0.0; } - longlong val_int() + longlong val_int() override { int err_not_used; char *end; @@ -1775,11 +1787,12 @@ public: end= (char*) res->ptr()+res->length(); return cs->strtoll10(res->ptr(), &end, &err_not_used); } - my_decimal *val_decimal(my_decimal *dec); - const Type_handler *type_handler() const { return string_type_handler(); } - bool fix_length_and_dec(); - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + my_decimal *val_decimal(my_decimal *dec) override; + const Type_handler *type_handler() const override + { return string_type_handler(); } + bool fix_length_and_dec() override; + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1793,23 +1806,25 @@ public: Item_udf_sum(thd, udf_arg, list) {} Item_sum_udf_decimal(THD *thd, Item_sum_udf_decimal *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); } - double val_real() + double val_real() override { return VDec(this).to_double(); } - longlong val_int() + longlong val_int() override { return VDec(this).to_longlong(unsigned_flag); } - my_decimal *val_decimal(my_decimal *); - const Type_handler *type_handler() const { return &type_handler_newdecimal; } - bool fix_length_and_dec() { fix_num_length_and_dec(); return FALSE; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + my_decimal *val_decimal(my_decimal *) override; + const Type_handler *type_handler() const override + { return &type_handler_newdecimal; } + bool fix_length_and_dec() override + { fix_num_length_and_dec(); return FALSE; } + Item *copy_or_same(THD* thd) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -2008,31 +2023,31 @@ public: Item_func_group_concat(THD *thd, Item_func_group_concat *item); ~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 { static LEX_CSTRING sum_name= {STRING_WITH_LEN("group_concat(") }; return sum_name; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { if (too_big_for_varchar()) return &type_handler_blob; return &type_handler_varchar; } - void clear(); - bool add() + void clear() override; + bool add() override { return add(skip_nulls()); } - void reset_field() { DBUG_ASSERT(0); } // not used - void update_field() { DBUG_ASSERT(0); } // not used - bool fix_fields(THD *,Item **); - bool setup(THD *thd); - void make_unique(); - double val_real() + void reset_field() override { DBUG_ASSERT(0); } // not used + void update_field() override { DBUG_ASSERT(0); } // not used + bool fix_fields(THD *,Item **) override; + bool setup(THD *thd) override; + void make_unique() override; + double val_real() override { int error; const char *end; @@ -2042,7 +2057,7 @@ public: end= res->ptr() + res->length(); return (my_strtod(res->ptr(), (char**) &end, &error)); } - longlong val_int() + longlong val_int() override { String *res; char *end_ptr; @@ -2052,21 +2067,21 @@ public: end_ptr= (char*) res->ptr()+ res->length(); 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); } - 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); } - String* val_str(String* str); - Item *copy_or_same(THD* thd); - void no_rows_in_result() {} - void print(String *str, enum_query_type query_type); - bool change_context_processor(void *cntx) + String *val_str(String *str) override; + Item *copy_or_same(THD* thd) override; + void no_rows_in_result() override {} + void print(String *str, enum_query_type query_type) override; + bool change_context_processor(void *cntx) override { context= (Name_resolution_context *)cntx; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } qsort_cmp2 get_comparator_function_for_distinct(); qsort_cmp2 get_comparator_function_for_order_by(); diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 892eb42c558..af266956b05 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -32,7 +32,7 @@ bool get_interval_value(THD *thd, Item *args, class Item_long_func_date_field: public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name_cstring()); } public: Item_long_func_date_field(THD *thd, Item *a) @@ -42,7 +42,7 @@ public: class Item_long_func_time_field: public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_time(func_name_cstring()); } public: Item_long_func_time_field(THD *thd, Item *a) @@ -52,45 +52,45 @@ public: class Item_func_period_add :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, 2); } public: Item_func_period_add(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("period_add") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length=6*MY_CHARSET_BIN_MB_MAXLEN; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_period_diff :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, 2); } public: Item_func_period_diff(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("period_diff") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; return FALSE; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -99,61 +99,61 @@ class Item_func_to_days :public Item_long_func_date_field { public: Item_func_to_days(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("to_days") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; set_maybe_null(); return FALSE; } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + enum_monotonicity_info get_monotonicity_info() const override; + longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_to_seconds :public Item_longlong_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_date(0, arg_count); } public: Item_func_to_seconds(THD *thd, Item *a): Item_longlong_func(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("to_seconds") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; fix_char_length(12); set_maybe_null(); return FALSE; } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool check_partition_func_processor(void *bool_arg) { return FALSE;} + enum_monotonicity_info get_monotonicity_info() const override; + longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; + bool check_partition_func_processor(void *bool_arg) override { return FALSE;} /* Only meaningful with date part and optional time part */ - bool check_valid_arguments_processor(void *int_arg) + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -162,26 +162,26 @@ class Item_func_dayofmonth :public Item_long_func_date_field { public: Item_func_dayofmonth(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("dayofmonth") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; set_maybe_null(); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -191,26 +191,26 @@ class Item_func_month :public Item_long_func public: Item_func_month(THD *thd, Item *a): Item_long_func(thd, a) { } - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("month") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; fix_char_length(2); set_maybe_null(); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -225,18 +225,18 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("monthname") }; return name; } - String *val_str(String *str); - bool fix_length_and_dec(); - bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool check_valid_arguments_processor(void *int_arg) + String *val_str(String *str) override; + bool fix_length_and_dec() override; + bool check_partition_func_processor(void *int_arg) override {return TRUE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -245,26 +245,26 @@ class Item_func_dayofyear :public Item_long_func_date_field { public: Item_func_dayofyear(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("dayofyear") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; fix_char_length(3); set_maybe_null(); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -273,26 +273,26 @@ class Item_func_hour :public Item_long_func_time_field { public: Item_func_hour(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("hour") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; set_maybe_null(); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_time_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -301,26 +301,26 @@ class Item_func_minute :public Item_long_func_time_field { public: Item_func_minute(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("minute") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; set_maybe_null(); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_time_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -329,26 +329,26 @@ class Item_func_quarter :public Item_long_func_date_field { public: Item_func_quarter(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("quarter") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=1*MY_CHARSET_BIN_MB_MAXLEN; set_maybe_null(); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -357,33 +357,33 @@ class Item_func_second :public Item_long_func_time_field { public: Item_func_second(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("second") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; set_maybe_null(); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_time_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_week :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name_cstring()) || (arg_count > 1 && args[1]->check_type_can_return_int(func_name_cstring())); @@ -391,36 +391,36 @@ class Item_func_week :public Item_long_func public: Item_func_week(THD *thd, Item *a): Item_long_func(thd, a) {} Item_func_week(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("week") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=2*MY_CHARSET_BIN_MB_MAXLEN; set_maybe_null(); return FALSE; } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { if (arg_count == 2) return FALSE; return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - bool check_valid_arguments_processor(void *int_arg) + bool check_valid_arguments_processor(void *int_arg) override { return arg_count == 2; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_yearweek :public Item_long_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name_cstring()) || args[1]->check_type_can_return_int(func_name_cstring()); @@ -428,26 +428,26 @@ class Item_func_yearweek :public Item_long_func public: Item_func_yearweek(THD *thd, Item *a, Item *b) :Item_long_func(thd, a, b) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("yearweek") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; max_length=6*MY_CHARSET_BIN_MB_MAXLEN; set_maybe_null(); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -456,28 +456,28 @@ class Item_func_year :public Item_long_func_date_field { public: Item_func_year(THD *thd, Item *a): Item_long_func_date_field(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("year") }; return name; } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool fix_length_and_dec() + enum_monotonicity_info get_monotonicity_info() const override; + longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; + bool fix_length_and_dec() override { decimals=0; max_length=4*MY_CHARSET_BIN_MB_MAXLEN; set_maybe_null(); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -488,31 +488,31 @@ class Item_func_weekday :public Item_long_func public: Item_func_weekday(THD *thd, Item *a, bool type_arg): Item_long_func(thd, a), odbc_type(type_arg) { } - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING dayofweek= {STRING_WITH_LEN("dayofweek") }; static LEX_CSTRING weekday= {STRING_WITH_LEN("weekday") }; return (odbc_type ? dayofweek : weekday); } - 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); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; fix_char_length(1); set_maybe_null(); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -526,19 +526,20 @@ class Item_func_dayname :public Item_str_func static LEX_CSTRING name= {STRING_WITH_LEN("dayname") }; return name; } - String *val_str(String *str); - const Type_handler *type_handler() const { return &type_handler_varchar; } - bool fix_length_and_dec(); - bool check_partition_func_processor(void *int_arg) {return TRUE;} - bool check_vcol_func_processor(void *arg) + String *val_str(String *str) override; + const Type_handler *type_handler() const override + { return &type_handler_varchar; } + bool fix_length_and_dec() override; + bool check_partition_func_processor(void *int_arg) override {return TRUE;} + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - bool check_valid_arguments_processor(void *int_arg) + bool check_valid_arguments_processor(void *int_arg) override { return !has_date_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -581,33 +582,33 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("unix_timestamp") }; return name; } - enum_monotonicity_info get_monotonicity_info() const; - longlong val_int_endpoint(bool left_endp, bool *incl_endp); - bool check_partition_func_processor(void *int_arg) {return FALSE;} + enum_monotonicity_info get_monotonicity_info() const override; + longlong val_int_endpoint(bool left_endp, bool *incl_endp) override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} /* UNIX_TIMESTAMP() depends on the current timezone (and thus may not be used as a partitioning function) when its argument is NOT of the TIMESTAMP type. */ - bool check_valid_arguments_processor(void *int_arg) + bool check_valid_arguments_processor(void *int_arg) override { return !has_timestamp_args(); } - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { if (arg_count) return FALSE; return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { fix_length_and_dec_generic(arg_count ? args[0]->datetime_precision(current_thd) : 0); return FALSE; } - longlong int_op(); - my_decimal *decimal_op(my_decimal* buf); - Item *get_copy(THD *thd) + longlong int_op() override; + my_decimal *decimal_op(my_decimal* buf) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -622,20 +623,20 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("time_to_sec") }; return name; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_time_args(); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { fix_length_and_dec_generic(args[0]->time_precision(current_thd)); return FALSE; } - longlong int_op(); - my_decimal *decimal_op(my_decimal* buf); - Item *get_copy(THD *thd) + longlong int_op() override; + my_decimal *decimal_op(my_decimal* buf) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -646,12 +647,17 @@ public: Item_datefunc(THD *thd): Item_func(thd) { } Item_datefunc(THD *thd, Item *a): Item_func(thd, a) { } Item_datefunc(THD *thd, Item *a, Item *b): Item_func(thd, a, b) { } - const Type_handler *type_handler() const { return &type_handler_newdate; } - longlong val_int() { return Date(this).to_longlong(); } - double val_real() { return Date(this).to_double(); } - String *val_str(String *to) { return Date(this).to_string(to); } - my_decimal *val_decimal(my_decimal *to) { return Date(this).to_decimal(to); } - bool fix_length_and_dec() + const Type_handler *type_handler() const override + { return &type_handler_newdate; } + longlong val_int() override + { return Date(this).to_longlong(); } + double val_real() override + { return Date(this).to_double(); } + String *val_str(String *to) override + { return Date(this).to_string(to); } + my_decimal *val_decimal(my_decimal *to) override + { return Date(this).to_decimal(to); } + bool fix_length_and_dec() override { fix_attributes_date(); set_maybe_null(arg_count > 0); @@ -667,15 +673,18 @@ public: Item_timefunc(THD *thd, Item *a): Item_func(thd, a) {} Item_timefunc(THD *thd, Item *a, Item *b): Item_func(thd, a, b) {} Item_timefunc(THD *thd, Item *a, Item *b, Item *c): Item_func(thd, a, b ,c) {} - const Type_handler *type_handler() const { return &type_handler_time2; } - longlong val_int() { return Time(this).to_longlong(); } - double val_real() { return Time(this).to_double(); } - String *val_str(String *to) { return Time(this).to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) { return Time(this).to_decimal(to); } - bool val_native(THD *thd, Native *to) - { - return Time(thd, this).to_native(to, decimals); - } + const Type_handler *type_handler() const override + { return &type_handler_time2; } + longlong val_int() override + { return Time(this).to_longlong(); } + double val_real() override + { return Time(this).to_double(); } + String *val_str(String *to) override + { return Time(this).to_string(to, decimals); } + my_decimal *val_decimal(my_decimal *to) override + { return Time(this).to_decimal(to); } + bool val_native(THD *thd, Native *to) override + { return Time(thd, this).to_native(to, decimals); } }; @@ -687,11 +696,14 @@ public: Item_datetimefunc(THD *thd, Item *a, Item *b): Item_func(thd, a, b) {} Item_datetimefunc(THD *thd, Item *a, Item *b, Item *c): Item_func(thd, a, b ,c) {} - const Type_handler *type_handler() const { return &type_handler_datetime2; } - longlong val_int() { return Datetime(this).to_longlong(); } - double val_real() { return Datetime(this).to_double(); } - String *val_str(String *to) { return Datetime(this).to_string(to, decimals); } - my_decimal *val_decimal(my_decimal *to) { return Datetime(this).to_decimal(to); } + const Type_handler *type_handler() const override + { return &type_handler_datetime2; } + longlong val_int() override { return Datetime(this).to_longlong(); } + double val_real() override { return Datetime(this).to_double(); } + String *val_str(String *to) override + { return Datetime(this).to_string(to, decimals); } + my_decimal *val_decimal(my_decimal *to) override + { return Datetime(this).to_decimal(to); } }; @@ -704,20 +716,21 @@ class Item_func_curtime :public Item_timefunc public: Item_func_curtime(THD *thd, uint dec): Item_timefunc(thd), last_query_id(0) { decimals= dec; } - bool fix_fields(THD *, Item **); - bool fix_length_and_dec() { fix_attributes_time(decimals); return FALSE; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override + { fix_attributes_time(decimals); return FALSE; } + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; /* Abstract method that defines which time zone is used for conversion. Converts time current time in my_time_t representation to broken-down MYSQL_TIME representation using UTC-SYSTEM or per-thread time zone. */ virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } - void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; }; @@ -730,8 +743,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("curtime") }; return name; } - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -745,8 +758,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("utc_time") }; return name; } - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -759,9 +772,9 @@ class Item_func_curdate :public Item_datefunc MYSQL_TIME ltime; public: Item_func_curdate(THD *thd): Item_datefunc(thd), last_query_id(0) {} - 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; virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } @@ -777,8 +790,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("curdate") }; return name; } - void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -792,8 +805,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("utc_date") }; return name; } - void store_now_in_TIME(THD* thd, MYSQL_TIME *now_time); - Item *get_copy(THD *thd) + void store_now_in_TIME(THD* thd, MYSQL_TIME *now_time) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -807,12 +820,12 @@ class Item_func_now :public Item_datetimefunc public: Item_func_now(THD *thd, uint dec): Item_datetimefunc(thd), last_query_id(0) { decimals= dec; } - bool fix_fields(THD *, Item **); - bool fix_length_and_dec() + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override { fix_attributes_datetime(decimals); return FALSE;} - 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; virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time)=0; - bool check_vcol_func_processor(void *arg) + bool check_vcol_func_processor(void *arg) override { /* NOW is safe for replication as slaves will run with same time as @@ -820,7 +833,7 @@ public: */ return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC); } - void print(String *str, enum_query_type query_type); + void print(String *str, enum_query_type query_type) override; }; @@ -833,10 +846,10 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("current_timestamp") }; return name; } - int save_in_field(Field *field, bool no_conversions); - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - virtual enum Functype functype() const { return NOW_FUNC; } - Item *get_copy(THD *thd) + int save_in_field(Field *field, bool no_conversions) override; + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + enum Functype functype() const override { return NOW_FUNC; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -850,14 +863,14 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("utc_timestamp") }; return name; } - virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - virtual enum Functype functype() const { return NOW_UTC_FUNC; } - virtual bool check_vcol_func_processor(void *arg) + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + enum Functype functype() const override { return NOW_UTC_FUNC; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC | VCOL_NON_DETERMINISTIC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -870,29 +883,29 @@ class Item_func_sysdate_local :public Item_func_now { public: Item_func_sysdate_local(THD *thd, uint dec): Item_func_now(thd, dec) {} - bool const_item() const { return 0; } + bool const_item() const override { return 0; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("sysdate") }; return name; } - void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time); - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - table_map used_tables() const { return RAND_TABLE_BIT; } - bool check_vcol_func_processor(void *arg) + void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) override; + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + table_map used_tables() const override { return RAND_TABLE_BIT; } + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_TIME_FUNC | VCOL_NON_DETERMINISTIC); } - virtual enum Functype functype() const { return SYSDATE_FUNC; } - Item *get_copy(THD *thd) + enum Functype functype() const override { return SYSDATE_FUNC; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_from_days :public Item_datefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_int(func_name_cstring()); } public: Item_func_from_days(THD *thd, Item *a): Item_datefunc(thd, a) {} @@ -901,21 +914,21 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("from_days") }; return name; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return has_date_args() || has_time_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_date_format :public Item_str_func { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name_cstring()) || check_argument_types_can_return_text(1, arg_count); @@ -930,22 +943,22 @@ public: Item_str_func(thd, a, b), locale(0), is_time_format(false) {} Item_func_date_format(THD *thd, Item *a, Item *b, Item *c): Item_str_func(thd, a, b, c), locale(0), is_time_format(false) {} - String *val_str(String *str); + String *val_str(String *str) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("date_format") }; return name; } - bool fix_length_and_dec(); + bool fix_length_and_dec() override; uint format_length(const String *format); - bool eq(const Item *item, bool binary_cmp) const; - bool check_vcol_func_processor(void *arg) + bool eq(const Item *item, bool binary_cmp) const override; + bool check_vcol_func_processor(void *arg) override { if (arg_count > 2) return false; return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -959,15 +972,15 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("time_format") }; return name; } - bool check_vcol_func_processor(void *arg) { return false; } - Item *get_copy(THD *thd) + bool check_vcol_func_processor(void *arg) override { return false; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_from_unixtime :public Item_datetimefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_decimal(func_name_cstring()); } Time_zone *tz; public: @@ -977,13 +990,13 @@ class Item_func_from_unixtime :public Item_datetimefunc static LEX_CSTRING name= {STRING_WITH_LEN("from_unixtime") }; return name; } - bool fix_length_and_dec(); - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool check_vcol_func_processor(void *arg) + bool fix_length_and_dec() override; + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + bool check_vcol_func_processor(void *arg) override { return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1004,7 +1017,7 @@ class Time_zone; */ class Item_func_convert_tz :public Item_datetimefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name_cstring()) || check_argument_types_can_return_text(1, arg_count); @@ -1025,27 +1038,27 @@ class Item_func_convert_tz :public Item_datetimefunc static LEX_CSTRING name= {STRING_WITH_LEN("convert_tz") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { fix_attributes_datetime(args[0]->datetime_precision(current_thd)); set_maybe_null(); return FALSE; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - void cleanup(); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + void cleanup() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_sec_to_time :public Item_timefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_decimal(func_name_cstring()); } public: Item_func_sec_to_time(THD *thd, Item *item): Item_timefunc(thd, item) {} - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - bool fix_length_and_dec() + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + bool fix_length_and_dec() override { fix_attributes_time(args[0]->decimals); set_maybe_null(); @@ -1056,7 +1069,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("sec_to_time") }; return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1075,12 +1088,12 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("date_add_interval") }; return name; } - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const; - void print(String *str, enum_query_type query_type); - enum precedence precedence() const { return INTERVAL_PRECEDENCE; } - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + bool eq(const Item *item, bool binary_cmp) const override; + void print(String *str, enum_query_type query_type) override; + enum precedence precedence() const override { return INTERVAL_PRECEDENCE; } + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1129,29 +1142,29 @@ class Item_extract :public Item_int_func, m_date_mode(date_mode_t(0)), int_type(type_arg) { } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } - longlong val_int(); - enum Functype functype() const { return EXTRACT_FUNC; } + longlong val_int() override; + enum Functype functype() const override { return EXTRACT_FUNC; } LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("extract") }; return name; } - bool check_arguments() const; - bool fix_length_and_dec(); - bool eq(const Item *item, bool binary_cmp) const; - void print(String *str, enum_query_type query_type); - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) + bool check_arguments() const override; + bool fix_length_and_dec() override; + bool eq(const Item *item, bool binary_cmp) const override; + void print(String *str, enum_query_type query_type) override; + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { if (int_type != INTERVAL_WEEK) return FALSE; return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC); } - bool check_valid_arguments_processor(void *int_arg) + bool check_valid_arguments_processor(void *int_arg) override { switch (int_type) { case INTERVAL_YEAR: @@ -1187,7 +1200,7 @@ class Item_extract :public Item_int_func, } return true; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1214,8 +1227,8 @@ public: Item_char_typecast(THD *thd, Item *a, uint length_arg, CHARSET_INFO *cs_arg): Item_handled_func(thd, a), cast_length(length_arg), cast_cs(cs_arg), m_suppress_warning_to_error_escalation(false) {} - enum Functype functype() const { return CHAR_TYPECAST_FUNC; } - bool eq(const Item *item, bool binary_cmp) const; + enum Functype functype() const override { return CHAR_TYPECAST_FUNC; } + bool eq(const Item *item, bool binary_cmp) const override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_char") }; @@ -1228,13 +1241,13 @@ public: void fix_length_and_dec_numeric(); void fix_length_and_dec_str(); void fix_length_and_dec_native_to_binary(uint32 octet_length); - bool fix_length_and_dec() + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_char_typecast_fix_length_and_dec(this); } - void print(String *str, enum_query_type query_type); - bool need_parentheses_in_default() { return true; } - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + bool need_parentheses_in_default() override { return true; } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1266,16 +1279,16 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_date") }; return name; } - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { print_cast_temporal(str, query_type); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool fix_length_and_dec() + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool fix_length_and_dec() override { return args[0]->type_handler()->Item_date_typecast_fix_length_and_dec(this); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1290,18 +1303,18 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_time") }; return name; } - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { print_cast_temporal(str, query_type); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool fix_length_and_dec() + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool fix_length_and_dec() override { return args[0]->type_handler()-> Item_time_typecast_fix_length_and_dec(this); } - Sql_mode_dependency value_depends_on_sql_mode() const; - Item *get_copy(THD *thd) + Sql_mode_dependency value_depends_on_sql_mode() const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1316,25 +1329,25 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_datetime") }; return name; } - void print(String *str, enum_query_type query_type) + void print(String *str, enum_query_type query_type) override { print_cast_temporal(str, query_type); } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - bool fix_length_and_dec() + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + bool fix_length_and_dec() override { return args[0]->type_handler()-> Item_datetime_typecast_fix_length_and_dec(this); } - Sql_mode_dependency value_depends_on_sql_mode() const; - Item *get_copy(THD *thd) + Sql_mode_dependency value_depends_on_sql_mode() const override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_makedate :public Item_datefunc { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, arg_count); } public: Item_func_makedate(THD *thd, Item *a, Item *b): @@ -1344,15 +1357,15 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("makedate") }; return name; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_timestamp :public Item_datetimefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name_cstring()) || args[1]->check_type_can_return_time(func_name_cstring()); @@ -1366,7 +1379,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("timestamp") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { THD *thd= current_thd; uint dec0= args[0]->datetime_precision(thd); @@ -1375,7 +1388,7 @@ public: set_maybe_null(); return false; } - 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 { Datetime dt(thd, args[0], Datetime::Options(TIME_CONV_NONE, thd)); if (!dt.is_valid_datetime()) @@ -1387,7 +1400,7 @@ public: return (null_value= Sec6_add(dt.get_mysql_time(), it.get_mysql_time(), 1). to_datetime(ltime)); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1412,21 +1425,21 @@ public: Item_func_add_time(THD *thd, Item *a, Item *b, bool neg_arg) :Item_handled_func(thd, a, b), sign(neg_arg ? -1 : 1) { } - bool fix_length_and_dec(); + bool fix_length_and_dec() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING addtime= { STRING_WITH_LEN("addtime") }; static LEX_CSTRING subtime= { STRING_WITH_LEN("subtime") }; return sign > 0 ? addtime : subtime; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_timediff :public Item_timefunc { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_time(0, arg_count); } public: Item_func_timediff(THD *thd, Item *a, Item *b): Item_timefunc(thd, a, b) {} @@ -1435,7 +1448,7 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("timediff") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { THD *thd= current_thd; uint dec= MY_MAX(args[0]->time_precision(thd), @@ -1444,14 +1457,14 @@ public: set_maybe_null(); return FALSE; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_maketime :public Item_timefunc { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_int(0, 2) || args[2]->check_type_can_return_decimal(func_name_cstring()); @@ -1460,7 +1473,7 @@ public: Item_func_maketime(THD *thd, Item *a, Item *b, Item *c): Item_timefunc(thd, a, b, c) {} - bool fix_length_and_dec() + bool fix_length_and_dec() override { fix_attributes_time(args[2]->decimals); set_maybe_null(); @@ -1471,8 +1484,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("maketime") }; return name; } - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1481,33 +1494,33 @@ class Item_func_microsecond :public Item_long_func_time_field { public: Item_func_microsecond(THD *thd, Item *a): Item_long_func_time_field(thd, a) {} - longlong val_int(); + longlong val_int() override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("microsecond") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals=0; set_maybe_null(); fix_char_length(6); return FALSE; } - bool check_partition_func_processor(void *int_arg) {return FALSE;} - bool check_vcol_func_processor(void *arg) { return FALSE;} - bool check_valid_arguments_processor(void *int_arg) + bool check_partition_func_processor(void *int_arg) override {return FALSE;} + bool check_vcol_func_processor(void *arg) override { return FALSE;} + bool check_valid_arguments_processor(void *int_arg) override { return !has_time_args(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_timestamp_diff :public Item_longlong_func { - bool check_arguments() const + bool check_arguments() const override { return check_argument_types_can_return_date(0, arg_count); } const interval_type int_type; public: @@ -1521,15 +1534,15 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("timestampdiff") }; return name; } - longlong val_int(); - bool fix_length_and_dec() + longlong val_int() override; + bool fix_length_and_dec() override { decimals=0; set_maybe_null(); return FALSE; } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1546,21 +1559,21 @@ public: Item_func_get_format(THD *thd, timestamp_type type_arg, Item *a): Item_str_ascii_func(thd, a), type(type_arg) {} - String *val_str_ascii(String *str); + String *val_str_ascii(String *str) override; LEX_CSTRING func_name_cstring() const override { static LEX_CSTRING name= {STRING_WITH_LEN("get_format") }; return name; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { set_maybe_null(); decimals=0; fix_length_and_charset(17, default_charset()); return FALSE; } - virtual void print(String *str, enum_query_type query_type); - Item *get_copy(THD *thd) + void print(String *str, enum_query_type query_type) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1583,15 +1596,15 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("str_to_date") }; return name; } - bool fix_length_and_dec(); - Item *get_copy(THD *thd) + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; class Item_func_last_day :public Item_datefunc { - bool check_arguments() const + bool check_arguments() const override { return args[0]->check_type_can_return_date(func_name_cstring()); } public: Item_func_last_day(THD *thd, Item *a): Item_datefunc(thd, a) {} @@ -1600,8 +1613,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("last_day") }; return name; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/item_vers.h b/sql/item_vers.h index 21d916c01e1..ecc0c17ba46 100644 --- a/sql/item_vers.h +++ b/sql/item_vers.h @@ -33,10 +33,10 @@ public: static LEX_CSTRING commit_name= {STRING_WITH_LEN("trt_commit_ts") }; return (trt_field == TR_table::FLD_BEGIN_TS) ? begin_name : commit_name; } - bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate); - Item *get_copy(THD *thd) + bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } - bool fix_length_and_dec() + bool fix_length_and_dec() override { fix_attributes_datetime(decimals); return FALSE; } }; @@ -71,15 +71,15 @@ public: return NULL_clex_str; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { bool res= Item_int_func::fix_length_and_dec(); max_length= 20; return res; } - longlong val_int(); - Item *get_copy(THD *thd) + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -95,8 +95,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("trt_trx_sees") }; return name; } - longlong val_int(); - Item *get_copy(THD *thd) + longlong val_int() override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h index 196e69438b5..ce9d89e62dd 100644 --- a/sql/item_windowfunc.h +++ b/sql/item_windowfunc.h @@ -118,28 +118,29 @@ public: Item_sum_row_number(THD *thd) : 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; } - bool add() + bool add() override { count++; return false; } - void reset_field() { DBUG_ASSERT(0); } - void update_field() {} + void reset_field() override { DBUG_ASSERT(0); } + void update_field() override {} - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return ROW_NUMBER_FUNC; } - longlong val_int() + longlong val_int() override { return count; } @@ -149,7 +150,7 @@ public: return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -182,26 +183,27 @@ public: 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 */ cur_rank= 1; row_number= 0; } - bool add(); + bool add() override; - longlong val_int() + longlong val_int() override { return cur_rank; } - void reset_field() { DBUG_ASSERT(0); } - void update_field() {} + void reset_field() override { DBUG_ASSERT(0); } + void update_field() override {} - enum Sumfunctype sum_func () const + enum Sumfunctype sum_func () const override { return RANK_FUNC; } @@ -212,9 +214,9 @@ public: 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) { @@ -223,7 +225,7 @@ public: } Item_sum_int::cleanup(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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 class, with a switch for the DENSE case. */ - void clear() + void clear() override { dense_rank= 0; first_add= true; } - bool add(); - void reset_field() { DBUG_ASSERT(0); } - void update_field() {} - longlong val_int() + bool add() override; + void reset_field() override { DBUG_ASSERT(0); } + void update_field() override {} + longlong val_int() override { return dense_rank; } Item_sum_dense_rank(THD *thd) : Item_sum_int(thd), dense_rank(0), first_add(true), peer_tracker(NULL) {} - const Type_handler *type_handler() const { return &type_handler_slonglong; } - enum Sumfunctype sum_func () const + const Type_handler *type_handler() const override + { return &type_handler_slonglong; } + enum Sumfunctype sum_func () const override { return DENSE_RANK_FUNC; } @@ -284,9 +287,9 @@ class Item_sum_dense_rank: public Item_sum_int 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) { @@ -295,7 +298,7 @@ class Item_sum_dense_rank: public Item_sum_int } Item_sum_int::cleanup(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -312,22 +315,22 @@ class Item_sum_hybrid_simple : public Item_sum_hybrid value(NULL) { } - bool add(); - bool fix_fields(THD *, Item **); - bool fix_length_and_dec(); + bool add() override; + bool fix_fields(THD *, Item **) override; + bool fix_length_and_dec() override; void setup_hybrid(THD *thd, Item *item); - double val_real(); - longlong val_int(); - my_decimal *val_decimal(my_decimal *); - void reset_field(); - String *val_str(String *); - bool val_native(THD *thd, Native *to); - bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); - const Type_handler *type_handler() const + double val_real() override; + longlong val_int() override; + my_decimal *val_decimal(my_decimal *) override; + void reset_field() override; + String *val_str(String *) override; + bool val_native(THD *thd, Native *to) override; + bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate) override; + const Type_handler *type_handler() const override { return Type_handler_hybrid_field_type::type_handler(); } - void update_field(); - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - void clear() + void update_field() override; + Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override; + void clear() override { value->clear(); null_value= 1; @@ -348,7 +351,7 @@ class Item_sum_first_value : public Item_sum_hybrid_simple Item_sum_hybrid_simple(thd, arg_expr) {} - enum Sumfunctype sum_func () const + enum Sumfunctype sum_func () const override { return FIRST_VALUE_FUNC; } @@ -359,7 +362,7 @@ class Item_sum_first_value : public Item_sum_hybrid_simple return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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_hybrid_simple(thd, arg_expr) {} - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return LAST_VALUE_FUNC; } @@ -386,7 +389,7 @@ class Item_sum_last_value : public Item_sum_hybrid_simple return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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_hybrid_simple(thd, arg_expr, offset_expr) {} - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return NTH_VALUE_FUNC; } @@ -408,7 +411,7 @@ class Item_sum_nth_value : public Item_sum_hybrid_simple return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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_hybrid_simple(thd, arg_expr, offset_expr) {} - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return LEAD_FUNC; } @@ -430,7 +433,7 @@ class Item_sum_lead : public Item_sum_hybrid_simple return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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_hybrid_simple(thd, arg_expr, offset_expr) {} - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return LAG_FUNC; } @@ -452,7 +455,7 @@ class Item_sum_lag : public Item_sum_hybrid_simple return name; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -506,7 +509,7 @@ class Item_sum_percent_rank: public Item_sum_double, Item_sum_percent_rank(THD *thd) : 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 @@ -516,7 +519,7 @@ class Item_sum_percent_rank: public Item_sum_double, return 0; } - double val_real() + double val_real() override { /* 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(cur_rank - 1) / (partition_rows - 1) : 0; } - enum Sumfunctype sum_func () const + enum Sumfunctype sum_func () const override { return PERCENT_RANK_FUNC; } @@ -540,33 +543,34 @@ class Item_sum_percent_rank: public Item_sum_double, return name; } - void update_field() {} + void update_field() override {} - void clear() + void clear() override { cur_rank= 1; row_number= 0; } - bool add(); - const Type_handler *type_handler() const { return &type_handler_double; } + bool add() override; + 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 // requires. 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); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: @@ -575,7 +579,7 @@ class Item_sum_percent_rank: public Item_sum_double, Group_bound_tracker *peer_tracker; - void cleanup() + void cleanup() override { 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 *arg) :Item_sum_double(thd, arg) { } - double val_real() + double val_real() override { return calc_val_real(&null_value, current_row_count_); } - bool add() + bool add() override { current_row_count_++; return false; } - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return CUME_DIST_FUNC; } - void clear() + void clear() override { current_row_count_= 0; partition_row_count_= 0; @@ -636,24 +640,25 @@ class Item_sum_cume_dist: public Item_sum_double, return name; } - void update_field() {} - const Type_handler *type_handler() const { return &type_handler_double; } + void update_field() override {} + 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 // requires. 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); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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) { } - longlong val_int() + longlong val_int() override { 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; } - bool add() + bool add() override { current_row_count_++; return false; } - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return NTILE_FUNC; } - void clear() + void clear() override { current_row_count_= 0; partition_row_count_= 0; @@ -718,18 +723,19 @@ class Item_sum_ntile : public Item_sum_int, 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); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } private: @@ -748,7 +754,7 @@ public: value(NULL), val_calculated(FALSE), first_call(TRUE), prev_value(0), order_item(NULL){} - double val_real() + double val_real() override { if (get_row_count() == 0 || get_arg(0)->is_null()) { @@ -759,7 +765,7 @@ public: return value->val_real(); } - longlong val_int() + longlong val_int() override { if (get_row_count() == 0 || get_arg(0)->is_null()) { @@ -770,7 +776,7 @@ public: 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()) { @@ -781,7 +787,7 @@ public: 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()) { @@ -792,7 +798,7 @@ public: 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()) { @@ -803,7 +809,7 @@ public: 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()) { @@ -814,7 +820,7 @@ public: return value->val_native(thd, to); } - bool add() + bool add() override { Item *arg= get_arg(0); if (arg->is_null()) @@ -855,12 +861,12 @@ public: return false; } - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return PERCENTILE_DISC_FUNC; } - void clear() + void clear() override { val_calculated= false; first_call= true; @@ -875,29 +881,29 @@ public: return name; } - void update_field() {} - const Type_handler *type_handler() const + void update_field() override {} + const Type_handler *type_handler() const override {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 // requires. 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); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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); - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; private: Item_cache *value; @@ -916,7 +922,7 @@ public: floor_value(NULL), ceil_value(NULL), first_call(TRUE),prev_value(0), 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()) { @@ -943,7 +949,7 @@ public: return ret_val; } - bool add() + bool add() override { Item *arg= get_arg(0); if (arg->is_null()) @@ -993,12 +999,12 @@ public: return false; } - enum Sumfunctype sum_func() const + enum Sumfunctype sum_func() const override { return PERCENTILE_CONT_FUNC; } - void clear() + void clear() override { first_call= true; floor_value->clear(); @@ -1014,27 +1020,27 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("percentile_cont") }; 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 // requires. 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); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(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); - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; private: Item_cache *floor_value; @@ -1072,7 +1078,7 @@ public: 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 @@ -1083,7 +1089,7 @@ public: 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. */ - bool register_field_in_read_map(void *arg) + bool register_field_in_read_map(void *arg) override { TABLE *table= (TABLE*) arg; if (result_field && (result_field->table == table || !table)) @@ -1186,11 +1192,11 @@ public: */ 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(); } - enum Item::Type type() const { return Item::WINDOW_FUNC_ITEM; } + enum Item::Type type() const override { return Item::WINDOW_FUNC_ITEM; } private: /* @@ -1233,7 +1239,7 @@ public: read_value_from_result_field= true; } - bool is_null() + bool is_null() override { if (force_return_blank) return true; @@ -1244,7 +1250,7 @@ public: return window_func()->is_null(); } - double val_real() + double val_real() override { double res; if (force_return_blank) @@ -1265,7 +1271,7 @@ public: return res; } - longlong val_int() + longlong val_int() override { longlong res; if (force_return_blank) @@ -1286,7 +1292,7 @@ public: return res; } - String* val_str(String* str) + String* val_str(String* str) override { String *res; if (force_return_blank) @@ -1309,7 +1315,7 @@ public: return res; } - bool val_native(THD *thd, Native *to) + bool val_native(THD *thd, Native *to) override { if (force_return_blank) return null_value= true; @@ -1318,7 +1324,7 @@ public: 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; if (force_return_blank) @@ -1341,7 +1347,7 @@ public: 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; if (force_return_blank) @@ -1365,9 +1371,9 @@ public: } void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array, - List &fields, uint flags); + List &fields, uint flags) override; - bool fix_length_and_dec() + bool fix_length_and_dec() override { Type_std_attributes::set(window_func()); return FALSE; @@ -1379,13 +1385,13 @@ public: return name; } - bool fix_fields(THD *thd, Item **ref); + bool fix_fields(THD *thd, Item **ref) override; 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; } }; diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index b926564bdf9..0fef3368dc7 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -141,21 +141,21 @@ public: fltend= (MY_XPATH_FLT*) tmp_native_value.end(); nodeset->length(0); } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { 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; } 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); return NULL; } - String *val_str(String *str) + String *val_str(String *str) override { prepare_nodes(); val_native(current_thd, &tmp2_native_value); @@ -189,7 +189,7 @@ public: } return str; } - bool fix_length_and_dec() + bool fix_length_and_dec() override { max_length= MAX_BLOB_WIDTH; collation.collation= pxml->charset(); @@ -202,7 +202,7 @@ public: { 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); } @@ -220,8 +220,8 @@ public: { return { STRING_WITH_LEN("xpath_rootelement") }; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -236,8 +236,8 @@ public: { return { STRING_WITH_LEN("xpath_union") }; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -276,8 +276,8 @@ public: { return { STRING_WITH_LEN("xpath_selfbyname") }; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -293,8 +293,8 @@ public: { return { STRING_WITH_LEN("xpath_childbyname") }; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -312,8 +312,8 @@ public: { return { STRING_WITH_LEN("xpath_descendantbyname") }; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -331,8 +331,8 @@ public: { return { STRING_WITH_LEN("xpath_ancestorbyname") }; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -349,8 +349,8 @@ public: { return { STRING_WITH_LEN("xpath_parentbyname") }; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -366,8 +366,8 @@ public: { return { STRING_WITH_LEN("xpath_attributebyname") }; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -386,8 +386,8 @@ public: { return { STRING_WITH_LEN("xpath_predicate") }; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -402,8 +402,8 @@ public: { return { STRING_WITH_LEN("xpath_elementbyindex") }; } - bool val_native(THD *thd, Native *nodeset); - Item *get_copy(THD *thd) + bool val_native(THD *thd, Native *nodeset) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -425,7 +425,7 @@ public: { return { STRING_WITH_LEN("xpath_cast_bool") }; } - longlong val_int() + longlong val_int() override { if (args[0]->fixed_type_handler() == &type_handler_xpath_nodeset) { @@ -434,7 +434,7 @@ public: } return args[0]->val_real() ? 1 : 0; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -450,8 +450,8 @@ public: { return { STRING_WITH_LEN("xpath_cast_number") }; } - virtual double val_real() { return args[0]->val_real(); } - Item *get_copy(THD *thd) + double val_real() override { return args[0]->val_real(); } + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -486,15 +486,15 @@ public: { return { STRING_WITH_LEN("xpath_position") }; } - bool fix_length_and_dec() { max_length=10; return FALSE; } - longlong val_int() + bool fix_length_and_dec() override { max_length=10; return FALSE; } + longlong val_int() override { args[0]->val_native(current_thd, &tmp_native_value); if (tmp_native_value.elements() == 1) return tmp_native_value.element(0).pos + 1; return 0; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -510,8 +510,8 @@ public: { return { STRING_WITH_LEN("xpath_count") }; } - bool fix_length_and_dec() { max_length=10; return FALSE; } - longlong val_int() + bool fix_length_and_dec() override { max_length=10; return FALSE; } + longlong val_int() override { uint predicate_supplied_context_size; args[0]->val_native(current_thd, &tmp_native_value); @@ -520,7 +520,7 @@ public: return predicate_supplied_context_size; return tmp_native_value.elements(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -537,7 +537,7 @@ public: { return { STRING_WITH_LEN("xpath_sum") }; } - double val_real() + double val_real() override { double sum= 0; args[0]->val_native(current_thd, &tmp_native_value); @@ -568,7 +568,7 @@ public: } return sum; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -612,17 +612,17 @@ public: { 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); } 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); return NULL; } - longlong val_int() + longlong val_int() override { Item_func *comp= (Item_func*)args[1]; Item_string_xml_non_const *fake= @@ -653,7 +653,7 @@ public: } return 0; } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h index 366958710a4..e2ffe2fa630 100644 --- a/sql/item_xmlfunc.h +++ b/sql/item_xmlfunc.h @@ -117,9 +117,9 @@ public: { set_maybe_null(); } - bool fix_fields(THD *thd, Item **ref); - bool fix_length_and_dec(); - bool const_item() const + bool fix_fields(THD *thd, Item **ref) override; + bool fix_length_and_dec() override; + bool const_item() const override { return const_item_cache && (!nodeset_func || nodeset_func->const_item()); } @@ -136,8 +136,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("extractvalue") }; return name; } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -157,8 +157,8 @@ public: static LEX_CSTRING name= {STRING_WITH_LEN("updatexml") }; return name; } - String *val_str(String *); - Item *get_copy(THD *thd) + String *val_str(String *) override; + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; diff --git a/sql/procedure.h b/sql/procedure.h index 769eac5f217..c83a52ff19c 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -44,9 +44,9 @@ public: this->name.str= 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, - 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: @@ -58,19 +58,19 @@ public: virtual void set(double nr)=0; virtual void set(const char *str,uint length,CHARSET_INFO *cs)=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()); } 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 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); } - Item* get_copy(THD *thd) { return 0; } + Item* get_copy(THD *thd) override { return 0; } }; class Item_proc_real :public Item_proc @@ -82,23 +82,24 @@ public: { decimals=dec; max_length=float_length(dec); } - const Type_handler *type_handler() const { return &type_handler_double; } - void set(double nr) { value=nr; } - void set(longlong nr) { value=(double) nr; } - void set(const char *str,uint length,CHARSET_INFO *cs) + const Type_handler *type_handler() const override + { return &type_handler_double; } + void set(double nr) override { value=nr; } + void set(longlong nr) override { value=(double) nr; } + void set(const char *str,uint length,CHARSET_INFO *cs) override { int err_not_used; char *end_not_used; value= cs->strntod((char*) str,length, &end_not_used, &err_not_used); } - double val_real() { return value; } - longlong val_int() { return (longlong) value; } - String *val_str(String *s) + double val_real() override { return value; } + longlong val_int() override { return (longlong) value; } + String *val_str(String *s) override { s->set_real(value,decimals,default_charset()); return s; } - my_decimal *val_decimal(my_decimal *); + my_decimal *val_decimal(my_decimal *) override; unsigned int size_of() { return sizeof(*this);} }; @@ -108,20 +109,21 @@ class Item_proc_int :public Item_proc public: Item_proc_int(THD *thd, const char *name_par): Item_proc(thd, name_par) { max_length=11; } - const Type_handler *type_handler() const + const Type_handler *type_handler() const override { if (unsigned_flag) return &type_handler_ulonglong; return &type_handler_slonglong; } - void set(double nr) { value=(longlong) nr; } - void set(longlong nr) { value=nr; } - void set(const char *str,uint length, CHARSET_INFO *cs) + void set(double nr) override { value=(longlong) nr; } + void set(longlong nr) override { value=nr; } + void set(const char *str,uint length, CHARSET_INFO *cs) override { int err; value= cs->strntoll(str,length,10,NULL,&err); } - double val_real() { return (double) value; } - longlong val_int() { return value; } - String *val_str(String *s) { s->set(value, default_charset()); return s; } - my_decimal *val_decimal(my_decimal *); + double val_real() override { return (double) value; } + longlong val_int() override { return value; } + String *val_str(String *s) override + { s->set(value, default_charset()); return s; } + my_decimal *val_decimal(my_decimal *) override; unsigned int size_of() { return sizeof(*this);} }; @@ -131,12 +133,13 @@ class Item_proc_string :public Item_proc public: Item_proc_string(THD *thd, const char *name_par, uint length): Item_proc(thd, name_par) { this->max_length=length; } - const Type_handler *type_handler() const { return &type_handler_varchar; } - void set(double nr) { str_value.set_real(nr, 2, default_charset()); } - void set(longlong nr) { str_value.set(nr, default_charset()); } - void set(const char *str, uint length, CHARSET_INFO *cs) + const Type_handler *type_handler() const override + { return &type_handler_varchar; } + void set(double nr) override { str_value.set_real(nr, 2, default_charset()); } + 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); } - double val_real() + double val_real() override { int err_not_used; char *end_not_used; @@ -144,17 +147,17 @@ public: return cs->strntod((char*) str_value.ptr(), str_value.length(), &end_not_used, &err_not_used); } - longlong val_int() + longlong val_int() override { int err; CHARSET_INFO *cs=str_value.charset(); 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; } - my_decimal *val_decimal(my_decimal *); + my_decimal *val_decimal(my_decimal *) override; unsigned int size_of() { return sizeof(*this);} }; diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h index ffc9c0e19af..a2b26ac01e1 100644 --- a/sql/sp_pcontext.h +++ b/sql/sp_pcontext.h @@ -60,7 +60,8 @@ public: Spvar_definition field_def; /// 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: sp_variable(const LEX_CSTRING *name_arg, uint offset_arg) diff --git a/sql/sql_class.h b/sql/sql_class.h index 2d84cc70e31..63af50ad234 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -6781,7 +6781,8 @@ public: ~my_var_sp() { } bool set(THD *thd, Item *val); 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; }; diff --git a/sql/sql_select.h b/sql/sql_select.h index 5d0f71ca783..14a459f9371 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1937,8 +1937,8 @@ class store_key_field: public store_key } } - enum Type type() const { return FIELD_STORE_KEY; } - const char *name() const { return field_name; } + enum Type type() const override { return FIELD_STORE_KEY; } + const char *name() const override { return field_name; } void change_source_field(Item_field *fld_item) { @@ -1947,7 +1947,7 @@ class store_key_field: public store_key } protected: - enum store_key_result copy_inner() + enum store_key_result copy_inner() override { TABLE *table= copy_field.to_field->table; my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, @@ -1990,11 +1990,11 @@ public: {} - enum Type type() const { return ITEM_STORE_KEY; } - const char *name() const { return "func"; } + enum Type type() const override { return ITEM_STORE_KEY; } + const char *name() const override { return "func"; } protected: - enum store_key_result copy_inner() + enum store_key_result copy_inner() override { TABLE *table= to_field->table; my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, @@ -2043,12 +2043,12 @@ public: :store_key_item(arg, new_item, FALSE), inited(0) {} - enum Type type() const { return CONST_ITEM_STORE_KEY; } - const char *name() const { return "const"; } - bool store_key_is_const() { return true; } + enum Type type() const override { return CONST_ITEM_STORE_KEY; } + const char *name() const override { return "const"; } + bool store_key_is_const() override { return true; } protected: - enum store_key_result copy_inner() + enum store_key_result copy_inner() override { int res; if (!inited) diff --git a/storage/maria/ha_s3.h b/storage/maria/ha_s3.h index e16353b2a32..e8c7f586a1b 100644 --- a/storage/maria/ha_s3.h +++ b/storage/maria/ha_s3.h @@ -54,12 +54,12 @@ public: DBUG_ENTER("analyze"); 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_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_RETURN(HA_ERR_TABLE_READONLY); -- cgit v1.2.1