diff --git a/manifest b/manifest index 6fa2f91da0..9547ff6eba 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C All\sidentifiers\sto\sbe\squoted\sin\ssquare\sbrackets,\sfor\scompatibility\swith\nMS-Access.\s(CVS\s370) -D 2002-02-14T21:42:51 +C Make\sthe\ssqliteParseInfoReset()\sfunction\slocale\sto\sthe\sselect.c\sfile.\s(CVS\s371) +D 2002-02-17T00:30:36 F Makefile.in 9fa4277413bf1d9cf91365f07d4108d7d87ed2af F Makefile.template 3372d45f8853afdb70bd30cc6fb50a3cd9069834 F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0 @@ -36,17 +36,17 @@ F src/pager.h b28f004e2f5541dc60cc32db01bf80cf4d056283 F src/parse.y 734ba1e0dce9882345e65de5a14d9fe02fb757c2 F src/printf.c 300a90554345751f26e1fc0c0333b90a66110a1d F src/random.c f6b36bec5ebd3edb3440224bf5bf811fe4ac9a1b -F src/select.c 4b4a25c57cc341565dad625c3100c71ce993f85f +F src/select.c 631fe7c1e06c70e4e78e9536e69f4eb57fdae07b F src/shell.c c102dfe388c7618a668c944ff157c49cb48f28e3 F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e F src/sqlite.h.in f57074c84a2c112a5093ba7a9d9636aa9cacc87c -F src/sqliteInt.h 41459cf6cae299f66c3ab16b20b8e24443c06089 +F src/sqliteInt.h 58d6311edad0d52eae1631c47356b329da24f3af F src/table.c c89698bd5bb4b8d14722d6ee7e9be014c383d24a F src/tclsqlite.c b9cf346e95291cb4c4f1bf5ac1d77db6b8ad023d F src/test1.c 33efd350dca27c52c58c553c04fd3a6a51f13c1f F src/test2.c d410dbd8a90faa466c3ab694fa0aa57f5a773aa6 F src/test3.c d6775f95fd91f5b3cf0e2382a28e5aaeb68f745b -F src/tokenize.c 0cbf765ef45e66889f02c9045c7917f271d5b70f +F src/tokenize.c 9e98f94469694a763992860596137e78dbae0cc0 F src/update.c 95459f94a061860bf8e5716b3426a5ba85c79103 F src/util.c f31f3d6198a0d1296a16f5a6ceec423a932cbbf6 F src/vdbe.c 94704a5733db95b78cc902208c5e8e26a784e7f8 @@ -122,7 +122,7 @@ F www/speed.tcl 83457b2bf6bb430900bd48ca3dd98264d9a916a5 F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279 F www/tclsqlite.tcl 829b393d1ab187fd7a5e978631b3429318885c49 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218 -P 4d067000077ee8f0221a7940232dc658c7f04b49 -R 8725fda7a81499bfdfe493d3c2d9a57a +P e17a858c9eeb70c62f54c88e6be5897e58d67301 +R b50edb4b34a53c4baa439c4b19149a7d U drh -Z e9271fcc79fa3d5d756f3d84ae819cfa +Z adc815cb558970a8bb42b33bc644f373 diff --git a/manifest.uuid b/manifest.uuid index fc780b017a..591ad6ac00 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e17a858c9eeb70c62f54c88e6be5897e58d67301 \ No newline at end of file +2336b1eadaedf2556a1988acc7bdf133135154dc \ No newline at end of file diff --git a/src/select.c b/src/select.c index 84eb2c35a0..611d70ea02 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.58 2002/02/13 23:22:54 drh Exp $ +** $Id: select.c,v 1.59 2002/02/17 00:30:36 drh Exp $ */ #include "sqliteInt.h" @@ -73,7 +73,7 @@ void sqliteSelectDelete(Select *p){ /* ** Delete the aggregate information from the parse structure. */ -void sqliteParseInfoReset(Parse *pParse){ +static void sqliteAggregateInfoReset(Parse *pParse){ sqliteFree(pParse->aAgg); pParse->aAgg = 0; pParse->nAgg = 0; @@ -708,6 +708,7 @@ int sqliteSelect( int isDistinct; /* True if the DISTINCT keyword is present */ int distinct; /* Table to use for the distinct set */ int base; /* First cursor available for use */ + int rc = 1; /* Value to return from this function */ if( sqlite_malloc_failed || pParse->nErr || p==0 ) return 1; @@ -735,18 +736,18 @@ int sqliteSelect( ** Do not even attempt to generate any code if we have already seen ** errors before this routine starts. */ - if( pParse->nErr>0 ) return 1; - sqliteParseInfoReset(pParse); + if( pParse->nErr>0 ) goto select_end; + sqliteAggregateInfoReset(pParse); /* Look up every table in the table list and create an appropriate ** columnlist in pEList if there isn't one already. (The parser leaves ** a NULL in the p->pEList if the SQL said "SELECT * FROM ...") */ if( fillInColumnList(pParse, p) ){ - return 1; + goto select_end; } pEList = p->pEList; - if( pEList==0 ) return 1; + if( pEList==0 ) goto select_end; /* Allocate a temporary table to use for the DISTINCT set, if ** necessary. This must be done early to allocate the cursor before @@ -765,7 +766,7 @@ int sqliteSelect( sqliteSetString(&pParse->zErrMsg, "only a single result allowed for " "a SELECT that is part of an expression", 0); pParse->nErr++; - return 1; + goto select_end; } /* ORDER BY is ignored if we are not sending the result to a callback. @@ -800,18 +801,18 @@ int sqliteSelect( */ for(i=0; inExpr; i++){ if( sqliteExprResolveIds(pParse, pTabList, 0, pEList->a[i].pExpr) ){ - return 1; + goto select_end; } if( sqliteExprCheck(pParse, pEList->a[i].pExpr, 1, &isAgg) ){ - return 1; + goto select_end; } } if( pWhere ){ if( sqliteExprResolveIds(pParse, pTabList, pEList, pWhere) ){ - return 1; + goto select_end; } if( sqliteExprCheck(pParse, pWhere, 0, 0) ){ - return 1; + goto select_end; } } if( pOrderBy ){ @@ -821,13 +822,13 @@ int sqliteSelect( sqliteSetString(&pParse->zErrMsg, "ORDER BY expressions should not be constant", 0); pParse->nErr++; - return 1; + goto select_end; } if( sqliteExprResolveIds(pParse, pTabList, pEList, pE) ){ - return 1; + goto select_end; } if( sqliteExprCheck(pParse, pE, isAgg, 0) ){ - return 1; + goto select_end; } } } @@ -838,13 +839,13 @@ int sqliteSelect( sqliteSetString(&pParse->zErrMsg, "GROUP BY expressions should not be constant", 0); pParse->nErr++; - return 1; + goto select_end; } if( sqliteExprResolveIds(pParse, pTabList, pEList, pE) ){ - return 1; + goto select_end; } if( sqliteExprCheck(pParse, pE, isAgg, 0) ){ - return 1; + goto select_end; } } } @@ -853,13 +854,13 @@ int sqliteSelect( sqliteSetString(&pParse->zErrMsg, "a GROUP BY clause is required " "before HAVING", 0); pParse->nErr++; - return 1; + goto select_end; } if( sqliteExprResolveIds(pParse, pTabList, pEList, pHaving) ){ - return 1; + goto select_end; } if( sqliteExprCheck(pParse, pHaving, isAgg, 0) ){ - return 1; + goto select_end; } } @@ -869,23 +870,23 @@ int sqliteSelect( assert( pParse->nAgg==0 && pParse->iAggCount<0 ); for(i=0; inExpr; i++){ if( sqliteExprAnalyzeAggregates(pParse, pEList->a[i].pExpr) ){ - return 1; + goto select_end; } } if( pGroupBy ){ for(i=0; inExpr; i++){ if( sqliteExprAnalyzeAggregates(pParse, pGroupBy->a[i].pExpr) ){ - return 1; + goto select_end; } } } if( pHaving && sqliteExprAnalyzeAggregates(pParse, pHaving) ){ - return 1; + goto select_end; } if( pOrderBy ){ for(i=0; inExpr; i++){ if( sqliteExprAnalyzeAggregates(pParse, pOrderBy->a[i].pExpr) ){ - return 1; + goto select_end; } } } @@ -894,7 +895,7 @@ int sqliteSelect( /* Begin generating code. */ v = sqliteGetVdbe(pParse); - if( v==0 ) return 1; + if( v==0 ) goto select_end; /* Set the limiter */ @@ -948,7 +949,7 @@ int sqliteSelect( sqliteVdbeAddOp(v, OP_OpenTemp, distinct, 1); } pWInfo = sqliteWhereBegin(pParse, pTabList, pWhere, 0); - if( pWInfo==0 ) return 1; + if( pWInfo==0 ) goto select_end; /* Use the standard inner loop if we are not dealing with ** aggregates @@ -956,7 +957,7 @@ int sqliteSelect( if( !isAgg ){ if( selectInnerLoop(pParse, pEList, 0, 0, pOrderBy, distinct, eDest, iParm, pWInfo->iContinue, pWInfo->iBreak) ){ - return 1; + goto select_end; } } @@ -1021,7 +1022,7 @@ int sqliteSelect( } if( selectInnerLoop(pParse, pEList, 0, 0, pOrderBy, distinct, eDest, iParm, startagg, endagg) ){ - return 1; + goto select_end; } sqliteVdbeAddOp(v, OP_Goto, 0, startagg); sqliteVdbeResolveLabel(v, endagg); @@ -1044,5 +1045,15 @@ int sqliteSelect( sqliteVdbeAddOp(v, OP_NullCallback, pEList->nExpr, 0); } - return 0; + /* The SELECT was successfully coded. Set the return code to 0 + ** to indicate no errors. + */ + rc = 0; + + /* Control jumps to here if an error is encountered above, or upon + ** successful coding of the SELECT. + */ +select_end: + sqliteAggregateInfoReset(pParse); + return rc; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 9a095b33f9..70be7c4308 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.84 2002/02/02 18:49:21 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.85 2002/02/17 00:30:36 drh Exp $ */ #include "sqlite.h" #include "hash.h" @@ -551,7 +551,6 @@ int sqliteFuncId(Token*); int sqliteExprResolveIds(Parse*, IdList*, ExprList*, Expr*); void sqliteExprResolveInSelect(Parse*, Expr*); int sqliteExprAnalyzeAggregates(Parse*, Expr*); -void sqliteParseInfoReset(Parse*); Vdbe *sqliteGetVdbe(Parse*); int sqliteRandomByte(void); int sqliteRandomInteger(void); diff --git a/src/tokenize.c b/src/tokenize.c index faeccb7593..18e2368567 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -15,7 +15,7 @@ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** -** $Id: tokenize.c,v 1.35 2002/02/14 21:42:51 drh Exp $ +** $Id: tokenize.c,v 1.36 2002/02/17 00:30:36 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -371,7 +371,6 @@ int sqliteRunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ db->flags &= ~SQLITE_Interrupt; pParse->rc = SQLITE_OK; i = 0; - sqliteParseInfoReset(pParse); pEngine = sqliteParserAlloc((void*(*)(int))malloc); if( pEngine==0 ){ sqliteSetString(pzErrMsg, "out of memory", 0); @@ -451,7 +450,6 @@ int sqliteRunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ sqliteDeleteTable(pParse->db, pParse->pNewTable); pParse->pNewTable = 0; } - sqliteParseInfoReset(pParse); if( nErr>0 && pParse->rc==SQLITE_OK ){ pParse->rc = SQLITE_ERROR; }