blob: 7e154246371ecd32d1ecf0f61553de85a947dae4 [file] [log] [blame]
drh38b41492015-06-08 15:08:15 +00001/*
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*/
drh2a7dcbf2022-04-06 15:41:53 +000027static void sqlite3TreeViewPush(TreeView **pp, u8 moreToFollow){
28 TreeView *p = *pp;
drh38b41492015-06-08 15:08:15 +000029 if( p==0 ){
drh2a7dcbf2022-04-06 15:41:53 +000030 *pp = p = sqlite3_malloc64( sizeof(*p) );
31 if( p==0 ) return;
drh38b41492015-06-08 15:08:15 +000032 memset(p, 0, sizeof(*p));
33 }else{
34 p->iLevel++;
35 }
36 assert( moreToFollow==0 || moreToFollow==1 );
drhe684ac62022-03-08 13:59:46 +000037 if( p->iLevel<(int)sizeof(p->bLine) ) p->bLine[p->iLevel] = moreToFollow;
drh38b41492015-06-08 15:08:15 +000038}
39
40/*
41** Finished with one layer of the tree
42*/
drh2a7dcbf2022-04-06 15:41:53 +000043static void sqlite3TreeViewPop(TreeView **pp){
44 TreeView *p = *pp;
drh38b41492015-06-08 15:08:15 +000045 if( p==0 ) return;
46 p->iLevel--;
drh2a7dcbf2022-04-06 15:41:53 +000047 if( p->iLevel<0 ){
48 sqlite3_free(p);
49 *pp = 0;
50 }
drh38b41492015-06-08 15:08:15 +000051}
52
53/*
54** Generate a single line of output for the tree, with a prefix that contains
55** all the appropriate tree lines
56*/
drh2a7dcbf2022-04-06 15:41:53 +000057void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){
drh38b41492015-06-08 15:08:15 +000058 va_list ap;
59 int i;
60 StrAccum acc;
61 char zBuf[500];
62 sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0);
63 if( p ){
drhe684ac62022-03-08 13:59:46 +000064 for(i=0; i<p->iLevel && i<(int)sizeof(p->bLine)-1; i++){
drh0cdbe1a2018-05-09 13:46:26 +000065 sqlite3_str_append(&acc, p->bLine[i] ? "| " : " ", 4);
drh38b41492015-06-08 15:08:15 +000066 }
drh0cdbe1a2018-05-09 13:46:26 +000067 sqlite3_str_append(&acc, p->bLine[i] ? "|-- " : "'-- ", 4);
drh38b41492015-06-08 15:08:15 +000068 }
drhfbe07532018-04-23 20:04:38 +000069 if( zFormat!=0 ){
70 va_start(ap, zFormat);
drh0cdbe1a2018-05-09 13:46:26 +000071 sqlite3_str_vappendf(&acc, zFormat, ap);
drhfbe07532018-04-23 20:04:38 +000072 va_end(ap);
drh10c0e712019-04-25 18:15:38 +000073 assert( acc.nChar>0 || acc.accError );
drh0cdbe1a2018-05-09 13:46:26 +000074 sqlite3_str_append(&acc, "\n", 1);
drhfbe07532018-04-23 20:04:38 +000075 }
drh38b41492015-06-08 15:08:15 +000076 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*/
84static void sqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreFollows){
drh2a7dcbf2022-04-06 15:41:53 +000085 sqlite3TreeViewPush(&p, moreFollows);
drh38b41492015-06-08 15:08:15 +000086 sqlite3TreeViewLine(p, "%s", zLabel);
87}
88
drh2476a6f2015-11-07 15:19:59 +000089/*
90** Generate a human-readable description of a WITH clause.
91*/
92void sqlite3TreeViewWith(TreeView *pView, const With *pWith, u8 moreToFollow){
93 int i;
94 if( pWith==0 ) return;
95 if( pWith->nCte==0 ) return;
96 if( pWith->pOuter ){
97 sqlite3TreeViewLine(pView, "WITH (0x%p, pOuter=0x%p)",pWith,pWith->pOuter);
98 }else{
99 sqlite3TreeViewLine(pView, "WITH (0x%p)", pWith);
100 }
101 if( pWith->nCte>0 ){
drh2a7dcbf2022-04-06 15:41:53 +0000102 sqlite3TreeViewPush(&pView, moreToFollow);
drh2476a6f2015-11-07 15:19:59 +0000103 for(i=0; i<pWith->nCte; i++){
104 StrAccum x;
105 char zLine[1000];
106 const struct Cte *pCte = &pWith->a[i];
107 sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
drh0cdbe1a2018-05-09 13:46:26 +0000108 sqlite3_str_appendf(&x, "%s", pCte->zName);
drh2476a6f2015-11-07 15:19:59 +0000109 if( pCte->pCols && pCte->pCols->nExpr>0 ){
110 char cSep = '(';
111 int j;
112 for(j=0; j<pCte->pCols->nExpr; j++){
drh41cee662019-12-12 20:22:34 +0000113 sqlite3_str_appendf(&x, "%c%s", cSep, pCte->pCols->a[j].zEName);
drh2476a6f2015-11-07 15:19:59 +0000114 cSep = ',';
115 }
drh0cdbe1a2018-05-09 13:46:26 +0000116 sqlite3_str_appendf(&x, ")");
drh2476a6f2015-11-07 15:19:59 +0000117 }
drha79e2a22021-02-21 23:44:14 +0000118 if( pCte->pUse ){
119 sqlite3_str_appendf(&x, " (pUse=0x%p, nUse=%d)", pCte->pUse,
120 pCte->pUse->nUse);
121 }
drh2476a6f2015-11-07 15:19:59 +0000122 sqlite3StrAccumFinish(&x);
123 sqlite3TreeViewItem(pView, zLine, i<pWith->nCte-1);
124 sqlite3TreeViewSelect(pView, pCte->pSelect, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000125 sqlite3TreeViewPop(&pView);
drh2476a6f2015-11-07 15:19:59 +0000126 }
drh2a7dcbf2022-04-06 15:41:53 +0000127 sqlite3TreeViewPop(&pView);
drh2476a6f2015-11-07 15:19:59 +0000128 }
129}
130
drh145d0a32018-11-08 22:53:06 +0000131/*
132** Generate a human-readable description of a SrcList object.
133*/
134void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
135 int i;
136 for(i=0; i<pSrc->nSrc; i++){
drh76012942021-02-21 21:04:54 +0000137 const SrcItem *pItem = &pSrc->a[i];
drh145d0a32018-11-08 22:53:06 +0000138 StrAccum x;
139 char zLine[100];
140 sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0);
drhff374912021-04-12 12:58:55 +0000141 x.printfFlags |= SQLITE_PRINTF_INTERNAL;
drh6610e6a2021-03-19 19:44:56 +0000142 sqlite3_str_appendf(&x, "{%d:*} %!S", pItem->iCursor, pItem);
drh145d0a32018-11-08 22:53:06 +0000143 if( pItem->pTab ){
drhf7f6dbf2020-03-21 22:03:32 +0000144 sqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p used=%llx",
145 pItem->pTab->zName, pItem->pTab->nCol, pItem->pTab, pItem->colUsed);
drh145d0a32018-11-08 22:53:06 +0000146 }
drh145d0a32018-11-08 22:53:06 +0000147 if( pItem->fg.jointype & JT_LEFT ){
148 sqlite3_str_appendf(&x, " LEFT-JOIN");
drh9b9f2352021-06-23 11:39:00 +0000149 }else if( pItem->fg.jointype & JT_CROSS ){
150 sqlite3_str_appendf(&x, " CROSS-JOIN");
drh145d0a32018-11-08 22:53:06 +0000151 }
drhb7e51992020-01-08 14:39:57 +0000152 if( pItem->fg.fromDDL ){
153 sqlite3_str_appendf(&x, " DDL");
154 }
drha79e2a22021-02-21 23:44:14 +0000155 if( pItem->fg.isCte ){
156 sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse);
157 }
drh145d0a32018-11-08 22:53:06 +0000158 sqlite3StrAccumFinish(&x);
159 sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1);
160 if( pItem->pSelect ){
161 sqlite3TreeViewSelect(pView, pItem->pSelect, 0);
162 }
163 if( pItem->fg.isTabFunc ){
164 sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
165 }
drh2a7dcbf2022-04-06 15:41:53 +0000166 sqlite3TreeViewPop(&pView);
drh145d0a32018-11-08 22:53:06 +0000167 }
168}
drh38b41492015-06-08 15:08:15 +0000169
170/*
drh2e5c5052016-08-27 20:21:51 +0000171** Generate a human-readable description of a Select object.
drh38b41492015-06-08 15:08:15 +0000172*/
173void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){
174 int n = 0;
drh1c4505d2015-08-26 11:34:31 +0000175 int cnt = 0;
drh510b7ff2017-03-13 17:37:13 +0000176 if( p==0 ){
177 sqlite3TreeViewLine(pView, "nil-SELECT");
178 return;
179 }
drh2a7dcbf2022-04-06 15:41:53 +0000180 sqlite3TreeViewPush(&pView, moreToFollow);
drh2476a6f2015-11-07 15:19:59 +0000181 if( p->pWith ){
182 sqlite3TreeViewWith(pView, p->pWith, 1);
183 cnt = 1;
drh2a7dcbf2022-04-06 15:41:53 +0000184 sqlite3TreeViewPush(&pView, 1);
drh2476a6f2015-11-07 15:19:59 +0000185 }
drh1c4505d2015-08-26 11:34:31 +0000186 do{
drh55b4c822019-08-03 16:17:46 +0000187 if( p->selFlags & SF_WhereBegin ){
188 sqlite3TreeViewLine(pView, "sqlite3WhereBegin()");
189 }else{
190 sqlite3TreeViewLine(pView,
191 "SELECT%s%s (%u/%p) selFlags=0x%x nSelectRow=%d",
192 ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
193 ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""),
194 p->selId, p, p->selFlags,
195 (int)p->nSelectRow
196 );
197 }
drh2a7dcbf2022-04-06 15:41:53 +0000198 if( cnt++ ) sqlite3TreeViewPop(&pView);
drh1c4505d2015-08-26 11:34:31 +0000199 if( p->pPrior ){
200 n = 1000;
201 }else{
202 n = 0;
203 if( p->pSrc && p->pSrc->nSrc ) n++;
204 if( p->pWhere ) n++;
205 if( p->pGroupBy ) n++;
206 if( p->pHaving ) n++;
207 if( p->pOrderBy ) n++;
208 if( p->pLimit ) n++;
drha1fd4b52018-07-10 06:32:53 +0000209#ifndef SQLITE_OMIT_WINDOWFUNC
210 if( p->pWin ) n++;
211 if( p->pWinDefn ) n++;
212#endif
drh1c4505d2015-08-26 11:34:31 +0000213 }
drh55b4c822019-08-03 16:17:46 +0000214 if( p->pEList ){
215 sqlite3TreeViewExprList(pView, p->pEList, n>0, "result-set");
216 }
217 n--;
drha1fd4b52018-07-10 06:32:53 +0000218#ifndef SQLITE_OMIT_WINDOWFUNC
219 if( p->pWin ){
220 Window *pX;
drh2a7dcbf2022-04-06 15:41:53 +0000221 sqlite3TreeViewPush(&pView, (n--)>0);
drha1fd4b52018-07-10 06:32:53 +0000222 sqlite3TreeViewLine(pView, "window-functions");
223 for(pX=p->pWin; pX; pX=pX->pNextWin){
224 sqlite3TreeViewWinFunc(pView, pX, pX->pNextWin!=0);
225 }
drh2a7dcbf2022-04-06 15:41:53 +0000226 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000227 }
228#endif
drh1c4505d2015-08-26 11:34:31 +0000229 if( p->pSrc && p->pSrc->nSrc ){
drh2a7dcbf2022-04-06 15:41:53 +0000230 sqlite3TreeViewPush(&pView, (n--)>0);
drh1c4505d2015-08-26 11:34:31 +0000231 sqlite3TreeViewLine(pView, "FROM");
drh145d0a32018-11-08 22:53:06 +0000232 sqlite3TreeViewSrcList(pView, p->pSrc);
drh2a7dcbf2022-04-06 15:41:53 +0000233 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000234 }
drh1c4505d2015-08-26 11:34:31 +0000235 if( p->pWhere ){
236 sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
237 sqlite3TreeViewExpr(pView, p->pWhere, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000238 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000239 }
drh1c4505d2015-08-26 11:34:31 +0000240 if( p->pGroupBy ){
241 sqlite3TreeViewExprList(pView, p->pGroupBy, (n--)>0, "GROUPBY");
242 }
243 if( p->pHaving ){
244 sqlite3TreeViewItem(pView, "HAVING", (n--)>0);
245 sqlite3TreeViewExpr(pView, p->pHaving, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000246 sqlite3TreeViewPop(&pView);
drh1c4505d2015-08-26 11:34:31 +0000247 }
drha1fd4b52018-07-10 06:32:53 +0000248#ifndef SQLITE_OMIT_WINDOWFUNC
249 if( p->pWinDefn ){
250 Window *pX;
251 sqlite3TreeViewItem(pView, "WINDOW", (n--)>0);
252 for(pX=p->pWinDefn; pX; pX=pX->pNextWin){
253 sqlite3TreeViewWindow(pView, pX, pX->pNextWin!=0);
254 }
drh2a7dcbf2022-04-06 15:41:53 +0000255 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000256 }
257#endif
drh1c4505d2015-08-26 11:34:31 +0000258 if( p->pOrderBy ){
259 sqlite3TreeViewExprList(pView, p->pOrderBy, (n--)>0, "ORDERBY");
260 }
261 if( p->pLimit ){
262 sqlite3TreeViewItem(pView, "LIMIT", (n--)>0);
drh8c0833f2017-11-14 23:48:23 +0000263 sqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0);
264 if( p->pLimit->pRight ){
265 sqlite3TreeViewItem(pView, "OFFSET", (n--)>0);
266 sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000267 sqlite3TreeViewPop(&pView);
drh8c0833f2017-11-14 23:48:23 +0000268 }
drh2a7dcbf2022-04-06 15:41:53 +0000269 sqlite3TreeViewPop(&pView);
drh1c4505d2015-08-26 11:34:31 +0000270 }
271 if( p->pPrior ){
272 const char *zOp = "UNION";
273 switch( p->op ){
274 case TK_ALL: zOp = "UNION ALL"; break;
275 case TK_INTERSECT: zOp = "INTERSECT"; break;
276 case TK_EXCEPT: zOp = "EXCEPT"; break;
277 }
278 sqlite3TreeViewItem(pView, zOp, 1);
279 }
280 p = p->pPrior;
281 }while( p!=0 );
drh2a7dcbf2022-04-06 15:41:53 +0000282 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000283}
284
drha1fd4b52018-07-10 06:32:53 +0000285#ifndef SQLITE_OMIT_WINDOWFUNC
286/*
287** Generate a description of starting or stopping bounds
288*/
289void sqlite3TreeViewBound(
290 TreeView *pView, /* View context */
291 u8 eBound, /* UNBOUNDED, CURRENT, PRECEDING, FOLLOWING */
292 Expr *pExpr, /* Value for PRECEDING or FOLLOWING */
293 u8 moreToFollow /* True if more to follow */
294){
295 switch( eBound ){
296 case TK_UNBOUNDED: {
297 sqlite3TreeViewItem(pView, "UNBOUNDED", moreToFollow);
drh2a7dcbf2022-04-06 15:41:53 +0000298 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000299 break;
300 }
301 case TK_CURRENT: {
302 sqlite3TreeViewItem(pView, "CURRENT", moreToFollow);
drh2a7dcbf2022-04-06 15:41:53 +0000303 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000304 break;
305 }
306 case TK_PRECEDING: {
307 sqlite3TreeViewItem(pView, "PRECEDING", moreToFollow);
308 sqlite3TreeViewExpr(pView, pExpr, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000309 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000310 break;
311 }
312 case TK_FOLLOWING: {
313 sqlite3TreeViewItem(pView, "FOLLOWING", moreToFollow);
314 sqlite3TreeViewExpr(pView, pExpr, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000315 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000316 break;
317 }
318 }
319}
320#endif /* SQLITE_OMIT_WINDOWFUNC */
321
322#ifndef SQLITE_OMIT_WINDOWFUNC
323/*
324** Generate a human-readable explanation for a Window object
325*/
326void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){
drhfc15f4c2019-03-28 13:03:41 +0000327 int nElement = 0;
drh0dc0e9c2019-03-28 13:35:28 +0000328 if( pWin->pFilter ){
329 sqlite3TreeViewItem(pView, "FILTER", 1);
330 sqlite3TreeViewExpr(pView, pWin->pFilter, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000331 sqlite3TreeViewPop(&pView);
drh0dc0e9c2019-03-28 13:35:28 +0000332 }
drh2a7dcbf2022-04-06 15:41:53 +0000333 sqlite3TreeViewPush(&pView, more);
drha1fd4b52018-07-10 06:32:53 +0000334 if( pWin->zName ){
drh6f1644c2019-03-28 13:53:12 +0000335 sqlite3TreeViewLine(pView, "OVER %s (%p)", pWin->zName, pWin);
drha1fd4b52018-07-10 06:32:53 +0000336 }else{
drh6f1644c2019-03-28 13:53:12 +0000337 sqlite3TreeViewLine(pView, "OVER (%p)", pWin);
drha1fd4b52018-07-10 06:32:53 +0000338 }
drhfc15f4c2019-03-28 13:03:41 +0000339 if( pWin->zBase ) nElement++;
340 if( pWin->pOrderBy ) nElement++;
341 if( pWin->eFrmType ) nElement++;
342 if( pWin->eExclude ) nElement++;
drhfc15f4c2019-03-28 13:03:41 +0000343 if( pWin->zBase ){
drh2a7dcbf2022-04-06 15:41:53 +0000344 sqlite3TreeViewPush(&pView, (--nElement)>0);
drhfc15f4c2019-03-28 13:03:41 +0000345 sqlite3TreeViewLine(pView, "window: %s", pWin->zBase);
drh2a7dcbf2022-04-06 15:41:53 +0000346 sqlite3TreeViewPop(&pView);
drhfc15f4c2019-03-28 13:03:41 +0000347 }
drha1fd4b52018-07-10 06:32:53 +0000348 if( pWin->pPartition ){
drhfc15f4c2019-03-28 13:03:41 +0000349 sqlite3TreeViewExprList(pView, pWin->pPartition, nElement>0,"PARTITION-BY");
drha1fd4b52018-07-10 06:32:53 +0000350 }
351 if( pWin->pOrderBy ){
drhfc15f4c2019-03-28 13:03:41 +0000352 sqlite3TreeViewExprList(pView, pWin->pOrderBy, (--nElement)>0, "ORDER-BY");
drha1fd4b52018-07-10 06:32:53 +0000353 }
drhfc15f4c2019-03-28 13:03:41 +0000354 if( pWin->eFrmType ){
drh0dc0e9c2019-03-28 13:35:28 +0000355 char zBuf[30];
drhfc15f4c2019-03-28 13:03:41 +0000356 const char *zFrmType = "ROWS";
357 if( pWin->eFrmType==TK_RANGE ) zFrmType = "RANGE";
358 if( pWin->eFrmType==TK_GROUPS ) zFrmType = "GROUPS";
drh0dc0e9c2019-03-28 13:35:28 +0000359 sqlite3_snprintf(sizeof(zBuf),zBuf,"%s%s",zFrmType,
360 pWin->bImplicitFrame ? " (implied)" : "");
361 sqlite3TreeViewItem(pView, zBuf, (--nElement)>0);
drha1fd4b52018-07-10 06:32:53 +0000362 sqlite3TreeViewBound(pView, pWin->eStart, pWin->pStart, 1);
363 sqlite3TreeViewBound(pView, pWin->eEnd, pWin->pEnd, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000364 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000365 }
drhfc15f4c2019-03-28 13:03:41 +0000366 if( pWin->eExclude ){
367 char zBuf[30];
368 const char *zExclude;
369 switch( pWin->eExclude ){
370 case TK_NO: zExclude = "NO OTHERS"; break;
371 case TK_CURRENT: zExclude = "CURRENT ROW"; break;
372 case TK_GROUP: zExclude = "GROUP"; break;
373 case TK_TIES: zExclude = "TIES"; break;
374 default:
375 sqlite3_snprintf(sizeof(zBuf),zBuf,"invalid(%d)", pWin->eExclude);
376 zExclude = zBuf;
377 break;
378 }
drh2a7dcbf2022-04-06 15:41:53 +0000379 sqlite3TreeViewPush(&pView, 0);
drhfc15f4c2019-03-28 13:03:41 +0000380 sqlite3TreeViewLine(pView, "EXCLUDE %s", zExclude);
drh2a7dcbf2022-04-06 15:41:53 +0000381 sqlite3TreeViewPop(&pView);
drhfc15f4c2019-03-28 13:03:41 +0000382 }
drh2a7dcbf2022-04-06 15:41:53 +0000383 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000384}
385#endif /* SQLITE_OMIT_WINDOWFUNC */
386
387#ifndef SQLITE_OMIT_WINDOWFUNC
388/*
389** Generate a human-readable explanation for a Window Function object
390*/
391void sqlite3TreeViewWinFunc(TreeView *pView, const Window *pWin, u8 more){
drh2a7dcbf2022-04-06 15:41:53 +0000392 sqlite3TreeViewPush(&pView, more);
drha1fd4b52018-07-10 06:32:53 +0000393 sqlite3TreeViewLine(pView, "WINFUNC %s(%d)",
drh105dcaa2022-03-10 16:01:14 +0000394 pWin->pWFunc->zName, pWin->pWFunc->nArg);
drha1fd4b52018-07-10 06:32:53 +0000395 sqlite3TreeViewWindow(pView, pWin, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000396 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000397}
398#endif /* SQLITE_OMIT_WINDOWFUNC */
399
drh38b41492015-06-08 15:08:15 +0000400/*
401** Generate a human-readable explanation of an expression tree.
402*/
403void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
404 const char *zBinOp = 0; /* Binary operator */
405 const char *zUniOp = 0; /* Unary operator */
drhe7375bf2020-03-10 19:24:38 +0000406 char zFlgs[200];
drh2a7dcbf2022-04-06 15:41:53 +0000407 sqlite3TreeViewPush(&pView, moreToFollow);
drh38b41492015-06-08 15:08:15 +0000408 if( pExpr==0 ){
409 sqlite3TreeViewLine(pView, "nil");
drh2a7dcbf2022-04-06 15:41:53 +0000410 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000411 return;
412 }
drhe7375bf2020-03-10 19:24:38 +0000413 if( pExpr->flags || pExpr->affExpr || pExpr->vvaFlags ){
drhb7e51992020-01-08 14:39:57 +0000414 StrAccum x;
415 sqlite3StrAccumInit(&x, 0, zFlgs, sizeof(zFlgs), 0);
416 sqlite3_str_appendf(&x, " fg.af=%x.%c",
417 pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n');
drhd97cda42017-04-14 14:02:14 +0000418 if( ExprHasProperty(pExpr, EP_FromJoin) ){
drh796588a2022-02-05 21:49:47 +0000419 sqlite3_str_appendf(&x, " iRJT=%d", pExpr->w.iRightJoinTable);
drhd97cda42017-04-14 14:02:14 +0000420 }
drhb7e51992020-01-08 14:39:57 +0000421 if( ExprHasProperty(pExpr, EP_FromDDL) ){
422 sqlite3_str_appendf(&x, " DDL");
423 }
drhe7375bf2020-03-10 19:24:38 +0000424 if( ExprHasVVAProperty(pExpr, EP_Immutable) ){
425 sqlite3_str_appendf(&x, " IMMUTABLE");
426 }
drhb7e51992020-01-08 14:39:57 +0000427 sqlite3StrAccumFinish(&x);
drhb3d903e2015-06-18 14:09:13 +0000428 }else{
429 zFlgs[0] = 0;
430 }
drh38b41492015-06-08 15:08:15 +0000431 switch( pExpr->op ){
432 case TK_AGG_COLUMN: {
drhb3d903e2015-06-18 14:09:13 +0000433 sqlite3TreeViewLine(pView, "AGG{%d:%d}%s",
434 pExpr->iTable, pExpr->iColumn, zFlgs);
drh38b41492015-06-08 15:08:15 +0000435 break;
436 }
437 case TK_COLUMN: {
438 if( pExpr->iTable<0 ){
439 /* This only happens when coding check constraints */
drhd4933532019-10-31 12:30:38 +0000440 char zOp2[16];
441 if( pExpr->op2 ){
442 sqlite3_snprintf(sizeof(zOp2),zOp2," op2=0x%02x",pExpr->op2);
443 }else{
444 zOp2[0] = 0;
445 }
446 sqlite3TreeViewLine(pView, "COLUMN(%d)%s%s",
447 pExpr->iColumn, zFlgs, zOp2);
drh38b41492015-06-08 15:08:15 +0000448 }else{
drh477572b2021-10-07 20:46:29 +0000449 assert( ExprUseYTab(pExpr) );
drha513e592019-12-20 20:08:56 +0000450 sqlite3TreeViewLine(pView, "{%d:%d} pTab=%p%s",
451 pExpr->iTable, pExpr->iColumn,
452 pExpr->y.pTab, zFlgs);
drh38b41492015-06-08 15:08:15 +0000453 }
drhefad2e22018-07-27 16:57:11 +0000454 if( ExprHasProperty(pExpr, EP_FixedCol) ){
455 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
456 }
drh38b41492015-06-08 15:08:15 +0000457 break;
458 }
459 case TK_INTEGER: {
460 if( pExpr->flags & EP_IntValue ){
461 sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue);
462 }else{
463 sqlite3TreeViewLine(pView, "%s", pExpr->u.zToken);
464 }
465 break;
466 }
467#ifndef SQLITE_OMIT_FLOATING_POINT
468 case TK_FLOAT: {
drhf9751072021-10-07 13:40:29 +0000469 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000470 sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken);
471 break;
472 }
473#endif
474 case TK_STRING: {
drhf9751072021-10-07 13:40:29 +0000475 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000476 sqlite3TreeViewLine(pView,"%Q", pExpr->u.zToken);
477 break;
478 }
479 case TK_NULL: {
480 sqlite3TreeViewLine(pView,"NULL");
481 break;
482 }
drh34328212018-02-26 19:03:25 +0000483 case TK_TRUEFALSE: {
drh348e0022021-07-22 16:07:01 +0000484 sqlite3TreeViewLine(pView,"%s%s",
485 sqlite3ExprTruthValue(pExpr) ? "TRUE" : "FALSE", zFlgs);
drh34328212018-02-26 19:03:25 +0000486 break;
487 }
drh38b41492015-06-08 15:08:15 +0000488#ifndef SQLITE_OMIT_BLOB_LITERAL
489 case TK_BLOB: {
drhf9751072021-10-07 13:40:29 +0000490 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000491 sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken);
492 break;
493 }
494#endif
495 case TK_VARIABLE: {
drhf9751072021-10-07 13:40:29 +0000496 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000497 sqlite3TreeViewLine(pView,"VARIABLE(%s,%d)",
498 pExpr->u.zToken, pExpr->iColumn);
499 break;
500 }
501 case TK_REGISTER: {
502 sqlite3TreeViewLine(pView,"REGISTER(%d)", pExpr->iTable);
503 break;
504 }
drh38b41492015-06-08 15:08:15 +0000505 case TK_ID: {
drhf9751072021-10-07 13:40:29 +0000506 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000507 sqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken);
508 break;
509 }
510#ifndef SQLITE_OMIT_CAST
511 case TK_CAST: {
512 /* Expressions of the form: CAST(pLeft AS token) */
drhf9751072021-10-07 13:40:29 +0000513 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000514 sqlite3TreeViewLine(pView,"CAST %Q", pExpr->u.zToken);
515 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
516 break;
517 }
518#endif /* SQLITE_OMIT_CAST */
519 case TK_LT: zBinOp = "LT"; break;
520 case TK_LE: zBinOp = "LE"; break;
521 case TK_GT: zBinOp = "GT"; break;
522 case TK_GE: zBinOp = "GE"; break;
523 case TK_NE: zBinOp = "NE"; break;
524 case TK_EQ: zBinOp = "EQ"; break;
525 case TK_IS: zBinOp = "IS"; break;
526 case TK_ISNOT: zBinOp = "ISNOT"; break;
527 case TK_AND: zBinOp = "AND"; break;
528 case TK_OR: zBinOp = "OR"; break;
529 case TK_PLUS: zBinOp = "ADD"; break;
530 case TK_STAR: zBinOp = "MUL"; break;
531 case TK_MINUS: zBinOp = "SUB"; break;
532 case TK_REM: zBinOp = "REM"; break;
533 case TK_BITAND: zBinOp = "BITAND"; break;
534 case TK_BITOR: zBinOp = "BITOR"; break;
535 case TK_SLASH: zBinOp = "DIV"; break;
536 case TK_LSHIFT: zBinOp = "LSHIFT"; break;
537 case TK_RSHIFT: zBinOp = "RSHIFT"; break;
538 case TK_CONCAT: zBinOp = "CONCAT"; break;
539 case TK_DOT: zBinOp = "DOT"; break;
drhe7375bf2020-03-10 19:24:38 +0000540 case TK_LIMIT: zBinOp = "LIMIT"; break;
drh38b41492015-06-08 15:08:15 +0000541
542 case TK_UMINUS: zUniOp = "UMINUS"; break;
543 case TK_UPLUS: zUniOp = "UPLUS"; break;
544 case TK_BITNOT: zUniOp = "BITNOT"; break;
545 case TK_NOT: zUniOp = "NOT"; break;
546 case TK_ISNULL: zUniOp = "ISNULL"; break;
547 case TK_NOTNULL: zUniOp = "NOTNULL"; break;
548
drh34328212018-02-26 19:03:25 +0000549 case TK_TRUTH: {
drh43c4ac82018-02-26 21:26:27 +0000550 int x;
551 const char *azOp[] = {
552 "IS-FALSE", "IS-TRUE", "IS-NOT-FALSE", "IS-NOT-TRUE"
553 };
drh34328212018-02-26 19:03:25 +0000554 assert( pExpr->op2==TK_IS || pExpr->op2==TK_ISNOT );
555 assert( pExpr->pRight );
dan6ece3532019-06-12 13:49:32 +0000556 assert( sqlite3ExprSkipCollate(pExpr->pRight)->op==TK_TRUEFALSE );
drh96acafb2018-02-27 14:49:25 +0000557 x = (pExpr->op2==TK_ISNOT)*2 + sqlite3ExprTruthValue(pExpr->pRight);
drh43c4ac82018-02-26 21:26:27 +0000558 zUniOp = azOp[x];
drh34328212018-02-26 19:03:25 +0000559 break;
560 }
561
drh94fa9c42016-02-27 21:16:04 +0000562 case TK_SPAN: {
drhf9751072021-10-07 13:40:29 +0000563 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh94fa9c42016-02-27 21:16:04 +0000564 sqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken);
565 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
566 break;
567 }
568
drh38b41492015-06-08 15:08:15 +0000569 case TK_COLLATE: {
drhc204d812019-09-10 17:51:27 +0000570 /* COLLATE operators without the EP_Collate flag are intended to
drh018dbb12019-09-28 16:14:55 +0000571 ** emulate collation associated with a table column. These show
572 ** up in the treeview output as "SOFT-COLLATE". Explicit COLLATE
573 ** operators that appear in the original SQL always have the
574 ** EP_Collate bit set and appear in treeview output as just "COLLATE" */
drhf9751072021-10-07 13:40:29 +0000575 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drhc204d812019-09-10 17:51:27 +0000576 sqlite3TreeViewLine(pView, "%sCOLLATE %Q%s",
577 !ExprHasProperty(pExpr, EP_Collate) ? "SOFT-" : "",
578 pExpr->u.zToken, zFlgs);
drh38b41492015-06-08 15:08:15 +0000579 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
580 break;
581 }
582
583 case TK_AGG_FUNCTION:
584 case TK_FUNCTION: {
585 ExprList *pFarg; /* List of function arguments */
drha1fd4b52018-07-10 06:32:53 +0000586 Window *pWin;
drh38b41492015-06-08 15:08:15 +0000587 if( ExprHasProperty(pExpr, EP_TokenOnly) ){
588 pFarg = 0;
drha1fd4b52018-07-10 06:32:53 +0000589 pWin = 0;
drh38b41492015-06-08 15:08:15 +0000590 }else{
drha4eeccd2021-10-07 17:43:30 +0000591 assert( ExprUseXList(pExpr) );
drh38b41492015-06-08 15:08:15 +0000592 pFarg = pExpr->x.pList;
drha1fd4b52018-07-10 06:32:53 +0000593#ifndef SQLITE_OMIT_WINDOWFUNC
drh014fff22020-01-08 22:22:36 +0000594 pWin = ExprHasProperty(pExpr, EP_WinFunc) ? pExpr->y.pWin : 0;
drha1fd4b52018-07-10 06:32:53 +0000595#else
596 pWin = 0;
597#endif
drh38b41492015-06-08 15:08:15 +0000598 }
drhf9751072021-10-07 13:40:29 +0000599 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000600 if( pExpr->op==TK_AGG_FUNCTION ){
drhe26d4282020-06-09 11:59:15 +0000601 sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s agg=%d[%d]/%p",
drhca74fbf2020-05-24 02:05:04 +0000602 pExpr->op2, pExpr->u.zToken, zFlgs,
drhe26d4282020-06-09 11:59:15 +0000603 pExpr->pAggInfo ? pExpr->pAggInfo->selId : 0,
drhca74fbf2020-05-24 02:05:04 +0000604 pExpr->iAgg, pExpr->pAggInfo);
drhd4933532019-10-31 12:30:38 +0000605 }else if( pExpr->op2!=0 ){
606 const char *zOp2;
607 char zBuf[8];
608 sqlite3_snprintf(sizeof(zBuf),zBuf,"0x%02x",pExpr->op2);
609 zOp2 = zBuf;
610 if( pExpr->op2==NC_IsCheck ) zOp2 = "NC_IsCheck";
611 if( pExpr->op2==NC_IdxExpr ) zOp2 = "NC_IdxExpr";
612 if( pExpr->op2==NC_PartIdx ) zOp2 = "NC_PartIdx";
613 if( pExpr->op2==NC_GenCol ) zOp2 = "NC_GenCol";
614 sqlite3TreeViewLine(pView, "FUNCTION %Q%s op2=%s",
615 pExpr->u.zToken, zFlgs, zOp2);
drh38b41492015-06-08 15:08:15 +0000616 }else{
drh42d2fce2019-08-15 20:04:09 +0000617 sqlite3TreeViewLine(pView, "FUNCTION %Q%s", pExpr->u.zToken, zFlgs);
drh38b41492015-06-08 15:08:15 +0000618 }
619 if( pFarg ){
drha1fd4b52018-07-10 06:32:53 +0000620 sqlite3TreeViewExprList(pView, pFarg, pWin!=0, 0);
drh38b41492015-06-08 15:08:15 +0000621 }
mistachkin14897852018-07-23 18:53:49 +0000622#ifndef SQLITE_OMIT_WINDOWFUNC
drha1fd4b52018-07-10 06:32:53 +0000623 if( pWin ){
624 sqlite3TreeViewWindow(pView, pWin, 0);
625 }
626#endif
drh38b41492015-06-08 15:08:15 +0000627 break;
628 }
629#ifndef SQLITE_OMIT_SUBQUERY
630 case TK_EXISTS: {
drha4eeccd2021-10-07 17:43:30 +0000631 assert( ExprUseXSelect(pExpr) );
drh9f6e14c2017-07-10 13:24:58 +0000632 sqlite3TreeViewLine(pView, "EXISTS-expr flags=0x%x", pExpr->flags);
drh38b41492015-06-08 15:08:15 +0000633 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
634 break;
635 }
636 case TK_SELECT: {
drha4eeccd2021-10-07 17:43:30 +0000637 assert( ExprUseXSelect(pExpr) );
drha0365c42020-06-05 04:01:50 +0000638 sqlite3TreeViewLine(pView, "subquery-expr flags=0x%x", pExpr->flags);
drh38b41492015-06-08 15:08:15 +0000639 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
640 break;
641 }
642 case TK_IN: {
drh9f6e14c2017-07-10 13:24:58 +0000643 sqlite3TreeViewLine(pView, "IN flags=0x%x", pExpr->flags);
drh38b41492015-06-08 15:08:15 +0000644 sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
drha4eeccd2021-10-07 17:43:30 +0000645 if( ExprUseXSelect(pExpr) ){
drh38b41492015-06-08 15:08:15 +0000646 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
647 }else{
648 sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
649 }
650 break;
651 }
652#endif /* SQLITE_OMIT_SUBQUERY */
653
654 /*
655 ** x BETWEEN y AND z
656 **
657 ** This is equivalent to
658 **
659 ** x>=y AND x<=z
660 **
661 ** X is stored in pExpr->pLeft.
662 ** Y is stored in pExpr->pList->a[0].pExpr.
663 ** Z is stored in pExpr->pList->a[1].pExpr.
664 */
665 case TK_BETWEEN: {
drha4eeccd2021-10-07 17:43:30 +0000666 const Expr *pX, *pY, *pZ;
667 pX = pExpr->pLeft;
668 assert( ExprUseXList(pExpr) );
669 assert( pExpr->x.pList->nExpr==2 );
670 pY = pExpr->x.pList->a[0].pExpr;
671 pZ = pExpr->x.pList->a[1].pExpr;
drh38b41492015-06-08 15:08:15 +0000672 sqlite3TreeViewLine(pView, "BETWEEN");
673 sqlite3TreeViewExpr(pView, pX, 1);
674 sqlite3TreeViewExpr(pView, pY, 1);
675 sqlite3TreeViewExpr(pView, pZ, 0);
676 break;
677 }
678 case TK_TRIGGER: {
679 /* If the opcode is TK_TRIGGER, then the expression is a reference
680 ** to a column in the new.* or old.* pseudo-tables available to
681 ** trigger programs. In this case Expr.iTable is set to 1 for the
682 ** new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn
683 ** is set to the column of the pseudo-table to read, or to -1 to
684 ** read the rowid field.
685 */
686 sqlite3TreeViewLine(pView, "%s(%d)",
687 pExpr->iTable ? "NEW" : "OLD", pExpr->iColumn);
688 break;
689 }
690 case TK_CASE: {
691 sqlite3TreeViewLine(pView, "CASE");
692 sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
drha4eeccd2021-10-07 17:43:30 +0000693 assert( ExprUseXList(pExpr) );
drh38b41492015-06-08 15:08:15 +0000694 sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
695 break;
696 }
697#ifndef SQLITE_OMIT_TRIGGER
698 case TK_RAISE: {
699 const char *zType = "unk";
drh11949042019-08-05 18:01:42 +0000700 switch( pExpr->affExpr ){
drh38b41492015-06-08 15:08:15 +0000701 case OE_Rollback: zType = "rollback"; break;
702 case OE_Abort: zType = "abort"; break;
703 case OE_Fail: zType = "fail"; break;
704 case OE_Ignore: zType = "ignore"; break;
705 }
drhf9751072021-10-07 13:40:29 +0000706 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000707 sqlite3TreeViewLine(pView, "RAISE %s(%Q)", zType, pExpr->u.zToken);
708 break;
709 }
710#endif
drhc84a4022016-05-27 12:30:20 +0000711 case TK_MATCH: {
712 sqlite3TreeViewLine(pView, "MATCH {%d:%d}%s",
713 pExpr->iTable, pExpr->iColumn, zFlgs);
714 sqlite3TreeViewExpr(pView, pExpr->pRight, 0);
715 break;
716 }
drhdb97e562016-08-18 17:55:57 +0000717 case TK_VECTOR: {
drh269d3222019-10-23 18:09:39 +0000718 char *z = sqlite3_mprintf("VECTOR%s",zFlgs);
drha4eeccd2021-10-07 17:43:30 +0000719 assert( ExprUseXList(pExpr) );
drh269d3222019-10-23 18:09:39 +0000720 sqlite3TreeViewBareExprList(pView, pExpr->x.pList, z);
721 sqlite3_free(z);
drhdb97e562016-08-18 17:55:57 +0000722 break;
723 }
drh48cb3a72016-08-18 18:09:10 +0000724 case TK_SELECT_COLUMN: {
drhe46292a2021-07-05 02:40:29 +0000725 sqlite3TreeViewLine(pView, "SELECT-COLUMN %d of [0..%d]%s",
726 pExpr->iColumn, pExpr->iTable-1,
727 pExpr->pRight==pExpr->pLeft ? " (SELECT-owner)" : "");
drha4eeccd2021-10-07 17:43:30 +0000728 assert( ExprUseXSelect(pExpr->pLeft) );
drh48cb3a72016-08-18 18:09:10 +0000729 sqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0);
730 break;
731 }
drh31d6fd52017-04-14 19:03:10 +0000732 case TK_IF_NULL_ROW: {
733 sqlite3TreeViewLine(pView, "IF-NULL-ROW %d", pExpr->iTable);
734 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
735 break;
736 }
drhbf7f3a02021-05-24 11:35:16 +0000737 case TK_ERROR: {
738 Expr tmp;
739 sqlite3TreeViewLine(pView, "ERROR");
740 tmp = *pExpr;
741 tmp.op = pExpr->op2;
742 sqlite3TreeViewExpr(pView, &tmp, 0);
743 break;
744 }
drh4a4e02b2021-07-04 22:33:08 +0000745 case TK_ROW: {
746 if( pExpr->iColumn<=0 ){
747 sqlite3TreeViewLine(pView, "First FROM table rowid");
748 }else{
749 sqlite3TreeViewLine(pView, "First FROM table column %d",
750 pExpr->iColumn-1);
751 }
752 break;
753 }
drh38b41492015-06-08 15:08:15 +0000754 default: {
755 sqlite3TreeViewLine(pView, "op=%d", pExpr->op);
756 break;
757 }
758 }
759 if( zBinOp ){
drhb3d903e2015-06-18 14:09:13 +0000760 sqlite3TreeViewLine(pView, "%s%s", zBinOp, zFlgs);
drh38b41492015-06-08 15:08:15 +0000761 sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
762 sqlite3TreeViewExpr(pView, pExpr->pRight, 0);
763 }else if( zUniOp ){
drhb3d903e2015-06-18 14:09:13 +0000764 sqlite3TreeViewLine(pView, "%s%s", zUniOp, zFlgs);
drh11949042019-08-05 18:01:42 +0000765 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
drh38b41492015-06-08 15:08:15 +0000766 }
drh2a7dcbf2022-04-06 15:41:53 +0000767 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000768}
769
drhdb97e562016-08-18 17:55:57 +0000770
drh38b41492015-06-08 15:08:15 +0000771/*
772** Generate a human-readable explanation of an expression list.
773*/
drhdb97e562016-08-18 17:55:57 +0000774void sqlite3TreeViewBareExprList(
drh38b41492015-06-08 15:08:15 +0000775 TreeView *pView,
776 const ExprList *pList,
drh38b41492015-06-08 15:08:15 +0000777 const char *zLabel
778){
drh38b41492015-06-08 15:08:15 +0000779 if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST";
780 if( pList==0 ){
781 sqlite3TreeViewLine(pView, "%s (empty)", zLabel);
782 }else{
drhdb97e562016-08-18 17:55:57 +0000783 int i;
drh38b41492015-06-08 15:08:15 +0000784 sqlite3TreeViewLine(pView, "%s", zLabel);
785 for(i=0; i<pList->nExpr; i++){
drh5579d592015-08-26 14:01:41 +0000786 int j = pList->a[i].u.x.iOrderByCol;
drh41cee662019-12-12 20:22:34 +0000787 char *zName = pList->a[i].zEName;
drhfbe07532018-04-23 20:04:38 +0000788 int moreToFollow = i<pList->nExpr - 1;
drhe1f49b82020-01-03 00:28:14 +0000789 if( pList->a[i].eEName!=ENAME_NAME ) zName = 0;
drh5a699a02017-12-22 19:53:02 +0000790 if( j || zName ){
drh2a7dcbf2022-04-06 15:41:53 +0000791 sqlite3TreeViewPush(&pView, moreToFollow);
drhfbe07532018-04-23 20:04:38 +0000792 moreToFollow = 0;
793 sqlite3TreeViewLine(pView, 0);
794 if( zName ){
795 fprintf(stdout, "AS %s ", zName);
796 }
797 if( j ){
798 fprintf(stdout, "iOrderByCol=%d", j);
799 }
800 fprintf(stdout, "\n");
801 fflush(stdout);
drh5a699a02017-12-22 19:53:02 +0000802 }
drhfbe07532018-04-23 20:04:38 +0000803 sqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow);
drh5a699a02017-12-22 19:53:02 +0000804 if( j || zName ){
drh2a7dcbf2022-04-06 15:41:53 +0000805 sqlite3TreeViewPop(&pView);
drh5a699a02017-12-22 19:53:02 +0000806 }
drh38b41492015-06-08 15:08:15 +0000807 }
808 }
drhdb97e562016-08-18 17:55:57 +0000809}
810void sqlite3TreeViewExprList(
811 TreeView *pView,
812 const ExprList *pList,
813 u8 moreToFollow,
814 const char *zLabel
815){
drh2a7dcbf2022-04-06 15:41:53 +0000816 sqlite3TreeViewPush(&pView, moreToFollow);
drhdb97e562016-08-18 17:55:57 +0000817 sqlite3TreeViewBareExprList(pView, pList, zLabel);
drh2a7dcbf2022-04-06 15:41:53 +0000818 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000819}
820
drh7d2c1d22022-04-06 00:29:21 +0000821/*
822** Generate a human-readable explanation of an id-list.
823*/
824void sqlite3TreeViewBareIdList(
825 TreeView *pView,
826 const IdList *pList,
827 const char *zLabel
828){
829 if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST";
830 if( pList==0 ){
831 sqlite3TreeViewLine(pView, "%s (empty)", zLabel);
832 }else{
833 int i;
834 sqlite3TreeViewLine(pView, "%s", zLabel);
835 for(i=0; i<pList->nId; i++){
836 char *zName = pList->a[i].zName;
837 int moreToFollow = i<pList->nId - 1;
838 if( zName==0 ) zName = "(null)";
drh2a7dcbf2022-04-06 15:41:53 +0000839 sqlite3TreeViewPush(&pView, moreToFollow);
drh7d2c1d22022-04-06 00:29:21 +0000840 moreToFollow = 0;
841 sqlite3TreeViewLine(pView, 0);
842 fprintf(stdout, "%s (%d)\n", zName, pList->a[i].idx);
drh2a7dcbf2022-04-06 15:41:53 +0000843 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000844 }
845 }
846}
847void sqlite3TreeViewIdList(
848 TreeView *pView,
849 const IdList *pList,
850 u8 moreToFollow,
851 const char *zLabel
852){
drh2a7dcbf2022-04-06 15:41:53 +0000853 sqlite3TreeViewPush(&pView, moreToFollow);
drh7d2c1d22022-04-06 00:29:21 +0000854 sqlite3TreeViewBareIdList(pView, pList, zLabel);
drh2a7dcbf2022-04-06 15:41:53 +0000855 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000856}
857
858/*
859** Generate a human-readable explanation of a list of Upsert objects
860*/
861void sqlite3TreeViewUpsert(
862 TreeView *pView,
863 const Upsert *pUpsert,
864 u8 moreToFollow
865){
866 if( pUpsert==0 ) return;
drh2a7dcbf2022-04-06 15:41:53 +0000867 sqlite3TreeViewPush(&pView, moreToFollow);
drh7d2c1d22022-04-06 00:29:21 +0000868 while( pUpsert ){
869 int n;
drh2a7dcbf2022-04-06 15:41:53 +0000870 sqlite3TreeViewPush(&pView, pUpsert->pNextUpsert!=0 || moreToFollow);
drh7d2c1d22022-04-06 00:29:21 +0000871 sqlite3TreeViewLine(pView, "ON CONFLICT DO %s",
872 pUpsert->isDoUpdate ? "UPDATE" : "NOTHING");
873 n = (pUpsert->pUpsertSet!=0) + (pUpsert->pUpsertWhere!=0);
874 sqlite3TreeViewExprList(pView, pUpsert->pUpsertTarget, (n--)>0, "TARGET");
875 sqlite3TreeViewExprList(pView, pUpsert->pUpsertSet, (n--)>0, "SET");
876 if( pUpsert->pUpsertWhere ){
877 sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
878 sqlite3TreeViewExpr(pView, pUpsert->pUpsertWhere, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000879 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000880 }
drh2a7dcbf2022-04-06 15:41:53 +0000881 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000882 pUpsert = pUpsert->pNextUpsert;
883 }
drh2a7dcbf2022-04-06 15:41:53 +0000884 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000885}
886
887/*
888** Generate a human-readable diagram of the data structure that go
drhf8ef2db2022-04-06 10:37:44 +0000889** into generating an DELETE statement.
890*/
891void sqlite3TreeViewDelete(
drhf8ef2db2022-04-06 10:37:44 +0000892 const With *pWith,
893 const SrcList *pTabList,
894 const Expr *pWhere,
895 const ExprList *pOrderBy,
drh2a7dcbf2022-04-06 15:41:53 +0000896 const Expr *pLimit,
897 const Trigger *pTrigger
drhf8ef2db2022-04-06 10:37:44 +0000898){
899 int n = 0;
drh2a7dcbf2022-04-06 15:41:53 +0000900 TreeView *pView = 0;
901 sqlite3TreeViewPush(&pView, 0);
drhf8ef2db2022-04-06 10:37:44 +0000902 sqlite3TreeViewLine(pView, "DELETE");
drhf8ef2db2022-04-06 10:37:44 +0000903 if( pWith ) n++;
904 if( pTabList ) n++;
905 if( pWhere ) n++;
906 if( pOrderBy ) n++;
907 if( pLimit ) n++;
drh2a7dcbf2022-04-06 15:41:53 +0000908 if( pTrigger ) n++;
drhf8ef2db2022-04-06 10:37:44 +0000909 if( pWith ){
drh2a7dcbf2022-04-06 15:41:53 +0000910 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +0000911 sqlite3TreeViewWith(pView, pWith, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000912 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +0000913 }
914 if( pTabList ){
drh2a7dcbf2022-04-06 15:41:53 +0000915 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +0000916 sqlite3TreeViewLine(pView, "FROM");
917 sqlite3TreeViewSrcList(pView, pTabList);
drh2a7dcbf2022-04-06 15:41:53 +0000918 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +0000919 }
920 if( pWhere ){
drh2a7dcbf2022-04-06 15:41:53 +0000921 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +0000922 sqlite3TreeViewLine(pView, "WHERE");
923 sqlite3TreeViewExpr(pView, pWhere, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000924 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +0000925 }
926 if( pOrderBy ){
927 sqlite3TreeViewExprList(pView, pOrderBy, (--n)>0, "ORDER-BY");
928 }
929 if( pLimit ){
drh2a7dcbf2022-04-06 15:41:53 +0000930 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +0000931 sqlite3TreeViewLine(pView, "LIMIT");
932 sqlite3TreeViewExpr(pView, pLimit, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000933 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +0000934 }
drh2a7dcbf2022-04-06 15:41:53 +0000935 if( pTrigger ){
936 sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
937 }
938 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +0000939}
940
941/*
942** Generate a human-readable diagram of the data structure that go
drh7d2c1d22022-04-06 00:29:21 +0000943** into generating an INSERT statement.
944*/
945void sqlite3TreeViewInsert(
drh7d2c1d22022-04-06 00:29:21 +0000946 const With *pWith,
947 const SrcList *pTabList,
948 const IdList *pColumnList,
949 const Select *pSelect,
drhc2d0df92022-04-06 18:30:17 +0000950 const ExprList *pExprList,
drh7d2c1d22022-04-06 00:29:21 +0000951 int onError,
drh2a7dcbf2022-04-06 15:41:53 +0000952 const Upsert *pUpsert,
953 const Trigger *pTrigger
drh7d2c1d22022-04-06 00:29:21 +0000954){
drh2a7dcbf2022-04-06 15:41:53 +0000955 TreeView *pView = 0;
drh7d2c1d22022-04-06 00:29:21 +0000956 int n = 0;
957 const char *zLabel = "INSERT";
958 switch( onError ){
959 case OE_Replace: zLabel = "REPLACE"; break;
960 case OE_Ignore: zLabel = "INSERT OR IGNORE"; break;
961 case OE_Rollback: zLabel = "INSERT OR ROLLBACK"; break;
962 case OE_Abort: zLabel = "INSERT OR ABORT"; break;
963 case OE_Fail: zLabel = "INSERT OR FAIL"; break;
964 }
drh2a7dcbf2022-04-06 15:41:53 +0000965 sqlite3TreeViewPush(&pView, 0);
drh7d2c1d22022-04-06 00:29:21 +0000966 sqlite3TreeViewLine(pView, zLabel);
drh7d2c1d22022-04-06 00:29:21 +0000967 if( pWith ) n++;
968 if( pTabList ) n++;
969 if( pColumnList ) n++;
970 if( pSelect ) n++;
drhc2d0df92022-04-06 18:30:17 +0000971 if( pExprList ) n++;
drh7d2c1d22022-04-06 00:29:21 +0000972 if( pUpsert ) n++;
drh2a7dcbf2022-04-06 15:41:53 +0000973 if( pTrigger ) n++;
drh7d2c1d22022-04-06 00:29:21 +0000974 if( pWith ){
drh2a7dcbf2022-04-06 15:41:53 +0000975 sqlite3TreeViewPush(&pView, (--n)>0);
drh7d2c1d22022-04-06 00:29:21 +0000976 sqlite3TreeViewWith(pView, pWith, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000977 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000978 }
979 if( pTabList ){
drh2a7dcbf2022-04-06 15:41:53 +0000980 sqlite3TreeViewPush(&pView, (--n)>0);
drh7d2c1d22022-04-06 00:29:21 +0000981 sqlite3TreeViewLine(pView, "INTO");
982 sqlite3TreeViewSrcList(pView, pTabList);
drh2a7dcbf2022-04-06 15:41:53 +0000983 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000984 }
985 if( pColumnList ){
986 sqlite3TreeViewIdList(pView, pColumnList, (--n)>0, "COLUMNS");
987 }
988 if( pSelect ){
drh2a7dcbf2022-04-06 15:41:53 +0000989 sqlite3TreeViewPush(&pView, (--n)>0);
drh7d2c1d22022-04-06 00:29:21 +0000990 sqlite3TreeViewLine(pView, "DATA-SOURCE");
991 sqlite3TreeViewSelect(pView, pSelect, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000992 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000993 }
drhc2d0df92022-04-06 18:30:17 +0000994 if( pExprList ){
995 sqlite3TreeViewExprList(pView, pExprList, (--n)>0, "VALUES");
996 }
drh7d2c1d22022-04-06 00:29:21 +0000997 if( pUpsert ){
drh2a7dcbf2022-04-06 15:41:53 +0000998 sqlite3TreeViewPush(&pView, (--n)>0);
drh7d2c1d22022-04-06 00:29:21 +0000999 sqlite3TreeViewLine(pView, "UPSERT");
1000 sqlite3TreeViewUpsert(pView, pUpsert, 0);
drh2a7dcbf2022-04-06 15:41:53 +00001001 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +00001002 }
drh2a7dcbf2022-04-06 15:41:53 +00001003 if( pTrigger ){
1004 sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
1005 }
1006 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +00001007}
1008
drhf8ef2db2022-04-06 10:37:44 +00001009/*
1010** Generate a human-readable diagram of the data structure that go
1011** into generating an UPDATE statement.
1012*/
1013void sqlite3TreeViewUpdate(
drhf8ef2db2022-04-06 10:37:44 +00001014 const With *pWith,
1015 const SrcList *pTabList,
1016 const ExprList *pChanges,
1017 const Expr *pWhere,
1018 int onError,
1019 const ExprList *pOrderBy,
1020 const Expr *pLimit,
drh2a7dcbf2022-04-06 15:41:53 +00001021 const Upsert *pUpsert,
1022 const Trigger *pTrigger
drhf8ef2db2022-04-06 10:37:44 +00001023){
1024 int n = 0;
drh2a7dcbf2022-04-06 15:41:53 +00001025 TreeView *pView = 0;
drhf8ef2db2022-04-06 10:37:44 +00001026 const char *zLabel = "UPDATE";
1027 switch( onError ){
1028 case OE_Replace: zLabel = "UPDATE OR REPLACE"; break;
1029 case OE_Ignore: zLabel = "UPDATE OR IGNORE"; break;
1030 case OE_Rollback: zLabel = "UPDATE OR ROLLBACK"; break;
1031 case OE_Abort: zLabel = "UPDATE OR ABORT"; break;
1032 case OE_Fail: zLabel = "UPDATE OR FAIL"; break;
1033 }
drh2a7dcbf2022-04-06 15:41:53 +00001034 sqlite3TreeViewPush(&pView, 0);
drhf8ef2db2022-04-06 10:37:44 +00001035 sqlite3TreeViewLine(pView, zLabel);
drhf8ef2db2022-04-06 10:37:44 +00001036 if( pWith ) n++;
1037 if( pTabList ) n++;
1038 if( pChanges ) n++;
1039 if( pWhere ) n++;
1040 if( pOrderBy ) n++;
1041 if( pLimit ) n++;
1042 if( pUpsert ) n++;
drh2a7dcbf2022-04-06 15:41:53 +00001043 if( pTrigger ) n++;
drhf8ef2db2022-04-06 10:37:44 +00001044 if( pWith ){
drh2a7dcbf2022-04-06 15:41:53 +00001045 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +00001046 sqlite3TreeViewWith(pView, pWith, 0);
drh2a7dcbf2022-04-06 15:41:53 +00001047 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001048 }
1049 if( pTabList ){
drh2a7dcbf2022-04-06 15:41:53 +00001050 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +00001051 sqlite3TreeViewLine(pView, "FROM");
1052 sqlite3TreeViewSrcList(pView, pTabList);
drh2a7dcbf2022-04-06 15:41:53 +00001053 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001054 }
1055 if( pChanges ){
1056 sqlite3TreeViewExprList(pView, pChanges, (--n)>0, "SET");
1057 }
1058 if( pWhere ){
drh2a7dcbf2022-04-06 15:41:53 +00001059 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +00001060 sqlite3TreeViewLine(pView, "WHERE");
1061 sqlite3TreeViewExpr(pView, pWhere, 0);
drh2a7dcbf2022-04-06 15:41:53 +00001062 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001063 }
1064 if( pOrderBy ){
1065 sqlite3TreeViewExprList(pView, pOrderBy, (--n)>0, "ORDER-BY");
1066 }
1067 if( pLimit ){
drh2a7dcbf2022-04-06 15:41:53 +00001068 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +00001069 sqlite3TreeViewLine(pView, "LIMIT");
1070 sqlite3TreeViewExpr(pView, pLimit, 0);
drh2a7dcbf2022-04-06 15:41:53 +00001071 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001072 }
1073 if( pUpsert ){
drh2a7dcbf2022-04-06 15:41:53 +00001074 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +00001075 sqlite3TreeViewLine(pView, "UPSERT");
1076 sqlite3TreeViewUpsert(pView, pUpsert, 0);
drh2a7dcbf2022-04-06 15:41:53 +00001077 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001078 }
drh2a7dcbf2022-04-06 15:41:53 +00001079 if( pTrigger ){
1080 sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
1081 }
1082 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001083}
1084
drh2a7dcbf2022-04-06 15:41:53 +00001085#ifndef SQLITE_OMIT_TRIGGER
1086/*
1087** Show a human-readable graph of a TriggerStep
1088*/
1089void sqlite3TreeViewTriggerStep(
1090 TreeView *pView,
1091 const TriggerStep *pStep,
1092 u8 moreToFollow,
1093 u8 showFullList
1094){
1095 int cnt = 0;
1096 if( pStep==0 ) return;
1097 sqlite3TreeViewPush(&pView,
1098 moreToFollow || (showFullList && pStep->pNext!=0));
1099 do{
1100 if( cnt++ && pStep->pNext==0 ){
1101 sqlite3TreeViewPop(&pView);
1102 sqlite3TreeViewPush(&pView, 0);
1103 }
1104 sqlite3TreeViewLine(pView, "%s", pStep->zSpan ? pStep->zSpan : "RETURNING");
1105 }while( showFullList && (pStep = pStep->pNext)!=0 );
1106 sqlite3TreeViewPop(&pView);
1107}
1108
1109/*
1110** Show a human-readable graph of a Trigger
1111*/
1112void sqlite3TreeViewTrigger(
1113 TreeView *pView,
1114 const Trigger *pTrigger,
1115 u8 moreToFollow,
1116 u8 showFullList
1117){
1118 int cnt = 0;
1119 if( pTrigger==0 ) return;
1120 sqlite3TreeViewPush(&pView,
1121 moreToFollow || (showFullList && pTrigger->pNext!=0));
1122 do{
1123 if( cnt++ && pTrigger->pNext==0 ){
1124 sqlite3TreeViewPop(&pView);
1125 sqlite3TreeViewPush(&pView, 0);
1126 }
1127 sqlite3TreeViewLine(pView, "TRIGGER %s", pTrigger->zName);
1128 sqlite3TreeViewPush(&pView, 0);
1129 sqlite3TreeViewTriggerStep(pView, pTrigger->step_list, 0, 1);
1130 sqlite3TreeViewPop(&pView);
1131 }while( showFullList && (pTrigger = pTrigger->pNext)!=0 );
1132 sqlite3TreeViewPop(&pView);
1133}
1134#endif /* SQLITE_OMIT_TRIGGER */
1135
1136
drh8f1eb6f2022-04-06 12:25:04 +00001137/*
1138** These simplified versions of the tree-view routines omit unnecessary
1139** parameters. These variants are intended to be used from a symbolic
1140** debugger, such as "gdb", during interactive debugging sessions.
1141**
1142** This routines are given external linkage so that they will always be
1143** accessible to the debugging, and to avoid warnings about unused
1144** functions. But these routines only exist in debugging builds, so they
1145** do not contaminate the interface.
1146*/
1147void sqlite3ShowExpr(const Expr *p){ sqlite3TreeViewExpr(0,p,0); }
1148void sqlite3ShowExprList(const ExprList *p){ sqlite3TreeViewExprList(0,p,0,0);}
1149void sqlite3ShowIdList(const IdList *p){ sqlite3TreeViewIdList(0,p,0,0); }
1150void sqlite3ShowSrcList(const SrcList *p){ sqlite3TreeViewSrcList(0,p); }
1151void sqlite3ShowSelect(const Select *p){ sqlite3TreeViewSelect(0,p,0); }
1152void sqlite3ShowWith(const With *p){ sqlite3TreeViewWith(0,p,0); }
1153void sqlite3ShowUpsert(const Upsert *p){ sqlite3TreeViewUpsert(0,p,0); }
drh2a7dcbf2022-04-06 15:41:53 +00001154#ifndef SQLITE_OMIT_TRIGGER
1155void sqlite3ShowTriggerStep(const TriggerStep *p){
1156 sqlite3TreeViewTriggerStep(0,p,0,0);
1157}
1158void sqlite3ShowTriggerStepList(const TriggerStep *p){
1159 sqlite3TreeViewTriggerStep(0,p,0,1);
1160}
1161void sqlite3ShowTrigger(const Trigger *p){ sqlite3TreeViewTrigger(0,p,0,0); }
1162void sqlite3ShowTriggerList(const Trigger *p){ sqlite3TreeViewTrigger(0,p,0,1);}
1163#endif
drh8f1eb6f2022-04-06 12:25:04 +00001164#ifndef SQLITE_OMIT_WINDOWFUNC
1165void sqlite3ShowWindow(const Window *p){ sqlite3TreeViewWindow(0,p,0); }
1166void sqlite3ShowWinFunc(const Window *p){ sqlite3TreeViewWinFunc(0,p,0); }
1167#endif
1168
drh38b41492015-06-08 15:08:15 +00001169#endif /* SQLITE_DEBUG */