IPV6_NUM_TO_STRING

IPV6_NUM_TO_STRING

Description

Syntax

VARCHAR IPV6_NUM_TO_STRING(VARCHAR ipv6_num)

VARCHAR INET6_NTOA(VARCHAR ipv6_num)

接受字符串类型的二进制格式的IPv6地址。以文本格式返回此地址的字符串。 IPv6映射的IPv4地址以::ffff:111.222.33。

Notice

如果输入字符串不是有效的 IPv6 地址的二进制编码,将返回 NULL。该函数有一个别名 INET6_NTOA

Example

  1. mysql> select ipv6_num_to_string(unhex('2A0206B8000000000000000000000011')) as addr;
  2. +--------------+
  3. | addr |
  4. +--------------+
  5. | 2a02:6b8::11 |
  6. +--------------+
  7. 1 row in set (0.01 sec)
  8. mysql> select ipv6_num_to_string("-23vno12i34nlfwlsj");
  9. +------------------------------------------+
  10. | ipv6_num_to_string('-23vno12i34nlfwlsj') |
  11. +------------------------------------------+
  12. | NULL |
  13. +------------------------------------------+
  14. 1 row in set (0.14 sec)

Keywords

IPV6_NUM_TO_STRING, INET6_NTOA, IP