Tarantool development patches archive
 help / color / mirror / Atom feed
From: imeevma@tarantool.org
To: tarantool-patches@freelists.org, v.shpilevoy@tarantool.org
Cc: korablev@tarantool.org
Subject: [tarantool-patches] [PATCH v5 1/6] sql: remove unused macros from pragma.c and pragma.h
Date: Tue, 29 Jan 2019 17:29:38 +0300	[thread overview]
Message-ID: <1f667d56f6684a5cb7030097a66c4ac8b46d36cc.1548771900.git.imeevma@gmail.com> (raw)
In-Reply-To: <cover.1548771900.git.imeevma@gmail.com>

Some macros in pragma.c and pragma.h are obsolete because the
values they are checking are no longer used or their usage makes
no sense. Let's remove them.
---
 src/box/sql/CMakeLists.txt |  2 --
 src/box/sql/parse.y        |  4 ++--
 src/box/sql/pragma.c       |  4 ----
 src/box/sql/pragma.h       | 31 ++-----------------------------
 src/box/sql/select.c       | 22 +++++++++++-----------
 src/box/sql/sqliteInt.h    | 18 +-----------------
 src/box/sql/where.c        | 46 ++++++++++++++++++++--------------------------
 src/box/sql/whereInt.h     |  4 ++--
 8 files changed, 38 insertions(+), 93 deletions(-)

diff --git a/src/box/sql/CMakeLists.txt b/src/box/sql/CMakeLists.txt
index 7f7b60e..68e2929 100644
--- a/src/box/sql/CMakeLists.txt
+++ b/src/box/sql/CMakeLists.txt
@@ -1,7 +1,5 @@
 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
   add_definitions(-DSQLITE_DEBUG=1)
-  add_definitions(-DSQLITE_ENABLE_SELECTTRACE)
-  add_definitions(-DSQLITE_ENABLE_WHERETRACE)
 endif()
 
 set(EXT_SRC_DIR ${CMAKE_SOURCE_DIR}/extra)
diff --git a/src/box/sql/parse.y b/src/box/sql/parse.y
index 50bb2ba..f18f597 100644
--- a/src/box/sql/parse.y
+++ b/src/box/sql/parse.y
@@ -449,11 +449,11 @@ multiselect_op(A) ::= EXCEPT|INTERSECT(OP).  {A = @OP; /*A-overwrites-OP*/}
 %endif SQLITE_OMIT_COMPOUND_SELECT
 oneselect(A) ::= SELECT(S) distinct(D) selcollist(W) from(X) where_opt(Y)
                  groupby_opt(P) having_opt(Q) orderby_opt(Z) limit_opt(L). {
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
   Token s = S; /*A-overwrites-S*/
 #endif
   A = sqlite3SelectNew(pParse,W,X,Y,P,Q,Z,D,L.pLimit,L.pOffset);
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
   /* Populate the Select.zSelName[] string that is used to help with
   ** query planner debugging, to differentiate between multiple Select
   ** objects in a complex query.
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index eef1ed9..5729fe6 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -465,7 +465,6 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 	/* Jump to the appropriate pragma handler */
 	switch (pPragma->ePragTyp) {
 
-#ifndef SQLITE_OMIT_FLAG_PRAGMAS
 	case PragTyp_FLAG:{
 			if (zRight == 0) {
 				setPragmaResultColumnNames(v, pPragma);
@@ -494,9 +493,7 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 			}
 			break;
 		}
-#endif				/* SQLITE_OMIT_FLAG_PRAGMAS */
 
-#ifndef SQLITE_OMIT_SCHEMA_PRAGMAS
 	case PragTyp_TABLE_INFO:
 		sql_pragma_table_info(pParse, zRight);
 		break;
@@ -538,7 +535,6 @@ sqlite3Pragma(Parse * pParse, Token * pId,	/* First part of [schema.]id field */
 		box_iterator_free(iter);
 		break;
 	}
-#endif				/* SQLITE_OMIT_SCHEMA_PRAGMAS */
 
 	case PragTyp_FOREIGN_KEY_LIST:{
 		if (zRight == NULL)
diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
index e608016..fd76b49 100644
--- a/src/box/sql/pragma.h
+++ b/src/box/sql/pragma.h
@@ -97,41 +97,32 @@ static const PragmaName aPragmaName[] = {
 	 /* ePragFlg:  */ PragFlg_NoColumns,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ 0},
-#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
 	{ /* zName:     */ "collation_list",
 	 /* ePragTyp:  */ PragTyp_COLLATION_LIST,
 	 /* ePragFlg:  */ PragFlg_Result0,
 	 /* ColNames:  */ 21, 2,
 	 /* iArg:      */ 0},
-#endif
-#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "count_changes",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_CountRows},
-#endif
-#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "defer_foreign_keys",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_DeferFKs},
-#endif
 	{ /* zName:     */ "foreign_key_list",
 	 /* ePragTyp:  */ PragTyp_FOREIGN_KEY_LIST,
 	 /* ePragFlg:  */
 	 PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
 	 /* ColNames:  */ 23, 8,
 	 /* iArg:      */ 0},
-#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "full_column_names",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_FullColNames},
-#endif
-#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
 	{ /* zName:     */ "index_info",
 	 /* ePragTyp:  */ PragTyp_INDEX_INFO,
 	 /* ePragFlg:  */
@@ -144,15 +135,13 @@ static const PragmaName aPragmaName[] = {
 	 PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
 	 /* ColNames:  */ 16, 5,
 	 /* iArg:      */ 0},
-#endif
-#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_PARSER_TRACE)
+#if defined(SQLITE_DEBUG)
 	{ /* zName:     */ "parser_trace",
 	 /* ePragTyp:  */ PragTyp_PARSER_TRACE,
 	 /* ePragFlg:  */ 0,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ 0},
 #endif
-#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "query_only",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
@@ -168,28 +157,23 @@ static const PragmaName aPragmaName[] = {
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_RecTriggers},
-#endif
-#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "reverse_unordered_selects",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_ReverseOrder},
-#endif
-#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) && defined(SQLITE_ENABLE_SELECTTRACE)
+#if defined(SQLITE_DEBUG)
 	{ /* zName:     */ "select_trace",
 	/* ePragTyp:  */ PragTyp_FLAG,
 	/* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	/* ColNames:  */ 0, 0,
 	/* iArg:      */ SQLITE_SelectTrace},
 #endif
-#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 	{ /* zName:     */ "short_column_names",
 	 /* ePragTyp:  */ PragTyp_FLAG,
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_ShortColNames},
-#endif
 	{ /* zName:     */ "sql_compound_select_limit",
 	/* ePragTyp:  */ PragTyp_COMPOUND_SELECT_LIMIT,
 	/* ePragFlg:  */ PragFlg_Result0,
@@ -200,7 +184,6 @@ static const PragmaName aPragmaName[] = {
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ 0},
-#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 #if defined(SQLITE_DEBUG)
 	{ /* zName:     */ "sql_trace",
 	 /* ePragTyp:  */ PragTyp_FLAG,
@@ -208,24 +191,18 @@ static const PragmaName aPragmaName[] = {
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_SqlTrace},
 #endif
-#endif
-#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
 	{ /* zName:     */ "stats",
 	 /* ePragTyp:  */ PragTyp_STATS,
 	 /* ePragFlg:  */
 	 PragFlg_NeedSchema | PragFlg_Result0 | PragFlg_SchemaReq,
 	 /* ColNames:  */ 6, 4,
 	 /* iArg:      */ 0},
-#endif
-#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
 	{ /* zName:     */ "table_info",
 	 /* ePragTyp:  */ PragTyp_TABLE_INFO,
 	 /* ePragFlg:  */
 	 PragFlg_NeedSchema | PragFlg_Result1 | PragFlg_SchemaOpt,
 	 /* ColNames:  */ 0, 6,
 	 /* iArg:      */ 0},
-#endif
-#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
 #if defined(SQLITE_DEBUG)
 	{ /* zName:     */ "vdbe_addoptrace",
 	 /* ePragTyp:  */ PragTyp_FLAG,
@@ -253,10 +230,6 @@ static const PragmaName aPragmaName[] = {
 	 /* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
 	 /* ColNames:  */ 0, 0,
 	 /* iArg:      */ SQLITE_VdbeTrace},
-#endif
-#endif
-#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) && defined(SQLITE_ENABLE_WHERETRACE)
-
 	{ /* zName:     */ "where_trace",
 	/* ePragTyp:  */ PragTyp_FLAG,
 	/* ePragFlg:  */ PragFlg_Result0 | PragFlg_NoColumns1,
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index 02ee225..c91f42f 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -45,7 +45,7 @@
 /*
  * Trace output macros
  */
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 /***/ int sqlite3SelectTrace = 0;
 #define SELECTTRACE(K,P,S,X)  \
   if(sqlite3SelectTrace&(K))   \
@@ -174,7 +174,7 @@ sqlite3SelectNew(Parse * pParse,	/* Parsing context */
 	pNew->selFlags = selFlags;
 	pNew->iLimit = 0;
 	pNew->iOffset = 0;
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 	pNew->zSelName[0] = 0;
 	if (user_session->sql_flags & SQLITE_SelectTrace)
 		sqlite3SelectTrace = 0xfff;
@@ -208,7 +208,7 @@ sqlite3SelectNew(Parse * pParse,	/* Parsing context */
 	return pNew;
 }
 
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 /*
  * Set the name of a Select object
  */
@@ -4214,7 +4214,7 @@ flattenSubquery(Parse * pParse,		/* Parsing context */
 	 */
 	sql_select_delete(db, pSub1);
 
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 	if (sqlite3SelectTrace & 0x100) {
 		SELECTTRACE(0x100, pParse, p, ("After flattening:\n"));
 		sqlite3TreeViewSelect(0, p, 0);
@@ -5460,7 +5460,7 @@ sqlite3Select(Parse * pParse,		/* The parser context */
 		return 1;
 	}
 	memset(&sAggInfo, 0, sizeof(sAggInfo));
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 	pParse->nSelectIndent++;
 	SELECTTRACE(1, pParse, p, ("begin processing:\n"));
 	if (sqlite3SelectTrace & 0x100) {
@@ -5496,7 +5496,7 @@ sqlite3Select(Parse * pParse,		/* The parser context */
 	}
 	assert(p->pEList != 0);
 	isAgg = (p->selFlags & SF_Aggregate) != 0;
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 	if (sqlite3SelectTrace & 0x100) {
 		SELECTTRACE(0x100, pParse, p, ("after name resolution:\n"));
 		sqlite3TreeViewSelect(0, p, 0);
@@ -5563,7 +5563,7 @@ sqlite3Select(Parse * pParse,		/* The parser context */
 		}
 		sqlite3VdbeResolveLabel(v, end);
 
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 		SELECTTRACE(1, pParse, p, ("end compound-select processing\n"));
 		pParse->nSelectIndent--;
 #endif
@@ -5611,7 +5611,7 @@ sqlite3Select(Parse * pParse,		/* The parser context */
 		    && pushDownWhereTerms(pParse, pSub, p->pWhere,
 					  pItem->iCursor)
 		    ) {
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 			if (sqlite3SelectTrace & 0x100) {
 				SELECTTRACE(0x100, pParse, p,
 					    ("After WHERE-clause push-down:\n"));
@@ -5712,7 +5712,7 @@ sqlite3Select(Parse * pParse,		/* The parser context */
 	pHaving = p->pHaving;
 	sDistinct.isTnct = (p->selFlags & SF_Distinct) != 0;
 
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 	if (sqlite3SelectTrace & 0x400) {
 		SELECTTRACE(0x400, pParse, p,
 			    ("After all FROM-clause analysis:\n"));
@@ -5745,7 +5745,7 @@ sqlite3Select(Parse * pParse,		/* The parser context */
 		 */
 		assert(sDistinct.isTnct);
 
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 		if (sqlite3SelectTrace & 0x400) {
 			SELECTTRACE(0x400, pParse, p,
 				    ("Transform DISTINCT into GROUP BY:\n"));
@@ -6394,7 +6394,7 @@ sqlite3Select(Parse * pParse,		/* The parser context */
 
 	sqlite3DbFree(db, sAggInfo.aCol);
 	sqlite3DbFree(db, sAggInfo.aFunc);
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 	SELECTTRACE(1, pParse, p, ("end processing\n"));
 	pParse->nSelectIndent--;
 #endif
diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h
index 7e16edc..970a422 100644
--- a/src/box/sql/sqliteInt.h
+++ b/src/box/sql/sqliteInt.h
@@ -1295,22 +1295,6 @@ extern const int sqlite3one;
 #endif
 
 /*
- * SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
- * the Select query generator tracing logic is turned on.
- */
-#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_SELECTTRACE)
-#define SELECTTRACE_ENABLED
-#else
-#undef SELECTTRACE_ENABLED
-#endif
-
-#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_WHERETRACE)
-#define WHERETRACE_ENABLED
-#else
-#undef WHERETRACE_ENABLED
-#endif
-
-/*
  * An instance of the following structure is used to store the busy-handler
  * callback for a given sqlite handle.
  *
@@ -3898,7 +3882,7 @@ Expr *sqlite3ExprDup(sqlite3 *, Expr *, int);
 SrcList *sqlite3SrcListDup(sqlite3 *, SrcList *, int);
 IdList *sqlite3IdListDup(sqlite3 *, IdList *);
 Select *sqlite3SelectDup(sqlite3 *, Select *, int);
-#ifdef SELECTTRACE_ENABLED
+#ifdef SQLITE_DEBUG
 void sqlite3SelectSetName(Select *, const char *);
 #else
 #define sqlite3SelectSetName(A,B)
diff --git a/src/box/sql/where.c b/src/box/sql/where.c
index 571b5af..aca0dc1 100644
--- a/src/box/sql/where.c
+++ b/src/box/sql/where.c
@@ -50,7 +50,7 @@
 static int whereLoopResize(sqlite3 *, WhereLoop *, int);
 
 /* Test variable that can be set to enable WHERE tracing */
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 /***/ int sqlite3WhereTrace = 0; /* -1; */
 #endif
 
@@ -145,7 +145,7 @@ sqlite3WhereOkOnePass(WhereInfo * pWInfo, int *aiCur)
 	if (pWInfo->eOnePass == ONEPASS_MULTI) {
 		pWInfo->eOnePass = ONEPASS_OFF;
 	}
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 	if (sqlite3WhereTrace && pWInfo->eOnePass != ONEPASS_OFF) {
 		sqlite3DebugPrintf("%s cursors: %d %d\n",
 				   pWInfo->eOnePass ==
@@ -1501,7 +1501,7 @@ whereRangeScanEst(Parse * pParse,	/* Parsing & code generating context */
 		nNew = 10;
 	if (nNew < nOut)
 		nOut = nNew;
-#if defined(WHERETRACE_ENABLED)
+#if defined(SQLITE_DEBUG)
 	if (pLoop->nOut > nOut) {
 		WHERETRACE(0x10, ("Range scan lowers nOut from %d to %d\n",
 				  pLoop->nOut, nOut));
@@ -1615,7 +1615,7 @@ whereInScanEst(Parse * pParse,	/* Parsing & code generating context */
 	return rc;
 }
 
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 /*
  * Print the content of a WhereTerm object
  */
@@ -1659,9 +1659,7 @@ whereTermPrint(WhereTerm * pTerm, int iTerm)
 		sqlite3TreeViewExpr(0, pTerm->pExpr, 0);
 	}
 }
-#endif
 
-#ifdef WHERETRACE_ENABLED
 /*
  * Show the complete content of a WhereClause
  */
@@ -1673,9 +1671,7 @@ sqlite3WhereClausePrint(WhereClause * pWC)
 		whereTermPrint(&pWC->a[i], i);
 	}
 }
-#endif
 
-#ifdef WHERETRACE_ENABLED
 /*
  * Print a WhereLoop object for debugging purposes
  */
@@ -1687,12 +1683,10 @@ whereLoopPrint(WhereLoop * p, WhereClause * pWC)
 	struct SrcList_item *pItem = pWInfo->pTabList->a + p->iTab;
 	Table *pTab = pItem->pTab;
 	Bitmask mAll = (((Bitmask) 1) << (nb * 4)) - 1;
-#ifdef SQLITE_DEBUG
 	sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId,
 			   p->iTab, nb, p->maskSelf, nb, p->prereq & mAll);
 	sqlite3DebugPrintf(" %12s",
 			   pItem->zAlias ? pItem->zAlias : pTab->def->name);
-#endif
 	const char *zName;
 	if (p->index_def != NULL && (zName = p->index_def->name) != NULL) {
 		if (strncmp(zName, "sql_autoindex_", 17) == 0) {
@@ -2053,14 +2047,14 @@ whereLoopInsert(WhereLoopBuilder * pBuilder, WhereLoop * pTemplate)
 	 */
 	if (pBuilder->pOrSet != 0) {
 		if (pTemplate->nLTerm) {
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 			u16 n = pBuilder->pOrSet->n;
 			int x =
 #endif
 			    whereOrInsert(pBuilder->pOrSet, pTemplate->prereq,
 					  pTemplate->rRun,
 					  pTemplate->nOut);
-#ifdef WHERETRACE_ENABLED		/* 0x8 */
+#ifdef SQLITE_DEBUG		/* 0x8 */
 			if (sqlite3WhereTrace & 0x8) {
 				sqlite3DebugPrintf(x ? "   or-%d:  " :
 						   "   or-X:  ", n);
@@ -2080,7 +2074,7 @@ whereLoopInsert(WhereLoopBuilder * pBuilder, WhereLoop * pTemplate)
 		/* There already exists a WhereLoop on the list that is better
 		 * than pTemplate, so just ignore pTemplate
 		 */
-#ifdef WHERETRACE_ENABLED		/* 0x8 */
+#ifdef SQLITE_DEBUG		/* 0x8 */
 		if (sqlite3WhereTrace & 0x8) {
 			sqlite3DebugPrintf("   skip: ");
 			whereLoopPrint(pTemplate, pBuilder->pWC);
@@ -2095,7 +2089,7 @@ whereLoopInsert(WhereLoopBuilder * pBuilder, WhereLoop * pTemplate)
 	 * with pTemplate[] if p[] exists, or if p==NULL then allocate a new
 	 * WhereLoop and insert it.
 	 */
-#ifdef WHERETRACE_ENABLED		/* 0x8 */
+#ifdef SQLITE_DEBUG		/* 0x8 */
 	if (sqlite3WhereTrace & 0x8) {
 		if (p != 0) {
 			sqlite3DebugPrintf("replace: ");
@@ -2127,7 +2121,7 @@ whereLoopInsert(WhereLoopBuilder * pBuilder, WhereLoop * pTemplate)
 			if (pToDel == 0)
 				break;
 			*ppTail = pToDel->pNextLoop;
-#ifdef WHERETRACE_ENABLED		/* 0x8 */
+#ifdef SQLITE_DEBUG		/* 0x8 */
 			if (sqlite3WhereTrace & 0x8) {
 				sqlite3DebugPrintf(" delete: ");
 				whereLoopPrint(pToDel, pBuilder->pWC);
@@ -3015,7 +3009,7 @@ whereLoopAddOr(WhereLoopBuilder * pBuilder, Bitmask mPrereq, Bitmask mUnusable)
 					continue;
 				}
 				sCur.n = 0;
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 				WHERETRACE(0x200,
 					   ("OR-term %d of %p has %d subterms:\n",
 					    (int)(pOrTerm - pOrWC->a), pTerm,
@@ -3513,7 +3507,7 @@ sqlite3WhereIsSorted(WhereInfo * pWInfo)
 	return pWInfo->sorted;
 }
 
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 /* For debugging use only: */
 static const char *
 wherePathName(WherePath * pPath, int nLoop, WhereLoop * pLast)
@@ -3781,7 +3775,7 @@ wherePathSolver(WhereInfo * pWInfo, LogEst nRowEst)
 						 * paths currently in the best-so-far buffer.  So discard
 						 * this candidate as not viable.
 						 */
-#ifdef WHERETRACE_ENABLED	/* 0x4 */
+#ifdef SQLITE_DEBUG	/* 0x4 */
 						if (sqlite3WhereTrace & 0x4) {
 							sqlite3DebugPrintf("Skip   %s cost=%-3d,%3d order=%c\n",
 									   wherePathName(pFrom, iLoop,
@@ -3804,7 +3798,7 @@ wherePathSolver(WhereInfo * pWInfo, LogEst nRowEst)
 						jj = mxI;
 					}
 					pTo = &aTo[jj];
-#ifdef WHERETRACE_ENABLED	/* 0x4 */
+#ifdef SQLITE_DEBUG	/* 0x4 */
 					if (sqlite3WhereTrace & 0x4) {
 						sqlite3DebugPrintf
 						    ("New    %s cost=%-3d,%3d order=%c\n",
@@ -3824,7 +3818,7 @@ wherePathSolver(WhereInfo * pWInfo, LogEst nRowEst)
 					if (pTo->rCost < rCost
 					    || (pTo->rCost == rCost
 						&& pTo->nRow <= nOut)) {
-#ifdef WHERETRACE_ENABLED	/* 0x4 */
+#ifdef SQLITE_DEBUG	/* 0x4 */
 						if (sqlite3WhereTrace & 0x4) {
 							sqlite3DebugPrintf("Skip   %s cost=%-3d,%3d order=%c",
 									   wherePathName(pFrom, iLoop,
@@ -3849,7 +3843,7 @@ wherePathSolver(WhereInfo * pWInfo, LogEst nRowEst)
 					/* Control reaches here if the candidate path is better than the
 					 * pTo path.  Replace pTo with the candidate.
 					 */
-#ifdef WHERETRACE_ENABLED	/* 0x4 */
+#ifdef SQLITE_DEBUG	/* 0x4 */
 					if (sqlite3WhereTrace & 0x4) {
 						sqlite3DebugPrintf("Update %s cost=%-3d,%3d order=%c",
 								   wherePathName(pFrom, iLoop,
@@ -3898,7 +3892,7 @@ wherePathSolver(WhereInfo * pWInfo, LogEst nRowEst)
 			}
 		}
 
-#ifdef WHERETRACE_ENABLED	/* >=2 */
+#ifdef SQLITE_DEBUG	/* >=2 */
 		if (sqlite3WhereTrace & 0x02) {
 			sqlite3DebugPrintf("---- after round %d ----\n", iLoop);
 			for (ii = 0, pTo = aTo; ii < nTo; ii++, pTo++) {
@@ -4258,7 +4252,7 @@ sqlite3WhereBegin(Parse * pParse,	/* The parser context */
 	u8 bFordelete = 0;	/* OPFLAG_FORDELETE or zero, as appropriate */
 	struct session *user_session = current_session();
 
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 	if (user_session->sql_flags & SQLITE_WhereTrace)
 		sqlite3WhereTrace = 0xfff;
 	else
@@ -4421,7 +4415,7 @@ sqlite3WhereBegin(Parse * pParse,	/* The parser context */
 	}
 
 	/* Construct the WhereLoop objects */
-#if defined(WHERETRACE_ENABLED)
+#if defined(SQLITE_DEBUG)
 	if (sqlite3WhereTrace & 0xffff) {
 		sqlite3DebugPrintf("*** Optimizer Start *** (wctrlFlags: 0x%x",
 				   wctrlFlags);
@@ -4440,7 +4434,7 @@ sqlite3WhereBegin(Parse * pParse,	/* The parser context */
 		if (rc)
 			goto whereBeginError;
 
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 		if (sqlite3WhereTrace) {	/* Display all of the WhereLoop objects */
 			WhereLoop *p;
 			int i;
@@ -4471,7 +4465,7 @@ sqlite3WhereBegin(Parse * pParse,	/* The parser context */
 	if (pParse->nErr || NEVER(db->mallocFailed)) {
 		goto whereBeginError;
 	}
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 	if (sqlite3WhereTrace) {
 		sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut);
 		if (pWInfo->nOBSat > 0) {
diff --git a/src/box/sql/whereInt.h b/src/box/sql/whereInt.h
index 4657055..35891dd 100644
--- a/src/box/sql/whereInt.h
+++ b/src/box/sql/whereInt.h
@@ -39,7 +39,7 @@
 /*
  * Trace output macros
  */
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 /***/ extern int sqlite3WhereTrace;
 #define WHERETRACE(K,X)  if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X
 #else
@@ -443,7 +443,7 @@ struct WhereInfo {
  * where.c:
  */
 Bitmask sqlite3WhereGetMask(WhereMaskSet *, int);
-#ifdef WHERETRACE_ENABLED
+#ifdef SQLITE_DEBUG
 void sqlite3WhereClausePrint(WhereClause * pWC);
 #endif
 WhereTerm *sqlite3WhereFindTerm(WhereClause * pWC,	/* The WHERE clause to be searched */
-- 
2.7.4

  reply	other threads:[~2019-01-29 14:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29 14:29 [tarantool-patches] [PATCH v5 0/6] sql: set column types for EXPLAIN and PRAGMA imeevma
2019-01-29 14:29 ` imeevma [this message]
2019-01-30 13:57   ` [tarantool-patches] Re: [PATCH v5 1/6] sql: remove unused macros from pragma.c and pragma.h Vladislav Shpilevoy
2019-01-31 14:56     ` Imeev Mergen
2019-01-29 14:29 ` [tarantool-patches] [PATCH v5 2/6] sql: fix "PRAGMA parser_trace" result imeevma
2019-01-30 13:57   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-31 14:56     ` Imeev Mergen
2019-02-04 13:06       ` Vladislav Shpilevoy
2019-02-09 10:08         ` Mergen Imeev
2019-01-29 14:29 ` [tarantool-patches] [PATCH v5 3/6] sql: Show currently set sql_default_engine imeevma
2019-01-30 13:57   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-31 14:56     ` Imeev Mergen
2019-01-29 14:29 ` [tarantool-patches] [PATCH v5 4/6] sql: fix "PRAGMA case_sensitive_like" result imeevma
2019-01-30 13:56   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-31 14:56     ` Imeev Mergen
2019-01-29 14:29 ` [tarantool-patches] [PATCH v5 5/6] sql: get results of PRAGMA statement in YAML format imeevma
2019-01-30 13:56   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-31 14:56     ` Imeev Mergen
2019-02-04 13:08       ` Vladislav Shpilevoy
2019-02-09 10:11         ` Mergen Imeev
2019-01-29 14:29 ` [tarantool-patches] [PATCH v5 6/6] sql: set column types for EXPLAIN and PRAGMA imeevma
2019-01-30 13:59 ` [tarantool-patches] Re: [PATCH v5 0/6] " Vladislav Shpilevoy
2019-01-31 14:56   ` Imeev Mergen
2019-02-15 20:44 ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f667d56f6684a5cb7030097a66c4ac8b46d36cc.1548771900.git.imeevma@gmail.com \
    --to=imeevma@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH v5 1/6] sql: remove unused macros from pragma.c and pragma.h' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox