-C Fix\sa\sbug\sin\swin32\scommand-line\sclient\sintroduced\sduring\sefforts\sto\sreduce\nthe\snumber\sof\sharmless\scompiler\swarnings\s(check-in\s(5982).)\s(CVS\s5992)
-D 2008-12-08T18:27:31
+C Some\sminor\sname\srefactoring\sin\swhere.c.\s\sAvoid\sdeclaring\svariables\sbefore\ninitializing\sthem\sin\sthe\samalgamation\sbecause\sVC++\sdoesn't\slike\sthat.\s(CVS\s5993)
+D 2008-12-08T21:37:15
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in f7e4c81c347b04f7b0f1c1b081a168645d7b8af7
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3
F src/loadext.c 2f53996c693a347edc2d773e9217dde49d96ae64
-F src/main.c d67d2eee7a643a4a894e5de91231a99ad88400b9
+F src/main.c 951f0836d7f454f7bfc2855b6fc7a90debab10e4
F src/malloc.c 89c7c58fbec06b80101fdc6dcdf9ee849b7cd7ac
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
F src/mem1.c bb8e26adde7d463270e961f045802c61dbabc8f1
F src/shell.c 484bddeefac9314be18d4a60d401e93848274ee8
F src/sqlite.h.in f13b2f27265b78226240cb0d2e07f165e2110bd9
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
-F src/sqliteInt.h 7bdc5726dff17a2e92b23d478b7024c535d77a47
+F src/sqliteInt.h f97f357ecd3d681b19d1d85e64889d9ecd321781
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
F src/tokenize.c aaa5fa6a4536a9dd7c855a3f66f32508f1612138
F src/trigger.c b86eb6d216c0014138f858a04185113cb54518e4
F src/update.c 7143ac31d26dee156277126e9a7c5be953b18347
-F src/utf.c 86dc0f8076f606432a01f1498ae054c32de1f9d2
+F src/utf.c 3d087d22b7a2d68aee32919713251b30fd327fc0
F src/util.c b9a5d1c4c1a433e17d5828f9717fac763016a2cb
F src/vacuum.c 383d6297bddc011ab04a9eed110db6eaf523e8e9
F src/vdbe.c c7da2727447ef5ebe9a25ed37796a493fd12d781
F src/vdbemem.c c4da6cee44bbd6e4ecc0129d76330fb16c29d432
F src/vtab.c 02c51eac45dbff1a1d6e73f58febf92ecb563f7f
F src/walker.c 488c2660e13224ff70c0c82761118efb547f8f0d
-F src/where.c d27611213e9fcbe99f4158bffd7c917a2b8672f0
+F src/where.c 538cbf219002ba078dec8203fdb9b5101d46415c
F tclinstaller.tcl 4356d9d94d2b5ed5e68f9f0c80c4df3048dd7617
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
F test/alias.test 597662c5d777a122f9a3df0047ea5c5bd383a911
F tool/mkkeywordhash.c 7cd8f12dea17d26e4b2c6dee8be13515248da069
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
-F tool/mksqlite3c.tcl 75cb8cdbea59c0db53a2393df15229376c211ca1
+F tool/mksqlite3c.tcl c259bcf64ae8fce346e3ae302c3fd6db977f89a8
F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87
F tool/omittest.tcl 27d6f6e3b1e95aeb26a1c140e6eb57771c6d794a
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 73c7302c5f76a2f61ecd75f8bda69bb500d3119c
-R e35fc03527ddf199e75a6f59bd7d841e
+P 6c0b2e7579ee5504617831a5e8bb6193e283ad30
+R 16d93897c611a643e89664ca78d16163
U drh
-Z 113eac2b3090ac202a89e92fb4135418
+Z 7c4f110d07988bd3998073bc21e9ea4f
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
-** $Id: where.c,v 1.333 2008/12/05 17:17:08 drh Exp $
+** $Id: where.c,v 1.334 2008/12/08 21:37:16 drh Exp $
*/
#include "sqliteInt.h"
** calling this routine. Such pointers may be reinitialized by referencing
** the pWC->a[] array.
*/
-static int whereClauseInsert(WhereClause *pWC, Expr *p, int wtFlags){
+static int whereClauseInsert(WhereClause *pWC, Expr *p, u16 wtFlags){
WhereTerm *pTerm;
int idx;
if( pWC->nTerm>=pWC->nSlot ){
sqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0);
VdbeComment((v, "%.*s", pX->span.n, pX->span.z));
if( pLevel->nIn==0 ){
- pLevel->nxt = sqlite3VdbeMakeLabel(v);
+ pLevel->addrNxt = sqlite3VdbeMakeLabel(v);
}
pLevel->nIn++;
pLevel->aInLoop = sqlite3DbReallocOrFree(pParse->db, pLevel->aInLoop,
pIn += pLevel->nIn - 1;
pIn->iCur = iTab;
if( eType==IN_INDEX_ROWID ){
- pIn->topAddr = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg);
+ pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg);
}else{
- pIn->topAddr = sqlite3VdbeAddOp3(v, OP_Column, iTab, 0, iReg);
+ pIn->addrInTop = sqlite3VdbeAddOp3(v, OP_Column, iTab, 0, iReg);
}
sqlite3VdbeAddOp1(v, OP_IsNull, iReg);
}else{
testcase( pTerm->eOperator & WO_ISNULL );
testcase( pTerm->eOperator & WO_IN );
if( (pTerm->eOperator & (WO_ISNULL|WO_IN))==0 ){
- sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->brk);
+ sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk);
}
}
return regBase;
int i; /* Loop counter */
WhereInfo *pWInfo; /* Will become the return value of this function */
Vdbe *v = pParse->pVdbe; /* The virtual database engine */
- int brk, cont = 0; /* Addresses used during code generation */
+ int addrBrk, addrCont = 0; /* Addresses used during code generation */
Bitmask notReady; /* Cursors that are not yet positioned */
WhereTerm *pTerm; /* A single term in the WHERE clause */
ExprMaskSet maskSet; /* The expression mask set */
int j, k;
int iCur = pTabItem->iCursor; /* The VDBE cursor for the table */
Index *pIdx; /* The index we will be using */
- int nxt; /* Where to jump to continue with the next IN case */
+ int addrNxt; /* Where to jump to continue with the next IN case */
int iIdxCur; /* The VDBE cursor for the index */
int omitTable; /* True if we use the index only */
int bRev; /* True if we need to scan in reverse order */
omitTable = (pLevel->wsFlags & WHERE_IDX_ONLY)!=0;
/* Create labels for the "break" and "continue" instructions
- ** for the current loop. Jump to brk to break out of a loop.
+ ** for the current loop. Jump to addrBrk to break out of a loop.
** Jump to cont to go immediately to the next iteration of the
** loop.
**
- ** When there is an IN operator, we also have a "nxt" label that
+ ** When there is an IN operator, we also have a "addrNxt" label that
** means to continue with the next IN value combination. When
- ** there are no IN operators in the constraints, the "nxt" label
- ** is the same as "brk".
+ ** there are no IN operators in the constraints, the "addrNxt" label
+ ** is the same as "addrBrk".
*/
- brk = pLevel->brk = pLevel->nxt = sqlite3VdbeMakeLabel(v);
- cont = pLevel->cont = sqlite3VdbeMakeLabel(v);
+ addrBrk = pLevel->addrBrk = pLevel->addrNxt = sqlite3VdbeMakeLabel(v);
+ addrCont = pLevel->addrCont = sqlite3VdbeMakeLabel(v);
/* If this is the right table of a LEFT OUTER JOIN, allocate and
** initialize a memory cell that records if this table matches any
pParse->disableColCache--;
sqlite3VdbeAddOp2(v, OP_Integer, pBestIdx->idxNum, iReg);
sqlite3VdbeAddOp2(v, OP_Integer, j-1, iReg+1);
- sqlite3VdbeAddOp4(v, OP_VFilter, iCur, brk, iReg, pBestIdx->idxStr,
+ sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrBrk, iReg, pBestIdx->idxStr,
pBestIdx->needToFreeIdxStr ? P4_MPRINTF : P4_STATIC);
sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2);
pBestIdx->needToFreeIdxStr = 0;
assert( pTerm->leftCursor==iCur );
assert( omitTable==0 );
r1 = codeEqualityTerm(pParse, pTerm, pLevel, rtmp);
- nxt = pLevel->nxt;
- sqlite3VdbeAddOp2(v, OP_MustBeInt, r1, nxt);
- sqlite3VdbeAddOp3(v, OP_NotExists, iCur, nxt, r1);
+ addrNxt = pLevel->addrNxt;
+ sqlite3VdbeAddOp2(v, OP_MustBeInt, r1, addrNxt);
+ sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, r1);
sqlite3ReleaseTempReg(pParse, rtmp);
VdbeComment((v, "pk"));
pLevel->op = OP_Noop;
r1 = sqlite3GetTempReg(pParse);
sqlite3ExprCode(pParse, pX->pRight, r1);
- sqlite3VdbeAddOp3(v, OP_ForceInt, r1, brk,
+ sqlite3VdbeAddOp3(v, OP_ForceInt, r1, addrBrk,
pX->op==TK_LE || pX->op==TK_GT);
- sqlite3VdbeAddOp3(v, bRev ? OP_MoveLt : OP_MoveGe, iCur, brk, r1);
+ sqlite3VdbeAddOp3(v, bRev ? OP_MoveLt : OP_MoveGe, iCur, addrBrk, r1);
VdbeComment((v, "pk"));
sqlite3ReleaseTempReg(pParse, r1);
disableTerm(pLevel, pStart);
}else{
- sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, brk);
+ sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrBrk);
}
if( pEnd ){
Expr *pX;
int r1 = sqlite3GetTempReg(pParse);
sqlite3VdbeAddOp2(v, OP_Rowid, iCur, r1);
/* sqlite3VdbeAddOp2(v, OP_SCopy, pLevel->iMem, 0); */
- sqlite3VdbeAddOp3(v, testOp, pLevel->iMem, brk, r1);
+ sqlite3VdbeAddOp3(v, testOp, pLevel->iMem, addrBrk, r1);
sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL);
sqlite3ReleaseTempReg(pParse, r1);
}
** starting at regBase.
*/
regBase = codeAllEqualityTerms(pParse, pLevel, &wc, notReady, 2);
- nxt = pLevel->nxt;
+ addrNxt = pLevel->addrNxt;
/* If this loop satisfies a sort order (pOrderBy) request that
** was passed to this function to implement a "SELECT min(x) ..."
}
sqlite3ExprCode(pParse, pRangeStart->pExpr->pRight, regBase+nEq);
pParse->disableColCache = dcc;
- sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, nxt);
+ sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
nConstraint++;
}else if( isMinQuery ){
sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
testcase( op==OP_MoveGe );
testcase( op==OP_MoveLe );
testcase( op==OP_MoveLt );
- sqlite3VdbeAddOp4(v, op, iIdxCur, nxt, regBase,
+ sqlite3VdbeAddOp4(v, op, iIdxCur, addrNxt, regBase,
SQLITE_INT_TO_PTR(nConstraint), P4_INT32);
/* Load the value for the inequality constraint at the end of the
nConstraint = nEq;
if( pRangeEnd ){
sqlite3ExprCode(pParse, pRangeEnd->pExpr->pRight, regBase+nEq);
- sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, nxt);
+ sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt);
codeApplyAffinity(pParse, regBase, nEq+1, pIdx);
nConstraint++;
}
testcase( op==OP_Noop );
testcase( op==OP_IdxGE );
testcase( op==OP_IdxLT );
- sqlite3VdbeAddOp4(v, op, iIdxCur, nxt, regBase,
+ sqlite3VdbeAddOp4(v, op, iIdxCur, addrNxt, regBase,
SQLITE_INT_TO_PTR(nConstraint), P4_INT32);
sqlite3VdbeChangeP5(v, endEq!=bRev);
testcase( pLevel->wsFlags & WHERE_TOP_LIMIT );
if( pLevel->wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT) ){
sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, nEq, r1);
- sqlite3VdbeAddOp2(v, OP_IsNull, r1, cont);
+ sqlite3VdbeAddOp2(v, OP_IsNull, r1, addrCont);
}
/* Seek the table cursor, if required */
assert( bRev==0 );
pLevel->op = OP_Next;
pLevel->p1 = iCur;
- pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, OP_Rewind, iCur, brk);
+ pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, OP_Rewind, iCur, addrBrk);
pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
}
notReady &= ~getMask(&maskSet, iCur);
continue;
}
pParse->disableColCache += k;
- sqlite3ExprIfFalse(pParse, pE, cont, SQLITE_JUMPIFNULL);
+ sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL);
pParse->disableColCache -= k;
k = 1;
pTerm->wtFlags |= TERM_CODED;
** at least one row of the right table has matched the left table.
*/
if( pLevel->iLeftJoin ){
- pLevel->top = sqlite3VdbeCurrentAddr(v);
+ pLevel->addrFirst = sqlite3VdbeCurrentAddr(v);
sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
VdbeComment((v, "record LEFT JOIN hit"));
sqlite3ExprClearColumnCache(pParse, pLevel->iTabCur);
if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue;
if( (pTerm->prereqAll & notReady)!=0 ) continue;
assert( pTerm->pExpr );
- sqlite3ExprIfFalse(pParse, pTerm->pExpr, cont, SQLITE_JUMPIFNULL);
+ sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
pTerm->wtFlags |= TERM_CODED;
}
}
/* Record the continuation address in the WhereInfo structure. Then
** clean up and return.
*/
- pWInfo->iContinue = cont;
+ pWInfo->iContinue = addrCont;
whereClauseClear(&wc);
return pWInfo;
sqlite3ExprClearColumnCache(pParse, -1);
for(i=pTabList->nSrc-1; i>=0; i--){
pLevel = &pWInfo->a[i];
- sqlite3VdbeResolveLabel(v, pLevel->cont);
+ sqlite3VdbeResolveLabel(v, pLevel->addrCont);
if( pLevel->op!=OP_Noop ){
sqlite3VdbeAddOp2(v, pLevel->op, pLevel->p1, pLevel->p2);
sqlite3VdbeChangeP5(v, pLevel->p5);
if( pLevel->nIn ){
struct InLoop *pIn;
int j;
- sqlite3VdbeResolveLabel(v, pLevel->nxt);
+ sqlite3VdbeResolveLabel(v, pLevel->addrNxt);
for(j=pLevel->nIn, pIn=&pLevel->aInLoop[j-1]; j>0; j--, pIn--){
- sqlite3VdbeJumpHere(v, pIn->topAddr+1);
- sqlite3VdbeAddOp2(v, OP_Next, pIn->iCur, pIn->topAddr);
- sqlite3VdbeJumpHere(v, pIn->topAddr-1);
+ sqlite3VdbeJumpHere(v, pIn->addrInTop+1);
+ sqlite3VdbeAddOp2(v, OP_Next, pIn->iCur, pIn->addrInTop);
+ sqlite3VdbeJumpHere(v, pIn->addrInTop-1);
}
sqlite3DbFree(db, pLevel->aInLoop);
}
- sqlite3VdbeResolveLabel(v, pLevel->brk);
+ sqlite3VdbeResolveLabel(v, pLevel->addrBrk);
if( pLevel->iLeftJoin ){
int addr;
addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin);
if( pLevel->iIdxCur>=0 ){
sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur);
}
- sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->top);
+ sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrFirst);
sqlite3VdbeJumpHere(v, addr);
}
}