Re: [sqlite] Custom collation method works for comparison, not for ORDER BY

2012-12-06 Thread Niall O'Reilly
On 6 Dec 2012, at 14:14, Igor Tandetnik wrote: > Your code assumes, in several places, that strings passed to collation > function are NUL-terminated. They don't have to be - that's why lengths are > also passed. I think this may be causing the problem you are seeing: when the > string comes

Re: [sqlite] Custom collation method works for comparison, not for ORDER BY

2012-12-06 Thread Igor Tandetnik
Niall O'Reilly wrote: > This and my Makefile follow below, as I understand attachments > are not supported on this list. Your code assumes, in several places, that strings passed to collation function are NUL-terminated. They don't have to be - that's why lengths are also

Re: [sqlite] Custom collation method works for comparison, not for ORDER BY

2012-12-06 Thread Niall O'Reilly
On 6 Dec 2012, at 05:21, Dan Kennedy wrote: > 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. Thanks for the encouragement! I've used conditionally compiled sections so that the

Re: [sqlite] Custom collation method works for comparison, not for ORDER BY

2012-12-05 Thread Dan Kennedy
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?

Re: [sqlite] Custom collation method works for comparison, not for ORDER BY

2012-12-05 Thread Niall O'Reilly
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.

Re: [sqlite] Custom collation method works for comparison, not for ORDER BY

2012-12-05 Thread Clemens Ladisch
Niall O'Reilly wrote: > I've coded up a custom collation method, and am seeing > what looks like strange behaviour. The method is > intended to sort IPv4 addresses before IPv6 addresses, > and IPv6 addresses before other text strings. > > select rowid, * from foo order by

[sqlite] Custom collation method works for comparison, not for ORDER BY

2012-12-05 Thread Niall O'Reilly
Hello. I've coded up a custom collation method, and am seeing what looks like strange behaviour. The method is intended to sort IPv4 addresses before IPv6 addresses, and IPv6 addresses before other text strings. It's just a little wrapping around