Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | New assert() statements in the rowvalue IN expression processing. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
00c328317473cee8fd7bd92c58409a35 |
User & Date: | drh 2017-11-17 17:32:40.141 |
Context
2017-11-17
| ||
20:07 | Add some missing "finish_test" lines to the end of test scripts. (check-in: c21406ab32 user: dan tags: trunk) | |
17:32 | New assert() statements in the rowvalue IN expression processing. (check-in: 00c3283174 user: drh tags: trunk) | |
15:02 | Clarification of comments on sqlite3FindInIndex(). No changes to code. (check-in: 071cabd23c user: drh tags: trunk) | |
Changes
Changes to src/wherecode.c.
︙ | ︙ | |||
372 373 374 375 376 377 378 379 380 381 382 383 384 385 | if( sqlite3CompareAffinity(p, zAff[i])==SQLITE_AFF_BLOB || sqlite3ExprNeedsNoAffinityChange(p, zAff[i]) ){ zAff[i] = SQLITE_AFF_BLOB; } } } /* ** Generate code for a single equality term of the WHERE clause. An equality ** term can be either X=expr or X IN (...). pTerm is the term to be ** coded. ** ** The current value for the constraint is left in a register, the index | > > > > > > > > > > > > > > > > > > > > > | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | if( sqlite3CompareAffinity(p, zAff[i])==SQLITE_AFF_BLOB || sqlite3ExprNeedsNoAffinityChange(p, zAff[i]) ){ zAff[i] = SQLITE_AFF_BLOB; } } } #ifdef SQLITE_DEBUG /* Return true if the pSub ExprList is a subset of pMain. The terms ** of pSub can be in a different order from pMain. The only requirement ** is that every term in pSub must exist somewhere in pMain. ** ** Return false if pSub contains any term that is not found in pMain. */ static int exprListSubset(ExprList *pSub, ExprList *pMain){ int i, j; for(i=0; i<pSub->nExpr; i++){ Expr *p = pSub->a[i].pExpr; for(j=0; j<pMain->nExpr; j++){ if( sqlite3ExprCompare(0, p, pMain->a[j].pExpr, 0)==0 ) break; } if( j>=pMain->nExpr ) return 0; } return 1; } #endif /* SQLITE_DEBUG */ /* ** Generate code for a single equality term of the WHERE clause. An equality ** term can be either X=expr or X IN (...). pTerm is the term to be ** coded. ** ** The current value for the constraint is left in a register, the index |
︙ | ︙ | |||
459 460 461 462 463 464 465 466 467 468 469 470 471 472 | Expr *pNewRhs = sqlite3ExprDup(db, pOrigRhs->a[iField].pExpr, 0); Expr *pNewLhs = sqlite3ExprDup(db, pOrigLhs->a[iField].pExpr, 0); pRhs = sqlite3ExprListAppend(pParse, pRhs, pNewRhs); pLhs = sqlite3ExprListAppend(pParse, pLhs, pNewLhs); } } if( !db->mallocFailed ){ Expr *pLeft = pX->pLeft; if( pSelect->pOrderBy ){ /* If the SELECT statement has an ORDER BY clause, zero the ** iOrderByCol variables. These are set to non-zero when an ** ORDER BY term exactly matches one of the terms of the | > > > > > > > > | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | Expr *pNewRhs = sqlite3ExprDup(db, pOrigRhs->a[iField].pExpr, 0); Expr *pNewLhs = sqlite3ExprDup(db, pOrigLhs->a[iField].pExpr, 0); pRhs = sqlite3ExprListAppend(pParse, pRhs, pNewRhs); pLhs = sqlite3ExprListAppend(pParse, pLhs, pNewLhs); } } /* pRhs should be a subset of pOrigRhs (though possibly in a different ** order). And pLhs should be a subset of pOrigLhs. To put it ** another way: Every term of pRhs should exist in pOrigRhs and ** every term of pLhs should exist in pOrigLhs. */ assert( db->mallocFailed || exprListSubset(pRhs, pOrigRhs) ); assert( db->mallocFailed || exprListSubset(pLhs, pOrigLhs) ); if( !db->mallocFailed ){ Expr *pLeft = pX->pLeft; if( pSelect->pOrderBy ){ /* If the SELECT statement has an ORDER BY clause, zero the ** iOrderByCol variables. These are set to non-zero when an ** ORDER BY term exactly matches one of the terms of the |
︙ | ︙ |