[TYPO3-dev] IP-Function in MySQL

Steffen Kamper info at sk-typo3.de
Sun Aug 3 17:38:12 CEST 2008


Hi,

maybe this is interesting for you, i found following MySQL-Function [1].

Normally IP-Adresses are stored in a VARCHAR-field, but with this 
function it's possible to store them in a INT-Field.

For saving the usage is
INET_ATON('127.128.129.130')

and for reading it's
INET_NTOA(`ip`)

Using varchar length 15 the field uses 16 Bytes,
Using unsigned INT it uses only 4 Bytes.
This is interesting for logging tables with a lot of entries.

vg Steffen

[1] http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html




More information about the TYPO3-dev mailing list