On 12/06/2012 06:11 AM, Niall O'Reilly wrote:
On 05/12/12 21:12, Clemens Ladisch wrote:
Do these queries give the correct result?

     select '100A' collate ipaddress<  '127.0.0.1';
     select '100A' collate ipaddress<  ' ABCD';

I.e., does the collation function actually work?

        Thanks for the helpful suggestions.
        I wish I had thought of something so simple.

        Here's what I get:

sqlite>  select '100A' collate ipaddress<  '127.0.0.1';
0
sqlite>  select '100A' collate ipaddress<  ' ABCD';
0
sqlite>  select '127.0.0.1' collate ipaddress<  '::1';
1
sqlite>  select '::1' collate ipaddress = '0::1';
1
sqlite>  select 'dead:beef::' collate ipaddress = 'DEAD:BEEF::';
1
sqlite>

        These results match what I intended the collation
        function to do.  It appears to work, including
        recognizing alternative notations for the same IPv6
        address as equivalent.

        Similar tests using BETWEEN also work as intended.

It still seems likely that the collation returns the wrong result
some circumstances. Posting the code for it is probably the right
thing to do.




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

Reply via email to