mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Enhance sqlite3FindInIndex() so that it is able to make use of the
primary keys at the end of an index. FossilOrigin-Name: 4b589fbfcc4265902de0f552961d2df497a184da
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
||||
C Fix\sa\spost-OOM\scrash\sin\supdateRangeAffinityStr().\s\sAdd\sseveral\sALWAYS()\nmacros\son\sunreachable\sbranches.
|
||||
D 2016-08-26T18:17:08.713
|
||||
C Enhance\ssqlite3FindInIndex()\sso\sthat\sit\sis\sable\sto\smake\suse\sof\sthe\nprimary\skeys\sat\sthe\send\sof\san\sindex.
|
||||
D 2016-08-26T19:31:29.011
|
||||
F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 5017381e4853b1472e01d5bb926be1268eba429c
|
||||
@@ -338,7 +338,7 @@ F src/ctime.c e77f3dc297b4b65c96da78b4ae4272fdfae863d7
|
||||
F src/date.c 95c9a8d00767e7221a8e9a31f4e913fc8029bf6b
|
||||
F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d
|
||||
F src/delete.c 76c084f0265f4a3cd1ecf17eee112a94f1ccbc05
|
||||
F src/expr.c 1f2ddbec8bf6de323cc0da3ff73e80b0ad21769d
|
||||
F src/expr.c 192dac6da7ff380fde35861d3f9d40bab39fab2c
|
||||
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
|
||||
F src/fkey.c e2be0968c1adc679c87e467aa5b4f167588f38a8
|
||||
F src/func.c 29cc9acb170ec1387b9f63eb52cd85f8de96c771
|
||||
@@ -1521,7 +1521,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P b34413ac7e34369b4420e57b0132249dca68a7b0
|
||||
R e94f28a1c30d92b873747a9f1cb33b94
|
||||
P 87d40195ae5cc2abd9bae45073a615db81263285
|
||||
R c0ed51d5af8253a23448fcfb693a50e8
|
||||
U drh
|
||||
Z a3a8a387b6b2455df60af55b1e2df964
|
||||
Z 3b9104524847b85ed5a08921e98408a8
|
||||
|
||||
@@ -1 +1 @@
|
||||
87d40195ae5cc2abd9bae45073a615db81263285
|
||||
4b589fbfcc4265902de0f552961d2df497a184da
|
||||
24
src/expr.c
24
src/expr.c
@@ -2099,11 +2099,11 @@ static int sqlite3InRhsIsConstant(Expr *pIn){
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_SUBQUERY
|
||||
int sqlite3FindInIndex(
|
||||
Parse *pParse,
|
||||
Expr *pX,
|
||||
u32 inFlags,
|
||||
int *prRhsHasNull,
|
||||
int *aiMap
|
||||
Parse *pParse, /* Parsing context */
|
||||
Expr *pX, /* The right-hand side (RHS) of the IN operator */
|
||||
u32 inFlags, /* IN_INDEX_LOOP, _MEMBERSHIP, and/or _NOOP_OK */
|
||||
int *prRhsHasNull, /* Register holding NULL status. See notes */
|
||||
int *aiMap /* Mapping from Index fields to RHS fields */
|
||||
){
|
||||
Select *p; /* SELECT to the right of IN operator */
|
||||
int eType = 0; /* Type of RHS table. IN_INDEX_* */
|
||||
@@ -2200,9 +2200,13 @@ int sqlite3FindInIndex(
|
||||
** to this collation sequence. */
|
||||
|
||||
for(pIdx=pTab->pIndex; pIdx && eType==0 && affinity_ok; pIdx=pIdx->pNext){
|
||||
if( pIdx->nKeyCol<nExpr ) continue;
|
||||
if( mustBeUnique && (pIdx->nKeyCol!=nExpr || !IsUniqueIndex(pIdx)) ){
|
||||
continue;
|
||||
if( pIdx->nColumn<nExpr ) continue;
|
||||
if( mustBeUnique ){
|
||||
if( pIdx->nKeyCol>nExpr
|
||||
||(pIdx->nColumn>nExpr && !IsUniqueIndex(pIdx))
|
||||
){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i<nExpr; i++){
|
||||
@@ -2211,11 +2215,11 @@ int sqlite3FindInIndex(
|
||||
CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
|
||||
int j;
|
||||
|
||||
if( pReq==0 ) break;
|
||||
|
||||
assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr );
|
||||
for(j=0; j<nExpr; j++){
|
||||
if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue;
|
||||
assert( pIdx->azColl[j] );
|
||||
if( pReq==0 ) continue;
|
||||
if( sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ) continue;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user