sqlite case insensitive matching

Bradley Giesbrecht brad at pixilla.com
Tue Mar 2 15:10:58 PST 2010


On Mar 2, 2010, at 1:38 PM, Joshua Root wrote:

> On 2010-3-3 08:30 , William Siegrist wrote:
>> On Mar 2, 2010, at 1:13 PM, Joshua Root wrote:
>>
>>> Can anyone advise the best way to match against a column in sqlite  
>>> in a
>>> case-insensitive but otherwise exact manner? This is specifically  
>>> for
>>> port names in the registry.
>>>
>>
>>
>> You mean you want to test "WHERE name LIKE 'apache'" and also match  
>> 'Apache' and 'APACHE'? Case-insensitive is the default for LIKE  
>> comparisons for ASCII characters in sqlite.
>
> Looks like COLLATE NOCASE in the column definition is what I wanted.

Most of the time I just use a function LOWER.

'WHERE LOWER(name) = "apache"'

// Brad


More information about the macports-dev mailing list