The current implementation of SQlite resorts strcmp which does a lexicographical compare...
for example consider the following items... Field NAME GPI_1 GPI_2 GPI_20 GPI_10 if I run the following sql statement SELECT * FROM list ORDER BY NAME I will get the following data sorted: GPI_1 GPI_10 GPI_2 GPI_20 Which is not really what I meant..... If you patch sqlite for natural sort the same code will yield the following: GPI_1 GPI_2 GPI_10 GPI_20 This is what's called a natural sort...... its what we are used to as non computers... Tezozomoc. ----- Original Message ----- From: "gohaku" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "tezozomoc" <[EMAIL PROTECTED]> Sent: Saturday, July 31, 2004 6:20 AM Subject: Re: [sqlite] HOWTO: Adding Natural Sort To Sqlite Database... > > On Jul 30, 2004, at 1:49 PM, tezozomoc wrote: > > > > > HOWTO: Adding Natural Sort To Sqlite Database... > > > > Assumption... this is based on SQLITE 2.8.6... forgive the aging.. > > > > > > I will make this very short and sweet... > > > > 1. Get the following two files: > > > > a.. strnatcmp.c, strnatcmp.h - the algorithm itself from > > a.. > > http://sourcefrog.net/projects/natsort/ > > > > add to your sqlite build project, I am using VxWorks, so the way that > > I did it will probably will not make sense... > > > > 2. Open util.c > > > > 3. Replace the following: > > ............ > > This sounds great. can you give an SQL Statement example and explain > what was wrong with sqliteSortCompare? > > Thanks. > >