Download & Extend

switch to a single field to store ipaddress

Project:CCK IP Address
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:firebus
Status:active

Issue Summary

Hi, there is some reason that why default octet column type is set to char ?
I think that octet data is a integer.

Thanks.

Comments

#1

in order to make it easy to encode and display octets with leading zeros.

i know that's dumb. i was being lazy about something else, where i didn't want to right pad the int and cast it as a string. i can't remember exactly what it was.

i regret the decision to have one field per octet, and i'm planning an upgrade to a single field that using ip2long and long2ip to encode and decode.

#2

Title:Default database column type» switch to a single field to store ipaddress
Assigned to:Anonymous» firebus

#3

Firebus,

To share my experience with the 'IP Address Entity' module, be aware that while the 'Schema' API supports 'unsigned' data columns in the database, the DB API itself doesn't actually allow the full range of unsigned integers ... so storing of a value such as ip2long(255.255.255.255) requires you to use a 'signed' column in the database. (PHP uses signed integers by default, so this shouldn't be a big deal ... but I had initially set 'unsigned' to TRUE in my db schema, which led to a couple hours of research and frustration before finally resolving the issue.)

#4

Version:5.x-1.x-dev» 6.x-1.x-dev
nobody click here