Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What issues did you run into? Having admittedly never done this before, it feels like whenever you need the dotted-quad IP you could just query:

    SELECT INET_NTOA(ip) FROM ips WHERE...
...in MySQL at least. (Which might be why MySQL has this function built in?)

I guess if you ever need to match on a specific prefix storing the numeric IP might be an issue?



> I guess if you ever need to match on a specific prefix storing the numeric IP might be an issue?

If you want to search for range, you can do:

   SELECT INET_NTOA(ip) FROM ips WHERE ip > INET_NTOA(:startOfRange) AND ip < INET_NTOA(:endOfRange)


Because as shocking as this might sound like unlike the characters in the movie Matrix I don't have a built-in INET_NTOA function in my retina to see the string form of the IP addresses when glancing at table rows of a large table looking for patterns or a certain IP.


How often are you looking at the full contents of a table vs. looking at the results of a query that you could throw an INET_NTOA onto?


Many. You also expect me to remember how to spell INET_NTOA and on what fields to use it on. What if I wanted do a quick "SELECT * FROM"? I barely know how to spell English words what makes you think I'm going to remember how to spell INET_NTOA.


I realize you’re describing a general problem and not just this particular example, but fwiw NTOA and friends got a lot easier for me once I learned enough that I stopped trying to “remember how to spell” them and started thinking about them in terms of the underlying concepts, like “Network (as in big-endianness) to ASCII”. Learning the significance of the term “address family” was a big clue for me for self-directed learning in this space :)


dbeaver CE is free.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: