From: drh Date: Thu, 8 Jun 2000 00:19:02 +0000 (+0000) Subject: :-) (CVS 75) X-Git-Tag: version-3.6.10~6025 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10e5e3cfde6277d96804dfc373dae2f78f31f613;p=thirdparty%2Fsqlite.git :-) (CVS 75) FossilOrigin-Name: c47d552e7e275dcc03a687e2a874e8e6e1eeb109 --- diff --git a/manifest b/manifest index f1d58fb447..d013426422 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C :-)\s(CVS\s74) -D 2000-06-07T23:51:50 +C :-)\s(CVS\s75) +D 2000-06-08T00:19:03 F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4 F Makefile.in 17ba1ccf8d2d40c627796bba8f72952365d6d644 F README 51f6a4e7408b34afa5bc1c0485f61b6a4efb6958 @@ -14,7 +14,7 @@ F src/expr.c baa8a4229b3acf69d908efcd697ab63922009c9f F src/insert.c ac4edfff474589c00b2490f206317dc5822122e5 F src/main.c e3297835b8e38ca726ac73f2c2bdb7cf08103197 F src/parse.y bb2126c8313c111184b89af8675911dcb57f1dca -F src/select.c 21d1097e32e0a8430c286309817be33b734eab9d +F src/select.c 409c38858024a4bf7d046e0aa387900fb742f70b F src/shell.c 3f4afc39a36e4824e8aa262623fd03568874799e F src/sqlite.h 58da0a8590133777b741f9836beaef3d58f40268 F src/sqliteInt.h 816c491f9896090dde03804fd3f60346456b99df @@ -54,7 +54,7 @@ F www/c_interface.tcl 9ac800854272db5fe439e07b7435b243a5422293 F www/changes.tcl 04e66b4257589ff78a7e1de93e9dda4725fb03d6 F www/index.tcl 52e29a4eeda8d59e91af43c61fef177c5f2ffd53 F www/sqlite.tcl 2f933ce18cffd34a0a020a82435ab937137970fd -P a00b81b0e1878487a6edaaca1b0dff002ad506d8 -R edeb782218e986f032924498f63df3c4 +P 2ffeb8509c469f5a499d56bb109da079fcdff570 +R 34a6f329df3d735505a6a2ab126209c9 U drh -Z e7171fdd9bf45a1d225b747155ebb197 +Z e59795bced83ef8a6bbccbb701b0703f diff --git a/manifest.uuid b/manifest.uuid index adde17c19d..75dad7e29c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2ffeb8509c469f5a499d56bb109da079fcdff570 \ No newline at end of file +c47d552e7e275dcc03a687e2a874e8e6e1eeb109 \ No newline at end of file diff --git a/src/select.c b/src/select.c index d524b1a17e..150bea9861 100644 --- a/src/select.c +++ b/src/select.c @@ -24,7 +24,7 @@ ** This file contains C code routines that are called by the parser ** to handle SELECT statements. ** -** $Id: select.c,v 1.16 2000/06/07 23:51:50 drh Exp $ +** $Id: select.c,v 1.17 2000/06/08 00:19:03 drh Exp $ */ #include "sqliteInt.h" @@ -429,9 +429,10 @@ Vdbe *sqliteGetVdbe(Parse *pParse){ ** or intersection of two or more separate queries. */ static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){ - int rc; - Select *pPrior; - Vdbe *v; + int rc; /* Success code from a subroutine */ + Select *pPrior; /* Another SELECT immediately to our left */ + Vdbe *v; /* Generate code to this VDBE */ + int base; /* Baseline value for pParse->nTab */ /* Make sure there is no ORDER BY clause on prior SELECTs. Only the ** last SELECT in the series may have an ORDER BY. @@ -452,6 +453,7 @@ static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){ /* Process the UNION or INTERSECTION */ + base = pParse->nTab; switch( p->op ){ case TK_ALL: case TK_EXCEPT: @@ -580,6 +582,7 @@ static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){ pParse->nErr++; return 1; } + pParse->nTab = base; return 0; } @@ -626,6 +629,7 @@ int sqliteSelect( Expr *pHaving; /* The HAVING clause. May be NULL */ 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 */ /* If there is are a sequence of queries, do the earlier ones first. */ @@ -642,11 +646,16 @@ int sqliteSelect( pHaving = p->pHaving; isDistinct = p->isDistinct; + /* Save the current value of pParse->nTab. Restore this value before + ** we exit. + */ + base = pParse->nTab; + /* ** Do not even attempt to generate any code if we have already seen ** errors before this routine starts. */ - if( pParse->nErr>0 ) return 0; + if( pParse->nErr>0 ) return 1; sqliteParseInfoReset(pParse); /* Look up every table in the table list and create an appropriate @@ -702,7 +711,11 @@ int sqliteSelect( } if( pHaving ) sqliteExprResolveInSelect(pParse, pHaving); - /* Resolve the field names and do a semantics check on all the expressions. + /* At this point, we should have allocated all the cursors that we + ** need to handle subquerys and temporary tables. From here on we + ** are committed to keeping the same value for pParse->nTab. + ** + ** Resolve the field names and do a semantics check on all the expressions. */ for(i=0; inExpr; i++){ if( sqliteExprResolveIds(pParse, pTabList, pEList->a[i].pExpr) ){ @@ -918,5 +931,6 @@ int sqliteSelect( if( pOrderBy ){ generateSortTail(v, pEList->nExpr); } + pParse->nTab = base; return 0; }