标签:network expr returns ATON address INET addresses
MySQL :: MySQL 8.0 Reference Manual :: 12.24 Miscellaneous Functions https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html#function_inet-aton
-
Given the dotted-quad representation of an IPv4 network address as a string, returns an integer that represents the numeric value of the address in network byte order (big endian).
INET_ATON()
returnsNULL
if it does not understand its argument.mysql> SELECT INET_ATON('10.0.5.9'); -> 167773449
For this example, the return value is calculated as 10×2563 + 0×2562 + 5×256 + 9.
NoteINET_ATON()
may or may not return a non-NULL
result for short-form IP addresses (such as'127.1'
as a representation of'127.0.0.1'
). Because of this,INET_ATON()
a should not be used for such addresses.To store values generated by
INET_ATON()
, use anINT UNSIGNED
column rather thanINT
, which is signed. If you use a signed column, values corresponding to IP addresses for which the first octet is greater than 127 cannot be stored correctly. See Section 11.1.7, “Out-of-Range and Overflow Handling”. -
Given a numeric IPv4 network address in network byte order, returns the dotted-quad string representation of the address as a string in the connection character set.
INET_NTOA()
returnsNULL
if it does not understand its argument.mysql> SELECT INET_NTOA(167773449); -> '10.0.5.9'
-
Given the dotted-quad representation of an IPv4 network address as a string, returns an integer that represents the numeric value of the address in network byte order (big endian).
INET_ATON()
returnsNULL
if it does not understand its argument.mysql> SELECT INET_ATON('10.0.5.9'); -> 167773449
For this example, the return value is calculated as 10×2563 + 0×2562 + 5×256 + 9.
NoteINET_ATON()
may or may not return a non-NULL
result for short-form IP addresses (such as'127.1'
as a representation of'127.0.0.1'
). Because of this,INET_ATON()
a should not be used for such addresses.To store values generated by
INET_ATON()
, use anINT UNSIGNED
column rather thanINT
, which is signed. If you use a signed column, values corresponding to IP addresses for which the first octet is greater than 127 cannot be stored correctly. See Section 11.1.7, “Out-of-Range and Overflow Handling”. -
Given a numeric IPv4 network address in network byte order, returns the dotted-quad string representation of the address as a string in the connection character set.
INET_NTOA()
returnsNULL
if it does not understand its argument.mysql> SELECT INET_NTOA(167773449); -> '10.0.5.9'
标签:network,expr,returns,ATON,address,INET,addresses
来源: https://www.cnblogs.com/rsapaper/p/15402642.html
本站声明:
1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。