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
{
null_value= false;
}
public:
virtual longlong val_int();
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
{ return get_item_copy<Item_func_inet6_aton>(thd, this); }
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
String *val_str_ascii(String *to);
Item *get_copy(THD *thd)
{ 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
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv4>(thd, this); }
protected:
virtual bool calc_value(const String *arg);
longlong val_int();
};
......@@ -192,14 +179,12 @@ class Item_func_is_ipv6 : public Item_func_inet_bool_base
Item_func_inet_bool_base(thd, ip_addr)
{ }
public:
virtual const char *func_name() const
{ return "is_ipv6"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv6>(thd, this); }
protected:
virtual bool calc_value(const String *arg);
longlong val_int();
};
......@@ -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):
Item_func_inet_bool_base(thd, ip_addr)
{ }
public:
virtual const char *func_name() const
{ return "is_ipv4_compat"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv4_compat>(thd, this); }
protected:
virtual bool calc_value(const String *arg);
longlong val_int();
};
......@@ -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):
Item_func_inet_bool_base(thd, ip_addr)
{ }
public:
virtual const char *func_name() const
{ return "is_ipv4_mapped"; }
Item *get_copy(THD *thd)
{ return get_item_copy<Item_func_is_ipv4_mapped>(thd, this); }
protected:
virtual bool calc_value(const String *arg);
longlong val_int();
};
#endif // ITEM_INETFUNC_INCLUDED
......@@ -119,16 +119,10 @@ class String_ptr
:m_string_ptr(str)
{ }
String_ptr(Item *item, String *buffer);
const String *string() const { return m_string_ptr; }
const char *ptr() const
const String *string() const
{
DBUG_ASSERT(m_string_ptr);
return m_string_ptr->ptr();
}
uint32 length() const
{
DBUG_ASSERT(m_string_ptr);
return m_string_ptr->length();
return m_string_ptr;
}
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