mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-19 21:43:15 +03:00
Fix the constructAutomaticIndex() routine so that it works with NGQP.
FossilOrigin-Name: 5e1e61399513b4a95fd93df2377a2603f1670063
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Improvements\sto\sthe\sORDER\sBY\ssuppressor\sin\sthe\sNGQP.
|
C Fix\sthe\sconstructAutomaticIndex()\sroutine\sso\sthat\sit\sworks\swith\sNGQP.
|
||||||
D 2013-05-30T23:21:20.132
|
D 2013-05-31T11:57:39.405
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
|
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -289,7 +289,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
|
|||||||
F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d
|
F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d
|
||||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||||
F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
|
F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
|
||||||
F src/where.c 38beadcfdf477b0f9a07c4d0a479ab522843b14c
|
F src/where.c 530dd22d4f803747e964edcb052d699c4c92e1a1
|
||||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
|
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
|
||||||
@@ -1093,7 +1093,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||||
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
||||||
P a51d8c92496436488e1a6eabd85785e8fedf2736
|
P 24a2e9ddcecd3926817d77abbb75d068ee7140ad
|
||||||
R 405146591851ecbfbac166e3c1b2db18
|
R 92deaa75392a3f586cae6bde8f65a470
|
||||||
U drh
|
U drh
|
||||||
Z 4964f74ab7b0cf98172fb87fb30a1333
|
Z 293d3cdab228aa747c73a2994c326e63
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
24a2e9ddcecd3926817d77abbb75d068ee7140ad
|
5e1e61399513b4a95fd93df2377a2603f1670063
|
||||||
12
src/where.c
12
src/where.c
@@ -1850,6 +1850,7 @@ static void constructAutomaticIndex(
|
|||||||
WhereLoop *pLoop; /* The Loop object */
|
WhereLoop *pLoop; /* The Loop object */
|
||||||
Bitmask idxCols; /* Bitmap of columns used for indexing */
|
Bitmask idxCols; /* Bitmap of columns used for indexing */
|
||||||
Bitmask extraCols; /* Bitmap of additional columns */
|
Bitmask extraCols; /* Bitmap of additional columns */
|
||||||
|
const int mxConstraint = 10; /* Maximum number of constraints */
|
||||||
|
|
||||||
/* Generate code to skip over the creation and initialization of the
|
/* Generate code to skip over the creation and initialization of the
|
||||||
** transient index on 2nd and subsequent iterations of the loop. */
|
** transient index on 2nd and subsequent iterations of the loop. */
|
||||||
@@ -1864,20 +1865,25 @@ static void constructAutomaticIndex(
|
|||||||
pWCEnd = &pWC->a[pWC->nTerm];
|
pWCEnd = &pWC->a[pWC->nTerm];
|
||||||
pLoop = pLevel->pWLoop;
|
pLoop = pLevel->pWLoop;
|
||||||
idxCols = 0;
|
idxCols = 0;
|
||||||
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
|
pLoop->aTerm = sqlite3DbRealloc(pParse->db, pLoop->aTerm,
|
||||||
|
mxConstraint*sizeof(pLoop->aTerm[0]));
|
||||||
|
if( pLoop->aTerm==0 ) return;
|
||||||
|
for(pTerm=pWC->a; pTerm<pWCEnd && pLoop->nTerm<mxConstraint; pTerm++){
|
||||||
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
|
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
|
||||||
int iCol = pTerm->u.leftColumn;
|
int iCol = pTerm->u.leftColumn;
|
||||||
Bitmask cMask = iCol>=BMS ? ((Bitmask)1)<<(BMS-1) : ((Bitmask)1)<<iCol;
|
Bitmask cMask = iCol>=BMS ? ((Bitmask)1)<<(BMS-1) : ((Bitmask)1)<<iCol;
|
||||||
testcase( iCol==BMS );
|
testcase( iCol==BMS );
|
||||||
testcase( iCol==BMS-1 );
|
testcase( iCol==BMS-1 );
|
||||||
if( (idxCols & cMask)==0 ){
|
if( (idxCols & cMask)==0 ){
|
||||||
nColumn++;
|
pLoop->aTerm[nColumn++] = pTerm;
|
||||||
idxCols |= cMask;
|
idxCols |= cMask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert( nColumn>0 );
|
assert( nColumn>0 );
|
||||||
pLoop->u.btree.nEq = nColumn;
|
pLoop->u.btree.nEq = pLoop->nTerm = nColumn;
|
||||||
|
pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED
|
||||||
|
| WHERE_TEMP_INDEX;
|
||||||
|
|
||||||
/* Count the number of additional columns needed to create a
|
/* Count the number of additional columns needed to create a
|
||||||
** covering index. A "covering index" is an index that contains all
|
** covering index. A "covering index" is an index that contains all
|
||||||
|
|||||||
Reference in New Issue
Block a user