码迷,mamicode.com
首页 > 数据库 > 详细

mysql IPv4 IPv6

时间:2017-01-24 19:16:05      阅读:353      评论:0      收藏:0      [点我收藏+]

标签:2.4   work   more   cti   because   man   expr   require   title   

w如何通过一个mysql方法,而不是借助脚本判断?INET6_ATON(expr)

https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_inet-aton

https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_inet6-aton

Given an IPv6 or IPv4 network address as a string, returns a binary string that represents the numeric value of the address in network byte order (big endian). Because numeric-format IPv6 addresses require more bytes than the largest integer type, the representation returned by this function has the VARBINARY data type: VARBINARY(16) for IPv6 addresses and VARBINARY(4) for IPv4 addresses. If the argument is not a valid address, INET6_ATON() returns NULL.

The following examples use HEX() to display the INET6_ATON() result in printable form:

mysql IPv4 IPv6

标签:2.4   work   more   cti   because   man   expr   require   title   

原文地址:http://www.cnblogs.com/yuanjiangw/p/6347517.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!