More wheretrace debugging support: Show a listing of all WHERE clause
terms (on wheretrace bit 0x100) and include important flags such as TERM_VIRTUAL, WO_EQUIV, and EP_FromJoin. FossilOrigin-Name: 92ccd705411ce3f64720ab5f34c7efc9cb46d5c9
This commit is contained in:
parent
c1ba2e7a52
commit
f4e9cb065b
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Bug\sfix\sand\senhancements\sto\sthe\simproved\swheretrace\slogic\sthat\sshows\sthe\nconstraint\sexpressions.
|
||||
D 2013-10-28T19:03:21.821
|
||||
C More\swheretrace\sdebugging\ssupport:\s\sShow\sa\slisting\sof\sall\sWHERE\sclause\nterms\s(on\swheretrace\sbit\s0x100)\sand\sinclude\simportant\sflags\ssuch\sas\nTERM_VIRTUAL,\sWO_EQUIV,\sand\sEP_FromJoin.
|
||||
D 2013-10-28T19:59:59.733
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 0522b53cdc1fcfc18f3a98e0246add129136c654
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -292,7 +292,7 @@ F src/vtab.c 5a423b042eb1402ef77697d03d6a67378d97bc8d
|
||||
F src/wal.c 7dc3966ef98b74422267e7e6e46e07ff6c6eb1b4
|
||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||
F src/walker.c e9e593d5bb798c3e67fc3893dfe7055c9e7d8d74
|
||||
F src/where.c 65ff0a3241feaebda8c2996f1d56e13e13bfad11
|
||||
F src/where.c 0490bd61f1327802e9d892a366b024dd7e39bb60
|
||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
|
||||
@ -1126,7 +1126,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
|
||||
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
|
||||
P 710a18ac7916cb688955505d7d461b461f563155
|
||||
R 89498d16fc02d0b55681c504013a5543
|
||||
P 10f125f5da55eca15e68c74d62ab7d37bbbbfb5f
|
||||
R 94f7d01ea5e366fe4a18fa71bac07ffd
|
||||
U drh
|
||||
Z a3f286e08ab862275ce77a1e64b61897
|
||||
Z b420ce79c50b8599b09c4667291607ef
|
||||
|
@ -1 +1 @@
|
||||
10f125f5da55eca15e68c74d62ab7d37bbbbfb5f
|
||||
92ccd705411ce3f64720ab5f34c7efc9cb46d5c9
|
41
src/where.c
41
src/where.c
@ -3889,6 +3889,25 @@ static Bitmask codeOneLoopStart(
|
||||
return pLevel->notReady;
|
||||
}
|
||||
|
||||
#if defined(WHERETRACE_ENABLED) && defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
||||
/*
|
||||
** Generate "Explanation" text for a WhereTerm.
|
||||
*/
|
||||
static void whereExplainTerm(Vdbe *v, WhereTerm *pTerm){
|
||||
char zType[4];
|
||||
memcpy(zType, "...", 4);
|
||||
if( pTerm->wtFlags & TERM_VIRTUAL ) zType[0] = 'V';
|
||||
if( pTerm->eOperator & WO_EQUIV ) zType[1] = 'E';
|
||||
if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L';
|
||||
sqlite3ExplainPrintf(v, "%s ", zType);
|
||||
if( (pTerm->wtFlags & (TERM_ORINFO|TERM_ANDINFO))==0 ){
|
||||
sqlite3ExplainPrintf(v, "lhs=%-2d ", pTerm->u.leftColumn);
|
||||
}
|
||||
sqlite3ExplainExpr(v, pTerm->pExpr);
|
||||
}
|
||||
#endif /* WHERETRACE_ENABLED && SQLITE_ENABLE_TREE_EXPLAIN */
|
||||
|
||||
|
||||
#ifdef WHERETRACE_ENABLED
|
||||
/*
|
||||
** Print a WhereLoop object for debugging purposes
|
||||
@ -3938,11 +3957,8 @@ static void whereLoopPrint(WhereLoop *p, WhereClause *pWC){
|
||||
for(i=0; i<p->nLTerm; i++){
|
||||
WhereTerm *pTerm = p->aLTerm[i];
|
||||
sqlite3ExplainPrintf(v, " (%d) #%d ", i+1, (int)(pTerm-pWC->a));
|
||||
if( (pTerm->wtFlags & (TERM_ORINFO|TERM_ANDINFO))==0 ){
|
||||
sqlite3ExplainPrintf(v, "lhs=%-2d ", pTerm->u.leftColumn);
|
||||
}
|
||||
sqlite3ExplainPush(v);
|
||||
sqlite3ExplainExpr(v, pTerm->pExpr);
|
||||
whereExplainTerm(v, pTerm);
|
||||
sqlite3ExplainPop(v);
|
||||
sqlite3ExplainNL(v);
|
||||
}
|
||||
@ -5839,6 +5855,23 @@ WhereInfo *sqlite3WhereBegin(
|
||||
|
||||
/* Construct the WhereLoop objects */
|
||||
WHERETRACE(0xffff,("*** Optimizer Start ***\n"));
|
||||
/* Display all terms of the WHERE clause */
|
||||
#if defined(WHERETRACE_ENABLED) && defined(SQLITE_ENABLE_TREE_EXPLAIN)
|
||||
if( sqlite3WhereTrace & 0x100 ){
|
||||
int i;
|
||||
Vdbe *v = pParse->pVdbe;
|
||||
sqlite3ExplainBegin(v);
|
||||
for(i=0; i<sWLB.pWC->nTerm; i++){
|
||||
sqlite3ExplainPrintf(v, "#%d ", i);
|
||||
sqlite3ExplainPush(v);
|
||||
whereExplainTerm(v, &sWLB.pWC->a[i]);
|
||||
sqlite3ExplainPop(v);
|
||||
sqlite3ExplainNL(v);
|
||||
}
|
||||
sqlite3ExplainFinish(v);
|
||||
sqlite3DebugPrintf("%s", sqlite3VdbeExplanation(v));
|
||||
}
|
||||
#endif
|
||||
if( nTabList!=1 || whereShortCut(&sWLB)==0 ){
|
||||
rc = whereLoopAddAll(&sWLB);
|
||||
if( rc ) goto whereBeginError;
|
||||
|
Loading…
Reference in New Issue
Block a user