Re: [sqlite] Order by creating function is not sorting for input order and alphabet

2011-10-24 Thread David Garfield
Suggestions: 1) Try: select cli_id, antok(cli_id) as antok_cli_id .. order by antok_cli_id This should at least show you exactly what it thinks it sorted. 2) Don't do regcomp() more than once. It can be very costly. And cache input.c_str() and input.length() while you are at it.

Re: [sqlite] Order by creating function is not sorting for input order and alphabet

2011-10-24 Thread Igor Tandetnik
On 10/24/2011 8:19 PM, ChingChang Hsiao wrote: case SQLITE_INTEGER: sqlite3_result_int64( context, sqlite3_value_int64(argv[0]) ); break; case SQLITE_NULL: sqlite3_result_null( context ); break; If you want to just return an argument unchanged, you can use

[sqlite] Order by creating function is not sorting for input order and alphabet

2011-10-24 Thread ChingChang Hsiao
The purpose of function antok is that solve the problem of "order by cli_id". Function antok converts, X86-1 -> x186-01 X86-2 -> x186-02 X86-10 -> x186-110 X86-111 -> x186-2111 X86- -> x186-3 1.1/12-ds3 -> 01.01/112-ds03 Examples, Input cli_id x86-2, x86-10, x86-1 Order by cli_id