Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Comment changes in select.c. (CVS 4691) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
38020592f15c072e0d221ae2e0df1350 |
User & Date: | danielk1977 2008-01-07 10:16:41.000 |
Context
2008-01-07
| ||
19:20 | Registerify the AUTOINCREMENT processing and the OP_IsNull and OP_NotNull operators. (CVS 4692) (check-in: aa48867cfa user: drh tags: trunk) | |
10:16 | Comment changes in select.c. (CVS 4691) (check-in: 38020592f1 user: danielk1977 tags: trunk) | |
2008-01-06
| ||
00:25 | Registerify the SRT_Subroutine destination for SELECT results. (CVS 4690) (check-in: 8201f71729 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.391 2008/01/07 10:16:41 danielk1977 Exp $ */ #include "sqliteInt.h" /* ** Delete all the content of a Select structure but do not deallocate ** the select structure itself. |
︙ | ︙ | |||
2638 2639 2640 2641 2642 2643 2644 | /* ** Analyze the SELECT statement passed as an argument to see if it ** is a min() or max() query. Return ORDERBY_MIN or ORDERBY_MAX if ** it is, or 0 otherwise. At present, a query is considered to be ** a min()/max() query if: ** | | > > | | 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 | /* ** Analyze the SELECT statement passed as an argument to see if it ** is a min() or max() query. Return ORDERBY_MIN or ORDERBY_MAX if ** it is, or 0 otherwise. At present, a query is considered to be ** a min()/max() query if: ** ** 1. There is a single object in the FROM clause. ** ** 2. There is a single expression in the result set, and it is ** either min(x) or max(x), where x is a column reference. */ static int minMaxQuery(Parse *pParse, Select *p){ Expr *pExpr; ExprList *pEList = p->pEList; if( pEList->nExpr!=1 ) return ORDERBY_NORMAL; pExpr = pEList->a[0].pExpr; |
︙ | ︙ | |||
3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 | } /* endif pGroupBy */ else { ExprList *pMinMax = 0; ExprList *pDel = 0; u8 flag; flag = minMaxQuery(pParse, p); if( flag ){ pMinMax = sqlite3ExprListDup(db, p->pEList->a[0].pExpr->pList); if( pMinMax ){ pMinMax->a[0].sortOrder = ((flag==ORDERBY_MIN)?0:1); pMinMax->a[0].pExpr->op = TK_COLUMN; pDel = pMinMax; | > > > > > > > > > > > > > > > > > > > > > > > > > | 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 | } /* endif pGroupBy */ else { ExprList *pMinMax = 0; ExprList *pDel = 0; u8 flag; /* Check if the query is of one of the following forms: ** ** SELECT min(x) FROM ... ** SELECT max(x) FROM ... ** ** If it is, then ask the code in where.c to attempt to sort results ** as if there was an "ORDER ON x" or "ORDER ON x DESC" clause. ** If where.c is able to produce results sorted in this order, then ** add vdbe code to break out of the processing loop after the ** first iteration (since the first iteration of the loop is ** guaranteed to operate on the row with the minimum or maximum ** value of x, the only row required). ** ** A special flag must be passed to sqlite3WhereBegin() to slightly ** modify behaviour as follows: ** ** + If the query is a "SELECT min(x)", then the loop coded by ** where.c should not iterate over any values with a NULL value ** for x. ** ** + The optimizer code in where.c (the thing that decides which ** index or indices to use) should place a different priority on ** satisfying the 'ORDER BY' clause than it does in other cases. ** Refer to code and comments in where.c for details. */ flag = minMaxQuery(pParse, p); if( flag ){ pMinMax = sqlite3ExprListDup(db, p->pEList->a[0].pExpr->pList); if( pMinMax ){ pMinMax->a[0].sortOrder = ((flag==ORDERBY_MIN)?0:1); pMinMax->a[0].pExpr->op = TK_COLUMN; pDel = pMinMax; |
︙ | ︙ |