Re: IP regex
Harald Fuchs <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Organization | Linux Private Site |
| Message-ID | <[email protected]> |
In article <[email protected]>, "Vladimir V. Kolpakov" <[email protected]> writes: > IP address is not integer by it's nature and is not string also. Huh? An IPv4 address is a sequence of 32 bits. Although MySQL does not have a column type for an IPv4 address, it does have support functions for them, namely INET_ATON and INET_NTOA. Since these functions operate on integers, what's wrong with using INT4? > It's closer to bits string representation, which can involve > creation of bitmap index (or maked up with SET type), > but quite often can be effectively worked around using fulltex index. If you're talking about indexed searching, I doubt there's anything faster than SELECT whatever FROM mytable WHERE ipv4 = INET_ATON(myinput) with a normal index on the ipv4 column. > As of "integer versus character" question, > I can also show example where storage requirements are equal > for both types, Of course also CHAR(4) BINARY would be able to hold an IPv4 address, but you gain nothing with that and lose the support functions. -- MySQL Perl Mailing List For list archives: http://lists.mysql.com/perl To unsubscribe: http://lists.mysql.com/[email protected]