mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
In treeview.c, show the columns of the table associated with each SrcItem.
FossilOrigin-Name: 3aafccb5c3c780c29090ee5eb428a6c3153627ce8bf834bbd392e79a30e9389b
This commit is contained in:
@@ -86,6 +86,51 @@ static void sqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreFollows){
|
||||
sqlite3TreeViewLine(p, "%s", zLabel);
|
||||
}
|
||||
|
||||
/*
|
||||
** 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.
|
||||
*/
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user