1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Remove the SQLITE_ENABLE_TREE_EXPLAIN compile-time option. Add alternative

debugging display routines: sqlite3TreeViewExpr(), sqlite3TreeViewExprList(),
and sqlite3TreeViewSelect().

FossilOrigin-Name: 4ff51325d6b41d0c59e303b573700ec80c51d216
This commit is contained in:
drh
2014-09-30 12:33:33 +00:00
parent 39c4b82b5a
commit 4fa4a54f7e
14 changed files with 245 additions and 403 deletions

View File

@@ -364,11 +364,6 @@ static int allowedOp(int op){
return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL;
}
/*
** Swap two objects of type TYPE.
*/
#define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;}
/*
** Commute a comparison operator. Expressions of the form "X op Y"
** are converted into "Y op X".
@@ -3761,22 +3756,6 @@ 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);
sqlite3ExplainExpr(v, pTerm->pExpr);
}
#endif /* WHERETRACE_ENABLED && SQLITE_ENABLE_TREE_EXPLAIN */
#ifdef WHERETRACE_ENABLED
/*
** Print a WhereLoop object for debugging purposes
@@ -3819,27 +3798,6 @@ static void whereLoopPrint(WhereLoop *p, WhereClause *pWC){
sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm);
}
sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut);
#ifdef SQLITE_ENABLE_TREE_EXPLAIN
/* If the 0x100 bit of wheretracing is set, then show all of the constraint
** expressions in the WhereLoop.aLTerm[] array.
*/
if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){ /* WHERETRACE 0x100 */
int i;
Vdbe *v = pWInfo->pParse->pVdbe;
sqlite3ExplainBegin(v);
for(i=0; i<p->nLTerm; i++){
WhereTerm *pTerm = p->aLTerm[i];
if( pTerm==0 ) continue;
sqlite3ExplainPrintf(v, " (%d) #%-2d ", i+1, (int)(pTerm-pWC->a));
sqlite3ExplainPush(v);
whereExplainTerm(v, pTerm);
sqlite3ExplainPop(v);
sqlite3ExplainNL(v);
}
sqlite3ExplainFinish(v);
sqlite3DebugPrintf("%s", sqlite3VdbeExplanation(v));
}
#endif
}
#endif
@@ -6172,23 +6130,6 @@ 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, "#%-2d ", 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;