On Fri, Apr 18, 2008 at 08:59:17PM -0500, John Stanton wrote:
> Use a function and convert the IP address from dotted format to a 32 bit 
> unsigned integer.  You can AND and OR these to establish inclusion and 
> exclusion.

That doesn't get you the prefix length.  If you represent the
mask/prefix length as a separate value then you have to be careful when
sorting.  If you represent prefixes as bit strings then you lose that
problem, but without a way to cast them to integers you have to add
user-defined functions to do bit-wise operations on them -- or at least
functions to convert to/from integert (but that only works well for
IPv4).

BTW, this can be very useful when one stores data on networks and
aggregations, such as when building a model of routing, or a database of
network and aggregate allocations.  It then becomes important to be able
to determine whether one prefix is inside the other -- that's almost the
most important operation -- and to be able to query for prefixes that
fit inside another, ...

Nico
-- 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to