/ Check-in [8c74065f]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the treeview.c module, break out the display of SrcList into a separate subroutine, so that it can be invoked while debugging.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8c74065f0031274d9bc711d5d53c39aefcfb2b2679811105974a2c7c7a9e1dcb
User & Date: drh 2018-11-08 22:53:06
Context
2018-11-09
14:17
Fix for ticket [787fa716be3a7f650cac] check-in: 531eca61 user: drh tags: trunk
00:02
Disable the use of coroutines for subqueries within a query that is the RHS of an IN operator, as the IN operator might be evaluated more than once. Possible fix for [787fa716be3a7f65], unless we can come up with something better. Later: Counter-example found. Closed-Leaf check-in: 8d663bfa user: drh tags: tkt787fa716-deadend
2018-11-08
22:53
In the treeview.c module, break out the display of SrcList into a separate subroutine, so that it can be invoked while debugging. check-in: 8c74065f user: drh tags: trunk
2018-11-07
14:39
Fix a problem with the handling of SQLITE_FCNTL_PRAGMA in the test_onefile.c demo. check-in: 13e21b7d user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/sqliteInt.h.

  3779   3779     void *sqlite3TestTextToPtr(const char*);
  3780   3780   #endif
  3781   3781   
  3782   3782   #if defined(SQLITE_DEBUG)
  3783   3783     void sqlite3TreeViewExpr(TreeView*, const Expr*, u8);
  3784   3784     void sqlite3TreeViewBareExprList(TreeView*, const ExprList*, const char*);
  3785   3785     void sqlite3TreeViewExprList(TreeView*, const ExprList*, u8, const char*);
         3786  +  void sqlite3TreeViewSrcList(TreeView*, const SrcList*);
  3786   3787     void sqlite3TreeViewSelect(TreeView*, const Select*, u8);
  3787   3788     void sqlite3TreeViewWith(TreeView*, const With*, u8);
  3788   3789   #ifndef SQLITE_OMIT_WINDOWFUNC
  3789   3790     void sqlite3TreeViewWindow(TreeView*, const Window*, u8);
  3790   3791     void sqlite3TreeViewWinFunc(TreeView*, const Window*, u8);
  3791   3792   #endif
  3792   3793   #endif

Changes to src/treeview.c.

   117    117         sqlite3TreeViewSelect(pView, pCte->pSelect, 0);
   118    118         sqlite3TreeViewPop(pView);
   119    119       }
   120    120       sqlite3TreeViewPop(pView);
   121    121     }
   122    122   }
   123    123   
          124  +/*
          125  +** Generate a human-readable description of a SrcList object.
          126  +*/
          127  +void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
          128  +  int i;
          129  +  for(i=0; i<pSrc->nSrc; i++){
          130  +    const struct SrcList_item *pItem = &pSrc->a[i];
          131  +    StrAccum x;
          132  +    char zLine[100];
          133  +    sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
          134  +    sqlite3_str_appendf(&x, "{%d,*}", pItem->iCursor);
          135  +    if( pItem->zDatabase ){
          136  +      sqlite3_str_appendf(&x, " %s.%s", pItem->zDatabase, pItem->zName);
          137  +    }else if( pItem->zName ){
          138  +      sqlite3_str_appendf(&x, " %s", pItem->zName);
          139  +    }
          140  +    if( pItem->pTab ){
          141  +      sqlite3_str_appendf(&x, " tabname=%Q", pItem->pTab->zName);
          142  +    }
          143  +    if( pItem->zAlias ){
          144  +      sqlite3_str_appendf(&x, " (AS %s)", pItem->zAlias);
          145  +    }
          146  +    if( pItem->fg.jointype & JT_LEFT ){
          147  +      sqlite3_str_appendf(&x, " LEFT-JOIN");
          148  +    }
          149  +    sqlite3StrAccumFinish(&x);
          150  +    sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1); 
          151  +    if( pItem->pSelect ){
          152  +      sqlite3TreeViewSelect(pView, pItem->pSelect, 0);
          153  +    }
          154  +    if( pItem->fg.isTabFunc ){
          155  +      sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
          156  +    }
          157  +    sqlite3TreeViewPop(pView);
          158  +  }
          159  +}
   124    160   
   125    161   /*
   126    162   ** Generate a human-readable description of a Select object.
   127    163   */
   128    164   void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){
   129    165     int n = 0;
   130    166     int cnt = 0;
................................................................................
   171    207         for(pX=p->pWin; pX; pX=pX->pNextWin){
   172    208           sqlite3TreeViewWinFunc(pView, pX, pX->pNextWin!=0);
   173    209         }
   174    210         sqlite3TreeViewPop(pView);
   175    211       }
   176    212   #endif
   177    213       if( p->pSrc && p->pSrc->nSrc ){
   178         -      int i;
   179    214         pView = sqlite3TreeViewPush(pView, (n--)>0);
   180    215         sqlite3TreeViewLine(pView, "FROM");
   181         -      for(i=0; i<p->pSrc->nSrc; i++){
   182         -        struct SrcList_item *pItem = &p->pSrc->a[i];
   183         -        StrAccum x;
   184         -        char zLine[100];
   185         -        sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
   186         -        sqlite3_str_appendf(&x, "{%d,*}", pItem->iCursor);
   187         -        if( pItem->zDatabase ){
   188         -          sqlite3_str_appendf(&x, " %s.%s", pItem->zDatabase, pItem->zName);
   189         -        }else if( pItem->zName ){
   190         -          sqlite3_str_appendf(&x, " %s", pItem->zName);
   191         -        }
   192         -        if( pItem->pTab ){
   193         -          sqlite3_str_appendf(&x, " tabname=%Q", pItem->pTab->zName);
   194         -        }
   195         -        if( pItem->zAlias ){
   196         -          sqlite3_str_appendf(&x, " (AS %s)", pItem->zAlias);
   197         -        }
   198         -        if( pItem->fg.jointype & JT_LEFT ){
   199         -          sqlite3_str_appendf(&x, " LEFT-JOIN");
   200         -        }
   201         -        sqlite3StrAccumFinish(&x);
   202         -        sqlite3TreeViewItem(pView, zLine, i<p->pSrc->nSrc-1); 
   203         -        if( pItem->pSelect ){
   204         -          sqlite3TreeViewSelect(pView, pItem->pSelect, 0);
   205         -        }
   206         -        if( pItem->fg.isTabFunc ){
   207         -          sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
   208         -        }
   209         -        sqlite3TreeViewPop(pView);
   210         -      }
          216  +      sqlite3TreeViewSrcList(pView, p->pSrc);
   211    217         sqlite3TreeViewPop(pView);
   212    218       }
   213    219       if( p->pWhere ){
   214    220         sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
   215    221         sqlite3TreeViewExpr(pView, p->pWhere, 0);
   216    222         sqlite3TreeViewPop(pView);
   217    223       }