Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
375256ba
Commit
375256ba
authored
Dec 14, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-18010 Add classes Inet4 and Inet6
parent
3b8c868a
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
325 additions
and
261 deletions
+325
-261
sql/item_inetfunc.cc
sql/item_inetfunc.cc
+319
-226
sql/item_inetfunc.h
sql/item_inetfunc.h
+4
-27
sql/sql_type.h
sql/sql_type.h
+2
-8
No files found.
sql/item_inetfunc.cc
View file @
375256ba
This diff is collapsed.
Click to expand it.
sql/item_inetfunc.h
View file @
375256ba
...
@@ -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
sql/sql_type.h
View file @
375256ba
...
@@ -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
;
}
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment