1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Minor code enhancements. (CVS 2642)

FossilOrigin-Name: 4ab994a87ee844f453d693555abd61b51bb44a0e
This commit is contained in:
drh
2005-08-30 00:54:01 +00:00
parent 220b10285b
commit 5d9a4af9af
5 changed files with 60 additions and 47 deletions

View File

@@ -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;
}
}