Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | :-) (CVS 19) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
03725ce5ae871247789ece0f2c3426f7 |
User & Date: | drh 2000-05-30 20:17:49.000 |
Context
2000-05-31
| ||
02:27 | :-) (CVS 20) (check-in: 01d85b35e9 user: drh tags: trunk) | |
2000-05-30
| ||
20:17 | :-) (CVS 19) (check-in: 03725ce5ae user: drh tags: trunk) | |
19:22 | :-) (CVS 18) (check-in: 2d41caec80 user: drh tags: trunk) | |
Changes
Changes to src/where.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 | ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. Also found here are subroutines ** to generate VDBE code to evaluate expressions. ** | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. Also found here are subroutines ** to generate VDBE code to evaluate expressions. ** ** $Id: where.c,v 1.3 2000/05/30 20:17:49 drh Exp $ */ #include "sqliteInt.h" /* ** The query generator uses an array of instances of this structure to ** help it analyze the subexpressions of the WHERE clause. Each WHERE ** clause subexpression is separated from the others by an AND operator. |
︙ | ︙ | |||
184 185 186 187 188 189 190 | } /* Figure out a good nesting order for the tables. aOrder[0] will ** be the index in pTabList of the outermost table. aOrder[1] will ** be the first nested loop and so on. aOrder[pTabList->nId-1] will ** be the innermost loop. ** | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | } /* Figure out a good nesting order for the tables. aOrder[0] will ** be the index in pTabList of the outermost table. aOrder[1] will ** be the first nested loop and so on. aOrder[pTabList->nId-1] will ** be the innermost loop. ** ** Someday will put in a good algorithm here to reorder the loops ** for an effiecient query. But for now, just use whatever order the ** tables appear in in the pTabList. */ for(i=0; i<pTabList->nId; i++){ aOrder[i] = i; } |
︙ | ︙ | |||
208 209 210 211 212 213 214 | for(i=0; i<pTabList->nId && i<ARRAYSIZE(aIdx); i++){ int idx = aOrder[i]; Table *pTab = pTabList->a[idx].pTab; Index *pIdx; Index *pBestIdx = 0; /* Do a search for usable indices. Leave pBestIdx pointing to | | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | for(i=0; i<pTabList->nId && i<ARRAYSIZE(aIdx); i++){ int idx = aOrder[i]; Table *pTab = pTabList->a[idx].pTab; Index *pIdx; Index *pBestIdx = 0; /* Do a search for usable indices. Leave pBestIdx pointing to ** the most specific usable index. ** ** "Most specific" means that pBestIdx is the usable index that ** has the largest value for nField. A usable index is one for ** which there are subexpressions to compute every field of the ** index. */ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |
︙ | ︙ | |||
251 252 253 254 255 256 257 258 259 260 261 262 263 264 | if( fieldMask + 1 == (1<<pIdx->nField) ){ if( pBestIdx==0 || pBestIdx->nField<pIdx->nField ){ pBestIdx = pIdx; } } } aIdx[i] = pBestIdx; } /* Open all tables in the pTabList and all indices in aIdx[]. */ for(i=0; i<pTabList->nId; i++){ sqliteVdbeAddOp(v, OP_Open, i, 0, pTabList->a[i].pTab->zName, 0); if( i<ARRAYSIZE(aIdx) && aIdx[i]!=0 ){ | > | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | if( fieldMask + 1 == (1<<pIdx->nField) ){ if( pBestIdx==0 || pBestIdx->nField<pIdx->nField ){ pBestIdx = pIdx; } } } aIdx[i] = pBestIdx; loopMask |= 1<<idx; } /* Open all tables in the pTabList and all indices in aIdx[]. */ for(i=0; i<pTabList->nId; i++){ sqliteVdbeAddOp(v, OP_Open, i, 0, pTabList->a[i].pTab->zName, 0); if( i<ARRAYSIZE(aIdx) && aIdx[i]!=0 ){ |
︙ | ︙ |