I'm working on a rails app that has an IPv6 model. I'm storing the IPv6 address in 2 32-bit ints and a 64-bit int:
+-----------------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+---------------------+------+-----+---------+----------------+
| global_routing_prefix | int(11) unsigned | YES | | NULL | |
| subnet_identifier | int(11) unsigned | YES | | NULL | |
| interface_identifier | bigint(20) unsigned | YES | | NULL | |
Unfortunately, when I go to find IPs in a range, MySQL does all arithmetic with signed bigints, so:
mysql> select 2 BETWEEN 0 AND 18446744073709551614;
+--------------------------------------+
| 2 BETWEEN 0 AND 18446744073709551614 |
+--------------------------------------+
| 0 |
+--------------------------------------+
Is there a work around I can do, or do I need to split up by interface_identifier into 2 unsigned ints?
Thanks, Donald