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

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

View File

@ -24,12 +24,12 @@ class Item_func_sysconst_test :public Item_func_sysconst
{
public:
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 @@ class Item_func_sysconst_test :public Item_func_sysconst
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<Item_func_sysconst_test>(thd, this); }
};

View File

@ -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 @@ class Item_func_inet_aton : public Item_longlong_func
unsigned_flag= 1;
return FALSE;
}
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_inet_aton>(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<Item_func_inet_ntoa>(thd, this); }
};
@ -111,17 +111,17 @@ class Item_func_inet6_aton : public Item_str_func
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<Item_func_inet6_aton>(thd, this); }
String *val_str(String *to);
String *val_str(String *to) override;
};
@ -143,7 +143,7 @@ class Item_func_inet6_ntoa : public Item_str_ascii_func
return name;
}
virtual bool fix_length_and_dec()
bool fix_length_and_dec() override
{
decimals= 0;
@ -155,8 +155,8 @@ class Item_func_inet6_ntoa : public Item_str_ascii_func
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<Item_func_inet6_ntoa>(thd, this); }
};
@ -178,10 +178,10 @@ class Item_func_is_ipv4 : public Item_func_inet_bool_base
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<Item_func_is_ipv4>(thd, this); }
longlong val_int();
longlong val_int() override;
};
@ -201,10 +201,10 @@ class Item_func_is_ipv6 : public Item_func_inet_bool_base
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<Item_func_is_ipv6>(thd, this); }
longlong val_int();
longlong val_int() override;
};
@ -223,9 +223,9 @@ class Item_func_is_ipv4_compat : public Item_func_inet_bool_base
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<Item_func_is_ipv4_compat>(thd, this); }
longlong val_int();
longlong val_int() override;
};
@ -244,9 +244,9 @@ class Item_func_is_ipv4_mapped : public Item_func_inet_bool_base
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<Item_func_is_ipv4_mapped>(thd, this); }
longlong val_int();
longlong val_int() override;
};
#endif // ITEM_INETFUNC_INCLUDED

View File

@ -1198,7 +1198,7 @@ class Field: public Value_source
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();
@ -4155,7 +4155,7 @@ class Field_varstring :public Field_longstr {
{
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);
}
@ -4505,7 +4505,7 @@ class Field_blob :public Field_longstr {
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);
}

View File

@ -467,7 +467,7 @@ class ha_partition :public handler
}
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();

View File

@ -2213,7 +2213,7 @@ class Item :public Value_source,
assumes that there are no multi-byte collations amongst the partition
fields.
*/
virtual bool check_partition_func_processor(void *arg) { return 1;}
virtual bool check_partition_func_processor(void *arg) { return true; }
virtual bool post_fix_fields_part_expr_processor(void *arg) { return 0; }
virtual bool rename_fields_processor(void *arg) { return 0; }
/*
@ -2988,7 +2988,6 @@ class Item_sp_variable :public Item_fixed_hybrid
public:
bool fix_fields(THD *thd, Item **) override= 0;
double val_real() override;
longlong val_int() override;
String *val_str(String *sp) override;
@ -2999,9 +2998,7 @@ class Item_sp_variable :public Item_fixed_hybrid
public:
void make_send_field(THD *thd, Send_field *field) override;
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) override
@ -3849,7 +3846,7 @@ class Item_null_result :public Item_null
{
save_in_field(result_field, no_conversions);
}
bool check_partition_func_processor(void *) override { return true; }
bool check_partition_func_processor(void *int_arg) override { return true; }
bool check_vcol_func_processor(void *arg) override
{
return mark_unsupported_function(full_name(), arg, VCOL_IMPOSSIBLE);
@ -4263,23 +4260,18 @@ class Item_param :public Item_basic_value,
bool append_for_log(THD *thd, String *str) override;
bool check_vcol_func_processor(void *) override { return false; }
Item *get_copy(THD *) override { return nullptr; }
bool add_as_clone(THD *thd);
void sync_clones();
bool register_clone(Item_param *i) { return m_clones.push_back(i); }
private:
void invalid_default_param() const;
bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override;
void set_out_param_info(Send_field *info) override;
public:
const Send_field *get_out_param_info() const override;
Item_param *get_item_param() override { return this; }
void make_send_field(THD *thd, Send_field *field) override;
private:
@ -4397,12 +4389,12 @@ class Item_uint :public Item_int
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);
double val_real() override { return ulonglong2double((ulonglong)value); }
Item *clone_item(THD *thd) override;
Item *neg(THD *thd) override;
decimal_digits_t decimal_precision() const override
{ return decimal_digits_t(max_length); }
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_uint>(thd, this); }
};
@ -4444,9 +4436,12 @@ class Item_decimal :public Item_num
{ 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; }
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;
@ -4519,12 +4514,10 @@ class Item_static_float_func :public Item_float
uint decimal_par, uint length):
Item_float(thd, NullS, val_arg, decimal_par, length), func_name(str)
{}
void print(String *str, enum_query_type) override
{
str->append(func_name, strlen(func_name));
}
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override
{
return const_charset_converter(thd, tocs, true, func_name);
@ -4665,8 +4658,7 @@ class Item_string :public Item_literal
{ return Item::check_well_formed_result(&str_value, send_error); }
Item_basic_constant *make_string_literal_concat(THD *thd,
const LEX_CSTRING *)
override;
const LEX_CSTRING *) override;
Item *make_odbc_literal(THD *thd, const LEX_CSTRING *typestr) override;
Item *get_copy(THD *thd) override
@ -4804,7 +4796,7 @@ class Item_return_int :public Item_int
{
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);
@ -4830,14 +4822,15 @@ class Item_hex_constant: public Item_literal
{
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);
}
@ -5071,7 +5064,7 @@ class Item_date_literal: public Item_temporal_literal
/**
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;
@ -5114,6 +5107,7 @@ class Item_time_literal: public Item_temporal_literal
/**
TIMESTAMP'2001-01-01 10:20:30'
*/
class Item_datetime_literal: public Item_temporal_literal
{
protected:
@ -5180,7 +5174,7 @@ class Item_date_literal_for_invalid_dates: public Item_date_literal
WHERE date_column='2001-01-01' ... ->
WHERE date_column=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'
@ -5215,7 +5209,7 @@ class Item_date_literal_for_invalid_dates: public Item_date_literal
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,
@ -5501,7 +5495,7 @@ class Item_ref :public Item_ident
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);
@ -5563,7 +5557,10 @@ class Item_ref :public Item_ident
return Item_ident::build_equal_items(thd, inherited, link_item_fields,
cond_equal_ref);
}
bool const_item() const override { return (*ref)->const_item(); }
bool const_item() const override
{
return (*ref)->const_item();
}
table_map not_null_tables() const override
{
return depended_from ? 0 : (*ref)->not_null_tables();
@ -5576,7 +5573,10 @@ class Item_ref :public Item_ident
{
(*ref)->save_in_field(result_field, no_conversions);
}
Item *real_item() override { return ref ? (*ref)->real_item() : this; }
Item *real_item() override
{
return ref ? (*ref)->real_item() : this;
}
const TYPELIB *get_typelib() const override
{
return ref ? (*ref)->get_typelib() : NULL;
@ -5821,13 +5821,10 @@ class Item_cache_wrapper :public Item_result_field
Type type() const override { return EXPR_CACHE_ITEM; }
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) override;
void cleanup() override;
Item *get_orig_item() const { return orig_item; }
/* Methods of getting value which should be cached in the cache */
@ -5868,8 +5865,12 @@ class Item_cache_wrapper :public Item_result_field
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(); }
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 override { return orig_item->const_item(); }
table_map not_null_tables() const override
{ return orig_item->not_null_tables(); }
@ -5979,7 +5980,7 @@ class Item_direct_view_ref :public Item_direct_ref
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; }
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) override
{
@ -6344,7 +6345,6 @@ class Item_copy :public Item,
Override the methods below as pure virtual to make sure all the
sub-classes implement them.
*/
String *val_str(String*) override = 0;
my_decimal *val_decimal(my_decimal *) override = 0;
double val_real() override = 0;
@ -6610,13 +6610,11 @@ class Item_default_value : public Item_field
Item_field *field_for_view_update() override { return nullptr; }
bool update_vcol_processor(void *) override { return false; }
bool check_func_default_processor(void *) override { return true; }
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)
override;
Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
@ -6981,7 +6979,8 @@ class Item_cache: public Item,
{
if (example)
{
Item::vcol_func_processor_result *res= (Item::vcol_func_processor_result*)arg;
Item::vcol_func_processor_result *res=
(Item::vcol_func_processor_result*) arg;
example->check_vcol_func_processor(arg);
/*
Item_cache of a non-deterministic function requires re-fixing
@ -7293,8 +7292,8 @@ class Item_cache_double: public Item_cache_real
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<Item_cache_double>(thd, this); }
};
@ -7305,8 +7304,8 @@ class Item_cache_float: public Item_cache_real
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<Item_cache_float>(thd, this); }
};
@ -7370,7 +7369,7 @@ class Item_cache_str_for_nullif: public Item_cache_str
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
@ -7384,7 +7383,7 @@ class Item_cache_str_for_nullif: public Item_cache_str
*/
return Item::safe_charset_converter(thd, tocs);
}
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_cache_str_for_nullif>(thd, this); }
};
@ -7537,7 +7536,6 @@ class Item_type_holder: public Item,
*this, table);
}
Item* get_copy(THD *) override { return nullptr; }
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -42,8 +42,9 @@ class Item_geometry_func: public Item_str_func
Item_geometry_func(THD *thd, Item *a, Item *b, Item *c):
Item_str_func(thd, a, b, c) {}
Item_geometry_func(THD *thd, List<Item> &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 @@ class Item_real_func_args_geometry: public Item_real_func
*/
class Item_long_func_args_geometry: public Item_long_func
{
bool check_arguments() const
bool check_arguments() const override
{
DBUG_ASSERT(arg_count == 1);
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 @@ class Item_bool_func_args_geometry: public Item_bool_func
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 @@ class Item_str_ascii_func_args_geometry: public Item_str_ascii_func
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 @@ class Item_binary_func_args_geometry: public Item_str_func
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 @@ class Item_geometry_func_args_geometry: public Item_geometry_func
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 @@ class Item_bool_func_args_geometry_geometry: public Item_bool_func
class Item_func_geometry_from_text: public Item_geometry_func
{
bool check_arguments() const
bool check_arguments() const override
{
return args[0]->check_type_general_purpose_string(func_name_cstring()) ||
check_argument_types_can_return_int(1, MY_MIN(2, arg_count));
@ -217,14 +218,14 @@ class Item_func_geometry_from_text: public Item_geometry_func
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<Item_func_geometry_from_text>(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 @@ class Item_func_geometry_from_wkb: public Item_geometry_func
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<Item_func_geometry_from_wkb>(thd, this); }
};
@ -248,7 +249,7 @@ class Item_func_geometry_from_wkb: public Item_geometry_func
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 @@ class Item_func_geometry_from_json: public Item_geometry_func
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<Item_func_geometry_from_json>(thd, this); }
};
@ -281,9 +282,9 @@ class Item_func_as_wkt: public Item_str_ascii_func_args_geometry
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<Item_func_as_wkt>(thd, this); }
};
@ -297,9 +298,10 @@ class Item_func_as_wkb: public Item_binary_func_args_geometry
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 @@ class Item_func_as_wkb: public Item_binary_func_args_geometry
set_maybe_null();
return FALSE;
}
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_as_wkb>(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 @@ class Item_func_as_geojson: public Item_str_ascii_func_args_geometry
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<Item_func_as_geojson>(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<Item_func_geometry_type>(thd, this); }
};
@ -395,8 +397,8 @@ class Item_func_convexhull: public Item_geometry_func_args_geometry
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<Item_func_convexhull>(thd, this); }
};
@ -411,12 +413,12 @@ class Item_func_centroid: public Item_geometry_func_args_geometry
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<Item_func_centroid>(thd, this); }
};
@ -430,12 +432,12 @@ class Item_func_envelope: public Item_geometry_func_args_geometry
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<Item_func_envelope>(thd, this); }
};
@ -472,15 +474,15 @@ class Item_func_boundary: public Item_geometry_func_args_geometry
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<Item_func_boundary>(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 @@ class Item_func_point: public Item_geometry_func
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<Item_func_point>(thd, this); }
};
@ -524,15 +526,15 @@ class Item_func_spatial_decomp: public Item_geometry_func_args_geometry
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<Item_func_spatial_decomp>(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 @@ class Item_func_spatial_decomp_n: public Item_geometry_func_args_geometry
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<Item_func_spatial_decomp_n>(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 @@ class Item_func_spatial_collection: public Item_geometry_func
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 @@ class Item_func_geometrycollection: public Item_func_spatial_collection
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 @@ class Item_func_geometrycollection: public Item_func_spatial_collection
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<Item_func_geometrycollection>(thd, this); }
};
@ -635,13 +637,14 @@ class Item_func_linestring: public Item_func_spatial_collection
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<Item_func_linestring>(thd, this); }
};
@ -654,13 +657,14 @@ class Item_func_polygon: public Item_func_spatial_collection
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<Item_func_polygon>(thd, this); }
};
@ -673,7 +677,7 @@ class Item_func_multilinestring: public Item_func_spatial_collection
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 @@ class Item_func_multilinestring: public Item_func_spatial_collection
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<Item_func_multilinestring>(thd, this); }
};
@ -695,7 +699,7 @@ class Item_func_multipoint: public Item_func_spatial_collection
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 @@ class Item_func_multipoint: public Item_func_spatial_collection
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<Item_func_multipoint>(thd, this); }
};
@ -717,7 +721,7 @@ class Item_func_multipolygon: public Item_func_spatial_collection
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 @@ class Item_func_multipolygon: public Item_func_spatial_collection
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<Item_func_multipolygon>(thd, this); }
};
@ -743,8 +747,8 @@ class Item_func_spatial_rel: public Item_bool_func2_with_rev
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 @@ class Item_func_spatial_rel: public Item_bool_func2_with_rev
{
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 @@ class Item_func_spatial_rel: public Item_bool_func2_with_rev
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 @@ class Item_func_spatial_mbr_rel: public Item_func_spatial_rel
Item_func_spatial_mbr_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
Item_func_spatial_rel(thd, a, b, sp_rel)
{ }
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<Item_func_spatial_mbr_rel>(thd, this); }
};
@ -804,9 +808,9 @@ class Item_func_spatial_precise_rel: public Item_func_spatial_rel
Item_func_spatial_precise_rel(THD *thd, Item *a, Item *b, enum Functype sp_rel):
Item_func_spatial_rel(thd, a, b, sp_rel), collector()
{ }
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<Item_func_spatial_precise_rel>(thd, this); }
};
@ -817,7 +821,7 @@ class Item_func_spatial_relate: public Item_bool_func_args_geometry_geometry
Gcalc_scan_iterator scan_it;
Gcalc_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 @@ class Item_func_spatial_relate: public Item_bool_func_args_geometry_geometry
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<Item_func_spatial_relate>(thd, this); }
};
@ -842,9 +846,9 @@ class Item_func_spatial_relate: public Item_bool_func_args_geometry_geometry
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 @@ class Item_func_spatial_operation: public Item_geometry_func
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<Item_func_spatial_operation>(thd, this); }
};
class Item_func_buffer: public Item_geometry_func_args_geometry
class Item_func_buffer final : public Item_geometry_func_args_geometry
{
bool check_arguments() const
bool check_arguments() const override
{
return Item_geometry_func_args_geometry::check_arguments() ||
args[1]->check_type_can_return_real(func_name_cstring());
@ -930,8 +934,8 @@ class Item_func_buffer: public Item_geometry_func_args_geometry
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<Item_func_buffer>(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; }
bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; }
decimal_digits_t decimal_precision() const override { return 1; }
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_issimple>(thd, this); }
};
@ -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; }
bool fix_length_and_dec() override { decimals=0; max_length=2; return FALSE; }
decimal_digits_t decimal_precision() const override { return 1; }
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_isclosed>(thd, this); }
};
@ -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<Item_func_isring>(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<Item_func_x>(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<Item_func_y>(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<Item_func_area>(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<Item_func_glength>(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<Item_func_distance>(thd, this); }
};
@ -1214,13 +1218,13 @@ class Item_func_sphere_distance: public Item_real_func
public:
Item_func_sphere_distance(THD *thd, List<Item> &list):
Item_real_func(thd, list) {}
double val_real();
double val_real() override;
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("st_distance_sphere") };
return name;
}
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_sphere_distance>(thd, this); }
};
@ -1239,12 +1243,12 @@ class Item_func_pointonsurface: public Item_geometry_func_args_geometry
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<Item_func_pointonsurface>(thd, this); }
};
@ -1255,18 +1259,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<Item_func_gis_debug>(thd, this); }
};
#endif

View File

@ -82,13 +82,13 @@ class Item_func_json_valid: public Item_bool_func
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;
@ -96,13 +96,14 @@ class Item_func_json_valid: public Item_bool_func
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<Item_func_json_valid>(thd, this); }
enum Functype functype() const { return JSON_VALID_FUNC; }
enum Functype functype() const override { return JSON_VALID_FUNC; }
};
@ -120,10 +121,10 @@ class Item_func_json_exists: public Item_bool_func
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<Item_func_json_exists>(thd, this); }
longlong val_int();
longlong val_int() override;
};
@ -217,9 +218,9 @@ class Item_func_json_quote: public Item_str_func
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<Item_func_json_quote>(thd, this); }
};
@ -236,9 +237,9 @@ class Item_func_json_unquote: public Item_str_func
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<Item_func_json_unquote>(thd, this); }
};
@ -271,14 +272,14 @@ class Item_func_json_extract: public Item_json_str_multipath
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<Item_func_json_extract>(thd, this); }
};
@ -299,9 +300,9 @@ class Item_func_json_contains: public Item_bool_func
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<Item_func_json_contains>(thd, this); }
};
@ -324,11 +325,11 @@ class Item_func_json_contains_path: public Item_bool_func
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<Item_func_json_contains_path>(thd, this); }
};
@ -343,14 +344,14 @@ class Item_func_json_array: public Item_json_func
Item_json_func(thd) {}
Item_func_json_array(THD *thd, List<Item> &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<Item_func_json_array>(thd, this); }
};
@ -363,15 +364,15 @@ class Item_func_json_array_append: public Item_json_str_multipath
public:
Item_func_json_array_append(THD *thd, List<Item> &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<Item_func_json_array_append>(thd, this); }
};
@ -381,13 +382,13 @@ class Item_func_json_array_insert: public Item_func_json_array_append
public:
Item_func_json_array_insert(THD *thd, List<Item> &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<Item_func_json_array_insert>(thd, this); }
};
@ -399,13 +400,13 @@ class Item_func_json_object: public Item_func_json_array
Item_func_json_array(thd) {}
Item_func_json_object(THD *thd, List<Item> &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<Item_func_json_object>(thd, this); }
};
@ -417,13 +418,13 @@ class Item_func_json_merge: public Item_func_json_array
public:
Item_func_json_merge(THD *thd, List<Item> &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<Item_func_json_merge>(thd, this); }
};
@ -437,14 +438,14 @@ class Item_func_json_merge_patch: public Item_func_json_merge
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<Item_func_json_merge_patch>(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 &&
@ -462,16 +463,16 @@ class Item_func_json_length: public Item_long_func
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<Item_func_json_length>(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;
@ -482,9 +483,9 @@ class Item_func_json_depth: public Item_long_func
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<Item_func_json_depth>(thd, this); }
};
@ -500,9 +501,9 @@ class Item_func_json_type: public Item_str_func
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<Item_func_json_type>(thd, this); }
};
@ -517,9 +518,9 @@ class Item_func_json_insert: public Item_json_str_multipath
Item_func_json_insert(bool i_mode, bool r_mode, THD *thd, List<Item> &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") };
@ -528,7 +529,7 @@ class Item_func_json_insert: public Item_json_str_multipath
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<Item_func_json_insert>(thd, this); }
};
@ -540,15 +541,15 @@ class Item_func_json_remove: public Item_json_str_multipath
public:
Item_func_json_remove(THD *thd, List<Item> &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<Item_func_json_remove>(thd, this); }
};
@ -567,9 +568,9 @@ class Item_func_json_keys: public Item_str_func
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<Item_func_json_keys>(thd, this); }
};
@ -594,11 +595,11 @@ class Item_func_json_search: public Item_json_str_multipath
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<Item_func_json_search>(thd, this); }
};
@ -623,10 +624,10 @@ class Item_func_json_format: public Item_json_func
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<Item_func_json_format>(thd, this); }
};
@ -638,12 +639,12 @@ class Item_func_json_arrayagg : public Item_func_group_concat
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,
@ -655,18 +656,18 @@ class Item_func_json_arrayagg : public Item_func_group_concat
{
}
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<Item_func_json_arrayagg>(thd, this); }
};
@ -683,44 +684,44 @@ class Item_func_json_objectagg : public Item_sum
}
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<Item_func_json_objectagg>(thd, this); }
};

View File

@ -54,101 +54,103 @@ class Item_row: public Item_fixed_hybrid,
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<Item> &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<Item> &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<Item_row>(thd, this); }
Item *build_clone(THD *thd);
Item *build_clone(THD *thd) override;
};
#endif /* ITEM_ROW_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@ -304,29 +304,30 @@ class Item_singlerow_subselect :public Item_subselect
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<Item*>(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<Item*>(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
@ -342,7 +343,7 @@ class Item_singlerow_subselect :public Item_subselect
*/
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;
};
@ -357,12 +358,12 @@ class Item_maxmin_subselect :public Item_singlerow_subselect
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 */

View File

@ -411,7 +411,7 @@ class Item_sum :public Item_func_or_sum
Item_sum(THD *thd, List<Item> &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 @@ class Item_sum :public Item_func_or_sum
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 @@ class Item_sum :public Item_func_or_sum
}
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 @@ class Item_sum :public Item_func_or_sum
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 @@ class Item_sum :public Item_func_or_sum
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 @@ class Item_sum :public Item_func_or_sum
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 @@ class Item_sum :public Item_func_or_sum
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 @@ class Item_sum :public Item_func_or_sum
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 @@ class Item_sum_double :public Item_sum_num
Item_sum_double(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {}
Item_sum_double(THD *thd, List<Item> &list): Item_sum_num(thd, list) {}
Item_sum_double(THD *thd, 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 @@ class Item_sum_int :public Item_sum_num
Item_sum_int(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {}
Item_sum_int(THD *thd, List<Item> &list): Item_sum_num(thd, list) {}
Item_sum_int(THD *thd, 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 @@ class Item_sum_sum :public Item_sum_num,
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 @@ class Item_sum_sum :public Item_sum_num,
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<Item_sum_sum>(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 @@ class Item_sum_count :public Item_sum_int
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 @@ class Item_sum_count :public Item_sum_int
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<Item_sum_count>(thd, this); }
bool supports_removal() const
bool supports_removal() const override
{
return true;
}
@ -948,40 +950,40 @@ class Item_sum_avg :public Item_sum_sum
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<Item_sum_avg>(thd, this); }
bool supports_removal() const
bool supports_removal() const override
{
return true;
}
@ -1113,7 +1115,7 @@ class Item_sum_hybrid : public Item_sum,
: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 @@ class Item_sum_min_max :public Item_sum_hybrid
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<Item_sum_min>(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<Item_sum_max>(thd, this); }
};
@ -1230,13 +1233,14 @@ class Item_sum_bit :public Item_sum_int
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 @@ class Item_sum_bit :public Item_sum_int
null_value= 0;
return FALSE;
}
void cleanup()
void cleanup() override
{
bits= reset_bits;
if (as_window_function)
@ -1254,11 +1258,12 @@ class Item_sum_bit :public Item_sum_int
}
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 @@ class Item_sum_bit :public Item_sum_int
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<Item_sum_or>(thd, this); }
private:
void set_bits_from_counters();
void set_bits_from_counters() override;
};
@ -1318,18 +1323,18 @@ class Item_sum_and final :public Item_sum_bit
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<Item_sum_and>(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<Item_sum_xor>(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 @@ class Item_sum_sp final :public Item_sum,
sp_head *sp, List<Item> &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 @@ class Item_sum_sp final :public Item_sum,
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 @@ class Item_sum_sp final :public Item_sum,
{
return sp_result_field;
}
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_sp>(thd, this); }
Item *copy_or_same(THD *thd);
Item *copy_or_same(THD *thd) override;
};
/* Items to get the value of a stored sum function */
@ -1509,18 +1514,18 @@ class Item_sum_field :public Item
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 @@ class Item_avg_field :public Item_sum_field
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 @@ class Item_avg_field_double :public Item_avg_field
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<Item_avg_field_double>(thd, this); }
};
@ -1566,21 +1574,22 @@ class Item_avg_field_decimal :public Item_avg_field
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<Item_avg_field_decimal>(thd, this); }
};
@ -1592,16 +1601,17 @@ class Item_variance_field :public Item_sum_field
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<Item_variance_field>(thd, this); }
};
@ -1612,9 +1622,9 @@ class Item_std_field :public Item_variance_field
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<Item_std_field>(thd, this); }
};
@ -1645,7 +1655,7 @@ class Item_udf_sum : public Item_sum
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 @@ class Item_udf_sum : public Item_sum
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<Item_sum_udf_float>(thd, this); }
};
@ -1725,20 +1737,20 @@ class Item_sum_udf_int :public Item_udf_sum
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<Item_sum_udf_int>(thd, this); }
};
@ -1752,8 +1764,8 @@ class Item_sum_udf_str :public Item_udf_sum
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 @@ class Item_sum_udf_str :public Item_udf_sum
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 @@ class Item_sum_udf_str :public Item_udf_sum
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<Item_sum_udf_str>(thd, this); }
};
@ -1793,23 +1806,25 @@ class Item_sum_udf_decimal :public Item_udf_sum
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<Item_sum_udf_decimal>(thd, this); }
};
@ -2008,31 +2023,31 @@ class Item_func_group_concat : public Item_sum
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 @@ class Item_func_group_concat : public Item_sum
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 @@ class Item_func_group_concat : public Item_sum
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<Item_func_group_concat>(thd, this); }
qsort_cmp2 get_comparator_function_for_distinct();
qsort_cmp2 get_comparator_function_for_order_by();

File diff suppressed because it is too large Load Diff

View File

@ -33,12 +33,9 @@ class Item_func_history: public Item_bool_func
DBUG_ASSERT(a->type() == Item::FIELD_ITEM);
}
virtual bool val_bool();
virtual longlong val_int()
{
return (val_bool() ? 1 : 0);
}
bool fix_length_and_dec()
bool val_bool() override;
longlong val_int() override { return val_bool(); }
bool fix_length_and_dec() override
{
set_maybe_null();
null_value= 0;
@ -46,13 +43,13 @@ class Item_func_history: public Item_bool_func
max_length= 1;
return FALSE;
}
virtual LEX_CSTRING func_name_cstring() const override
LEX_CSTRING func_name_cstring() const override
{
static LEX_CSTRING name= {STRING_WITH_LEN("is_history") };
return name;
}
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<Item_func_history>(thd, this); }
};
@ -67,10 +64,10 @@ class Item_func_trt_ts: public Item_datetimefunc
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<Item_func_trt_ts>(thd, this); }
bool fix_length_and_dec()
bool fix_length_and_dec() override
{ fix_attributes_datetime(decimals); return FALSE; }
};
@ -105,15 +102,15 @@ class Item_func_trt_id : public Item_longlong_func
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<Item_func_trt_id>(thd, this); }
};
@ -129,8 +126,8 @@ class Item_func_trt_trx_sees : public Item_bool_func
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<Item_func_trt_trx_sees>(thd, this); }
};

View File

@ -118,28 +118,29 @@ class Item_sum_row_number: public Item_sum_int
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 @@ class Item_sum_row_number: public Item_sum_int
return name;
}
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_row_number>(thd, this); }
};
@ -182,26 +183,27 @@ class Item_sum_rank: public Item_sum_int
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 @@ class Item_sum_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)
{
@ -223,7 +225,7 @@ class Item_sum_rank: public Item_sum_int
}
Item_sum_int::cleanup();
}
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_sum_rank>(thd, this); }
};
@ -257,23 +259,24 @@ class Item_sum_dense_rank: public Item_sum_int
XXX(cvicentiu) This class could potentially be implemented in the rank
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<Item_sum_dense_rank>(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<Item_sum_first_value>(thd, this); }
};
@ -375,7 +378,7 @@ class Item_sum_last_value : public Item_sum_hybrid_simple
Item_sum_last_value(THD* thd, Item* arg_expr) :
Item_sum_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<Item_sum_last_value>(thd, this); }
};
@ -397,7 +400,7 @@ class Item_sum_nth_value : public Item_sum_hybrid_simple
Item_sum_nth_value(THD *thd, Item *arg_expr, Item* offset_expr) :
Item_sum_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<Item_sum_nth_value>(thd, this); }
};
@ -419,7 +422,7 @@ class Item_sum_lead : public Item_sum_hybrid_simple
Item_sum_lead(THD *thd, Item *arg_expr, Item* offset_expr) :
Item_sum_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<Item_sum_lead>(thd, this); }
};
@ -441,7 +444,7 @@ class Item_sum_lag : public Item_sum_hybrid_simple
Item_sum_lag(THD *thd, Item *arg_expr, Item* offset_expr) :
Item_sum_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<Item_sum_lag>(thd, this); }
};
@ -506,7 +509,7 @@ class Item_sum_percent_rank: public Item_sum_double,
Item_sum_percent_rank(THD *thd)
: Item_sum_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<double>(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<Item_sum_percent_rank>(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<Item_sum_cume_dist>(thd, this); }
};
@ -667,7 +672,7 @@ class Item_sum_ntile : public Item_sum_int,
Item_sum_int(thd, num_quantiles_expr), n_old_val_(0)
{ }
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<Item_sum_ntile>(thd, this); }
private:
@ -748,7 +754,7 @@ class Item_sum_percentile_disc : public Item_sum_num,
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 @@ class Item_sum_percentile_disc : public Item_sum_num,
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 @@ class Item_sum_percentile_disc : public Item_sum_num,
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 @@ class Item_sum_percentile_disc : public Item_sum_num,
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 @@ class Item_sum_percentile_disc : public Item_sum_num,
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 @@ class Item_sum_percentile_disc : public Item_sum_num,
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 @@ class Item_sum_percentile_disc : public Item_sum_num,
return value->val_native(thd, to);
}
bool add()
bool add() override
{
Item *arg= get_arg(0);
if (arg->is_null())
@ -855,12 +861,12 @@ class Item_sum_percentile_disc : public Item_sum_num,
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 @@ class Item_sum_percentile_disc : public Item_sum_num,
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<Item_sum_percentile_disc>(thd, this); }
void setup_window_func(THD *thd, Window_spec *window_spec);
void setup_window_func(THD *thd, Window_spec *window_spec) override;
void setup_hybrid(THD *thd, Item *item);
bool fix_fields(THD *thd, Item **ref);
bool fix_fields(THD *thd, Item **ref) override;
private:
Item_cache *value;
@ -916,7 +922,7 @@ class Item_sum_percentile_cont : public Item_sum_double,
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 @@ class Item_sum_percentile_cont : public Item_sum_double,
return ret_val;
}
bool add()
bool add() override
{
Item *arg= get_arg(0);
if (arg->is_null())
@ -993,12 +999,12 @@ class Item_sum_percentile_cont : public Item_sum_double,
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 @@ class Item_sum_percentile_cont : public Item_sum_double,
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<Item_sum_percentile_cont>(thd, this); }
void setup_window_func(THD *thd, Window_spec *window_spec);
void setup_window_func(THD *thd, Window_spec *window_spec) override;
void setup_hybrid(THD *thd, Item *item);
bool fix_fields(THD *thd, Item **ref);
bool fix_fields(THD *thd, Item **ref) override;
private:
Item_cache *floor_value;
@ -1072,7 +1078,7 @@ class Item_window_func : public Item_func_or_sum
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 @@ class Item_window_func : public Item_func_or_sum
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 @@ class Item_window_func : public Item_func_or_sum
*/
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 @@ class Item_window_func : public Item_func_or_sum
read_value_from_result_field= true;
}
bool is_null()
bool is_null() override
{
if (force_return_blank)
return true;
@ -1244,7 +1250,7 @@ class Item_window_func : public Item_func_or_sum
return window_func()->is_null();
}
double val_real()
double val_real() override
{
double res;
if (force_return_blank)
@ -1265,7 +1271,7 @@ class Item_window_func : public Item_func_or_sum
return res;
}
longlong val_int()
longlong val_int() override
{
longlong res;
if (force_return_blank)
@ -1286,7 +1292,7 @@ class Item_window_func : public Item_func_or_sum
return res;
}
String* val_str(String* str)
String* val_str(String* str) override
{
String *res;
if (force_return_blank)
@ -1309,7 +1315,7 @@ class Item_window_func : public Item_func_or_sum
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 @@ class Item_window_func : public Item_func_or_sum
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 @@ class Item_window_func : public Item_func_or_sum
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 @@ class Item_window_func : public Item_func_or_sum
}
void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
List<Item> &fields, uint flags);
List<Item> &fields, uint flags) override;
bool fix_length_and_dec()
bool fix_length_and_dec() override
{
Type_std_attributes::set(window_func());
return FALSE;
@ -1379,13 +1385,13 @@ class Item_window_func : public Item_func_or_sum
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; }
};

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2005, 2019, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB
Copyright (c) 2009, 2021, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -141,21 +141,21 @@ class Item_nodeset_func :public Item_str_func
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 @@ class Item_nodeset_func :public Item_str_func
}
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 @@ class Item_nodeset_func :public Item_str_func
{
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 @@ class Item_nodeset_func_rootelement :public Item_nodeset_func
{
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<Item_nodeset_func_rootelement>(thd, this); }
};
@ -236,8 +236,8 @@ class Item_nodeset_func_union :public Item_nodeset_func
{
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<Item_nodeset_func_union>(thd, this); }
};
@ -276,8 +276,8 @@ class Item_nodeset_func_selfbyname: public Item_nodeset_func_axisbyname
{
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<Item_nodeset_func_selfbyname>(thd, this); }
};
@ -293,8 +293,8 @@ class Item_nodeset_func_childbyname: public Item_nodeset_func_axisbyname
{
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<Item_nodeset_func_childbyname>(thd, this); }
};
@ -312,8 +312,8 @@ class Item_nodeset_func_descendantbyname: public Item_nodeset_func_axisbyname
{
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<Item_nodeset_func_descendantbyname>(thd, this); }
};
@ -331,8 +331,8 @@ class Item_nodeset_func_ancestorbyname: public Item_nodeset_func_axisbyname
{
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<Item_nodeset_func_ancestorbyname>(thd, this); }
};
@ -349,8 +349,8 @@ class Item_nodeset_func_parentbyname: public Item_nodeset_func_axisbyname
{
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<Item_nodeset_func_parentbyname>(thd, this); }
};
@ -366,8 +366,8 @@ class Item_nodeset_func_attributebyname: public Item_nodeset_func_axisbyname
{
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<Item_nodeset_func_attributebyname>(thd, this); }
};
@ -386,8 +386,8 @@ class Item_nodeset_func_predicate :public Item_nodeset_func
{
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<Item_nodeset_func_predicate>(thd, this); }
};
@ -402,8 +402,8 @@ class Item_nodeset_func_elementbyindex :public Item_nodeset_func
{
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<Item_nodeset_func_elementbyindex>(thd, this); }
};
@ -425,7 +425,7 @@ class Item_xpath_cast_bool :public Item_bool_func
{
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 @@ class Item_xpath_cast_bool :public Item_bool_func
}
return args[0]->val_real() ? 1 : 0;
}
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_xpath_cast_bool>(thd, this); }
};
@ -450,8 +450,8 @@ class Item_xpath_cast_number :public Item_real_func
{
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<Item_xpath_cast_number>(thd, this); }
};
@ -465,12 +465,13 @@ class Item_nodeset_context_cache :public Item_nodeset_func
Native *native_cache;
Item_nodeset_context_cache(THD *thd, Native *native_arg, String *pxml):
Item_nodeset_func(thd, pxml), native_cache(native_arg) { }
bool val_native(THD *thd, Native *nodeset)
bool val_native(THD *, Native *nodeset) override
{
return nodeset->copy(*native_cache);
}
bool fix_length_and_dec() { max_length= MAX_BLOB_WIDTH;; return FALSE; }
Item *get_copy(THD *thd)
bool fix_length_and_dec() override
{ max_length= MAX_BLOB_WIDTH; return FALSE; }
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_context_cache>(thd, this); }
};
@ -486,15 +487,15 @@ class Item_func_xpath_position :public Item_long_func
{
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<Item_func_xpath_position>(thd, this); }
};
@ -510,8 +511,8 @@ class Item_func_xpath_count :public Item_long_func
{
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 +521,7 @@ class Item_func_xpath_count :public Item_long_func
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<Item_func_xpath_count>(thd, this); }
};
@ -537,7 +538,7 @@ class Item_func_xpath_sum :public Item_real_func
{
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 +569,7 @@ class Item_func_xpath_sum :public Item_real_func
}
return sum;
}
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_func_xpath_sum>(thd, this); }
};
@ -612,17 +613,17 @@ class Item_nodeset_to_const_comparator :public Item_bool_func
{
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 +654,7 @@ class Item_nodeset_to_const_comparator :public Item_bool_func
}
return 0;
}
Item *get_copy(THD *thd)
Item *get_copy(THD *thd) override
{ return get_item_copy<Item_nodeset_to_const_comparator>(thd, this); }
};

View File

@ -117,9 +117,9 @@ class Item_xml_str_func: public Item_str_func
{
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 @@ class Item_func_xml_extractvalue: public Item_xml_str_func
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<Item_func_xml_extractvalue>(thd, this); }
};
@ -157,8 +157,8 @@ class Item_func_xml_update: public Item_xml_str_func
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<Item_func_xml_update>(thd, this); }
};

View File

@ -44,9 +44,9 @@ class Item_proc :public Item
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 @@ class Item_proc :public Item
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 @@ class Item_proc_real :public Item_proc
{
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 @@ class Item_proc_string :public Item_proc
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);}
};

View File

@ -60,7 +60,8 @@ class sp_variable : public Sql_alloc
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)

View File

@ -6985,7 +6985,8 @@ class my_var_sp: public my_var {
~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;
};

View File

@ -1960,8 +1960,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)
{
@ -1970,7 +1970,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 *old_map= dbug_tmp_use_all_columns(table,
@ -2013,11 +2013,11 @@ class store_key_item :public store_key
{}
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 *old_map= dbug_tmp_use_all_columns(table,
@ -2066,12 +2066,12 @@ class store_key_const_item :public store_key_item
: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)

View File

@ -54,12 +54,12 @@ class ha_s3 final :public ha_maria
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);