diff options
Diffstat (limited to 'plugin/type_inet/item_inetfunc.h')
-rw-r--r-- | plugin/type_inet/item_inetfunc.h | 105 |
1 files changed, 65 insertions, 40 deletions
diff --git a/plugin/type_inet/item_inetfunc.h b/plugin/type_inet/item_inetfunc.h index 94255426f68..4acb42d2175 100644 --- a/plugin/type_inet/item_inetfunc.h +++ b/plugin/type_inet/item_inetfunc.h @@ -27,21 +27,25 @@ 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(); - const char *func_name() const { return "inet_aton"; } - bool fix_length_and_dec() + 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() override { decimals= 0; max_length= 21; - maybe_null= 1; + set_maybe_null(); 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); } }; @@ -55,16 +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); - const char *func_name() const { return "inet_ntoa"; } - bool fix_length_and_dec() + 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() override { decimals= 0; fix_length_and_charset(3 * 8 + 7, default_charset()); - maybe_null= 1; + 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); } }; @@ -98,20 +106,22 @@ public: { } public: - virtual const char *func_name() const - { return "inet6_aton"; } - - virtual bool fix_length_and_dec() + LEX_CSTRING func_name_cstring() const override + { + static LEX_CSTRING name= {STRING_WITH_LEN("inet6_aton") }; + return name; + } + bool fix_length_and_dec() override { decimals= 0; fix_length_and_charset(16, &my_charset_bin); - maybe_null= 1; + 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; }; @@ -127,10 +137,13 @@ public: { } public: - virtual const char *func_name() const - { return "inet6_ntoa"; } + LEX_CSTRING func_name_cstring() const override + { + static LEX_CSTRING name= {STRING_WITH_LEN("inet6_ntoa") }; + return name; + } - virtual bool fix_length_and_dec() + bool fix_length_and_dec() override { decimals= 0; @@ -139,11 +152,11 @@ public: // 4 symbols per group fix_length_and_charset(8 * 4 + 7, default_charset()); - maybe_null= 1; + 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); } }; @@ -160,12 +173,15 @@ public: { } public: - virtual const char *func_name() const - { return "is_ipv4"; } - Item *get_copy(THD *thd) + LEX_CSTRING func_name_cstring() const override + { + static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4") }; + return name; + } + Item *get_copy(THD *thd) override { return get_item_copy<Item_func_is_ipv4>(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -180,12 +196,15 @@ public: Item_func_inet_bool_base(thd, ip_addr) { } - virtual const char *func_name() const - { return "is_ipv6"; } - Item *get_copy(THD *thd) + LEX_CSTRING func_name_cstring() const override + { + static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv6") }; + return name; + } + Item *get_copy(THD *thd) override { return get_item_copy<Item_func_is_ipv6>(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -199,11 +218,14 @@ public: inline Item_func_is_ipv4_compat(THD *thd, Item *ip_addr): Item_func_inet_bool_base(thd, ip_addr) { } - virtual const char *func_name() const - { return "is_ipv4_compat"; } - Item *get_copy(THD *thd) + LEX_CSTRING func_name_cstring() const override + { + static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_compat") }; + return name; + } + Item *get_copy(THD *thd) override { return get_item_copy<Item_func_is_ipv4_compat>(thd, this); } - longlong val_int(); + longlong val_int() override; }; @@ -217,11 +239,14 @@ public: inline Item_func_is_ipv4_mapped(THD *thd, Item *ip_addr): Item_func_inet_bool_base(thd, ip_addr) { } - virtual const char *func_name() const - { return "is_ipv4_mapped"; } - Item *get_copy(THD *thd) + LEX_CSTRING func_name_cstring() const override + { + static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_mapped") }; + return name; + } + 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 |