I was asked today to confirm the operation of INET_ATON() and INET_NTOA() functions for converting IP4 strings to numeric representations. My tests on the machine I was just connected to at the very instant reported the following results.
mysql> SELECT VERSION(); +-----------------+ | VERSION() | +-----------------+ | 5.1.31-1ubuntu2 | +-----------------+ 1 row in set (0.00 sec) mysql> SELECT INET_ATON('74.165.97.204') AS ipn; +------------+ | ipn | +------------+ | 1252352460 | +------------+ 1 row in set (0.00 sec) mysql> SELECT INET_NTOA(1252352460) as ipa; +---------------+ | ipa | +---------------+ | 74.165.97.204 | +---------------+ 1 row in set (0.01 sec)
The results on the client via ODBC using MySQL 5.0.45 was?
ipn 1252352460 ipa 37342E3136352E39372E323034
What is causing this? It was immediately suspicious the pattern of 2E (the only letter), which translates from Hex to decimal …
[Read more]