Re: [sqlite] cidr data type

2008-04-19 Thread Christof Meerwald
On Fri, 18 Apr 2008 15:59:14 -0600, Dennis Cote wrote:
> Christof Meerwald wrote:
>> Currently, I am thinking of storing start and end IP addresses as a blob in
>> the database - that way I would be able to use the "between" operator in
>> selects, e.g.
>>   select X'c0a81234' between X'c0a8' and X'c0a8';
[...]
> I would store the IP addresses, network addresses, and subnet width as 
> integers. Then create a few custom function to manipulate them.

Ok, that would work for IPv4 addresses, but if I ever wanted to use IPv6
addresses, then I would have to go back to using blobs - as integers are
limited to 64 bits in SQLite.


Christof

-- 

http://cmeerw.org  sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org   xmpp:cmeerw at cmeerw.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] cidr data type

2008-04-18 Thread Christof Meerwald
Hi,

does SQLite have anything similar to PostgreSQL's cidr data type (see
http://www.postgresql.org/docs/8.3/interactive/datatype-net-types.html).

I would be particularly interested in being able to use a "contained in"
operator in selects - in PostgreSQL you are able to do:

  select inet '192.168.18.52' << cidr '192.168.0.0/16';

What would be the preferred way to do it in SQLite?

Currently, I am thinking of storing start and end IP addresses as a blob in
the database - that way I would be able to use the "between" operator in
selects, e.g.

  select X'c0a81234' between X'c0a8' and X'c0a8';


Are there any other/better ideas?


Christof

-- 

http://cmeerw.org  sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org   xmpp:cmeerw at cmeerw.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users