Skip to main content
Version: V1.0.0

IS_IPV4_COMPAT

Declaration

IS_IPV4_COMPAT(expr)

Description

Returns the IPv6 address in binary string format as a number, as returned by INET6_ATON().

Returns 1 if the parameter is a valid IPv4-compatible IPv6 address, otherwise returns 0. IPv4-compatible addresses are in the format ::ipv4_address. The IPv4 part of an IPv4-compatible address can also be represented in hexadecimal.

Examples

SELECT IS_IPV4_COMPAT(INET6_ATON('::10.x.x.x'));
+------------------------------------------+
| IS_IPV4_COMPAT(INET6_ATON('::10.x.x.x')) |
+------------------------------------------+
| 1 |
+------------------------------------------+
1 row in set (0.001 sec)

SELECT HEX(INET6_ATON('10.10.10.10'));
+---------------------------------+
| HEX(INET6_ATON('10.10.10.10')) |
+---------------------------------+
| C6336501 |
+---------------------------------+
1 row in set (0.001 sec)