Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix for ticket #297 - bug in sqliteSortCompare(). (CVS 917) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4ded1965eb83dee0f28c27ba935d615c |
User & Date: | drh 2003-04-18 17:45:14.000 |
Context
2003-04-18
| ||
22:52 | fix a memory leak in btree_rb.c. (CVS 918) (check-in: 1e3d0d0947 user: drh tags: trunk) | |
17:45 | Fix for ticket #297 - bug in sqliteSortCompare(). (CVS 917) (check-in: 4ded1965eb user: drh tags: trunk) | |
02:31 | The VACUUM command is now functioning (again). Need to do more testing. (CVS 916) (check-in: 6e948d9aae user: drh tags: trunk) | |
Changes
Changes to src/util.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Utility functions used throughout sqlite. ** ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Utility functions used throughout sqlite. ** ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** ** $Id: util.c,v 1.62 2003/04/18 17:45:14 drh Exp $ */ #include "sqliteInt.h" #include <stdarg.h> #include <ctype.h> /* ** If malloc() ever fails, this global variable gets set to 1. |
︙ | ︙ | |||
904 905 906 907 908 909 910 | ** ** Note that the sort order imposed by the rules above is the same ** from the ordering defined by the "<", "<=", ">", and ">=" operators ** of expressions and for indices. This was not the case for version ** 2.6.3 and earlier. */ int sqliteSortCompare(const char *a, const char *b){ | < | 904 905 906 907 908 909 910 911 912 913 914 915 916 917 | ** ** Note that the sort order imposed by the rules above is the same ** from the ordering defined by the "<", "<=", ">", and ">=" operators ** of expressions and for indices. This was not the case for version ** 2.6.3 and earlier. */ int sqliteSortCompare(const char *a, const char *b){ int res = 0; int isNumA, isNumB; int dir = 0; while( res==0 && *a && *b ){ if( a[0]=='N' || b[0]=='N' ){ if( a[0]==b[0] ){ |
︙ | ︙ | |||
956 957 958 959 960 961 962 | res = +1; break; }else{ res = strcmp(&a[1],&b[1]); if( res ) break; } } | | < | | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | res = +1; break; }else{ res = strcmp(&a[1],&b[1]); if( res ) break; } } a += strlen(&a[1]) + 2; b += strlen(&b[1]) + 2; } if( dir=='-' || dir=='D' ) res = -res; return res; } /* ** Some powers of 64. These constants are needed in the |
︙ | ︙ |
Changes to test/sort.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the CREATE TABLE statement. # # $Id: sort.test,v 1.9 2003/04/18 17:45:15 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a bunch of data to sort against # do_test sort-1.0 { |
︙ | ︙ | |||
343 344 345 346 347 348 349 350 | } {1 11 12 2} do_test sort-7.14 { execsql { SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1 COLLATE varchar; } } {1 11 12 2} finish_test | > > > > > > > > > > > | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | } {1 11 12 2} do_test sort-7.14 { execsql { SELECT b FROM t4 UNION SELECT b FROM v4 ORDER BY 1 COLLATE varchar; } } {1 11 12 2} # Ticket #297 # do_test sort-8.1 { execsql { CREATE TABLE t5(a real, b text); INSERT INTO t5 VALUES(100,'A1'); INSERT INTO t5 VALUES(100.0,'A2'); SELECT * FROM t5 ORDER BY a, b; } } {100 A1 100.0 A2} finish_test |