Commit 375256ba authored by Alexander Barkov's avatar Alexander Barkov

MDEV-18010 Add classes Inet4 and Inet6

parent 3b8c868a
This diff is collapsed.
...@@ -81,13 +81,7 @@ class Item_func_inet_bool_base : public Item_bool_func ...@@ -81,13 +81,7 @@ class Item_func_inet_bool_base : public Item_bool_func
{ {
null_value= false; null_value= false;
} }
public:
virtual longlong val_int();
bool need_parentheses_in_default() { return false; } bool need_parentheses_in_default() { return false; }
protected:
virtual bool calc_value(const String *arg) = 0;
}; };
...@@ -117,9 +111,6 @@ class Item_func_inet6_aton : public Item_str_func ...@@ -117,9 +111,6 @@ class Item_func_inet6_aton : public Item_str_func
{ return get_item_copy<Item_func_inet6_aton>(thd, this); } { return get_item_copy<Item_func_inet6_aton>(thd, this); }
String *val_str(String *to); String *val_str(String *to);
protected:
bool calc_value(const String *arg, String *buffer);
}; };
...@@ -153,9 +144,6 @@ class Item_func_inet6_ntoa : public Item_str_ascii_func ...@@ -153,9 +144,6 @@ class Item_func_inet6_ntoa : public Item_str_ascii_func
String *val_str_ascii(String *to); String *val_str_ascii(String *to);
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_inet6_ntoa>(thd, this); } { return get_item_copy<Item_func_inet6_ntoa>(thd, this); }
protected:
bool calc_value(const Binary_string *arg, String *buffer);
}; };
...@@ -176,8 +164,7 @@ class Item_func_is_ipv4 : public Item_func_inet_bool_base ...@@ -176,8 +164,7 @@ class Item_func_is_ipv4 : public Item_func_inet_bool_base
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv4>(thd, this); } { return get_item_copy<Item_func_is_ipv4>(thd, this); }
protected: longlong val_int();
virtual bool calc_value(const String *arg);
}; };
...@@ -192,14 +179,12 @@ class Item_func_is_ipv6 : public Item_func_inet_bool_base ...@@ -192,14 +179,12 @@ class Item_func_is_ipv6 : public Item_func_inet_bool_base
Item_func_inet_bool_base(thd, ip_addr) Item_func_inet_bool_base(thd, ip_addr)
{ } { }
public:
virtual const char *func_name() const virtual const char *func_name() const
{ return "is_ipv6"; } { return "is_ipv6"; }
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv6>(thd, this); } { return get_item_copy<Item_func_is_ipv6>(thd, this); }
protected: longlong val_int();
virtual bool calc_value(const String *arg);
}; };
...@@ -213,15 +198,11 @@ class Item_func_is_ipv4_compat : public Item_func_inet_bool_base ...@@ -213,15 +198,11 @@ class Item_func_is_ipv4_compat : public Item_func_inet_bool_base
inline Item_func_is_ipv4_compat(THD *thd, Item *ip_addr): inline Item_func_is_ipv4_compat(THD *thd, Item *ip_addr):
Item_func_inet_bool_base(thd, ip_addr) Item_func_inet_bool_base(thd, ip_addr)
{ } { }
public:
virtual const char *func_name() const virtual const char *func_name() const
{ return "is_ipv4_compat"; } { return "is_ipv4_compat"; }
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv4_compat>(thd, this); } { return get_item_copy<Item_func_is_ipv4_compat>(thd, this); }
longlong val_int();
protected:
virtual bool calc_value(const String *arg);
}; };
...@@ -235,15 +216,11 @@ class Item_func_is_ipv4_mapped : public Item_func_inet_bool_base ...@@ -235,15 +216,11 @@ class Item_func_is_ipv4_mapped : public Item_func_inet_bool_base
inline Item_func_is_ipv4_mapped(THD *thd, Item *ip_addr): inline Item_func_is_ipv4_mapped(THD *thd, Item *ip_addr):
Item_func_inet_bool_base(thd, ip_addr) Item_func_inet_bool_base(thd, ip_addr)
{ } { }
public:
virtual const char *func_name() const virtual const char *func_name() const
{ return "is_ipv4_mapped"; } { return "is_ipv4_mapped"; }
Item *get_copy(THD *thd) Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv4_mapped>(thd, this); } { return get_item_copy<Item_func_is_ipv4_mapped>(thd, this); }
longlong val_int();
protected:
virtual bool calc_value(const String *arg);
}; };
#endif // ITEM_INETFUNC_INCLUDED #endif // ITEM_INETFUNC_INCLUDED
...@@ -119,16 +119,10 @@ class String_ptr ...@@ -119,16 +119,10 @@ class String_ptr
:m_string_ptr(str) :m_string_ptr(str)
{ } { }
String_ptr(Item *item, String *buffer); String_ptr(Item *item, String *buffer);
const String *string() const { return m_string_ptr; } const String *string() const
const char *ptr() const
{ {
DBUG_ASSERT(m_string_ptr); DBUG_ASSERT(m_string_ptr);
return m_string_ptr->ptr(); return m_string_ptr;
}
uint32 length() const
{
DBUG_ASSERT(m_string_ptr);
return m_string_ptr->length();
} }
bool is_null() const { return m_string_ptr == NULL; } bool is_null() const { return m_string_ptr == NULL; }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment