On Fri, Aug 1, 2008 at 3:44 PM, Brian Aker <[EMAIL PROTECTED]> wrote:
> On Aug 1, 2008, at 2:37 PM, Pete Kruckenberg wrote:
>
>> I've seen BIT operators used in situations dealing with IP addresses (i.e.
>> network/security management applications). For example, to determine if an
>> IP address is part of a given network range (network number and netmask), I
>> bitwise AND the IP address with the netmask, then compare the result to the
>> network number.
>>
>
> I would rather hand folks functions for these (though I take your point
> about being able to do this).
So the BIT operators wouldn't be in the core functionality, but could be
added in (plug-in? UDF?) so they would somehow be accessible in a query?
> I have patches for both IPADDRESS and IPADDRESSV4. The question has been
> how to handle these types.... have both? Have one?
>
What do the patches do (alternatively, what's special about how
IPADDRESS/IPADDRESSV4 types are handled)?
> Queries which group rows of IP addresses by network range would use the
>> BIT operators, as would queries which search rows of network ranges for
>> those that cover specific IP addresses.
>> I'd guess that work-arounds can be found for most situations (i.e.
>> pre-calculate the starting and ending IP address for a range and use
>> BETWEEN()), but there may be some that require BIT operators.
>>
>
> Yep. Though the issue with doing this is you assume a four byte into which
> can represent IPV4.
Whatever workarounds work for V4 should also work (or not) for V6.
I'm curious, wow well are BIT operators handled by the (5.1) optimizer?
Would "ip & <NETMASK> = <NETWORK_NUMBER>" ("ip" is a column) perform
anywhere near "BETWEEN(ip, <RANGE_MIN_IP>,<RANGE_MAX_IP>)"?
Pete.
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp