Recent Posts

Caution: Greetings to all visitors. The site is working in short. Links Please skip the link to view any topic and thank you for visiting
header ads

Reason of searching with INET6_NTON()

I saw someone says that you can store IPV4 (4bytes) and IPV6 (16bytes) in a column of varbinary(16), and do something like the following code when you want to insert an IP:
INSERT INTO `log_table` (`ip_address`, `created_at`) VALUES(INET6_ATON(?), NOW());
Code (SQL):
Where ? is the IP to save.

I have no questions with above code as it is self-explanatory.

But then he says that when you want to search an IP, do this:
SELECT INET6_NTOA(`ip_address`) AS...
Code (SQL):
Reason of searching with INET6_NTON()

from MySQL https://ift.tt/2sQjlvT
via IFTTT

Post a Comment

0 Comments