diff options
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/src/select.c b/src/select.c index 33c5f2449..bb8c06e86 100644 --- a/src/select.c +++ b/src/select.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements in SQLite. ** -** $Id: select.c,v 1.255 2005/08/28 01:34:22 drh Exp $ +** $Id: select.c,v 1.256 2005/08/30 00:54:03 drh Exp $ */ #include "sqliteInt.h" @@ -2632,10 +2632,10 @@ int sqlite3Select( ** names that have been explicitly specified. */ if( pOrderBy ){ - for(i=0; i<pOrderBy->nExpr; i++){ - if( pOrderBy->a[i].zName ){ - pOrderBy->a[i].pExpr->pColl = - sqlite3LocateCollSeq(pParse, pOrderBy->a[i].zName, -1); + struct ExprList_item *pTerm; + for(i=0, pTerm=pOrderBy->a; i<pOrderBy->nExpr; i++, pTerm++){ + if( pTerm->zName ){ + pTerm->pExpr->pColl = sqlite3LocateCollSeq(pParse, pTerm->zName, -1); } } if( pParse->nErr ){ @@ -2664,27 +2664,17 @@ int sqlite3Select( assert( pParse->nAgg==0 ); isAgg = 1; - for(i=0; i<pEList->nExpr; i++){ - if( sqlite3ExprAnalyzeAggregates(&sNC, pEList->a[i].pExpr) ){ - goto select_end; - } + if( sqlite3ExprAnalyzeAggList(&sNC, pEList) ){ + goto select_end; } - if( pGroupBy ){ - for(i=0; i<pGroupBy->nExpr; i++){ - if( sqlite3ExprAnalyzeAggregates(&sNC, pGroupBy->a[i].pExpr) ){ - goto select_end; - } - } + if( sqlite3ExprAnalyzeAggList(&sNC, pGroupBy) ){ + goto select_end; } if( pHaving && sqlite3ExprAnalyzeAggregates(&sNC, pHaving) ){ goto select_end; } - if( pOrderBy ){ - for(i=0; i<pOrderBy->nExpr; i++){ - if( sqlite3ExprAnalyzeAggregates(&sNC, pOrderBy->a[i].pExpr) ){ - goto select_end; - } - } + if( sqlite3ExprAnalyzeAggList(&sNC, pOrderBy) ){ + goto select_end; } } |