mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-06 15:49:35 +03:00
Add evidence marks to the where.c source file. Comment only - no code changes.
FossilOrigin-Name: f3f9e8e5bb90cc36e0d63a7289a8acf534c5fa2a
This commit is contained in:
24
manifest
24
manifest
@@ -1,5 +1,8 @@
|
|||||||
C Make\sthe\ssqlite3_db_status()\sroutine\sthreadsafe.
|
-----BEGIN PGP SIGNED MESSAGE-----
|
||||||
D 2010-07-22T17:55:40
|
Hash: SHA1
|
||||||
|
|
||||||
|
C Add\sevidence\smarks\sto\sthe\swhere.c\ssource\sfile.\s\sComment\sonly\s-\sno\scode\schanges.
|
||||||
|
D 2010-07-22T22:40:04
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
|
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -230,7 +233,7 @@ F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
|
|||||||
F src/wal.c 0925601f3299c2941a67c9cfff41ee710f70ca82
|
F src/wal.c 0925601f3299c2941a67c9cfff41ee710f70ca82
|
||||||
F src/wal.h 906c85760598b18584921fe08008435aa4eeeeb2
|
F src/wal.h 906c85760598b18584921fe08008435aa4eeeeb2
|
||||||
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
|
||||||
F src/where.c 19a0f80a759ef288ed925e64944bbbbae3215abf
|
F src/where.c 62262cee281c859ae136a40371f68a869b59ea1a
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
|
F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
|
||||||
F test/all.test 6745008c144bd2956d58864d21f7b304689c1cce
|
F test/all.test 6745008c144bd2956d58864d21f7b304689c1cce
|
||||||
@@ -838,7 +841,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
|||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P 9f932655f9eb9fdab16d7deed98b7cad414e0ca6
|
P 241f7bd190329fa02ca428651072a4a206132eab
|
||||||
R f4b6bdde71d0ed3e7ea8f2e2fea940cb
|
R 58c9336648eb3ce384b25cb1a31df81e
|
||||||
U dan
|
U drh
|
||||||
Z 79b01e4fa7fd5fb80263b4c4dd7b3da4
|
Z 05893823ee3052eca076f0070c9d2946
|
||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
Version: GnuPG v1.4.6 (GNU/Linux)
|
||||||
|
|
||||||
|
iD8DBQFMSMjIoxKgR168RlERAotrAJwKX5P9bHGJ1mEEtboK6UGGgyWioQCgi8M5
|
||||||
|
Adn9/cSJE8bR6eO9+n8ekCg=
|
||||||
|
=4n2n
|
||||||
|
-----END PGP SIGNATURE-----
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
241f7bd190329fa02ca428651072a4a206132eab
|
f3f9e8e5bb90cc36e0d63a7289a8acf534c5fa2a
|
||||||
32
src/where.c
32
src/where.c
@@ -327,6 +327,7 @@ static void whereClauseClear(WhereClause *pWC){
|
|||||||
static int whereClauseInsert(WhereClause *pWC, Expr *p, u8 wtFlags){
|
static int whereClauseInsert(WhereClause *pWC, Expr *p, u8 wtFlags){
|
||||||
WhereTerm *pTerm;
|
WhereTerm *pTerm;
|
||||||
int idx;
|
int idx;
|
||||||
|
testcase( wtFlags & TERM_VIRTUAL ); /* EV: R-00211-15100 */
|
||||||
if( pWC->nTerm>=pWC->nSlot ){
|
if( pWC->nTerm>=pWC->nSlot ){
|
||||||
WhereTerm *pOld = pWC->a;
|
WhereTerm *pOld = pWC->a;
|
||||||
sqlite3 *db = pWC->pParse->db;
|
sqlite3 *db = pWC->pParse->db;
|
||||||
@@ -472,6 +473,13 @@ static Bitmask exprSelectTableUsage(WhereMaskSet *pMaskSet, Select *pS){
|
|||||||
** Return TRUE if the given operator is one of the operators that is
|
** Return TRUE if the given operator is one of the operators that is
|
||||||
** allowed for an indexable WHERE clause term. The allowed operators are
|
** allowed for an indexable WHERE clause term. The allowed operators are
|
||||||
** "=", "<", ">", "<=", ">=", and "IN".
|
** "=", "<", ">", "<=", ">=", and "IN".
|
||||||
|
**
|
||||||
|
** IMPLEMENTATION-OF: R-59926-26393 To be usable by an index a term must be
|
||||||
|
** of one of the following forms: column = expression column > expression
|
||||||
|
** column >= expression column < expression column <= expression
|
||||||
|
** expression = column expression > column expression >= column
|
||||||
|
** expression < column expression <= column column IN
|
||||||
|
** (expression-list) column IN (subquery) column IS NULL
|
||||||
*/
|
*/
|
||||||
static int allowedOp(int op){
|
static int allowedOp(int op){
|
||||||
assert( TK_GT>TK_EQ && TK_GT<TK_GE );
|
assert( TK_GT>TK_EQ && TK_GT<TK_GE );
|
||||||
@@ -1016,6 +1024,8 @@ static void exprAnalyzeOrTerm(
|
|||||||
/* At this point, okToChngToIN is true if original pTerm satisfies
|
/* At this point, okToChngToIN is true if original pTerm satisfies
|
||||||
** case 1. In that case, construct a new virtual term that is
|
** case 1. In that case, construct a new virtual term that is
|
||||||
** pTerm converted into an IN operator.
|
** pTerm converted into an IN operator.
|
||||||
|
**
|
||||||
|
** EV: R-00211-15100
|
||||||
*/
|
*/
|
||||||
if( okToChngToIN ){
|
if( okToChngToIN ){
|
||||||
Expr *pDup; /* A transient duplicate expression */
|
Expr *pDup; /* A transient duplicate expression */
|
||||||
@@ -1247,7 +1257,8 @@ static void exprAnalyze(
|
|||||||
** inequality. To avoid this, make sure to also run the full
|
** inequality. To avoid this, make sure to also run the full
|
||||||
** LIKE on all candidate expressions by clearing the isComplete flag
|
** LIKE on all candidate expressions by clearing the isComplete flag
|
||||||
*/
|
*/
|
||||||
if( c=='A'-1 ) isComplete = 0;
|
if( c=='A'-1 ) isComplete = 0; /* EV: R-64339-08207 */
|
||||||
|
|
||||||
|
|
||||||
c = sqlite3UpperToLower[c];
|
c = sqlite3UpperToLower[c];
|
||||||
}
|
}
|
||||||
@@ -2879,6 +2890,9 @@ static void bestIndex(
|
|||||||
** in the ON clause. The term is disabled in (3) because it is not part
|
** in the ON clause. The term is disabled in (3) because it is not part
|
||||||
** of a LEFT OUTER JOIN. In (1), the term is not disabled.
|
** of a LEFT OUTER JOIN. In (1), the term is not disabled.
|
||||||
**
|
**
|
||||||
|
** IMPLEMENTATION-OF: R-24597-58655 No tests are done for terms that are
|
||||||
|
** completely satisfied by indices.
|
||||||
|
**
|
||||||
** Disabling a term causes that term to not be tested in the inner loop
|
** Disabling a term causes that term to not be tested in the inner loop
|
||||||
** of the join. Disabling is an optimization. When terms are satisfied
|
** of the join. Disabling is an optimization. When terms are satisfied
|
||||||
** by indices, we disable them to prevent redundant tests in the inner
|
** by indices, we disable them to prevent redundant tests in the inner
|
||||||
@@ -3090,6 +3104,7 @@ static int codeAllEqualityTerms(
|
|||||||
/* The following true for indices with redundant columns.
|
/* The following true for indices with redundant columns.
|
||||||
** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */
|
** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */
|
||||||
testcase( (pTerm->wtFlags & TERM_CODED)!=0 );
|
testcase( (pTerm->wtFlags & TERM_CODED)!=0 );
|
||||||
|
testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
|
||||||
r1 = codeEqualityTerm(pParse, pTerm, pLevel, regBase+j);
|
r1 = codeEqualityTerm(pParse, pTerm, pLevel, regBase+j);
|
||||||
if( r1!=regBase+j ){
|
if( r1!=regBase+j ){
|
||||||
if( nReg==1 ){
|
if( nReg==1 ){
|
||||||
@@ -3233,6 +3248,7 @@ static Bitmask codeOneLoopStart(
|
|||||||
assert( pTerm->pExpr!=0 );
|
assert( pTerm->pExpr!=0 );
|
||||||
assert( pTerm->leftCursor==iCur );
|
assert( pTerm->leftCursor==iCur );
|
||||||
assert( omitTable==0 );
|
assert( omitTable==0 );
|
||||||
|
testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
|
||||||
iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, iReleaseReg);
|
iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, iReleaseReg);
|
||||||
addrNxt = pLevel->addrNxt;
|
addrNxt = pLevel->addrNxt;
|
||||||
sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt);
|
sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt);
|
||||||
@@ -3273,6 +3289,7 @@ static Bitmask codeOneLoopStart(
|
|||||||
assert( TK_LT==TK_GT+2 ); /* ... of the TK_xx values... */
|
assert( TK_LT==TK_GT+2 ); /* ... of the TK_xx values... */
|
||||||
assert( TK_GE==TK_GT+3 ); /* ... is correcct. */
|
assert( TK_GE==TK_GT+3 ); /* ... is correcct. */
|
||||||
|
|
||||||
|
testcase( pStart->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
|
||||||
pX = pStart->pExpr;
|
pX = pStart->pExpr;
|
||||||
assert( pX!=0 );
|
assert( pX!=0 );
|
||||||
assert( pStart->leftCursor==iCur );
|
assert( pStart->leftCursor==iCur );
|
||||||
@@ -3290,6 +3307,7 @@ static Bitmask codeOneLoopStart(
|
|||||||
pX = pEnd->pExpr;
|
pX = pEnd->pExpr;
|
||||||
assert( pX!=0 );
|
assert( pX!=0 );
|
||||||
assert( pEnd->leftCursor==iCur );
|
assert( pEnd->leftCursor==iCur );
|
||||||
|
testcase( pEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
|
||||||
memEndValue = ++pParse->nMem;
|
memEndValue = ++pParse->nMem;
|
||||||
sqlite3ExprCode(pParse, pX->pRight, memEndValue);
|
sqlite3ExprCode(pParse, pX->pRight, memEndValue);
|
||||||
if( pX->op==TK_LT || pX->op==TK_GT ){
|
if( pX->op==TK_LT || pX->op==TK_GT ){
|
||||||
@@ -3457,6 +3475,7 @@ static Bitmask codeOneLoopStart(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
nConstraint++;
|
nConstraint++;
|
||||||
|
testcase( pRangeStart->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
|
||||||
}else if( isMinQuery ){
|
}else if( isMinQuery ){
|
||||||
sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
|
sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
|
||||||
nConstraint++;
|
nConstraint++;
|
||||||
@@ -3496,6 +3515,7 @@ static Bitmask codeOneLoopStart(
|
|||||||
}
|
}
|
||||||
codeApplyAffinity(pParse, regBase, nEq+1, zEndAff);
|
codeApplyAffinity(pParse, regBase, nEq+1, zEndAff);
|
||||||
nConstraint++;
|
nConstraint++;
|
||||||
|
testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
|
||||||
}
|
}
|
||||||
sqlite3DbFree(pParse->db, zStartAff);
|
sqlite3DbFree(pParse->db, zStartAff);
|
||||||
sqlite3DbFree(pParse->db, zEndAff);
|
sqlite3DbFree(pParse->db, zEndAff);
|
||||||
@@ -3702,11 +3722,15 @@ static Bitmask codeOneLoopStart(
|
|||||||
|
|
||||||
/* Insert code to test every subexpression that can be completely
|
/* Insert code to test every subexpression that can be completely
|
||||||
** computed using the current set of tables.
|
** computed using the current set of tables.
|
||||||
|
**
|
||||||
|
** IMPLEMENTATION-OF: R-49525-50935 Terms that cannot be satisfied through
|
||||||
|
** the use of indices become tests that are evaluated against each row of
|
||||||
|
** the relevant input tables.
|
||||||
*/
|
*/
|
||||||
k = 0;
|
k = 0;
|
||||||
for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
|
for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
|
||||||
Expr *pE;
|
Expr *pE;
|
||||||
testcase( pTerm->wtFlags & TERM_VIRTUAL );
|
testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* IMP: R-30575-11662 */
|
||||||
testcase( pTerm->wtFlags & TERM_CODED );
|
testcase( pTerm->wtFlags & TERM_CODED );
|
||||||
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
|
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
|
||||||
if( (pTerm->prereqAll & notReady)!=0 ){
|
if( (pTerm->prereqAll & notReady)!=0 ){
|
||||||
@@ -3734,7 +3758,7 @@ static Bitmask codeOneLoopStart(
|
|||||||
VdbeComment((v, "record LEFT JOIN hit"));
|
VdbeComment((v, "record LEFT JOIN hit"));
|
||||||
sqlite3ExprCacheClear(pParse);
|
sqlite3ExprCacheClear(pParse);
|
||||||
for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){
|
for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){
|
||||||
testcase( pTerm->wtFlags & TERM_VIRTUAL );
|
testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* IMP: R-30575-11662 */
|
||||||
testcase( pTerm->wtFlags & TERM_CODED );
|
testcase( pTerm->wtFlags & TERM_CODED );
|
||||||
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
|
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
|
||||||
if( (pTerm->prereqAll & notReady)!=0 ){
|
if( (pTerm->prereqAll & notReady)!=0 ){
|
||||||
@@ -3952,7 +3976,7 @@ WhereInfo *sqlite3WhereBegin(
|
|||||||
initMaskSet(pMaskSet);
|
initMaskSet(pMaskSet);
|
||||||
whereClauseInit(pWC, pParse, pMaskSet);
|
whereClauseInit(pWC, pParse, pMaskSet);
|
||||||
sqlite3ExprCodeConstants(pParse, pWhere);
|
sqlite3ExprCodeConstants(pParse, pWhere);
|
||||||
whereSplit(pWC, pWhere, TK_AND);
|
whereSplit(pWC, pWhere, TK_AND); /* IMP: R-15842-53296 */
|
||||||
|
|
||||||
/* Special case: a WHERE clause that is constant. Evaluate the
|
/* Special case: a WHERE clause that is constant. Evaluate the
|
||||||
** expression and either jump over all of the code or fall thru.
|
** expression and either jump over all of the code or fall thru.
|
||||||
|
|||||||
Reference in New Issue
Block a user