-C Tighter\sVDBE\scode\sfor\sthe\sWHERE_DISTINCT_ORDERED\scase\sof\sDISTINCT\skeyword\nhandling.
-D 2012-09-19T21:15:46.053
+C Refactoring\sof\sDISTINCT\scode.\s\sChange\sthe\sname\sof\sthe\slocal\svariable\n"distinct"\sto\s"distinctTab".\s\sGenerate\scleaner\scode\sw/o\sunnecessary\sP4\nand\sP5\svalues\son\sthe\sOP_Null\sfor\sWHERE_DISTINCT_ORDERED.
+D 2012-09-20T14:26:22.088
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5f4f26109f9d80829122e0e09f9cda008fa065fb
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
F src/resolve.c 9e28280ec98035f31900fdd1db01f86f68ca6c32
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
-F src/select.c 63206bbfd19e0f85e609307041db9276ddf9f2c2
+F src/select.c 7878dd564f5ec107e9b58af5f3eeb27ac640770b
F src/shell.c 87953c5d9c73d9494db97d1607e2e2280418f261
F src/sqlite.h.in c76c38f9635590ff5844684a7976843878327137
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
F src/sqlite3ext.h 6904f4aadf976f95241311fbffb00823075d9477
-F src/sqliteInt.h 7fa267db5593970061523081b29d8da7f5399a2c
+F src/sqliteInt.h bcfaf463a0fecda2d10efd68a52fea11f1cff388
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 35939e7e03abf1b7577ce311f48f682c40de3208
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
-P 82320501904f65030622a67836ba30f412169056
-R 9541e63a94fc58e6e6ac938d40479670
+P 94b48064db3cbb43e911fdf7183218b08146ec10
+R 5e2afb7573559eb5eba9ed47e068d0d2
U drh
-Z 981d7e657532e16949d872fc02730646
+Z 5042a680f6b5da609676733ff0c80d03
int srcTab, /* Pull data from this table */
int nColumn, /* Number of columns in the source table */
ExprList *pOrderBy, /* If not NULL, sort results using this key */
- int distinct, /* If >=0, make sure results are distinct */
+ int distinctTab, /* If >=0, make sure results are distinct */
SelectDest *pDest, /* How to dispose of the results */
int iContinue, /* Jump here to continue with next row */
int iBreak /* Jump here to break out of the inner loop */
assert( v );
if( NEVER(v==0) ) return;
assert( pEList!=0 );
- hasDistinct = distinct>=0;
+ hasDistinct = distinctTab>=0;
if( pOrderBy==0 && !hasDistinct ){
codeOffset(v, p, iContinue);
}
if( hasDistinct ){
assert( pEList!=0 );
assert( pEList->nExpr==nColumn );
- codeDistinct(pParse, distinct, iContinue, nColumn, regResult);
+ codeDistinct(pParse, distinctTab, iContinue, nColumn, regResult);
if( pOrderBy==0 ){
codeOffset(v, p, iContinue);
}
ExprList *pGroupBy; /* The GROUP BY clause. May be NULL */
Expr *pHaving; /* The HAVING clause. May be NULL */
int isDistinct; /* True if the DISTINCT keyword is present */
- int distinct; /* Table to use for the distinct set */
+ int distinctTab; /* Table to use for the distinct set */
int rc = 1; /* Value to return from this function */
int addrSortIndex; /* Address of an OP_OpenEphemeral instruction */
int addrDistinctIndex; /* Address of an OP_OpenEphemeral instruction */
*/
if( p->selFlags & SF_Distinct ){
KeyInfo *pKeyInfo;
- distinct = pParse->nTab++;
+ distinctTab = pParse->nTab++;
pKeyInfo = keyInfoFromExprList(pParse, p->pEList);
- addrDistinctIndex = sqlite3VdbeAddOp4(v, OP_OpenEphemeral, distinct, 0, 0,
- (char*)pKeyInfo, P4_KEYINFO_HANDOFF);
+ addrDistinctIndex = sqlite3VdbeAddOp4(v, OP_OpenEphemeral, distinctTab,
+ 0, 0, (char*)pKeyInfo, P4_KEYINFO_HANDOFF);
sqlite3VdbeChangeP5(v, BTREE_UNORDERED);
}else{
- distinct = addrDistinctIndex = -1;
+ distinctTab = addrDistinctIndex = -1;
}
/* Aggregate and non-aggregate queries are handled differently */
VdbeOp *pOp; /* No longer required OpenEphemeral instr. */
assert( addrDistinctIndex>=0 );
+ sqlite3VdbeChangeToNoop(v, addrDistinctIndex);
pOp = sqlite3VdbeGetOp(v, addrDistinctIndex);
assert( isDistinct );
assert( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED
|| pWInfo->eDistinct==WHERE_DISTINCT_UNIQUE
);
- distinct = -1;
+ distinctTab = -1;
if( pWInfo->eDistinct==WHERE_DISTINCT_ORDERED ){
int iJump;
int iExpr;
pOp->opcode = OP_Null;
pOp->p1 = 1;
pOp->p2 = iBase2;
- pOp->p3 = iBase2 + nExpr - 1;
sqlite3ExprCodeExprList(pParse, pEList, iBase, 1);
iJump = sqlite3VdbeCurrentAddr(v) + pEList->nExpr;
}
assert( sqlite3VdbeCurrentAddr(v)==iJump );
sqlite3VdbeAddOp3(v, OP_Move, iBase, iBase2, pEList->nExpr);
- }else{
- pOp->opcode = OP_Noop;
}
}
/* Use the standard inner loop. */
- selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinct, pDest,
+ selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinctTab, pDest,
pWInfo->iContinue, pWInfo->iBreak);
/* End the database scan loop.
finalizeAggFunctions(pParse, &sAggInfo);
sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL);
selectInnerLoop(pParse, p, p->pEList, 0, 0, pOrderBy,
- distinct, pDest,
+ distinctTab, pDest,
addrOutputRow+1, addrSetAbort);
sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);
VdbeComment((v, "end groupby result generator"));
} /* endif aggregate query */
- if( distinct>=0 ){
+ if( distinctTab>=0 ){
explainTempTable(pParse, "DISTINCT");
}