IS_IPV4_STRING

SinceVersion dev

IS_IPV4_STRING

description

Syntax

BOOLEAN IS_IPV4_STRING(STRING ipv4_str)

Receive an IPv4 address in the form of a string as a parameter. If it is a correctly formatted and valid IPv4 address, return true; On the contrary, return false.

notice

If the input parameter is NULL, return NULL, indicating invalid input

example

1. mysql> select is_ipv4_string(NULL);
2. +----------------------+
3. | is_ipv4_string(NULL) |
4. +----------------------+
5. |                 NULL |
6. +----------------------+

8. mysql> CREATE TABLE `test_is_ipv4_string` (
9. `id` int,
10. `ip_v4` string
11. ) ENGINE=OLAP
12. DISTRIBUTED BY HASH(`id`) BUCKETS 4
13. PROPERTIES (
14. "replication_allocation" = "tag.location.default: 1"
15. );

17. mysql> insert into test_is_ipv4_string values(0, NULL), (1, '0.0.0.'), (2, ''), (3, '.'), (4, '255.255.255.255');

19. mysql> select id, is_ipv4_string(ip_v4) from test_is_ipv4_string order by id;
20. +------+-----------------------+
21. | id   | is_ipv4_string(ip_v4) |
22. +------+-----------------------+
23. |    0 |                  NULL |
24. |    1 |                     0 |
25. |    2 |                     0 |
26. |    3 |                     0 |
27. |    4 |                     1 |
28. +------+-----------------------+

keywords

IS_IPV4_STRING, IP