diff options
author | drh <drh@noemail.net> | 2014-01-02 21:05:10 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2014-01-02 21:05:10 +0000 |
commit | 759e8588117ef04a0ef331b0128e2a684049f00c (patch) | |
tree | 923ed01f4f2b5503d41e0b7c26f388df31d5ca83 /src | |
parent | 762c1c4071bbc4c73ec1aa70d017ee0e9c03d729 (diff) | |
download | sqlite-759e8588117ef04a0ef331b0128e2a684049f00c.tar.gz sqlite-759e8588117ef04a0ef331b0128e2a684049f00c.zip |
Try to factor constant subcomponents of the WHERE clause out of the loop.
FossilOrigin-Name: 9d05777fe24e1a5ce71762de38db840931ef0bc8
Diffstat (limited to 'src')
-rw-r--r-- | src/where.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/where.c b/src/where.c index 59028b992..0acc0db53 100644 --- a/src/where.c +++ b/src/where.c @@ -5430,9 +5430,12 @@ WhereInfo *sqlite3WhereBegin( /* Special case: a WHERE clause that is constant. Evaluate the ** expression and either jump over all of the code or fall thru. */ - if( pWhere && (nTabList==0 || sqlite3ExprIsConstantNotJoin(pWhere)) ){ - sqlite3ExprIfFalse(pParse, pWhere, pWInfo->iBreak, SQLITE_JUMPIFNULL); - pWhere = 0; + for(ii=0; ii<sWLB.pWC->nTerm; ii++){ + if( nTabList==0 || sqlite3ExprIsConstantNotJoin(sWLB.pWC->a[ii].pExpr) ){ + sqlite3ExprIfFalse(pParse, sWLB.pWC->a[ii].pExpr, pWInfo->iBreak, + SQLITE_JUMPIFNULL); + sWLB.pWC->a[ii].wtFlags |= TERM_CODED; + } } /* Special case: No FROM clause |