sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
| 1 | /* |
| 2 | ** 2015-06-08 |
| 3 | ** |
| 4 | ** The author disclaims copyright to this source code. In place of |
| 5 | ** a legal notice, here is a blessing: |
| 6 | ** |
| 7 | ** May you do good and not evil. |
| 8 | ** May you find forgiveness for yourself and forgive others. |
| 9 | ** May you share freely, never taking more than you give. |
| 10 | ** |
| 11 | ************************************************************************* |
| 12 | ** |
| 13 | ** This file contains C code to implement the TreeView debugging routines. |
| 14 | ** These routines print a parse tree to standard output for debugging and |
| 15 | ** analysis. |
| 16 | ** |
| 17 | ** The interfaces in this file is only available when compiling |
| 18 | ** with SQLITE_DEBUG. |
| 19 | */ |
| 20 | #include "sqliteInt.h" |
| 21 | #ifdef SQLITE_DEBUG |
| 22 | |
| 23 | /* |
| 24 | ** Add a new subitem to the tree. The moreToFollow flag indicates that this |
| 25 | ** is not the last item in the tree. |
| 26 | */ |
| 27 | static void sqlite3TreeViewPush(TreeView **pp, u8 moreToFollow){ |
| 28 | TreeView *p = *pp; |
| 29 | if( p==0 ){ |
| 30 | *pp = p = sqlite3_malloc64( sizeof(*p) ); |
| 31 | if( p==0 ) return; |
| 32 | memset(p, 0, sizeof(*p)); |
| 33 | }else{ |
| 34 | p->iLevel++; |
| 35 | } |
| 36 | assert( moreToFollow==0 || moreToFollow==1 ); |
| 37 | if( p->iLevel<(int)sizeof(p->bLine) ) p->bLine[p->iLevel] = moreToFollow; |
| 38 | } |
| 39 | |
| 40 | /* |
| 41 | ** Finished with one layer of the tree |
| 42 | */ |
| 43 | static void sqlite3TreeViewPop(TreeView **pp){ |
| 44 | TreeView *p = *pp; |
| 45 | if( p==0 ) return; |
| 46 | p->iLevel--; |
| 47 | if( p->iLevel<0 ){ |
| 48 | sqlite3_free(p); |
| 49 | *pp = 0; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /* |
| 54 | ** Generate a single line of output for the tree, with a prefix that contains |
| 55 | ** all the appropriate tree lines |
| 56 | */ |
| 57 | void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){ |
| 58 | va_list ap; |
| 59 | int i; |
| 60 | StrAccum acc; |
| 61 | char zBuf[1000]; |
| 62 | sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); |
| 63 | if( p ){ |
| 64 | for(i=0; i<p->iLevel && i<(int)sizeof(p->bLine)-1; i++){ |
| 65 | sqlite3_str_append(&acc, p->bLine[i] ? "| " : " ", 4); |
| 66 | } |
| 67 | sqlite3_str_append(&acc, p->bLine[i] ? "|-- " : "'-- ", 4); |
| 68 | } |
| 69 | if( zFormat!=0 ){ |
| 70 | va_start(ap, zFormat); |
| 71 | sqlite3_str_vappendf(&acc, zFormat, ap); |
| 72 | va_end(ap); |
| 73 | assert( acc.nChar>0 || acc.accError ); |
| 74 | sqlite3_str_append(&acc, "\n", 1); |
| 75 | } |
| 76 | sqlite3StrAccumFinish(&acc); |
| 77 | fprintf(stdout,"%s", zBuf); |
| 78 | fflush(stdout); |
| 79 | } |
| 80 | |
| 81 | /* |
| 82 | ** Shorthand for starting a new tree item that consists of a single label |
| 83 | */ |
| 84 | static void sqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreFollows){ |
| 85 | sqlite3TreeViewPush(&p, moreFollows); |
| 86 | sqlite3TreeViewLine(p, "%s", zLabel); |
| 87 | } |
| 88 | |
| 89 | /* |
| 90 | ** Show a list of Column objects in tree format. |
| 91 | */ |
| 92 | void sqlite3TreeViewColumnList( |
| 93 | TreeView *pView, |
| 94 | const Column *aCol, |
| 95 | int nCol, |
| 96 | u8 moreToFollow |
| 97 | ){ |
| 98 | int i; |
| 99 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 100 | sqlite3TreeViewLine(pView, "COLUMNS"); |
| 101 | for(i=0; i<nCol; i++){ |
| 102 | u16 flg = aCol[i].colFlags; |
| 103 | int colMoreToFollow = i<(nCol - 1); |
| 104 | sqlite3TreeViewPush(&pView, colMoreToFollow); |
| 105 | sqlite3TreeViewLine(pView, 0); |
| 106 | printf(" %s", aCol[i].zCnName); |
| 107 | switch( aCol[i].eCType ){ |
| 108 | case COLTYPE_ANY: printf(" ANY"); break; |
| 109 | case COLTYPE_BLOB: printf(" BLOB"); break; |
| 110 | case COLTYPE_INT: printf(" INT"); break; |
| 111 | case COLTYPE_INTEGER: printf(" INTEGER"); break; |
| 112 | case COLTYPE_REAL: printf(" REAL"); break; |
| 113 | case COLTYPE_TEXT: printf(" TEXT"); break; |
| 114 | case COLTYPE_CUSTOM: { |
| 115 | if( flg & COLFLAG_HASTYPE ){ |
| 116 | const char *z = aCol[i].zCnName; |
| 117 | z += strlen(z)+1; |
| 118 | printf(" X-%s", z); |
| 119 | break; |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | if( flg & COLFLAG_PRIMKEY ) printf(" PRIMARY KEY"); |
| 124 | if( flg & COLFLAG_HIDDEN ) printf(" HIDDEN"); |
| 125 | #ifdef COLFLAG_NOEXPAND |
| 126 | if( flg & COLFLAG_NOEXPAND ) printf(" NO-EXPAND"); |
| 127 | #endif |
| 128 | if( flg ) printf(" flags=%04x", flg); |
| 129 | printf("\n"); |
| 130 | fflush(stdout); |
| 131 | sqlite3TreeViewPop(&pView); |
| 132 | } |
| 133 | sqlite3TreeViewPop(&pView); |
| 134 | } |
| 135 | |
| 136 | /* |
| 137 | ** Generate a human-readable description of a WITH clause. |
| 138 | */ |
| 139 | void sqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 moreToFollow){ |
| 140 | int i; |
| 141 | if( pWith==0 ) return; |
| 142 | if( pWith->nCte==0 ) return; |
| 143 | if( pWith->pOuter ){ |
| 144 | sqlite3TreeViewLine(pView, "WITH (0x%p, pOuter=0x%p)",pWith,pWith->pOuter); |
| 145 | }else{ |
| 146 | sqlite3TreeViewLine(pView, "WITH (0x%p)", pWith); |
| 147 | } |
| 148 | if( pWith->nCte>0 ){ |
| 149 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 150 | for(i=0; i<pWith->nCte; i++){ |
| 151 | StrAccum x; |
| 152 | char zLine[1000]; |
| 153 | const struct Cte *pCte = &pWith->a[i]; |
| 154 | sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0); |
| 155 | sqlite3_str_appendf(&x, "%s", pCte->zName); |
| 156 | if( pCte->pCols && pCte->pCols->nExpr>0 ){ |
| 157 | char cSep = '('; |
| 158 | int j; |
| 159 | for(j=0; j<pCte->pCols->nExpr; j++){ |
| 160 | sqlite3_str_appendf(&x, "%c%s", cSep, pCte->pCols->a[j].zEName); |
| 161 | cSep = ','; |
| 162 | } |
| 163 | sqlite3_str_appendf(&x, ")"); |
| 164 | } |
| 165 | if( pCte->eM10d!=M10d_Any ){ |
| 166 | sqlite3_str_appendf(&x, " %sMATERIALIZED", |
| 167 | pCte->eM10d==M10d_No ? "NOT " : ""); |
| 168 | } |
| 169 | if( pCte->pUse ){ |
| 170 | sqlite3_str_appendf(&x, " (pUse=0x%p, nUse=%d)", pCte->pUse, |
| 171 | pCte->pUse->nUse); |
| 172 | } |
| 173 | sqlite3StrAccumFinish(&x); |
| 174 | sqlite3TreeViewItem(pView, zLine, i<pWith->nCte-1); |
| 175 | sqlite3TreeViewSelect(pView, pCte->pSelect, 0); |
| 176 | sqlite3TreeViewPop(&pView); |
| 177 | } |
| 178 | sqlite3TreeViewPop(&pView); |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | /* |
| 183 | ** Generate a human-readable description of a SrcList object. |
| 184 | */ |
| 185 | void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){ |
| 186 | int i; |
| 187 | if( pSrc==0 ) return; |
| 188 | for(i=0; i<pSrc->nSrc; i++){ |
| 189 | const SrcItem *pItem = &pSrc->a[i]; |
| 190 | StrAccum x; |
| 191 | int n = 0; |
| 192 | char zLine[1000]; |
| 193 | sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0); |
| 194 | x.printfFlags |= SQLITE_PRINTF_INTERNAL; |
| 195 | sqlite3_str_appendf(&x, "{%d:*} %!S", pItem->iCursor, pItem); |
| 196 | if( pItem->pSTab ){ |
| 197 | sqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p used=%llx%s", |
| 198 | pItem->pSTab->zName, pItem->pSTab->nCol, pItem->pSTab, |
| 199 | pItem->colUsed, |
| 200 | pItem->fg.rowidUsed ? "+rowid" : ""); |
| 201 | } |
| 202 | if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))==(JT_LEFT|JT_RIGHT) ){ |
| 203 | sqlite3_str_appendf(&x, " FULL-OUTER-JOIN"); |
| 204 | }else if( pItem->fg.jointype & JT_LEFT ){ |
| 205 | sqlite3_str_appendf(&x, " LEFT-JOIN"); |
| 206 | }else if( pItem->fg.jointype & JT_RIGHT ){ |
| 207 | sqlite3_str_appendf(&x, " RIGHT-JOIN"); |
| 208 | }else if( pItem->fg.jointype & JT_CROSS ){ |
| 209 | sqlite3_str_appendf(&x, " CROSS-JOIN"); |
| 210 | } |
| 211 | if( pItem->fg.jointype & JT_LTORJ ){ |
| 212 | sqlite3_str_appendf(&x, " LTORJ"); |
| 213 | } |
| 214 | if( pItem->fg.fromDDL ){ |
| 215 | sqlite3_str_appendf(&x, " DDL"); |
| 216 | } |
| 217 | if( pItem->fg.isCte ){ |
| 218 | static const char *aMat[] = {",MAT", "", ",NO-MAT"}; |
| 219 | sqlite3_str_appendf(&x, " CteUse=%d%s", |
| 220 | pItem->u2.pCteUse->nUse, |
| 221 | aMat[pItem->u2.pCteUse->eM10d]); |
| 222 | } |
| 223 | if( pItem->fg.isOn || (pItem->fg.isUsing==0 && pItem->u3.pOn!=0) ){ |
| 224 | sqlite3_str_appendf(&x, " isOn"); |
| 225 | } |
| 226 | if( pItem->fg.isTabFunc ) sqlite3_str_appendf(&x, " isTabFunc"); |
| 227 | if( pItem->fg.isCorrelated ) sqlite3_str_appendf(&x, " isCorrelated"); |
| 228 | if( pItem->fg.isMaterialized ) sqlite3_str_appendf(&x, " isMaterialized"); |
| 229 | if( pItem->fg.viaCoroutine ) sqlite3_str_appendf(&x, " viaCoroutine"); |
| 230 | if( pItem->fg.notCte ) sqlite3_str_appendf(&x, " notCte"); |
| 231 | if( pItem->fg.isNestedFrom ) sqlite3_str_appendf(&x, " isNestedFrom"); |
| 232 | if( pItem->fg.fixedSchema ) sqlite3_str_appendf(&x, " fixedSchema"); |
| 233 | if( pItem->fg.hadSchema ) sqlite3_str_appendf(&x, " hadSchema"); |
| 234 | if( pItem->fg.isSubquery ) sqlite3_str_appendf(&x, " isSubquery"); |
| 235 | |
| 236 | sqlite3StrAccumFinish(&x); |
| 237 | sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1); |
| 238 | n = 0; |
| 239 | if( pItem->fg.isSubquery ) n++; |
| 240 | if( pItem->fg.isTabFunc ) n++; |
| 241 | if( pItem->fg.isUsing || pItem->u3.pOn!=0 ) n++; |
| 242 | if( pItem->fg.isUsing ){ |
| 243 | sqlite3TreeViewIdList(pView, pItem->u3.pUsing, (--n)>0, "USING"); |
| 244 | }else if( pItem->u3.pOn!=0 ){ |
| 245 | sqlite3TreeViewItem(pView, "ON", (--n)>0); |
| 246 | sqlite3TreeViewExpr(pView, pItem->u3.pOn, 0); |
| 247 | sqlite3TreeViewPop(&pView); |
| 248 | } |
| 249 | if( pItem->fg.isSubquery ){ |
| 250 | assert( n==1 ); |
| 251 | if( pItem->pSTab ){ |
| 252 | Table *pTab = pItem->pSTab; |
| 253 | sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1); |
| 254 | } |
| 255 | assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem) ); |
| 256 | sqlite3TreeViewSelect(pView, pItem->u4.pSubq->pSelect, 0); |
| 257 | } |
| 258 | if( pItem->fg.isTabFunc ){ |
| 259 | sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:"); |
| 260 | } |
| 261 | sqlite3TreeViewPop(&pView); |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | /* |
| 266 | ** Generate a human-readable description of a Select object. |
| 267 | */ |
| 268 | void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){ |
| 269 | int n = 0; |
| 270 | int cnt = 0; |
| 271 | if( p==0 ){ |
| 272 | sqlite3TreeViewLine(pView, "nil-SELECT"); |
| 273 | return; |
| 274 | } |
| 275 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 276 | if( p->pWith ){ |
| 277 | sqlite3TreeViewWith(pView, p->pWith, 1); |
| 278 | cnt = 1; |
| 279 | sqlite3TreeViewPush(&pView, 1); |
| 280 | } |
| 281 | do{ |
| 282 | if( p->selFlags & SF_WhereBegin ){ |
| 283 | sqlite3TreeViewLine(pView, "sqlite3WhereBegin()"); |
| 284 | }else{ |
| 285 | sqlite3TreeViewLine(pView, |
| 286 | "SELECT%s%s (%u/%p) selFlags=0x%x nSelectRow=%d", |
| 287 | ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""), |
| 288 | ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""), |
| 289 | p->selId, p, p->selFlags, |
| 290 | (int)p->nSelectRow |
| 291 | ); |
| 292 | } |
| 293 | if( cnt++ ) sqlite3TreeViewPop(&pView); |
| 294 | if( p->pPrior ){ |
| 295 | n = 1000; |
| 296 | }else{ |
| 297 | n = 0; |
| 298 | if( p->pSrc && p->pSrc->nSrc && p->pSrc->nAlloc ) n++; |
| 299 | if( p->pWhere ) n++; |
| 300 | if( p->pGroupBy ) n++; |
| 301 | if( p->pHaving ) n++; |
| 302 | if( p->pOrderBy ) n++; |
| 303 | if( p->pLimit ) n++; |
| 304 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 305 | if( p->pWin ) n++; |
| 306 | if( p->pWinDefn ) n++; |
| 307 | #endif |
| 308 | } |
| 309 | if( p->pEList ){ |
| 310 | sqlite3TreeViewExprList(pView, p->pEList, n>0, "result-set"); |
| 311 | } |
| 312 | n--; |
| 313 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 314 | if( p->pWin ){ |
| 315 | Window *pX; |
| 316 | sqlite3TreeViewPush(&pView, (n--)>0); |
| 317 | sqlite3TreeViewLine(pView, "window-functions"); |
| 318 | for(pX=p->pWin; pX; pX=pX->pNextWin){ |
| 319 | sqlite3TreeViewWinFunc(pView, pX, pX->pNextWin!=0); |
| 320 | } |
| 321 | sqlite3TreeViewPop(&pView); |
| 322 | } |
| 323 | #endif |
| 324 | if( p->pSrc && p->pSrc->nSrc && p->pSrc->nAlloc ){ |
| 325 | sqlite3TreeViewPush(&pView, (n--)>0); |
| 326 | sqlite3TreeViewLine(pView, "FROM"); |
| 327 | sqlite3TreeViewSrcList(pView, p->pSrc); |
| 328 | sqlite3TreeViewPop(&pView); |
| 329 | } |
| 330 | if( p->pWhere ){ |
| 331 | sqlite3TreeViewItem(pView, "WHERE", (n--)>0); |
| 332 | sqlite3TreeViewExpr(pView, p->pWhere, 0); |
| 333 | sqlite3TreeViewPop(&pView); |
| 334 | } |
| 335 | if( p->pGroupBy ){ |
| 336 | sqlite3TreeViewExprList(pView, p->pGroupBy, (n--)>0, "GROUPBY"); |
| 337 | } |
| 338 | if( p->pHaving ){ |
| 339 | sqlite3TreeViewItem(pView, "HAVING", (n--)>0); |
| 340 | sqlite3TreeViewExpr(pView, p->pHaving, 0); |
| 341 | sqlite3TreeViewPop(&pView); |
| 342 | } |
| 343 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 344 | if( p->pWinDefn ){ |
| 345 | Window *pX; |
| 346 | sqlite3TreeViewItem(pView, "WINDOW", (n--)>0); |
| 347 | for(pX=p->pWinDefn; pX; pX=pX->pNextWin){ |
| 348 | sqlite3TreeViewWindow(pView, pX, pX->pNextWin!=0); |
| 349 | } |
| 350 | sqlite3TreeViewPop(&pView); |
| 351 | } |
| 352 | #endif |
| 353 | if( p->pOrderBy ){ |
| 354 | sqlite3TreeViewExprList(pView, p->pOrderBy, (n--)>0, "ORDERBY"); |
| 355 | } |
| 356 | if( p->pLimit ){ |
| 357 | sqlite3TreeViewItem(pView, "LIMIT", (n--)>0); |
| 358 | sqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0); |
| 359 | if( p->pLimit->pRight ){ |
| 360 | sqlite3TreeViewItem(pView, "OFFSET", 0); |
| 361 | sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0); |
| 362 | sqlite3TreeViewPop(&pView); |
| 363 | } |
| 364 | sqlite3TreeViewPop(&pView); |
| 365 | } |
| 366 | if( p->pPrior ){ |
| 367 | const char *zOp = "UNION"; |
| 368 | switch( p->op ){ |
| 369 | case TK_ALL: zOp = "UNION ALL"; break; |
| 370 | case TK_INTERSECT: zOp = "INTERSECT"; break; |
| 371 | case TK_EXCEPT: zOp = "EXCEPT"; break; |
| 372 | } |
| 373 | sqlite3TreeViewItem(pView, zOp, 1); |
| 374 | } |
| 375 | p = p->pPrior; |
| 376 | }while( p!=0 ); |
| 377 | sqlite3TreeViewPop(&pView); |
| 378 | } |
| 379 | |
| 380 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 381 | /* |
| 382 | ** Generate a description of starting or stopping bounds |
| 383 | */ |
| 384 | void sqlite3TreeViewBound( |
| 385 | TreeView *pView, /* View context */ |
| 386 | u8 eBound, /* UNBOUNDED, CURRENT, PRECEDING, FOLLOWING */ |
| 387 | Expr *pExpr, /* Value for PRECEDING or FOLLOWING */ |
| 388 | u8 moreToFollow /* True if more to follow */ |
| 389 | ){ |
| 390 | switch( eBound ){ |
| 391 | case TK_UNBOUNDED: { |
| 392 | sqlite3TreeViewItem(pView, "UNBOUNDED", moreToFollow); |
| 393 | sqlite3TreeViewPop(&pView); |
| 394 | break; |
| 395 | } |
| 396 | case TK_CURRENT: { |
| 397 | sqlite3TreeViewItem(pView, "CURRENT", moreToFollow); |
| 398 | sqlite3TreeViewPop(&pView); |
| 399 | break; |
| 400 | } |
| 401 | case TK_PRECEDING: { |
| 402 | sqlite3TreeViewItem(pView, "PRECEDING", moreToFollow); |
| 403 | sqlite3TreeViewExpr(pView, pExpr, 0); |
| 404 | sqlite3TreeViewPop(&pView); |
| 405 | break; |
| 406 | } |
| 407 | case TK_FOLLOWING: { |
| 408 | sqlite3TreeViewItem(pView, "FOLLOWING", moreToFollow); |
| 409 | sqlite3TreeViewExpr(pView, pExpr, 0); |
| 410 | sqlite3TreeViewPop(&pView); |
| 411 | break; |
| 412 | } |
| 413 | } |
| 414 | } |
| 415 | #endif /* SQLITE_OMIT_WINDOWFUNC */ |
| 416 | |
| 417 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 418 | /* |
| 419 | ** Generate a human-readable explanation for a Window object |
| 420 | */ |
| 421 | void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){ |
| 422 | int nElement = 0; |
| 423 | if( pWin==0 ) return; |
| 424 | if( pWin->pFilter ){ |
| 425 | sqlite3TreeViewItem(pView, "FILTER", 1); |
| 426 | sqlite3TreeViewExpr(pView, pWin->pFilter, 0); |
| 427 | sqlite3TreeViewPop(&pView); |
| 428 | if( pWin->eFrmType==TK_FILTER ) return; |
| 429 | } |
| 430 | sqlite3TreeViewPush(&pView, more); |
| 431 | if( pWin->zName ){ |
| 432 | sqlite3TreeViewLine(pView, "OVER %s (%p)", pWin->zName, pWin); |
| 433 | }else{ |
| 434 | sqlite3TreeViewLine(pView, "OVER (%p)", pWin); |
| 435 | } |
| 436 | if( pWin->zBase ) nElement++; |
| 437 | if( pWin->pOrderBy ) nElement++; |
| 438 | if( pWin->eFrmType!=0 && pWin->eFrmType!=TK_FILTER ) nElement++; |
| 439 | if( pWin->eExclude ) nElement++; |
| 440 | if( pWin->zBase ){ |
| 441 | sqlite3TreeViewPush(&pView, (--nElement)>0); |
| 442 | sqlite3TreeViewLine(pView, "window: %s", pWin->zBase); |
| 443 | sqlite3TreeViewPop(&pView); |
| 444 | } |
| 445 | if( pWin->pPartition ){ |
| 446 | sqlite3TreeViewExprList(pView, pWin->pPartition, nElement>0,"PARTITION-BY"); |
| 447 | } |
| 448 | if( pWin->pOrderBy ){ |
| 449 | sqlite3TreeViewExprList(pView, pWin->pOrderBy, (--nElement)>0, "ORDER-BY"); |
| 450 | } |
| 451 | if( pWin->eFrmType!=0 && pWin->eFrmType!=TK_FILTER ){ |
| 452 | char zBuf[30]; |
| 453 | const char *zFrmType = "ROWS"; |
| 454 | if( pWin->eFrmType==TK_RANGE ) zFrmType = "RANGE"; |
| 455 | if( pWin->eFrmType==TK_GROUPS ) zFrmType = "GROUPS"; |
| 456 | sqlite3_snprintf(sizeof(zBuf),zBuf,"%s%s",zFrmType, |
| 457 | pWin->bImplicitFrame ? " (implied)" : ""); |
| 458 | sqlite3TreeViewItem(pView, zBuf, (--nElement)>0); |
| 459 | sqlite3TreeViewBound(pView, pWin->eStart, pWin->pStart, 1); |
| 460 | sqlite3TreeViewBound(pView, pWin->eEnd, pWin->pEnd, 0); |
| 461 | sqlite3TreeViewPop(&pView); |
| 462 | } |
| 463 | if( pWin->eExclude ){ |
| 464 | char zBuf[30]; |
| 465 | const char *zExclude; |
| 466 | switch( pWin->eExclude ){ |
| 467 | case TK_NO: zExclude = "NO OTHERS"; break; |
| 468 | case TK_CURRENT: zExclude = "CURRENT ROW"; break; |
| 469 | case TK_GROUP: zExclude = "GROUP"; break; |
| 470 | case TK_TIES: zExclude = "TIES"; break; |
| 471 | default: |
| 472 | sqlite3_snprintf(sizeof(zBuf),zBuf,"invalid(%d)", pWin->eExclude); |
| 473 | zExclude = zBuf; |
| 474 | break; |
| 475 | } |
| 476 | sqlite3TreeViewPush(&pView, 0); |
| 477 | sqlite3TreeViewLine(pView, "EXCLUDE %s", zExclude); |
| 478 | sqlite3TreeViewPop(&pView); |
| 479 | } |
| 480 | sqlite3TreeViewPop(&pView); |
| 481 | } |
| 482 | #endif /* SQLITE_OMIT_WINDOWFUNC */ |
| 483 | |
| 484 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 485 | /* |
| 486 | ** Generate a human-readable explanation for a Window Function object |
| 487 | */ |
| 488 | void sqlite3TreeViewWinFunc(TreeView *pView, const Window *pWin, u8 more){ |
| 489 | if( pWin==0 ) return; |
| 490 | sqlite3TreeViewPush(&pView, more); |
| 491 | sqlite3TreeViewLine(pView, "WINFUNC %s(%d)", |
| 492 | pWin->pWFunc->zName, pWin->pWFunc->nArg); |
| 493 | sqlite3TreeViewWindow(pView, pWin, 0); |
| 494 | sqlite3TreeViewPop(&pView); |
| 495 | } |
| 496 | #endif /* SQLITE_OMIT_WINDOWFUNC */ |
| 497 | |
| 498 | /* |
| 499 | ** Generate a human-readable explanation of an expression tree. |
| 500 | */ |
| 501 | void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){ |
| 502 | const char *zBinOp = 0; /* Binary operator */ |
| 503 | const char *zUniOp = 0; /* Unary operator */ |
| 504 | char zFlgs[200]; |
| 505 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 506 | if( pExpr==0 ){ |
| 507 | sqlite3TreeViewLine(pView, "nil"); |
| 508 | sqlite3TreeViewPop(&pView); |
| 509 | return; |
| 510 | } |
| 511 | if( pExpr->flags || pExpr->affExpr || pExpr->vvaFlags || pExpr->pAggInfo ){ |
| 512 | StrAccum x; |
| 513 | sqlite3StrAccumInit(&x, 0, zFlgs, sizeof(zFlgs), 0); |
| 514 | sqlite3_str_appendf(&x, " fg.af=%x.%c", |
| 515 | pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n'); |
| 516 | if( ExprHasProperty(pExpr, EP_OuterON) ){ |
| 517 | sqlite3_str_appendf(&x, " outer.iJoin=%d", pExpr->w.iJoin); |
| 518 | } |
| 519 | if( ExprHasProperty(pExpr, EP_InnerON) ){ |
| 520 | sqlite3_str_appendf(&x, " inner.iJoin=%d", pExpr->w.iJoin); |
| 521 | } |
| 522 | if( ExprHasProperty(pExpr, EP_FromDDL) ){ |
| 523 | sqlite3_str_appendf(&x, " DDL"); |
| 524 | } |
| 525 | if( ExprHasVVAProperty(pExpr, EP_Immutable) ){ |
| 526 | sqlite3_str_appendf(&x, " IMMUTABLE"); |
| 527 | } |
| 528 | if( pExpr->pAggInfo!=0 ){ |
| 529 | sqlite3_str_appendf(&x, " agg-column[%d]", pExpr->iAgg); |
| 530 | } |
| 531 | sqlite3StrAccumFinish(&x); |
| 532 | }else{ |
| 533 | zFlgs[0] = 0; |
| 534 | } |
| 535 | switch( pExpr->op ){ |
| 536 | case TK_AGG_COLUMN: { |
| 537 | sqlite3TreeViewLine(pView, "AGG{%d:%d}%s", |
| 538 | pExpr->iTable, pExpr->iColumn, zFlgs); |
| 539 | break; |
| 540 | } |
| 541 | case TK_COLUMN: { |
| 542 | if( pExpr->iTable<0 ){ |
| 543 | /* This only happens when coding check constraints */ |
| 544 | char zOp2[16]; |
| 545 | if( pExpr->op2 ){ |
| 546 | sqlite3_snprintf(sizeof(zOp2),zOp2," op2=0x%02x",pExpr->op2); |
| 547 | }else{ |
| 548 | zOp2[0] = 0; |
| 549 | } |
| 550 | sqlite3TreeViewLine(pView, "COLUMN(%d)%s%s", |
| 551 | pExpr->iColumn, zFlgs, zOp2); |
| 552 | }else{ |
| 553 | assert( ExprUseYTab(pExpr) ); |
| 554 | sqlite3TreeViewLine(pView, "{%d:%d} pTab=%p%s", |
| 555 | pExpr->iTable, pExpr->iColumn, |
| 556 | pExpr->y.pTab, zFlgs); |
| 557 | } |
| 558 | if( ExprHasProperty(pExpr, EP_FixedCol) ){ |
| 559 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); |
| 560 | } |
| 561 | break; |
| 562 | } |
| 563 | case TK_INTEGER: { |
| 564 | if( pExpr->flags & EP_IntValue ){ |
| 565 | sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue); |
| 566 | }else{ |
| 567 | sqlite3TreeViewLine(pView, "%s", pExpr->u.zToken); |
| 568 | } |
| 569 | break; |
| 570 | } |
| 571 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 572 | case TK_FLOAT: { |
| 573 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 574 | sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken); |
| 575 | break; |
| 576 | } |
| 577 | #endif |
| 578 | case TK_STRING: { |
| 579 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 580 | sqlite3TreeViewLine(pView,"%Q", pExpr->u.zToken); |
| 581 | break; |
| 582 | } |
| 583 | case TK_NULL: { |
| 584 | sqlite3TreeViewLine(pView,"NULL"); |
| 585 | break; |
| 586 | } |
| 587 | case TK_TRUEFALSE: { |
| 588 | sqlite3TreeViewLine(pView,"%s%s", |
| 589 | sqlite3ExprTruthValue(pExpr) ? "TRUE" : "FALSE", zFlgs); |
| 590 | break; |
| 591 | } |
| 592 | #ifndef SQLITE_OMIT_BLOB_LITERAL |
| 593 | case TK_BLOB: { |
| 594 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 595 | sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken); |
| 596 | break; |
| 597 | } |
| 598 | #endif |
| 599 | case TK_VARIABLE: { |
| 600 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 601 | sqlite3TreeViewLine(pView,"VARIABLE(%s,%d)", |
| 602 | pExpr->u.zToken, pExpr->iColumn); |
| 603 | break; |
| 604 | } |
| 605 | case TK_REGISTER: { |
| 606 | sqlite3TreeViewLine(pView,"REGISTER(%d)", pExpr->iTable); |
| 607 | break; |
| 608 | } |
| 609 | case TK_ID: { |
| 610 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 611 | sqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken); |
| 612 | break; |
| 613 | } |
| 614 | case TK_ASTERISK: { |
| 615 | sqlite3TreeViewLine(pView,"ASKTERISK"); |
| 616 | break; |
| 617 | } |
| 618 | #ifndef SQLITE_OMIT_CAST |
| 619 | case TK_CAST: { |
| 620 | /* Expressions of the form: CAST(pLeft AS token) */ |
| 621 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 622 | sqlite3TreeViewLine(pView,"CAST %Q", pExpr->u.zToken); |
| 623 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); |
| 624 | break; |
| 625 | } |
| 626 | #endif /* SQLITE_OMIT_CAST */ |
| 627 | case TK_LT: zBinOp = "LT"; break; |
| 628 | case TK_LE: zBinOp = "LE"; break; |
| 629 | case TK_GT: zBinOp = "GT"; break; |
| 630 | case TK_GE: zBinOp = "GE"; break; |
| 631 | case TK_NE: zBinOp = "NE"; break; |
| 632 | case TK_EQ: zBinOp = "EQ"; break; |
| 633 | case TK_IS: zBinOp = "IS"; break; |
| 634 | case TK_ISNOT: zBinOp = "ISNOT"; break; |
| 635 | case TK_AND: zBinOp = "AND"; break; |
| 636 | case TK_OR: zBinOp = "OR"; break; |
| 637 | case TK_PLUS: zBinOp = "ADD"; break; |
| 638 | case TK_STAR: zBinOp = "MUL"; break; |
| 639 | case TK_MINUS: zBinOp = "SUB"; break; |
| 640 | case TK_REM: zBinOp = "REM"; break; |
| 641 | case TK_BITAND: zBinOp = "BITAND"; break; |
| 642 | case TK_BITOR: zBinOp = "BITOR"; break; |
| 643 | case TK_SLASH: zBinOp = "DIV"; break; |
| 644 | case TK_LSHIFT: zBinOp = "LSHIFT"; break; |
| 645 | case TK_RSHIFT: zBinOp = "RSHIFT"; break; |
| 646 | case TK_CONCAT: zBinOp = "CONCAT"; break; |
| 647 | case TK_DOT: zBinOp = "DOT"; break; |
| 648 | case TK_LIMIT: zBinOp = "LIMIT"; break; |
| 649 | |
| 650 | case TK_UMINUS: zUniOp = "UMINUS"; break; |
| 651 | case TK_UPLUS: zUniOp = "UPLUS"; break; |
| 652 | case TK_BITNOT: zUniOp = "BITNOT"; break; |
| 653 | case TK_NOT: zUniOp = "NOT"; break; |
| 654 | case TK_ISNULL: zUniOp = "ISNULL"; break; |
| 655 | case TK_NOTNULL: zUniOp = "NOTNULL"; break; |
| 656 | |
| 657 | case TK_TRUTH: { |
| 658 | int x; |
| 659 | const char *azOp[] = { |
| 660 | "IS-FALSE", "IS-TRUE", "IS-NOT-FALSE", "IS-NOT-TRUE" |
| 661 | }; |
| 662 | assert( pExpr->op2==TK_IS || pExpr->op2==TK_ISNOT ); |
| 663 | assert( pExpr->pRight ); |
| 664 | assert( sqlite3ExprSkipCollateAndLikely(pExpr->pRight)->op |
| 665 | == TK_TRUEFALSE ); |
| 666 | x = (pExpr->op2==TK_ISNOT)*2 + sqlite3ExprTruthValue(pExpr->pRight); |
| 667 | zUniOp = azOp[x]; |
| 668 | break; |
| 669 | } |
| 670 | |
| 671 | case TK_SPAN: { |
| 672 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 673 | sqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken); |
| 674 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); |
| 675 | break; |
| 676 | } |
| 677 | |
| 678 | case TK_COLLATE: { |
| 679 | /* COLLATE operators without the EP_Collate flag are intended to |
| 680 | ** emulate collation associated with a table column. These show |
| 681 | ** up in the treeview output as "SOFT-COLLATE". Explicit COLLATE |
| 682 | ** operators that appear in the original SQL always have the |
| 683 | ** EP_Collate bit set and appear in treeview output as just "COLLATE" */ |
| 684 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 685 | sqlite3TreeViewLine(pView, "%sCOLLATE %Q%s", |
| 686 | !ExprHasProperty(pExpr, EP_Collate) ? "SOFT-" : "", |
| 687 | pExpr->u.zToken, zFlgs); |
| 688 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); |
| 689 | break; |
| 690 | } |
| 691 | |
| 692 | case TK_AGG_FUNCTION: |
| 693 | case TK_FUNCTION: { |
| 694 | ExprList *pFarg; /* List of function arguments */ |
| 695 | Window *pWin; |
| 696 | if( ExprHasProperty(pExpr, EP_TokenOnly) ){ |
| 697 | pFarg = 0; |
| 698 | pWin = 0; |
| 699 | }else{ |
| 700 | assert( ExprUseXList(pExpr) ); |
| 701 | pFarg = pExpr->x.pList; |
| 702 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 703 | pWin = IsWindowFunc(pExpr) ? pExpr->y.pWin : 0; |
| 704 | #else |
| 705 | pWin = 0; |
| 706 | #endif |
| 707 | } |
| 708 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 709 | if( pExpr->op==TK_AGG_FUNCTION ){ |
| 710 | sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s agg=%d[%d]/%p", |
| 711 | pExpr->op2, pExpr->u.zToken, zFlgs, |
| 712 | pExpr->pAggInfo ? pExpr->pAggInfo->selId : 0, |
| 713 | pExpr->iAgg, pExpr->pAggInfo); |
| 714 | }else if( pExpr->op2!=0 ){ |
| 715 | const char *zOp2; |
| 716 | char zBuf[8]; |
| 717 | sqlite3_snprintf(sizeof(zBuf),zBuf,"0x%02x",pExpr->op2); |
| 718 | zOp2 = zBuf; |
| 719 | if( pExpr->op2==NC_IsCheck ) zOp2 = "NC_IsCheck"; |
| 720 | if( pExpr->op2==NC_IdxExpr ) zOp2 = "NC_IdxExpr"; |
| 721 | if( pExpr->op2==NC_PartIdx ) zOp2 = "NC_PartIdx"; |
| 722 | if( pExpr->op2==NC_GenCol ) zOp2 = "NC_GenCol"; |
| 723 | sqlite3TreeViewLine(pView, "FUNCTION %Q%s op2=%s", |
| 724 | pExpr->u.zToken, zFlgs, zOp2); |
| 725 | }else{ |
| 726 | sqlite3TreeViewLine(pView, "FUNCTION %Q%s", pExpr->u.zToken, zFlgs); |
| 727 | } |
| 728 | if( pFarg ){ |
| 729 | sqlite3TreeViewExprList(pView, pFarg, pWin!=0 || pExpr->pLeft, 0); |
| 730 | if( pExpr->pLeft ){ |
| 731 | Expr *pOB = pExpr->pLeft; |
| 732 | assert( pOB->op==TK_ORDER ); |
| 733 | assert( ExprUseXList(pOB) ); |
| 734 | sqlite3TreeViewExprList(pView, pOB->x.pList, pWin!=0, "ORDERBY"); |
| 735 | } |
| 736 | } |
| 737 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 738 | if( pWin ){ |
| 739 | sqlite3TreeViewWindow(pView, pWin, 0); |
| 740 | } |
| 741 | #endif |
| 742 | break; |
| 743 | } |
| 744 | case TK_ORDER: { |
| 745 | sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, "ORDERBY"); |
| 746 | break; |
| 747 | } |
| 748 | #ifndef SQLITE_OMIT_SUBQUERY |
| 749 | case TK_EXISTS: { |
| 750 | assert( ExprUseXSelect(pExpr) ); |
| 751 | sqlite3TreeViewLine(pView, "EXISTS-expr flags=0x%x", pExpr->flags); |
| 752 | sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); |
| 753 | break; |
| 754 | } |
| 755 | case TK_SELECT: { |
| 756 | assert( ExprUseXSelect(pExpr) ); |
| 757 | sqlite3TreeViewLine(pView, "subquery-expr flags=0x%x", pExpr->flags); |
| 758 | sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); |
| 759 | break; |
| 760 | } |
| 761 | case TK_IN: { |
| 762 | sqlite3_str *pStr = sqlite3_str_new(0); |
| 763 | char *z; |
| 764 | sqlite3_str_appendf(pStr, "IN flags=0x%x", pExpr->flags); |
| 765 | if( pExpr->iTable ) sqlite3_str_appendf(pStr, " iTable=%d",pExpr->iTable); |
| 766 | if( ExprHasProperty(pExpr, EP_Subrtn) ){ |
| 767 | sqlite3_str_appendf(pStr, " subrtn(%d,%d)", |
| 768 | pExpr->y.sub.regReturn, pExpr->y.sub.iAddr); |
| 769 | } |
| 770 | z = sqlite3_str_finish(pStr); |
| 771 | sqlite3TreeViewLine(pView, z); |
| 772 | sqlite3_free(z); |
| 773 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 1); |
| 774 | if( ExprUseXSelect(pExpr) ){ |
| 775 | sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); |
| 776 | }else{ |
| 777 | sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0); |
| 778 | } |
| 779 | break; |
| 780 | } |
| 781 | #endif /* SQLITE_OMIT_SUBQUERY */ |
| 782 | |
| 783 | /* |
| 784 | ** x BETWEEN y AND z |
| 785 | ** |
| 786 | ** This is equivalent to |
| 787 | ** |
| 788 | ** x>=y AND x<=z |
| 789 | ** |
| 790 | ** X is stored in pExpr->pLeft. |
| 791 | ** Y is stored in pExpr->pList->a[0].pExpr. |
| 792 | ** Z is stored in pExpr->pList->a[1].pExpr. |
| 793 | */ |
| 794 | case TK_BETWEEN: { |
| 795 | const Expr *pX, *pY, *pZ; |
| 796 | pX = pExpr->pLeft; |
| 797 | assert( ExprUseXList(pExpr) ); |
| 798 | assert( pExpr->x.pList->nExpr==2 ); |
| 799 | pY = pExpr->x.pList->a[0].pExpr; |
| 800 | pZ = pExpr->x.pList->a[1].pExpr; |
| 801 | sqlite3TreeViewLine(pView, "BETWEEN%s", zFlgs); |
| 802 | sqlite3TreeViewExpr(pView, pX, 1); |
| 803 | sqlite3TreeViewExpr(pView, pY, 1); |
| 804 | sqlite3TreeViewExpr(pView, pZ, 0); |
| 805 | break; |
| 806 | } |
| 807 | case TK_TRIGGER: { |
| 808 | /* If the opcode is TK_TRIGGER, then the expression is a reference |
| 809 | ** to a column in the new.* or old.* pseudo-tables available to |
| 810 | ** trigger programs. In this case Expr.iTable is set to 1 for the |
| 811 | ** new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn |
| 812 | ** is set to the column of the pseudo-table to read, or to -1 to |
| 813 | ** read the rowid field. |
| 814 | */ |
| 815 | sqlite3TreeViewLine(pView, "%s(%d)", |
| 816 | pExpr->iTable ? "NEW" : "OLD", pExpr->iColumn); |
| 817 | break; |
| 818 | } |
| 819 | case TK_CASE: { |
| 820 | sqlite3TreeViewLine(pView, "CASE"); |
| 821 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 1); |
| 822 | assert( ExprUseXList(pExpr) ); |
| 823 | sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0); |
| 824 | break; |
| 825 | } |
| 826 | #ifndef SQLITE_OMIT_TRIGGER |
| 827 | case TK_RAISE: { |
| 828 | const char *zType = "unk"; |
| 829 | switch( pExpr->affExpr ){ |
| 830 | case OE_Rollback: zType = "rollback"; break; |
| 831 | case OE_Abort: zType = "abort"; break; |
| 832 | case OE_Fail: zType = "fail"; break; |
| 833 | case OE_Ignore: zType = "ignore"; break; |
| 834 | } |
| 835 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 836 | sqlite3TreeViewLine(pView, "RAISE %s", zType); |
| 837 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); |
| 838 | break; |
| 839 | } |
| 840 | #endif |
| 841 | case TK_MATCH: { |
| 842 | sqlite3TreeViewLine(pView, "MATCH {%d:%d}%s", |
| 843 | pExpr->iTable, pExpr->iColumn, zFlgs); |
| 844 | sqlite3TreeViewExpr(pView, pExpr->pRight, 0); |
| 845 | break; |
| 846 | } |
| 847 | case TK_VECTOR: { |
| 848 | char *z = sqlite3_mprintf("VECTOR%s",zFlgs); |
| 849 | assert( ExprUseXList(pExpr) ); |
| 850 | sqlite3TreeViewBareExprList(pView, pExpr->x.pList, z); |
| 851 | sqlite3_free(z); |
| 852 | break; |
| 853 | } |
| 854 | case TK_SELECT_COLUMN: { |
| 855 | sqlite3TreeViewLine(pView, "SELECT-COLUMN %d of [0..%d]%s", |
| 856 | pExpr->iColumn, pExpr->iTable-1, |
| 857 | pExpr->pRight==pExpr->pLeft ? " (SELECT-owner)" : ""); |
| 858 | assert( ExprUseXSelect(pExpr->pLeft) ); |
| 859 | sqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0); |
| 860 | break; |
| 861 | } |
| 862 | case TK_IF_NULL_ROW: { |
| 863 | sqlite3TreeViewLine(pView, "IF-NULL-ROW %d", pExpr->iTable); |
| 864 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); |
| 865 | break; |
| 866 | } |
| 867 | case TK_ERROR: { |
| 868 | Expr tmp; |
| 869 | sqlite3TreeViewLine(pView, "ERROR"); |
| 870 | tmp = *pExpr; |
| 871 | tmp.op = pExpr->op2; |
| 872 | sqlite3TreeViewExpr(pView, &tmp, 0); |
| 873 | break; |
| 874 | } |
| 875 | case TK_ROW: { |
| 876 | if( pExpr->iColumn<=0 ){ |
| 877 | sqlite3TreeViewLine(pView, "First FROM table rowid"); |
| 878 | }else{ |
| 879 | sqlite3TreeViewLine(pView, "First FROM table column %d", |
| 880 | pExpr->iColumn-1); |
| 881 | } |
| 882 | break; |
| 883 | } |
| 884 | default: { |
| 885 | sqlite3TreeViewLine(pView, "op=%d", pExpr->op); |
| 886 | break; |
| 887 | } |
| 888 | } |
| 889 | if( zBinOp ){ |
| 890 | sqlite3TreeViewLine(pView, "%s%s", zBinOp, zFlgs); |
| 891 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 1); |
| 892 | sqlite3TreeViewExpr(pView, pExpr->pRight, 0); |
| 893 | }else if( zUniOp ){ |
| 894 | sqlite3TreeViewLine(pView, "%s%s", zUniOp, zFlgs); |
| 895 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); |
| 896 | } |
| 897 | sqlite3TreeViewPop(&pView); |
| 898 | } |
| 899 | |
| 900 | |
| 901 | /* |
| 902 | ** Generate a human-readable explanation of an expression list. |
| 903 | */ |
| 904 | void sqlite3TreeViewBareExprList( |
| 905 | TreeView *pView, |
| 906 | const ExprList *pList, |
| 907 | const char *zLabel |
| 908 | ){ |
| 909 | if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST"; |
| 910 | if( pList==0 ){ |
| 911 | sqlite3TreeViewLine(pView, "%s (empty)", zLabel); |
| 912 | }else{ |
| 913 | int i; |
| 914 | sqlite3TreeViewLine(pView, "%s", zLabel); |
| 915 | for(i=0; i<pList->nExpr; i++){ |
| 916 | int j = pList->a[i].u.x.iOrderByCol; |
| 917 | u8 sortFlags = pList->a[i].fg.sortFlags; |
| 918 | char *zName = pList->a[i].zEName; |
| 919 | int moreToFollow = i<pList->nExpr - 1; |
| 920 | if( j || zName || sortFlags ){ |
| 921 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 922 | moreToFollow = 0; |
| 923 | sqlite3TreeViewLine(pView, 0); |
| 924 | if( zName ){ |
| 925 | switch( pList->a[i].fg.eEName ){ |
| 926 | default: |
| 927 | fprintf(stdout, "AS %s ", zName); |
| 928 | break; |
| 929 | case ENAME_TAB: |
| 930 | fprintf(stdout, "TABLE-ALIAS-NAME(\"%s\") ", zName); |
| 931 | if( pList->a[i].fg.bUsed ) fprintf(stdout, "(used) "); |
| 932 | if( pList->a[i].fg.bUsingTerm ) fprintf(stdout, "(USING-term) "); |
| 933 | if( pList->a[i].fg.bNoExpand ) fprintf(stdout, "(NoExpand) "); |
| 934 | break; |
| 935 | case ENAME_SPAN: |
| 936 | fprintf(stdout, "SPAN(\"%s\") ", zName); |
| 937 | break; |
| 938 | } |
| 939 | } |
| 940 | if( j ){ |
| 941 | fprintf(stdout, "iOrderByCol=%d ", j); |
| 942 | } |
| 943 | if( sortFlags & KEYINFO_ORDER_DESC ){ |
| 944 | fprintf(stdout, "DESC "); |
| 945 | }else if( sortFlags & KEYINFO_ORDER_BIGNULL ){ |
| 946 | fprintf(stdout, "NULLS-LAST"); |
| 947 | } |
| 948 | fprintf(stdout, "\n"); |
| 949 | fflush(stdout); |
| 950 | } |
| 951 | sqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow); |
| 952 | if( j || zName || sortFlags ){ |
| 953 | sqlite3TreeViewPop(&pView); |
| 954 | } |
| 955 | } |
| 956 | } |
| 957 | } |
| 958 | void sqlite3TreeViewExprList( |
| 959 | TreeView *pView, |
| 960 | const ExprList *pList, |
| 961 | u8 moreToFollow, |
| 962 | const char *zLabel |
| 963 | ){ |
| 964 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 965 | sqlite3TreeViewBareExprList(pView, pList, zLabel); |
| 966 | sqlite3TreeViewPop(&pView); |
| 967 | } |
| 968 | |
| 969 | /* |
| 970 | ** Generate a human-readable explanation of an id-list. |
| 971 | */ |
| 972 | void sqlite3TreeViewBareIdList( |
| 973 | TreeView *pView, |
| 974 | const IdList *pList, |
| 975 | const char *zLabel |
| 976 | ){ |
| 977 | if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST"; |
| 978 | if( pList==0 ){ |
| 979 | sqlite3TreeViewLine(pView, "%s (empty)", zLabel); |
| 980 | }else{ |
| 981 | int i; |
| 982 | sqlite3TreeViewLine(pView, "%s", zLabel); |
| 983 | for(i=0; i<pList->nId; i++){ |
| 984 | char *zName = pList->a[i].zName; |
| 985 | int moreToFollow = i<pList->nId - 1; |
| 986 | if( zName==0 ) zName = "(null)"; |
| 987 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 988 | sqlite3TreeViewLine(pView, 0); |
| 989 | fprintf(stdout, "%s\n", zName); |
| 990 | sqlite3TreeViewPop(&pView); |
| 991 | } |
| 992 | } |
| 993 | } |
| 994 | void sqlite3TreeViewIdList( |
| 995 | TreeView *pView, |
| 996 | const IdList *pList, |
| 997 | u8 moreToFollow, |
| 998 | const char *zLabel |
| 999 | ){ |
| 1000 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 1001 | sqlite3TreeViewBareIdList(pView, pList, zLabel); |
| 1002 | sqlite3TreeViewPop(&pView); |
| 1003 | } |
| 1004 | |
| 1005 | /* |
| 1006 | ** Generate a human-readable explanation of a list of Upsert objects |
| 1007 | */ |
| 1008 | void sqlite3TreeViewUpsert( |
| 1009 | TreeView *pView, |
| 1010 | const Upsert *pUpsert, |
| 1011 | u8 moreToFollow |
| 1012 | ){ |
| 1013 | if( pUpsert==0 ) return; |
| 1014 | sqlite3TreeViewPush(&pView, moreToFollow); |
| 1015 | while( pUpsert ){ |
| 1016 | int n; |
| 1017 | sqlite3TreeViewPush(&pView, pUpsert->pNextUpsert!=0 || moreToFollow); |
| 1018 | sqlite3TreeViewLine(pView, "ON CONFLICT DO %s", |
| 1019 | pUpsert->isDoUpdate ? "UPDATE" : "NOTHING"); |
| 1020 | n = (pUpsert->pUpsertSet!=0) + (pUpsert->pUpsertWhere!=0); |
| 1021 | sqlite3TreeViewExprList(pView, pUpsert->pUpsertTarget, (n--)>0, "TARGET"); |
| 1022 | sqlite3TreeViewExprList(pView, pUpsert->pUpsertSet, (n--)>0, "SET"); |
| 1023 | if( pUpsert->pUpsertWhere ){ |
| 1024 | sqlite3TreeViewItem(pView, "WHERE", (n--)>0); |
| 1025 | sqlite3TreeViewExpr(pView, pUpsert->pUpsertWhere, 0); |
| 1026 | sqlite3TreeViewPop(&pView); |
| 1027 | } |
| 1028 | sqlite3TreeViewPop(&pView); |
| 1029 | pUpsert = pUpsert->pNextUpsert; |
| 1030 | } |
| 1031 | sqlite3TreeViewPop(&pView); |
| 1032 | } |
| 1033 | |
| 1034 | #if TREETRACE_ENABLED |
| 1035 | /* |
| 1036 | ** Generate a human-readable diagram of the data structure that go |
| 1037 | ** into generating an DELETE statement. |
| 1038 | */ |
| 1039 | void sqlite3TreeViewDelete( |
| 1040 | const With *pWith, |
| 1041 | const SrcList *pTabList, |
| 1042 | const Expr *pWhere, |
| 1043 | const ExprList *pOrderBy, |
| 1044 | const Expr *pLimit, |
| 1045 | const Trigger *pTrigger |
| 1046 | ){ |
| 1047 | int n = 0; |
| 1048 | TreeView *pView = 0; |
| 1049 | sqlite3TreeViewPush(&pView, 0); |
| 1050 | sqlite3TreeViewLine(pView, "DELETE"); |
| 1051 | if( pWith ) n++; |
| 1052 | if( pTabList ) n++; |
| 1053 | if( pWhere ) n++; |
| 1054 | if( pOrderBy ) n++; |
| 1055 | if( pLimit ) n++; |
| 1056 | if( pTrigger ) n++; |
| 1057 | if( pWith ){ |
| 1058 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1059 | sqlite3TreeViewWith(pView, pWith, 0); |
| 1060 | sqlite3TreeViewPop(&pView); |
| 1061 | } |
| 1062 | if( pTabList ){ |
| 1063 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1064 | sqlite3TreeViewLine(pView, "FROM"); |
| 1065 | sqlite3TreeViewSrcList(pView, pTabList); |
| 1066 | sqlite3TreeViewPop(&pView); |
| 1067 | } |
| 1068 | if( pWhere ){ |
| 1069 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1070 | sqlite3TreeViewLine(pView, "WHERE"); |
| 1071 | sqlite3TreeViewExpr(pView, pWhere, 0); |
| 1072 | sqlite3TreeViewPop(&pView); |
| 1073 | } |
| 1074 | if( pOrderBy ){ |
| 1075 | sqlite3TreeViewExprList(pView, pOrderBy, (--n)>0, "ORDER-BY"); |
| 1076 | } |
| 1077 | if( pLimit ){ |
| 1078 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1079 | sqlite3TreeViewLine(pView, "LIMIT"); |
| 1080 | sqlite3TreeViewExpr(pView, pLimit, 0); |
| 1081 | sqlite3TreeViewPop(&pView); |
| 1082 | } |
| 1083 | if( pTrigger ){ |
| 1084 | sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1); |
| 1085 | } |
| 1086 | sqlite3TreeViewPop(&pView); |
| 1087 | } |
| 1088 | #endif /* TREETRACE_ENABLED */ |
| 1089 | |
| 1090 | #if TREETRACE_ENABLED |
| 1091 | /* |
| 1092 | ** Generate a human-readable diagram of the data structure that go |
| 1093 | ** into generating an INSERT statement. |
| 1094 | */ |
| 1095 | void sqlite3TreeViewInsert( |
| 1096 | const With *pWith, |
| 1097 | const SrcList *pTabList, |
| 1098 | const IdList *pColumnList, |
| 1099 | const Select *pSelect, |
| 1100 | const ExprList *pExprList, |
| 1101 | int onError, |
| 1102 | const Upsert *pUpsert, |
| 1103 | const Trigger *pTrigger |
| 1104 | ){ |
| 1105 | TreeView *pView = 0; |
| 1106 | int n = 0; |
| 1107 | const char *zLabel = "INSERT"; |
| 1108 | switch( onError ){ |
| 1109 | case OE_Replace: zLabel = "REPLACE"; break; |
| 1110 | case OE_Ignore: zLabel = "INSERT OR IGNORE"; break; |
| 1111 | case OE_Rollback: zLabel = "INSERT OR ROLLBACK"; break; |
| 1112 | case OE_Abort: zLabel = "INSERT OR ABORT"; break; |
| 1113 | case OE_Fail: zLabel = "INSERT OR FAIL"; break; |
| 1114 | } |
| 1115 | sqlite3TreeViewPush(&pView, 0); |
| 1116 | sqlite3TreeViewLine(pView, zLabel); |
| 1117 | if( pWith ) n++; |
| 1118 | if( pTabList ) n++; |
| 1119 | if( pColumnList ) n++; |
| 1120 | if( pSelect ) n++; |
| 1121 | if( pExprList ) n++; |
| 1122 | if( pUpsert ) n++; |
| 1123 | if( pTrigger ) n++; |
| 1124 | if( pWith ){ |
| 1125 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1126 | sqlite3TreeViewWith(pView, pWith, 0); |
| 1127 | sqlite3TreeViewPop(&pView); |
| 1128 | } |
| 1129 | if( pTabList ){ |
| 1130 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1131 | sqlite3TreeViewLine(pView, "INTO"); |
| 1132 | sqlite3TreeViewSrcList(pView, pTabList); |
| 1133 | sqlite3TreeViewPop(&pView); |
| 1134 | } |
| 1135 | if( pColumnList ){ |
| 1136 | sqlite3TreeViewIdList(pView, pColumnList, (--n)>0, "COLUMNS"); |
| 1137 | } |
| 1138 | if( pSelect ){ |
| 1139 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1140 | sqlite3TreeViewLine(pView, "DATA-SOURCE"); |
| 1141 | sqlite3TreeViewSelect(pView, pSelect, 0); |
| 1142 | sqlite3TreeViewPop(&pView); |
| 1143 | } |
| 1144 | if( pExprList ){ |
| 1145 | sqlite3TreeViewExprList(pView, pExprList, (--n)>0, "VALUES"); |
| 1146 | } |
| 1147 | if( pUpsert ){ |
| 1148 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1149 | sqlite3TreeViewLine(pView, "UPSERT"); |
| 1150 | sqlite3TreeViewUpsert(pView, pUpsert, 0); |
| 1151 | sqlite3TreeViewPop(&pView); |
| 1152 | } |
| 1153 | if( pTrigger ){ |
| 1154 | sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1); |
| 1155 | } |
| 1156 | sqlite3TreeViewPop(&pView); |
| 1157 | } |
| 1158 | #endif /* TREETRACE_ENABLED */ |
| 1159 | |
| 1160 | #if TREETRACE_ENABLED |
| 1161 | /* |
| 1162 | ** Generate a human-readable diagram of the data structure that go |
| 1163 | ** into generating an UPDATE statement. |
| 1164 | */ |
| 1165 | void sqlite3TreeViewUpdate( |
| 1166 | const With *pWith, |
| 1167 | const SrcList *pTabList, |
| 1168 | const ExprList *pChanges, |
| 1169 | const Expr *pWhere, |
| 1170 | int onError, |
| 1171 | const ExprList *pOrderBy, |
| 1172 | const Expr *pLimit, |
| 1173 | const Upsert *pUpsert, |
| 1174 | const Trigger *pTrigger |
| 1175 | ){ |
| 1176 | int n = 0; |
| 1177 | TreeView *pView = 0; |
| 1178 | const char *zLabel = "UPDATE"; |
| 1179 | switch( onError ){ |
| 1180 | case OE_Replace: zLabel = "UPDATE OR REPLACE"; break; |
| 1181 | case OE_Ignore: zLabel = "UPDATE OR IGNORE"; break; |
| 1182 | case OE_Rollback: zLabel = "UPDATE OR ROLLBACK"; break; |
| 1183 | case OE_Abort: zLabel = "UPDATE OR ABORT"; break; |
| 1184 | case OE_Fail: zLabel = "UPDATE OR FAIL"; break; |
| 1185 | } |
| 1186 | sqlite3TreeViewPush(&pView, 0); |
| 1187 | sqlite3TreeViewLine(pView, zLabel); |
| 1188 | if( pWith ) n++; |
| 1189 | if( pTabList ) n++; |
| 1190 | if( pChanges ) n++; |
| 1191 | if( pWhere ) n++; |
| 1192 | if( pOrderBy ) n++; |
| 1193 | if( pLimit ) n++; |
| 1194 | if( pUpsert ) n++; |
| 1195 | if( pTrigger ) n++; |
| 1196 | if( pWith ){ |
| 1197 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1198 | sqlite3TreeViewWith(pView, pWith, 0); |
| 1199 | sqlite3TreeViewPop(&pView); |
| 1200 | } |
| 1201 | if( pTabList ){ |
| 1202 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1203 | sqlite3TreeViewLine(pView, "FROM"); |
| 1204 | sqlite3TreeViewSrcList(pView, pTabList); |
| 1205 | sqlite3TreeViewPop(&pView); |
| 1206 | } |
| 1207 | if( pChanges ){ |
| 1208 | sqlite3TreeViewExprList(pView, pChanges, (--n)>0, "SET"); |
| 1209 | } |
| 1210 | if( pWhere ){ |
| 1211 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1212 | sqlite3TreeViewLine(pView, "WHERE"); |
| 1213 | sqlite3TreeViewExpr(pView, pWhere, 0); |
| 1214 | sqlite3TreeViewPop(&pView); |
| 1215 | } |
| 1216 | if( pOrderBy ){ |
| 1217 | sqlite3TreeViewExprList(pView, pOrderBy, (--n)>0, "ORDER-BY"); |
| 1218 | } |
| 1219 | if( pLimit ){ |
| 1220 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1221 | sqlite3TreeViewLine(pView, "LIMIT"); |
| 1222 | sqlite3TreeViewExpr(pView, pLimit, 0); |
| 1223 | sqlite3TreeViewPop(&pView); |
| 1224 | } |
| 1225 | if( pUpsert ){ |
| 1226 | sqlite3TreeViewPush(&pView, (--n)>0); |
| 1227 | sqlite3TreeViewLine(pView, "UPSERT"); |
| 1228 | sqlite3TreeViewUpsert(pView, pUpsert, 0); |
| 1229 | sqlite3TreeViewPop(&pView); |
| 1230 | } |
| 1231 | if( pTrigger ){ |
| 1232 | sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1); |
| 1233 | } |
| 1234 | sqlite3TreeViewPop(&pView); |
| 1235 | } |
| 1236 | #endif /* TREETRACE_ENABLED */ |
| 1237 | |
| 1238 | #ifndef SQLITE_OMIT_TRIGGER |
| 1239 | /* |
| 1240 | ** Show a human-readable graph of a TriggerStep |
| 1241 | */ |
| 1242 | void sqlite3TreeViewTriggerStep( |
| 1243 | TreeView *pView, |
| 1244 | const TriggerStep *pStep, |
| 1245 | u8 moreToFollow, |
| 1246 | u8 showFullList |
| 1247 | ){ |
| 1248 | int cnt = 0; |
| 1249 | if( pStep==0 ) return; |
| 1250 | sqlite3TreeViewPush(&pView, |
| 1251 | moreToFollow || (showFullList && pStep->pNext!=0)); |
| 1252 | do{ |
| 1253 | if( cnt++ && pStep->pNext==0 ){ |
| 1254 | sqlite3TreeViewPop(&pView); |
| 1255 | sqlite3TreeViewPush(&pView, 0); |
| 1256 | } |
| 1257 | sqlite3TreeViewLine(pView, "%s", pStep->zSpan ? pStep->zSpan : "RETURNING"); |
| 1258 | }while( showFullList && (pStep = pStep->pNext)!=0 ); |
| 1259 | sqlite3TreeViewPop(&pView); |
| 1260 | } |
| 1261 | |
| 1262 | /* |
| 1263 | ** Show a human-readable graph of a Trigger |
| 1264 | */ |
| 1265 | void sqlite3TreeViewTrigger( |
| 1266 | TreeView *pView, |
| 1267 | const Trigger *pTrigger, |
| 1268 | u8 moreToFollow, |
| 1269 | u8 showFullList |
| 1270 | ){ |
| 1271 | int cnt = 0; |
| 1272 | if( pTrigger==0 ) return; |
| 1273 | sqlite3TreeViewPush(&pView, |
| 1274 | moreToFollow || (showFullList && pTrigger->pNext!=0)); |
| 1275 | do{ |
| 1276 | if( cnt++ && pTrigger->pNext==0 ){ |
| 1277 | sqlite3TreeViewPop(&pView); |
| 1278 | sqlite3TreeViewPush(&pView, 0); |
| 1279 | } |
| 1280 | sqlite3TreeViewLine(pView, "TRIGGER %s", pTrigger->zName); |
| 1281 | sqlite3TreeViewPush(&pView, 0); |
| 1282 | sqlite3TreeViewTriggerStep(pView, pTrigger->step_list, 0, 1); |
| 1283 | sqlite3TreeViewPop(&pView); |
| 1284 | }while( showFullList && (pTrigger = pTrigger->pNext)!=0 ); |
| 1285 | sqlite3TreeViewPop(&pView); |
| 1286 | } |
| 1287 | #endif /* SQLITE_OMIT_TRIGGER */ |
| 1288 | |
| 1289 | |
| 1290 | /* |
| 1291 | ** These simplified versions of the tree-view routines omit unnecessary |
| 1292 | ** parameters. These variants are intended to be used from a symbolic |
| 1293 | ** debugger, such as "gdb", during interactive debugging sessions. |
| 1294 | ** |
| 1295 | ** This routines are given external linkage so that they will always be |
| 1296 | ** accessible to the debugging, and to avoid warnings about unused |
| 1297 | ** functions. But these routines only exist in debugging builds, so they |
| 1298 | ** do not contaminate the interface. |
| 1299 | ** |
| 1300 | ** See Also: |
| 1301 | ** |
| 1302 | ** sqlite3ShowWhereTerm() in where.c |
| 1303 | */ |
| 1304 | void sqlite3ShowExpr(const Expr *p){ sqlite3TreeViewExpr(0,p,0); } |
| 1305 | void sqlite3ShowExprList(const ExprList *p){ sqlite3TreeViewExprList(0,p,0,0);} |
| 1306 | void sqlite3ShowIdList(const IdList *p){ sqlite3TreeViewIdList(0,p,0,0); } |
| 1307 | void sqlite3ShowSrcList(const SrcList *p){ |
| 1308 | TreeView *pView = 0; |
| 1309 | sqlite3TreeViewPush(&pView, 0); |
| 1310 | sqlite3TreeViewLine(pView, "SRCLIST"); |
| 1311 | sqlite3TreeViewSrcList(pView,p); |
| 1312 | sqlite3TreeViewPop(&pView); |
| 1313 | } |
| 1314 | void sqlite3ShowSelect(const Select *p){ sqlite3TreeViewSelect(0,p,0); } |
| 1315 | void sqlite3ShowWith(const With *p){ sqlite3TreeViewWith(0,p,0); } |
| 1316 | void sqlite3ShowUpsert(const Upsert *p){ sqlite3TreeViewUpsert(0,p,0); } |
| 1317 | #ifndef SQLITE_OMIT_TRIGGER |
| 1318 | void sqlite3ShowTriggerStep(const TriggerStep *p){ |
| 1319 | sqlite3TreeViewTriggerStep(0,p,0,0); |
| 1320 | } |
| 1321 | void sqlite3ShowTriggerStepList(const TriggerStep *p){ |
| 1322 | sqlite3TreeViewTriggerStep(0,p,0,1); |
| 1323 | } |
| 1324 | void sqlite3ShowTrigger(const Trigger *p){ sqlite3TreeViewTrigger(0,p,0,0); } |
| 1325 | void sqlite3ShowTriggerList(const Trigger *p){ sqlite3TreeViewTrigger(0,p,0,1);} |
| 1326 | #endif |
| 1327 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 1328 | void sqlite3ShowWindow(const Window *p){ sqlite3TreeViewWindow(0,p,0); } |
| 1329 | void sqlite3ShowWinFunc(const Window *p){ sqlite3TreeViewWinFunc(0,p,0); } |
| 1330 | #endif |
| 1331 | |
| 1332 | #endif /* SQLITE_DEBUG */ |