From: drh Date: Mon, 24 Sep 2012 19:50:00 +0000 (+0000) Subject: Remove an unused subfunction parameter and an obsolete comment from the X-Git-Tag: version-3.7.15~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d85fa760f28582b4482e98878f7777f8d1fa873;p=thirdparty%2Fsqlite.git Remove an unused subfunction parameter and an obsolete comment from the query planner logic in where.c. FossilOrigin-Name: 349a55cd8ba9ce65ebfd987ecfebd1204f7d0a85 --- diff --git a/manifest b/manifest index 534ea306e5..2e6bf42149 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\sinternal\ssqlite3WhereBegin()\sto\sreport\sthat\sthe\sORDER\sBY\sclause\nis\ssatisfied\sby\sindices\susing\sthe\sWhereInfo.nOBSat\sfield\sof\sthe\sreturned\nstructure. -D 2012-09-24T15:30:54.533 +C Remove\san\sunused\ssubfunction\sparameter\sand\san\sobsolete\scomment\sfrom\sthe\nquery\splanner\slogic\sin\swhere.c. +D 2012-09-24T19:50:00.842 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5f4f26109f9d80829122e0e09f9cda008fa065fb F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -249,7 +249,7 @@ F src/vtab.c d8020c0a0e8ccc490ca449d7e665311b6e9f3ba9 F src/wal.c 5acb3e7bbd31f10ba39acad9ce6b399055337a9d F src/wal.h 29c197540b19044e6cd73487017e5e47a1d3dac6 F src/walker.c 3d75ba73de15e0f8cd0737643badbeb0e002f07b -F src/where.c af126a6cdb290c2d79ef18bb41bbca949c9cad61 +F src/where.c 40708330a0e9bf79c0ab97109b8014fa04cce858 F test/8_3_names.test 631ea964a3edb091cf73c3b540f6bcfdb36ce823 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/aggnested.test 0be144b453e0622a085fae8665c32f5676708e00 @@ -1016,7 +1016,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9 -P e081890cd77ad8de4bf55a8f8cf9d63bfaaf8218 -R 4ad3ce4fdebd545cd663ab5469164871 +P 22989f3588531efd555cc29d6c576e7a34b7edc4 +R af274415395e47bec73279dd70f3872e U drh -Z 1dbcfbc31e18555fa81506ef779ada01 +Z 2c59ca6ec247c019d5fe7043b4d83355 diff --git a/manifest.uuid b/manifest.uuid index 79fb09f471..2d6a191e78 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -22989f3588531efd555cc29d6c576e7a34b7edc4 \ No newline at end of file +349a55cd8ba9ce65ebfd987ecfebd1204f7d0a85 \ No newline at end of file diff --git a/src/where.c b/src/where.c index ba885f1304..85fb1ed4f0 100644 --- a/src/where.c +++ b/src/where.c @@ -1813,7 +1813,7 @@ static void TRACE_IDX_OUTPUTS(sqlite3_index_info *p){ */ static void bestIndex( Parse*, WhereClause*, struct SrcList_item*, - Bitmask, Bitmask, ExprList*, WhereCost*); + Bitmask, Bitmask, WhereCost*); /* ** This routine attempts to find an scanning strategy that can be used @@ -1867,7 +1867,7 @@ static void bestOrClauseIndex( )); if( pOrTerm->eOperator==WO_AND ){ WhereClause *pAndWC = &pOrTerm->u.pAndInfo->wc; - bestIndex(pParse, pAndWC, pSrc, notReady, notValid, 0, &sTermCost); + bestIndex(pParse, pAndWC, pSrc, notReady, notValid, &sTermCost); }else if( pOrTerm->leftCursor==iCur ){ WhereClause tempWC; tempWC.pParse = pWC->pParse; @@ -1877,7 +1877,7 @@ static void bestOrClauseIndex( tempWC.a = pOrTerm; tempWC.wctrlFlags = 0; tempWC.nTerm = 1; - bestIndex(pParse, &tempWC, pSrc, notReady, notValid, 0, &sTermCost); + bestIndex(pParse, &tempWC, pSrc, notReady, notValid, &sTermCost); }else{ continue; } @@ -3388,6 +3388,12 @@ static void bestBtreeIndex( ** best query plan and its cost into the WhereCost object supplied ** as the last parameter. This function may calculate the cost of ** both real and virtual table scans. +** +** This function does not take ORDER BY or DISTINCT into account. Nor +** does it remember the virtual table query plan. All it does is compute +** the cost while determining if an OR optimization is applicable. The +** details will be reconsidered later if the optimization is found to be +** applicable. */ static void bestIndex( Parse *pParse, /* The parsing context */ @@ -3395,13 +3401,12 @@ static void bestIndex( struct SrcList_item *pSrc, /* The FROM clause term to search */ Bitmask notReady, /* Mask of cursors not available for indexing */ Bitmask notValid, /* Cursors not available for any purpose */ - ExprList *pOrderBy, /* The ORDER BY clause */ WhereCost *pCost /* Lowest cost query plan */ ){ #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pSrc->pTab) ){ sqlite3_index_info *p = 0; - bestVirtualIndex(pParse, pWC, pSrc, notReady, notValid, pOrderBy, pCost,&p); + bestVirtualIndex(pParse, pWC, pSrc, notReady, notValid, 0, pCost, &p); if( p->needToFreeIdxStr ){ sqlite3_free(p->idxStr); } @@ -3409,7 +3414,7 @@ static void bestIndex( }else #endif { - bestBtreeIndex(pParse, pWC, pSrc, notReady, notValid, pOrderBy, 0, pCost); + bestBtreeIndex(pParse, pWC, pSrc, notReady, notValid, 0, 0, pCost); } } @@ -4698,7 +4703,7 @@ WhereInfo *sqlite3WhereBegin( WhereMaskSet *pMaskSet; /* The expression mask set */ WhereClause *pWC; /* Decomposition of the WHERE clause */ struct SrcList_item *pTabItem; /* A single entry from pTabList */ - WhereLevel *pLevel; /* A single level in the pWInfo list */ + WhereLevel *pLevel; /* A single level in pWInfo->a[] */ int iFrom; /* First unused FROM clause element */ int andFlags; /* AND-ed combination of all pWC->a[].wtFlags */ sqlite3 *db; /* Database connection */ @@ -4994,7 +4999,6 @@ WhereInfo *sqlite3WhereBegin( WHERETRACE(("*** Optimizer selects table %d for loop %d" " with cost=%g and nRow=%g\n", bestJ, pLevel-pWInfo->a, bestPlan.rCost, bestPlan.plan.nRow)); - /* The ALWAYS() that follows was added to hush up clang scan-build */ if( (bestPlan.plan.wsFlags & WHERE_ORDERBY)!=0 ){ pWInfo->nOBSat = pOrderBy->nExpr; }