MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
item_inetfunc.h
1
#ifndef ITEM_INETFUNC_INCLUDED
2
#define ITEM_INETFUNC_INCLUDED
3
4
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
5
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; version 2 of the License.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
18
19
20
#include "item.h"
21
22
/*************************************************************************
23
Item_func_inet_aton implements INET_ATON() SQL-function.
24
*************************************************************************/
25
26
class
Item_func_inet_aton
:
public
Item_int_func
27
{
28
public
:
29
inline
Item_func_inet_aton
(
Item
*arg)
30
:
Item_int_func
(arg)
31
{}
32
33
public
:
34
virtual
longlong val_int();
35
36
virtual
const
char
*func_name()
const
37
{
return
"inet_aton"
; }
38
39
virtual
void
fix_length_and_dec()
40
{
41
decimals= 0;
42
max_length= 21;
43
maybe_null= 1;
44
unsigned_flag= 1;
45
}
46
};
47
48
49
/*************************************************************************
50
Item_func_inet_ntoa implements INET_NTOA() SQL-function.
51
*************************************************************************/
52
53
class
Item_func_inet_ntoa
:
public
Item_str_func
54
{
55
public
:
56
inline
Item_func_inet_ntoa
(
Item
*arg)
57
:
Item_str_func
(arg)
58
{ }
59
60
public
:
61
virtual
String
* val_str(
String
* str);
62
63
virtual
const
char
*func_name()
const
64
{
return
"inet_ntoa"
; }
65
66
virtual
void
fix_length_and_dec()
67
{
68
decimals= 0;
69
fix_length_and_charset(3 * 8 + 7, default_charset());
70
maybe_null= 1;
71
}
72
};
73
74
75
/*************************************************************************
76
Item_func_inet_bool_base implements common code for INET6/IP-related
77
functions returning boolean value.
78
*************************************************************************/
79
80
class
Item_func_inet_bool_base
:
public
Item_bool_func
81
{
82
public
:
83
inline
Item_func_inet_bool_base
(
Item
*ip_addr)
84
:
Item_bool_func
(ip_addr)
85
{
86
null_value=
false
;
87
}
88
89
public
:
90
virtual
longlong
val_int
();
91
92
protected
:
93
virtual
bool
calc_value(
const
String
*arg) = 0;
94
};
95
96
97
/*************************************************************************
98
Item_func_inet_str_base implements common code for INET6/IP-related
99
functions returning string value.
100
*************************************************************************/
101
102
class
Item_func_inet_str_base
:
public
Item_str_ascii_func
103
{
104
public
:
105
inline
Item_func_inet_str_base
(
Item
*arg)
106
:
Item_str_ascii_func
(arg)
107
{ }
108
109
public
:
110
virtual
String
*
val_str_ascii
(
String
*buffer);
111
112
protected
:
113
virtual
bool
calc_value(
String
*arg,
String
*buffer) = 0;
114
};
115
116
117
/*************************************************************************
118
Item_func_inet6_aton implements INET6_ATON() SQL-function.
119
*************************************************************************/
120
121
class
Item_func_inet6_aton
:
public
Item_func_inet_str_base
122
{
123
public
:
124
inline
Item_func_inet6_aton
(
Item
*ip_addr)
125
:
Item_func_inet_str_base
(ip_addr)
126
{ }
127
128
public
:
129
virtual
const
char
*func_name()
const
130
{
return
"inet6_aton"
; }
131
132
virtual
void
fix_length_and_dec()
133
{
134
decimals= 0;
135
fix_length_and_charset(16, &my_charset_bin);
136
maybe_null= 1;
137
}
138
139
protected
:
140
virtual
bool
calc_value
(
String
*arg,
String
*buffer);
141
};
142
143
144
/*************************************************************************
145
Item_func_inet6_ntoa implements INET6_NTOA() SQL-function.
146
*************************************************************************/
147
148
class
Item_func_inet6_ntoa
:
public
Item_func_inet_str_base
149
{
150
public
:
151
inline
Item_func_inet6_ntoa
(
Item
*ip_addr)
152
:
Item_func_inet_str_base
(ip_addr)
153
{ }
154
155
public
:
156
virtual
const
char
*func_name()
const
157
{
return
"inet6_ntoa"
; }
158
159
virtual
void
fix_length_and_dec()
160
{
161
decimals= 0;
162
163
// max length: IPv6-address -- 16 bytes
164
// 16 bytes / 2 bytes per group == 8 groups => 7 delimiter
165
// 4 symbols per group
166
fix_length_and_charset(8 * 4 + 7, default_charset());
167
168
maybe_null= 1;
169
}
170
171
protected
:
172
virtual
bool
calc_value
(
String
*arg,
String
*buffer);
173
};
174
175
176
/*************************************************************************
177
Item_func_is_ipv4 implements IS_IPV4() SQL-function.
178
*************************************************************************/
179
180
class
Item_func_is_ipv4
:
public
Item_func_inet_bool_base
181
{
182
public
:
183
inline
Item_func_is_ipv4
(
Item
*ip_addr)
184
:
Item_func_inet_bool_base
(ip_addr)
185
{ }
186
187
public
:
188
virtual
const
char
*func_name()
const
189
{
return
"is_ipv4"
; }
190
191
protected
:
192
virtual
bool
calc_value
(
const
String
*arg);
193
};
194
195
196
/*************************************************************************
197
Item_func_is_ipv6 implements IS_IPV6() SQL-function.
198
*************************************************************************/
199
200
class
Item_func_is_ipv6
:
public
Item_func_inet_bool_base
201
{
202
public
:
203
inline
Item_func_is_ipv6
(
Item
*ip_addr)
204
:
Item_func_inet_bool_base
(ip_addr)
205
{ }
206
207
public
:
208
virtual
const
char
*func_name()
const
209
{
return
"is_ipv6"
; }
210
211
protected
:
212
virtual
bool
calc_value
(
const
String
*arg);
213
};
214
215
216
/*************************************************************************
217
Item_func_is_ipv4_compat implements IS_IPV4_COMPAT() SQL-function.
218
*************************************************************************/
219
220
class
Item_func_is_ipv4_compat
:
public
Item_func_inet_bool_base
221
{
222
public
:
223
inline
Item_func_is_ipv4_compat
(
Item
*ip_addr)
224
:
Item_func_inet_bool_base
(ip_addr)
225
{ }
226
227
public
:
228
virtual
const
char
*func_name()
const
229
{
return
"is_ipv4_compat"
; }
230
231
protected
:
232
virtual
bool
calc_value
(
const
String
*arg);
233
};
234
235
236
/*************************************************************************
237
Item_func_is_ipv4_mapped implements IS_IPV4_MAPPED() SQL-function.
238
*************************************************************************/
239
240
class
Item_func_is_ipv4_mapped
:
public
Item_func_inet_bool_base
241
{
242
public
:
243
inline
Item_func_is_ipv4_mapped
(
Item
*ip_addr)
244
:
Item_func_inet_bool_base
(ip_addr)
245
{ }
246
247
public
:
248
virtual
const
char
*func_name()
const
249
{
return
"is_ipv4_mapped"
; }
250
251
protected
:
252
virtual
bool
calc_value
(
const
String
*arg);
253
};
254
255
#endif // ITEM_INETFUNC_INCLUDED
sql
item_inetfunc.h
Generated on Sat Nov 9 2013 01:25:33 for MySQL 5.6.14 Source Code Document by
1.8.1.2