Christof Meerwald wrote:
> 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'c0a80000' and X'c0a8ffff';
> 
> 
> Are there any other/better ideas?
> 
> 
> Christof
> 
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.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to