Skip to main content
Skip to main content

IS_IPV4_COMPAT

IS_IPV4_COMPAT​

IS_IPV4_COMPAT

Description​

Syntax​

VARCHAR IS_IPV4_COMPAT(INET6_ATON(VARCHAR ipv4_addr))

This function takes an IPv6 address represented in numeric form as a binary string, as returned by INET6_ATON(). It returns 1 if the argument is a valid IPv4-compatible IPv6 address, 0 otherwise (unless expr is NULL, in which case the function returns NULL). IPv4-compatible addresses have the form ::ipv4_address.

Example​

mysql> SELECT IS_IPV4_COMPAT(INET6_ATON('::ffff:10.0.5.9')) AS is_result;
+-----------+
| is_result |
+-----------+
| 0 |
+-----------+
1 row in set (0.02 sec)

mysql> SELECT IS_IPV4_COMPAT(INET6_ATON('::10.0.5.9')) AS is_result;
+-----------+
| is_result |
+-----------+
| 1 |
+-----------+
1 row in set (0.03 sec)

Keywords​

IS_IPV4_COMPAT, IP