Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | An improved fix for the min() problem of ticket #800. (CVS 1804) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b6e8b7a13cd9f90e2f7d963d9ddbe591 |
User & Date: | drh 2004-07-18 21:33:02.000 |
Context
2004-07-18
| ||
22:22 | The %W date specifier in strftime should be measured from the first Monday of the year. Ticket #758. (CVS 1805) (check-in: 50b016b004 user: drh tags: trunk) | |
21:33 | An improved fix for the min() problem of ticket #800. (CVS 1804) (check-in: b6e8b7a13c user: drh tags: trunk) | |
20:52 | min() ignores NULL values. Ticket #800. (CVS 1802) (check-in: 166234a2b6 user: drh tags: trunk) | |
Changes
Changes to src/select.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** ** $Id: select.c,v 1.197 2004/07/18 21:33:02 drh Exp $ */ #include "sqliteInt.h" /* ** Allocate a new Select structure and return a pointer to that ** structure. |
︙ | ︙ | |||
2071 2072 2073 2074 2075 2076 2077 | cont = sqlite3VdbeMakeLabel(v); if( pIdx==0 ){ sqlite3VdbeAddOp(v, seekOp, base, 0); }else{ sqlite3VdbeAddOp(v, OP_Integer, pIdx->iDb, 0); sqlite3VdbeOp3(v, OP_OpenRead, base+1, pIdx->tnum, (char*)&pIdx->keyInfo, P3_KEYINFO); | < < < < < | | > > | 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 | cont = sqlite3VdbeMakeLabel(v); if( pIdx==0 ){ sqlite3VdbeAddOp(v, seekOp, base, 0); }else{ sqlite3VdbeAddOp(v, OP_Integer, pIdx->iDb, 0); sqlite3VdbeOp3(v, OP_OpenRead, base+1, pIdx->tnum, (char*)&pIdx->keyInfo, P3_KEYINFO); if( seekOp==OP_Rewind ){ sqlite3VdbeAddOp(v, OP_String, 0, 0); sqlite3VdbeAddOp(v, OP_MakeRecord, 1, 0); seekOp = OP_MoveGt; } sqlite3VdbeAddOp(v, seekOp, base+1, 0); sqlite3VdbeAddOp(v, OP_IdxRecno, base+1, 0); sqlite3VdbeAddOp(v, OP_Close, base+1, 0); sqlite3VdbeAddOp(v, OP_MoveGe, base, 0); } eList.nExpr = 1; memset(&eListItem, 0, sizeof(eListItem)); eList.a = &eListItem; |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** ** $Id: vdbe.c,v 1.401 2004/07/18 21:33:02 drh Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
2657 2658 2659 2660 2661 2662 2663 | pC->cacheValid = 0; *pC->pIncrKey = 0; sqlite3_search_count++; if( oc==OP_MoveGe || oc==OP_MoveGt ){ if( res<0 ){ sqlite3BtreeNext(pC->pCursor, &res); pC->recnoIsValid = 0; | < < | > > | > > > | 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 | pC->cacheValid = 0; *pC->pIncrKey = 0; sqlite3_search_count++; if( oc==OP_MoveGe || oc==OP_MoveGt ){ if( res<0 ){ sqlite3BtreeNext(pC->pCursor, &res); pC->recnoIsValid = 0; }else{ res = 0; } }else{ assert( oc==OP_MoveLt || oc==OP_MoveLe ); if( res>=0 ){ sqlite3BtreePrevious(pC->pCursor, &res); pC->recnoIsValid = 0; }else{ /* res might be negative because the table is empty. Check to ** see if this is the case. */ res = sqlite3BtreeEof(pC->pCursor); } } if( res ){ if( pOp->p2>0 ){ pc = pOp->p2 - 1; }else{ pC->nullRow = 1; } } } Release(pTos); pTos--; break; } |
︙ | ︙ |
Changes to test/collate4.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # 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 script is page cache subsystem. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # 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 script is page cache subsystem. # # $Id: collate4.test,v 1.3 2004/07/18 21:33:02 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl db collate TEXT text_collate proc text_collate {a b} { return [string compare $a $b] |
︙ | ︙ | |||
585 586 587 588 589 590 591 | # Test that the index with collation type TEXT is used. execsql { CREATE INDEX collate4i1 ON collate4t1(a); } count { SELECT min(a) FROM collate4t1; } | | | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | # Test that the index with collation type TEXT is used. execsql { CREATE INDEX collate4i1 ON collate4t1(a); } count { SELECT min(a) FROM collate4t1; } } {10 2} do_test collate4-4.4 { count { SELECT max(a) FROM collate4t1; } } {20 1} do_test collate4-4.5 { # Test that the index with collation type NUMERIC is not used. |
︙ | ︙ |
Changes to test/minmax.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing SELECT statements that contain # aggregate min() and max() functions and which are handled as # as a special case. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing SELECT statements that contain # aggregate min() and max() functions and which are handled as # as a special case. # # $Id: minmax.test,v 1.12 2004/07/18 21:33:02 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl do_test minmax-1.0 { execsql { BEGIN; |
︙ | ︙ | |||
64 65 66 67 68 69 70 | do_test minmax-1.5 { execsql {CREATE INDEX t1i1 ON t1(x)} set sqlite_search_count 0 execsql {SELECT min(x) FROM t1} } {1} do_test minmax-1.6 { set sqlite_search_count | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | do_test minmax-1.5 { execsql {CREATE INDEX t1i1 ON t1(x)} set sqlite_search_count 0 execsql {SELECT min(x) FROM t1} } {1} do_test minmax-1.6 { set sqlite_search_count } {2} do_test minmax-1.7 { set sqlite_search_count 0 execsql {SELECT max(x) FROM t1} } {20} do_test minmax-1.8 { set sqlite_search_count } {1} |
︙ | ︙ |