diff options
author | drh <> | 2022-04-28 18:17:51 +0000 |
---|---|---|
committer | drh <> | 2022-04-28 18:17:51 +0000 |
commit | a087eb8f6d28a05f3dbe8a4eee9deb45b746865d (patch) | |
tree | 8c5c1f130d27d859eb6c09d3674c5507be31f8b4 /src/treeview.c | |
parent | 4bea8c6b564bf84005df34e4b7f318af6ba37189 (diff) | |
download | sqlite-a087eb8f6d28a05f3dbe8a4eee9deb45b746865d.tar.gz sqlite-a087eb8f6d28a05f3dbe8a4eee9deb45b746865d.zip |
In treeview.c, show the columns of the table associated with each SrcItem.
FossilOrigin-Name: 3aafccb5c3c780c29090ee5eb428a6c3153627ce8bf834bbd392e79a30e9389b
Diffstat (limited to 'src/treeview.c')
-rw-r--r-- | src/treeview.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/src/treeview.c b/src/treeview.c index 117e21f1a..009ba2739 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -87,6 +87,51 @@ static void sqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreFollows){ } /* +** Show a list of Column objects in tree format. +*/ +void sqlite3TreeViewColumnList( + TreeView *pView, + const Column *aCol, + int nCol, + u8 moreToFollow +){ + int i; + sqlite3TreeViewPush(&pView, moreToFollow); + sqlite3TreeViewLine(pView, "COLUMNS"); + for(i=0; i<nCol; i++){ + u16 flg = aCol[i].colFlags; + int moreToFollow = i<(nCol - 1); + sqlite3TreeViewPush(&pView, moreToFollow); + sqlite3TreeViewLine(pView, 0); + printf(" %s", aCol[i].zCnName); + switch( aCol[i].eCType ){ + case COLTYPE_ANY: printf(" ANY"); break; + case COLTYPE_BLOB: printf(" BLOB"); break; + case COLTYPE_INT: printf(" INT"); break; + case COLTYPE_INTEGER: printf(" INTEGER"); break; + case COLTYPE_REAL: printf(" REAL"); break; + case COLTYPE_TEXT: printf(" TEXT"); break; + case COLTYPE_CUSTOM: { + if( flg & COLFLAG_HASTYPE ){ + const char *z = aCol[i].zCnName; + z += strlen(z)+1; + printf(" X-%s", z); + break; + } + } + } + if( flg & COLFLAG_PRIMKEY ) printf(" PRIMARY KEY"); + if( flg & COLFLAG_HIDDEN ) printf(" HIDDEN"); + if( flg & COLFLAG_NOEXPAND ) printf(" NO-EXPAND"); + if( flg ) printf(" flags=%04x", flg); + printf("\n"); + fflush(stdout); + sqlite3TreeViewPop(&pView); + } + sqlite3TreeViewPop(&pView); +} + +/* ** Generate a human-readable description of a WITH clause. */ void sqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 moreToFollow){ @@ -168,7 +213,12 @@ void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){ sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse); } sqlite3StrAccumFinish(&x); - sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1); + sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1); + if( pItem->pTab ){ + Table *pTab = pItem->pTab; + sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, + pItem->pSelect!=0); + } if( pItem->pSelect ){ assert( pItem->fg.isNestedFrom == IsNestedFrom(pItem->pSelect) ); sqlite3TreeViewSelect(pView, pItem->pSelect, 0); |