blob: 4593161905c73958b58548bdedf9ef74d1b0396a [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 }
drha76ac882022-04-08 19:20:12 +0000147 if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))==(JT_LEFT|JT_RIGHT) ){
148 sqlite3_str_appendf(&x, " FULL-OUTER-JOIN");
149 }else if( pItem->fg.jointype & JT_LEFT ){
drh145d0a32018-11-08 22:53:06 +0000150 sqlite3_str_appendf(&x, " LEFT-JOIN");
drha76ac882022-04-08 19:20:12 +0000151 }else if( pItem->fg.jointype & JT_RIGHT ){
152 sqlite3_str_appendf(&x, " RIGHT-JOIN");
drh9b9f2352021-06-23 11:39:00 +0000153 }else if( pItem->fg.jointype & JT_CROSS ){
154 sqlite3_str_appendf(&x, " CROSS-JOIN");
drh145d0a32018-11-08 22:53:06 +0000155 }
drh8a28ce72022-04-11 00:54:30 +0000156 if( pItem->fg.jointype & JT_LTORJ ){
157 sqlite3_str_appendf(&x, " LTORJ");
158 }
drhb7e51992020-01-08 14:39:57 +0000159 if( pItem->fg.fromDDL ){
160 sqlite3_str_appendf(&x, " DDL");
161 }
drha79e2a22021-02-21 23:44:14 +0000162 if( pItem->fg.isCte ){
163 sqlite3_str_appendf(&x, " CteUse=0x%p", pItem->u2.pCteUse);
164 }
drh145d0a32018-11-08 22:53:06 +0000165 sqlite3StrAccumFinish(&x);
166 sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1);
167 if( pItem->pSelect ){
168 sqlite3TreeViewSelect(pView, pItem->pSelect, 0);
169 }
170 if( pItem->fg.isTabFunc ){
171 sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:");
172 }
drh2a7dcbf2022-04-06 15:41:53 +0000173 sqlite3TreeViewPop(&pView);
drh145d0a32018-11-08 22:53:06 +0000174 }
175}
drh38b41492015-06-08 15:08:15 +0000176
177/*
drh2e5c5052016-08-27 20:21:51 +0000178** Generate a human-readable description of a Select object.
drh38b41492015-06-08 15:08:15 +0000179*/
180void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){
181 int n = 0;
drh1c4505d2015-08-26 11:34:31 +0000182 int cnt = 0;
drh510b7ff2017-03-13 17:37:13 +0000183 if( p==0 ){
184 sqlite3TreeViewLine(pView, "nil-SELECT");
185 return;
186 }
drh2a7dcbf2022-04-06 15:41:53 +0000187 sqlite3TreeViewPush(&pView, moreToFollow);
drh2476a6f2015-11-07 15:19:59 +0000188 if( p->pWith ){
189 sqlite3TreeViewWith(pView, p->pWith, 1);
190 cnt = 1;
drh2a7dcbf2022-04-06 15:41:53 +0000191 sqlite3TreeViewPush(&pView, 1);
drh2476a6f2015-11-07 15:19:59 +0000192 }
drh1c4505d2015-08-26 11:34:31 +0000193 do{
drh55b4c822019-08-03 16:17:46 +0000194 if( p->selFlags & SF_WhereBegin ){
195 sqlite3TreeViewLine(pView, "sqlite3WhereBegin()");
196 }else{
197 sqlite3TreeViewLine(pView,
198 "SELECT%s%s (%u/%p) selFlags=0x%x nSelectRow=%d",
199 ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""),
200 ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""),
201 p->selId, p, p->selFlags,
202 (int)p->nSelectRow
203 );
204 }
drh2a7dcbf2022-04-06 15:41:53 +0000205 if( cnt++ ) sqlite3TreeViewPop(&pView);
drh1c4505d2015-08-26 11:34:31 +0000206 if( p->pPrior ){
207 n = 1000;
208 }else{
209 n = 0;
210 if( p->pSrc && p->pSrc->nSrc ) n++;
211 if( p->pWhere ) n++;
212 if( p->pGroupBy ) n++;
213 if( p->pHaving ) n++;
214 if( p->pOrderBy ) n++;
215 if( p->pLimit ) n++;
drha1fd4b52018-07-10 06:32:53 +0000216#ifndef SQLITE_OMIT_WINDOWFUNC
217 if( p->pWin ) n++;
218 if( p->pWinDefn ) n++;
219#endif
drh1c4505d2015-08-26 11:34:31 +0000220 }
drh55b4c822019-08-03 16:17:46 +0000221 if( p->pEList ){
222 sqlite3TreeViewExprList(pView, p->pEList, n>0, "result-set");
223 }
224 n--;
drha1fd4b52018-07-10 06:32:53 +0000225#ifndef SQLITE_OMIT_WINDOWFUNC
226 if( p->pWin ){
227 Window *pX;
drh2a7dcbf2022-04-06 15:41:53 +0000228 sqlite3TreeViewPush(&pView, (n--)>0);
drha1fd4b52018-07-10 06:32:53 +0000229 sqlite3TreeViewLine(pView, "window-functions");
230 for(pX=p->pWin; pX; pX=pX->pNextWin){
231 sqlite3TreeViewWinFunc(pView, pX, pX->pNextWin!=0);
232 }
drh2a7dcbf2022-04-06 15:41:53 +0000233 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000234 }
235#endif
drh1c4505d2015-08-26 11:34:31 +0000236 if( p->pSrc && p->pSrc->nSrc ){
drh2a7dcbf2022-04-06 15:41:53 +0000237 sqlite3TreeViewPush(&pView, (n--)>0);
drh1c4505d2015-08-26 11:34:31 +0000238 sqlite3TreeViewLine(pView, "FROM");
drh145d0a32018-11-08 22:53:06 +0000239 sqlite3TreeViewSrcList(pView, p->pSrc);
drh2a7dcbf2022-04-06 15:41:53 +0000240 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000241 }
drh1c4505d2015-08-26 11:34:31 +0000242 if( p->pWhere ){
243 sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
244 sqlite3TreeViewExpr(pView, p->pWhere, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000245 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000246 }
drh1c4505d2015-08-26 11:34:31 +0000247 if( p->pGroupBy ){
248 sqlite3TreeViewExprList(pView, p->pGroupBy, (n--)>0, "GROUPBY");
249 }
250 if( p->pHaving ){
251 sqlite3TreeViewItem(pView, "HAVING", (n--)>0);
252 sqlite3TreeViewExpr(pView, p->pHaving, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000253 sqlite3TreeViewPop(&pView);
drh1c4505d2015-08-26 11:34:31 +0000254 }
drha1fd4b52018-07-10 06:32:53 +0000255#ifndef SQLITE_OMIT_WINDOWFUNC
256 if( p->pWinDefn ){
257 Window *pX;
258 sqlite3TreeViewItem(pView, "WINDOW", (n--)>0);
259 for(pX=p->pWinDefn; pX; pX=pX->pNextWin){
260 sqlite3TreeViewWindow(pView, pX, pX->pNextWin!=0);
261 }
drh2a7dcbf2022-04-06 15:41:53 +0000262 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000263 }
264#endif
drh1c4505d2015-08-26 11:34:31 +0000265 if( p->pOrderBy ){
266 sqlite3TreeViewExprList(pView, p->pOrderBy, (n--)>0, "ORDERBY");
267 }
268 if( p->pLimit ){
269 sqlite3TreeViewItem(pView, "LIMIT", (n--)>0);
drh8c0833f2017-11-14 23:48:23 +0000270 sqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0);
271 if( p->pLimit->pRight ){
272 sqlite3TreeViewItem(pView, "OFFSET", (n--)>0);
273 sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000274 sqlite3TreeViewPop(&pView);
drh8c0833f2017-11-14 23:48:23 +0000275 }
drh2a7dcbf2022-04-06 15:41:53 +0000276 sqlite3TreeViewPop(&pView);
drh1c4505d2015-08-26 11:34:31 +0000277 }
278 if( p->pPrior ){
279 const char *zOp = "UNION";
280 switch( p->op ){
281 case TK_ALL: zOp = "UNION ALL"; break;
282 case TK_INTERSECT: zOp = "INTERSECT"; break;
283 case TK_EXCEPT: zOp = "EXCEPT"; break;
284 }
285 sqlite3TreeViewItem(pView, zOp, 1);
286 }
287 p = p->pPrior;
288 }while( p!=0 );
drh2a7dcbf2022-04-06 15:41:53 +0000289 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000290}
291
drha1fd4b52018-07-10 06:32:53 +0000292#ifndef SQLITE_OMIT_WINDOWFUNC
293/*
294** Generate a description of starting or stopping bounds
295*/
296void sqlite3TreeViewBound(
297 TreeView *pView, /* View context */
298 u8 eBound, /* UNBOUNDED, CURRENT, PRECEDING, FOLLOWING */
299 Expr *pExpr, /* Value for PRECEDING or FOLLOWING */
300 u8 moreToFollow /* True if more to follow */
301){
302 switch( eBound ){
303 case TK_UNBOUNDED: {
304 sqlite3TreeViewItem(pView, "UNBOUNDED", moreToFollow);
drh2a7dcbf2022-04-06 15:41:53 +0000305 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000306 break;
307 }
308 case TK_CURRENT: {
309 sqlite3TreeViewItem(pView, "CURRENT", moreToFollow);
drh2a7dcbf2022-04-06 15:41:53 +0000310 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000311 break;
312 }
313 case TK_PRECEDING: {
314 sqlite3TreeViewItem(pView, "PRECEDING", moreToFollow);
315 sqlite3TreeViewExpr(pView, pExpr, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000316 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000317 break;
318 }
319 case TK_FOLLOWING: {
320 sqlite3TreeViewItem(pView, "FOLLOWING", moreToFollow);
321 sqlite3TreeViewExpr(pView, pExpr, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000322 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000323 break;
324 }
325 }
326}
327#endif /* SQLITE_OMIT_WINDOWFUNC */
328
329#ifndef SQLITE_OMIT_WINDOWFUNC
330/*
331** Generate a human-readable explanation for a Window object
332*/
333void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){
drhfc15f4c2019-03-28 13:03:41 +0000334 int nElement = 0;
drh0dc0e9c2019-03-28 13:35:28 +0000335 if( pWin->pFilter ){
336 sqlite3TreeViewItem(pView, "FILTER", 1);
337 sqlite3TreeViewExpr(pView, pWin->pFilter, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000338 sqlite3TreeViewPop(&pView);
drh0dc0e9c2019-03-28 13:35:28 +0000339 }
drh2a7dcbf2022-04-06 15:41:53 +0000340 sqlite3TreeViewPush(&pView, more);
drha1fd4b52018-07-10 06:32:53 +0000341 if( pWin->zName ){
drh6f1644c2019-03-28 13:53:12 +0000342 sqlite3TreeViewLine(pView, "OVER %s (%p)", pWin->zName, pWin);
drha1fd4b52018-07-10 06:32:53 +0000343 }else{
drh6f1644c2019-03-28 13:53:12 +0000344 sqlite3TreeViewLine(pView, "OVER (%p)", pWin);
drha1fd4b52018-07-10 06:32:53 +0000345 }
drhfc15f4c2019-03-28 13:03:41 +0000346 if( pWin->zBase ) nElement++;
347 if( pWin->pOrderBy ) nElement++;
348 if( pWin->eFrmType ) nElement++;
349 if( pWin->eExclude ) nElement++;
drhfc15f4c2019-03-28 13:03:41 +0000350 if( pWin->zBase ){
drh2a7dcbf2022-04-06 15:41:53 +0000351 sqlite3TreeViewPush(&pView, (--nElement)>0);
drhfc15f4c2019-03-28 13:03:41 +0000352 sqlite3TreeViewLine(pView, "window: %s", pWin->zBase);
drh2a7dcbf2022-04-06 15:41:53 +0000353 sqlite3TreeViewPop(&pView);
drhfc15f4c2019-03-28 13:03:41 +0000354 }
drha1fd4b52018-07-10 06:32:53 +0000355 if( pWin->pPartition ){
drhfc15f4c2019-03-28 13:03:41 +0000356 sqlite3TreeViewExprList(pView, pWin->pPartition, nElement>0,"PARTITION-BY");
drha1fd4b52018-07-10 06:32:53 +0000357 }
358 if( pWin->pOrderBy ){
drhfc15f4c2019-03-28 13:03:41 +0000359 sqlite3TreeViewExprList(pView, pWin->pOrderBy, (--nElement)>0, "ORDER-BY");
drha1fd4b52018-07-10 06:32:53 +0000360 }
drhfc15f4c2019-03-28 13:03:41 +0000361 if( pWin->eFrmType ){
drh0dc0e9c2019-03-28 13:35:28 +0000362 char zBuf[30];
drhfc15f4c2019-03-28 13:03:41 +0000363 const char *zFrmType = "ROWS";
364 if( pWin->eFrmType==TK_RANGE ) zFrmType = "RANGE";
365 if( pWin->eFrmType==TK_GROUPS ) zFrmType = "GROUPS";
drh0dc0e9c2019-03-28 13:35:28 +0000366 sqlite3_snprintf(sizeof(zBuf),zBuf,"%s%s",zFrmType,
367 pWin->bImplicitFrame ? " (implied)" : "");
368 sqlite3TreeViewItem(pView, zBuf, (--nElement)>0);
drha1fd4b52018-07-10 06:32:53 +0000369 sqlite3TreeViewBound(pView, pWin->eStart, pWin->pStart, 1);
370 sqlite3TreeViewBound(pView, pWin->eEnd, pWin->pEnd, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000371 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000372 }
drhfc15f4c2019-03-28 13:03:41 +0000373 if( pWin->eExclude ){
374 char zBuf[30];
375 const char *zExclude;
376 switch( pWin->eExclude ){
377 case TK_NO: zExclude = "NO OTHERS"; break;
378 case TK_CURRENT: zExclude = "CURRENT ROW"; break;
379 case TK_GROUP: zExclude = "GROUP"; break;
380 case TK_TIES: zExclude = "TIES"; break;
381 default:
382 sqlite3_snprintf(sizeof(zBuf),zBuf,"invalid(%d)", pWin->eExclude);
383 zExclude = zBuf;
384 break;
385 }
drh2a7dcbf2022-04-06 15:41:53 +0000386 sqlite3TreeViewPush(&pView, 0);
drhfc15f4c2019-03-28 13:03:41 +0000387 sqlite3TreeViewLine(pView, "EXCLUDE %s", zExclude);
drh2a7dcbf2022-04-06 15:41:53 +0000388 sqlite3TreeViewPop(&pView);
drhfc15f4c2019-03-28 13:03:41 +0000389 }
drh2a7dcbf2022-04-06 15:41:53 +0000390 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000391}
392#endif /* SQLITE_OMIT_WINDOWFUNC */
393
394#ifndef SQLITE_OMIT_WINDOWFUNC
395/*
396** Generate a human-readable explanation for a Window Function object
397*/
398void sqlite3TreeViewWinFunc(TreeView *pView, const Window *pWin, u8 more){
drh2a7dcbf2022-04-06 15:41:53 +0000399 sqlite3TreeViewPush(&pView, more);
drha1fd4b52018-07-10 06:32:53 +0000400 sqlite3TreeViewLine(pView, "WINFUNC %s(%d)",
drh105dcaa2022-03-10 16:01:14 +0000401 pWin->pWFunc->zName, pWin->pWFunc->nArg);
drha1fd4b52018-07-10 06:32:53 +0000402 sqlite3TreeViewWindow(pView, pWin, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000403 sqlite3TreeViewPop(&pView);
drha1fd4b52018-07-10 06:32:53 +0000404}
405#endif /* SQLITE_OMIT_WINDOWFUNC */
406
drh38b41492015-06-08 15:08:15 +0000407/*
408** Generate a human-readable explanation of an expression tree.
409*/
410void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
411 const char *zBinOp = 0; /* Binary operator */
412 const char *zUniOp = 0; /* Unary operator */
drhe7375bf2020-03-10 19:24:38 +0000413 char zFlgs[200];
drh2a7dcbf2022-04-06 15:41:53 +0000414 sqlite3TreeViewPush(&pView, moreToFollow);
drh38b41492015-06-08 15:08:15 +0000415 if( pExpr==0 ){
416 sqlite3TreeViewLine(pView, "nil");
drh2a7dcbf2022-04-06 15:41:53 +0000417 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000418 return;
419 }
drhe7375bf2020-03-10 19:24:38 +0000420 if( pExpr->flags || pExpr->affExpr || pExpr->vvaFlags ){
drhb7e51992020-01-08 14:39:57 +0000421 StrAccum x;
422 sqlite3StrAccumInit(&x, 0, zFlgs, sizeof(zFlgs), 0);
423 sqlite3_str_appendf(&x, " fg.af=%x.%c",
424 pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n');
drhd97cda42017-04-14 14:02:14 +0000425 if( ExprHasProperty(pExpr, EP_FromJoin) ){
drhd1985262022-04-11 11:25:28 +0000426 sqlite3_str_appendf(&x, " iJoin=%d", pExpr->w.iJoin);
drhd97cda42017-04-14 14:02:14 +0000427 }
drhb7e51992020-01-08 14:39:57 +0000428 if( ExprHasProperty(pExpr, EP_FromDDL) ){
429 sqlite3_str_appendf(&x, " DDL");
430 }
drhe7375bf2020-03-10 19:24:38 +0000431 if( ExprHasVVAProperty(pExpr, EP_Immutable) ){
432 sqlite3_str_appendf(&x, " IMMUTABLE");
433 }
drhb7e51992020-01-08 14:39:57 +0000434 sqlite3StrAccumFinish(&x);
drhb3d903e2015-06-18 14:09:13 +0000435 }else{
436 zFlgs[0] = 0;
437 }
drh38b41492015-06-08 15:08:15 +0000438 switch( pExpr->op ){
439 case TK_AGG_COLUMN: {
drhb3d903e2015-06-18 14:09:13 +0000440 sqlite3TreeViewLine(pView, "AGG{%d:%d}%s",
441 pExpr->iTable, pExpr->iColumn, zFlgs);
drh38b41492015-06-08 15:08:15 +0000442 break;
443 }
444 case TK_COLUMN: {
445 if( pExpr->iTable<0 ){
446 /* This only happens when coding check constraints */
drhd4933532019-10-31 12:30:38 +0000447 char zOp2[16];
448 if( pExpr->op2 ){
449 sqlite3_snprintf(sizeof(zOp2),zOp2," op2=0x%02x",pExpr->op2);
450 }else{
451 zOp2[0] = 0;
452 }
453 sqlite3TreeViewLine(pView, "COLUMN(%d)%s%s",
454 pExpr->iColumn, zFlgs, zOp2);
drh38b41492015-06-08 15:08:15 +0000455 }else{
drh477572b2021-10-07 20:46:29 +0000456 assert( ExprUseYTab(pExpr) );
drha513e592019-12-20 20:08:56 +0000457 sqlite3TreeViewLine(pView, "{%d:%d} pTab=%p%s",
458 pExpr->iTable, pExpr->iColumn,
459 pExpr->y.pTab, zFlgs);
drh38b41492015-06-08 15:08:15 +0000460 }
drhefad2e22018-07-27 16:57:11 +0000461 if( ExprHasProperty(pExpr, EP_FixedCol) ){
462 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
463 }
drh38b41492015-06-08 15:08:15 +0000464 break;
465 }
466 case TK_INTEGER: {
467 if( pExpr->flags & EP_IntValue ){
468 sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue);
469 }else{
470 sqlite3TreeViewLine(pView, "%s", pExpr->u.zToken);
471 }
472 break;
473 }
474#ifndef SQLITE_OMIT_FLOATING_POINT
475 case TK_FLOAT: {
drhf9751072021-10-07 13:40:29 +0000476 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000477 sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken);
478 break;
479 }
480#endif
481 case TK_STRING: {
drhf9751072021-10-07 13:40:29 +0000482 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000483 sqlite3TreeViewLine(pView,"%Q", pExpr->u.zToken);
484 break;
485 }
486 case TK_NULL: {
487 sqlite3TreeViewLine(pView,"NULL");
488 break;
489 }
drh34328212018-02-26 19:03:25 +0000490 case TK_TRUEFALSE: {
drh348e0022021-07-22 16:07:01 +0000491 sqlite3TreeViewLine(pView,"%s%s",
492 sqlite3ExprTruthValue(pExpr) ? "TRUE" : "FALSE", zFlgs);
drh34328212018-02-26 19:03:25 +0000493 break;
494 }
drh38b41492015-06-08 15:08:15 +0000495#ifndef SQLITE_OMIT_BLOB_LITERAL
496 case TK_BLOB: {
drhf9751072021-10-07 13:40:29 +0000497 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000498 sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken);
499 break;
500 }
501#endif
502 case TK_VARIABLE: {
drhf9751072021-10-07 13:40:29 +0000503 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000504 sqlite3TreeViewLine(pView,"VARIABLE(%s,%d)",
505 pExpr->u.zToken, pExpr->iColumn);
506 break;
507 }
508 case TK_REGISTER: {
509 sqlite3TreeViewLine(pView,"REGISTER(%d)", pExpr->iTable);
510 break;
511 }
drh38b41492015-06-08 15:08:15 +0000512 case TK_ID: {
drhf9751072021-10-07 13:40:29 +0000513 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000514 sqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken);
515 break;
516 }
517#ifndef SQLITE_OMIT_CAST
518 case TK_CAST: {
519 /* Expressions of the form: CAST(pLeft AS token) */
drhf9751072021-10-07 13:40:29 +0000520 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000521 sqlite3TreeViewLine(pView,"CAST %Q", pExpr->u.zToken);
522 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
523 break;
524 }
525#endif /* SQLITE_OMIT_CAST */
526 case TK_LT: zBinOp = "LT"; break;
527 case TK_LE: zBinOp = "LE"; break;
528 case TK_GT: zBinOp = "GT"; break;
529 case TK_GE: zBinOp = "GE"; break;
530 case TK_NE: zBinOp = "NE"; break;
531 case TK_EQ: zBinOp = "EQ"; break;
532 case TK_IS: zBinOp = "IS"; break;
533 case TK_ISNOT: zBinOp = "ISNOT"; break;
534 case TK_AND: zBinOp = "AND"; break;
535 case TK_OR: zBinOp = "OR"; break;
536 case TK_PLUS: zBinOp = "ADD"; break;
537 case TK_STAR: zBinOp = "MUL"; break;
538 case TK_MINUS: zBinOp = "SUB"; break;
539 case TK_REM: zBinOp = "REM"; break;
540 case TK_BITAND: zBinOp = "BITAND"; break;
541 case TK_BITOR: zBinOp = "BITOR"; break;
542 case TK_SLASH: zBinOp = "DIV"; break;
543 case TK_LSHIFT: zBinOp = "LSHIFT"; break;
544 case TK_RSHIFT: zBinOp = "RSHIFT"; break;
545 case TK_CONCAT: zBinOp = "CONCAT"; break;
546 case TK_DOT: zBinOp = "DOT"; break;
drhe7375bf2020-03-10 19:24:38 +0000547 case TK_LIMIT: zBinOp = "LIMIT"; break;
drh38b41492015-06-08 15:08:15 +0000548
549 case TK_UMINUS: zUniOp = "UMINUS"; break;
550 case TK_UPLUS: zUniOp = "UPLUS"; break;
551 case TK_BITNOT: zUniOp = "BITNOT"; break;
552 case TK_NOT: zUniOp = "NOT"; break;
553 case TK_ISNULL: zUniOp = "ISNULL"; break;
554 case TK_NOTNULL: zUniOp = "NOTNULL"; break;
555
drh34328212018-02-26 19:03:25 +0000556 case TK_TRUTH: {
drh43c4ac82018-02-26 21:26:27 +0000557 int x;
558 const char *azOp[] = {
559 "IS-FALSE", "IS-TRUE", "IS-NOT-FALSE", "IS-NOT-TRUE"
560 };
drh34328212018-02-26 19:03:25 +0000561 assert( pExpr->op2==TK_IS || pExpr->op2==TK_ISNOT );
562 assert( pExpr->pRight );
dan6ece3532019-06-12 13:49:32 +0000563 assert( sqlite3ExprSkipCollate(pExpr->pRight)->op==TK_TRUEFALSE );
drh96acafb2018-02-27 14:49:25 +0000564 x = (pExpr->op2==TK_ISNOT)*2 + sqlite3ExprTruthValue(pExpr->pRight);
drh43c4ac82018-02-26 21:26:27 +0000565 zUniOp = azOp[x];
drh34328212018-02-26 19:03:25 +0000566 break;
567 }
568
drh94fa9c42016-02-27 21:16:04 +0000569 case TK_SPAN: {
drhf9751072021-10-07 13:40:29 +0000570 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh94fa9c42016-02-27 21:16:04 +0000571 sqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken);
572 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
573 break;
574 }
575
drh38b41492015-06-08 15:08:15 +0000576 case TK_COLLATE: {
drhc204d812019-09-10 17:51:27 +0000577 /* COLLATE operators without the EP_Collate flag are intended to
drh018dbb12019-09-28 16:14:55 +0000578 ** emulate collation associated with a table column. These show
579 ** up in the treeview output as "SOFT-COLLATE". Explicit COLLATE
580 ** operators that appear in the original SQL always have the
581 ** EP_Collate bit set and appear in treeview output as just "COLLATE" */
drhf9751072021-10-07 13:40:29 +0000582 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drhc204d812019-09-10 17:51:27 +0000583 sqlite3TreeViewLine(pView, "%sCOLLATE %Q%s",
584 !ExprHasProperty(pExpr, EP_Collate) ? "SOFT-" : "",
585 pExpr->u.zToken, zFlgs);
drh38b41492015-06-08 15:08:15 +0000586 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
587 break;
588 }
589
590 case TK_AGG_FUNCTION:
591 case TK_FUNCTION: {
592 ExprList *pFarg; /* List of function arguments */
drha1fd4b52018-07-10 06:32:53 +0000593 Window *pWin;
drh38b41492015-06-08 15:08:15 +0000594 if( ExprHasProperty(pExpr, EP_TokenOnly) ){
595 pFarg = 0;
drha1fd4b52018-07-10 06:32:53 +0000596 pWin = 0;
drh38b41492015-06-08 15:08:15 +0000597 }else{
drha4eeccd2021-10-07 17:43:30 +0000598 assert( ExprUseXList(pExpr) );
drh38b41492015-06-08 15:08:15 +0000599 pFarg = pExpr->x.pList;
drha1fd4b52018-07-10 06:32:53 +0000600#ifndef SQLITE_OMIT_WINDOWFUNC
drh014fff22020-01-08 22:22:36 +0000601 pWin = ExprHasProperty(pExpr, EP_WinFunc) ? pExpr->y.pWin : 0;
drha1fd4b52018-07-10 06:32:53 +0000602#else
603 pWin = 0;
604#endif
drh38b41492015-06-08 15:08:15 +0000605 }
drhf9751072021-10-07 13:40:29 +0000606 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000607 if( pExpr->op==TK_AGG_FUNCTION ){
drhe26d4282020-06-09 11:59:15 +0000608 sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s agg=%d[%d]/%p",
drhca74fbf2020-05-24 02:05:04 +0000609 pExpr->op2, pExpr->u.zToken, zFlgs,
drhe26d4282020-06-09 11:59:15 +0000610 pExpr->pAggInfo ? pExpr->pAggInfo->selId : 0,
drhca74fbf2020-05-24 02:05:04 +0000611 pExpr->iAgg, pExpr->pAggInfo);
drhd4933532019-10-31 12:30:38 +0000612 }else if( pExpr->op2!=0 ){
613 const char *zOp2;
614 char zBuf[8];
615 sqlite3_snprintf(sizeof(zBuf),zBuf,"0x%02x",pExpr->op2);
616 zOp2 = zBuf;
617 if( pExpr->op2==NC_IsCheck ) zOp2 = "NC_IsCheck";
618 if( pExpr->op2==NC_IdxExpr ) zOp2 = "NC_IdxExpr";
619 if( pExpr->op2==NC_PartIdx ) zOp2 = "NC_PartIdx";
620 if( pExpr->op2==NC_GenCol ) zOp2 = "NC_GenCol";
621 sqlite3TreeViewLine(pView, "FUNCTION %Q%s op2=%s",
622 pExpr->u.zToken, zFlgs, zOp2);
drh38b41492015-06-08 15:08:15 +0000623 }else{
drh42d2fce2019-08-15 20:04:09 +0000624 sqlite3TreeViewLine(pView, "FUNCTION %Q%s", pExpr->u.zToken, zFlgs);
drh38b41492015-06-08 15:08:15 +0000625 }
626 if( pFarg ){
drha1fd4b52018-07-10 06:32:53 +0000627 sqlite3TreeViewExprList(pView, pFarg, pWin!=0, 0);
drh38b41492015-06-08 15:08:15 +0000628 }
mistachkin14897852018-07-23 18:53:49 +0000629#ifndef SQLITE_OMIT_WINDOWFUNC
drha1fd4b52018-07-10 06:32:53 +0000630 if( pWin ){
631 sqlite3TreeViewWindow(pView, pWin, 0);
632 }
633#endif
drh38b41492015-06-08 15:08:15 +0000634 break;
635 }
636#ifndef SQLITE_OMIT_SUBQUERY
637 case TK_EXISTS: {
drha4eeccd2021-10-07 17:43:30 +0000638 assert( ExprUseXSelect(pExpr) );
drh9f6e14c2017-07-10 13:24:58 +0000639 sqlite3TreeViewLine(pView, "EXISTS-expr flags=0x%x", pExpr->flags);
drh38b41492015-06-08 15:08:15 +0000640 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
641 break;
642 }
643 case TK_SELECT: {
drha4eeccd2021-10-07 17:43:30 +0000644 assert( ExprUseXSelect(pExpr) );
drha0365c42020-06-05 04:01:50 +0000645 sqlite3TreeViewLine(pView, "subquery-expr flags=0x%x", pExpr->flags);
drh38b41492015-06-08 15:08:15 +0000646 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
647 break;
648 }
649 case TK_IN: {
drh9f6e14c2017-07-10 13:24:58 +0000650 sqlite3TreeViewLine(pView, "IN flags=0x%x", pExpr->flags);
drh38b41492015-06-08 15:08:15 +0000651 sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
drha4eeccd2021-10-07 17:43:30 +0000652 if( ExprUseXSelect(pExpr) ){
drh38b41492015-06-08 15:08:15 +0000653 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
654 }else{
655 sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
656 }
657 break;
658 }
659#endif /* SQLITE_OMIT_SUBQUERY */
660
661 /*
662 ** x BETWEEN y AND z
663 **
664 ** This is equivalent to
665 **
666 ** x>=y AND x<=z
667 **
668 ** X is stored in pExpr->pLeft.
669 ** Y is stored in pExpr->pList->a[0].pExpr.
670 ** Z is stored in pExpr->pList->a[1].pExpr.
671 */
672 case TK_BETWEEN: {
drha4eeccd2021-10-07 17:43:30 +0000673 const Expr *pX, *pY, *pZ;
674 pX = pExpr->pLeft;
675 assert( ExprUseXList(pExpr) );
676 assert( pExpr->x.pList->nExpr==2 );
677 pY = pExpr->x.pList->a[0].pExpr;
678 pZ = pExpr->x.pList->a[1].pExpr;
drh38b41492015-06-08 15:08:15 +0000679 sqlite3TreeViewLine(pView, "BETWEEN");
680 sqlite3TreeViewExpr(pView, pX, 1);
681 sqlite3TreeViewExpr(pView, pY, 1);
682 sqlite3TreeViewExpr(pView, pZ, 0);
683 break;
684 }
685 case TK_TRIGGER: {
686 /* If the opcode is TK_TRIGGER, then the expression is a reference
687 ** to a column in the new.* or old.* pseudo-tables available to
688 ** trigger programs. In this case Expr.iTable is set to 1 for the
689 ** new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn
690 ** is set to the column of the pseudo-table to read, or to -1 to
691 ** read the rowid field.
692 */
693 sqlite3TreeViewLine(pView, "%s(%d)",
694 pExpr->iTable ? "NEW" : "OLD", pExpr->iColumn);
695 break;
696 }
697 case TK_CASE: {
698 sqlite3TreeViewLine(pView, "CASE");
699 sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
drha4eeccd2021-10-07 17:43:30 +0000700 assert( ExprUseXList(pExpr) );
drh38b41492015-06-08 15:08:15 +0000701 sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
702 break;
703 }
704#ifndef SQLITE_OMIT_TRIGGER
705 case TK_RAISE: {
706 const char *zType = "unk";
drh11949042019-08-05 18:01:42 +0000707 switch( pExpr->affExpr ){
drh38b41492015-06-08 15:08:15 +0000708 case OE_Rollback: zType = "rollback"; break;
709 case OE_Abort: zType = "abort"; break;
710 case OE_Fail: zType = "fail"; break;
711 case OE_Ignore: zType = "ignore"; break;
712 }
drhf9751072021-10-07 13:40:29 +0000713 assert( !ExprHasProperty(pExpr, EP_IntValue) );
drh38b41492015-06-08 15:08:15 +0000714 sqlite3TreeViewLine(pView, "RAISE %s(%Q)", zType, pExpr->u.zToken);
715 break;
716 }
717#endif
drhc84a4022016-05-27 12:30:20 +0000718 case TK_MATCH: {
719 sqlite3TreeViewLine(pView, "MATCH {%d:%d}%s",
720 pExpr->iTable, pExpr->iColumn, zFlgs);
721 sqlite3TreeViewExpr(pView, pExpr->pRight, 0);
722 break;
723 }
drhdb97e562016-08-18 17:55:57 +0000724 case TK_VECTOR: {
drh269d3222019-10-23 18:09:39 +0000725 char *z = sqlite3_mprintf("VECTOR%s",zFlgs);
drha4eeccd2021-10-07 17:43:30 +0000726 assert( ExprUseXList(pExpr) );
drh269d3222019-10-23 18:09:39 +0000727 sqlite3TreeViewBareExprList(pView, pExpr->x.pList, z);
728 sqlite3_free(z);
drhdb97e562016-08-18 17:55:57 +0000729 break;
730 }
drh48cb3a72016-08-18 18:09:10 +0000731 case TK_SELECT_COLUMN: {
drhe46292a2021-07-05 02:40:29 +0000732 sqlite3TreeViewLine(pView, "SELECT-COLUMN %d of [0..%d]%s",
733 pExpr->iColumn, pExpr->iTable-1,
734 pExpr->pRight==pExpr->pLeft ? " (SELECT-owner)" : "");
drha4eeccd2021-10-07 17:43:30 +0000735 assert( ExprUseXSelect(pExpr->pLeft) );
drh48cb3a72016-08-18 18:09:10 +0000736 sqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0);
737 break;
738 }
drh31d6fd52017-04-14 19:03:10 +0000739 case TK_IF_NULL_ROW: {
740 sqlite3TreeViewLine(pView, "IF-NULL-ROW %d", pExpr->iTable);
741 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
742 break;
743 }
drhbf7f3a02021-05-24 11:35:16 +0000744 case TK_ERROR: {
745 Expr tmp;
746 sqlite3TreeViewLine(pView, "ERROR");
747 tmp = *pExpr;
748 tmp.op = pExpr->op2;
749 sqlite3TreeViewExpr(pView, &tmp, 0);
750 break;
751 }
drh4a4e02b2021-07-04 22:33:08 +0000752 case TK_ROW: {
753 if( pExpr->iColumn<=0 ){
754 sqlite3TreeViewLine(pView, "First FROM table rowid");
755 }else{
756 sqlite3TreeViewLine(pView, "First FROM table column %d",
757 pExpr->iColumn-1);
758 }
759 break;
760 }
drh38b41492015-06-08 15:08:15 +0000761 default: {
762 sqlite3TreeViewLine(pView, "op=%d", pExpr->op);
763 break;
764 }
765 }
766 if( zBinOp ){
drhb3d903e2015-06-18 14:09:13 +0000767 sqlite3TreeViewLine(pView, "%s%s", zBinOp, zFlgs);
drh38b41492015-06-08 15:08:15 +0000768 sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
769 sqlite3TreeViewExpr(pView, pExpr->pRight, 0);
770 }else if( zUniOp ){
drhb3d903e2015-06-18 14:09:13 +0000771 sqlite3TreeViewLine(pView, "%s%s", zUniOp, zFlgs);
drh11949042019-08-05 18:01:42 +0000772 sqlite3TreeViewExpr(pView, pExpr->pLeft, 0);
drh38b41492015-06-08 15:08:15 +0000773 }
drh2a7dcbf2022-04-06 15:41:53 +0000774 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000775}
776
drhdb97e562016-08-18 17:55:57 +0000777
drh38b41492015-06-08 15:08:15 +0000778/*
779** Generate a human-readable explanation of an expression list.
780*/
drhdb97e562016-08-18 17:55:57 +0000781void sqlite3TreeViewBareExprList(
drh38b41492015-06-08 15:08:15 +0000782 TreeView *pView,
783 const ExprList *pList,
drh38b41492015-06-08 15:08:15 +0000784 const char *zLabel
785){
drh38b41492015-06-08 15:08:15 +0000786 if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST";
787 if( pList==0 ){
788 sqlite3TreeViewLine(pView, "%s (empty)", zLabel);
789 }else{
drhdb97e562016-08-18 17:55:57 +0000790 int i;
drh38b41492015-06-08 15:08:15 +0000791 sqlite3TreeViewLine(pView, "%s", zLabel);
792 for(i=0; i<pList->nExpr; i++){
drh5579d592015-08-26 14:01:41 +0000793 int j = pList->a[i].u.x.iOrderByCol;
drh41cee662019-12-12 20:22:34 +0000794 char *zName = pList->a[i].zEName;
drhfbe07532018-04-23 20:04:38 +0000795 int moreToFollow = i<pList->nExpr - 1;
drhe1f49b82020-01-03 00:28:14 +0000796 if( pList->a[i].eEName!=ENAME_NAME ) zName = 0;
drh5a699a02017-12-22 19:53:02 +0000797 if( j || zName ){
drh2a7dcbf2022-04-06 15:41:53 +0000798 sqlite3TreeViewPush(&pView, moreToFollow);
drhfbe07532018-04-23 20:04:38 +0000799 moreToFollow = 0;
800 sqlite3TreeViewLine(pView, 0);
801 if( zName ){
802 fprintf(stdout, "AS %s ", zName);
803 }
804 if( j ){
805 fprintf(stdout, "iOrderByCol=%d", j);
806 }
807 fprintf(stdout, "\n");
808 fflush(stdout);
drh5a699a02017-12-22 19:53:02 +0000809 }
drhfbe07532018-04-23 20:04:38 +0000810 sqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow);
drh5a699a02017-12-22 19:53:02 +0000811 if( j || zName ){
drh2a7dcbf2022-04-06 15:41:53 +0000812 sqlite3TreeViewPop(&pView);
drh5a699a02017-12-22 19:53:02 +0000813 }
drh38b41492015-06-08 15:08:15 +0000814 }
815 }
drhdb97e562016-08-18 17:55:57 +0000816}
817void sqlite3TreeViewExprList(
818 TreeView *pView,
819 const ExprList *pList,
820 u8 moreToFollow,
821 const char *zLabel
822){
drh2a7dcbf2022-04-06 15:41:53 +0000823 sqlite3TreeViewPush(&pView, moreToFollow);
drhdb97e562016-08-18 17:55:57 +0000824 sqlite3TreeViewBareExprList(pView, pList, zLabel);
drh2a7dcbf2022-04-06 15:41:53 +0000825 sqlite3TreeViewPop(&pView);
drh38b41492015-06-08 15:08:15 +0000826}
827
drh7d2c1d22022-04-06 00:29:21 +0000828/*
829** Generate a human-readable explanation of an id-list.
830*/
831void sqlite3TreeViewBareIdList(
832 TreeView *pView,
833 const IdList *pList,
834 const char *zLabel
835){
836 if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST";
837 if( pList==0 ){
838 sqlite3TreeViewLine(pView, "%s (empty)", zLabel);
839 }else{
840 int i;
841 sqlite3TreeViewLine(pView, "%s", zLabel);
842 for(i=0; i<pList->nId; i++){
843 char *zName = pList->a[i].zName;
844 int moreToFollow = i<pList->nId - 1;
845 if( zName==0 ) zName = "(null)";
drh2a7dcbf2022-04-06 15:41:53 +0000846 sqlite3TreeViewPush(&pView, moreToFollow);
drh7d2c1d22022-04-06 00:29:21 +0000847 sqlite3TreeViewLine(pView, 0);
848 fprintf(stdout, "%s (%d)\n", zName, pList->a[i].idx);
drh2a7dcbf2022-04-06 15:41:53 +0000849 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000850 }
851 }
852}
853void sqlite3TreeViewIdList(
854 TreeView *pView,
855 const IdList *pList,
856 u8 moreToFollow,
857 const char *zLabel
858){
drh2a7dcbf2022-04-06 15:41:53 +0000859 sqlite3TreeViewPush(&pView, moreToFollow);
drh7d2c1d22022-04-06 00:29:21 +0000860 sqlite3TreeViewBareIdList(pView, pList, zLabel);
drh2a7dcbf2022-04-06 15:41:53 +0000861 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000862}
863
864/*
865** Generate a human-readable explanation of a list of Upsert objects
866*/
867void sqlite3TreeViewUpsert(
868 TreeView *pView,
869 const Upsert *pUpsert,
870 u8 moreToFollow
871){
872 if( pUpsert==0 ) return;
drh2a7dcbf2022-04-06 15:41:53 +0000873 sqlite3TreeViewPush(&pView, moreToFollow);
drh7d2c1d22022-04-06 00:29:21 +0000874 while( pUpsert ){
875 int n;
drh2a7dcbf2022-04-06 15:41:53 +0000876 sqlite3TreeViewPush(&pView, pUpsert->pNextUpsert!=0 || moreToFollow);
drh7d2c1d22022-04-06 00:29:21 +0000877 sqlite3TreeViewLine(pView, "ON CONFLICT DO %s",
878 pUpsert->isDoUpdate ? "UPDATE" : "NOTHING");
879 n = (pUpsert->pUpsertSet!=0) + (pUpsert->pUpsertWhere!=0);
880 sqlite3TreeViewExprList(pView, pUpsert->pUpsertTarget, (n--)>0, "TARGET");
881 sqlite3TreeViewExprList(pView, pUpsert->pUpsertSet, (n--)>0, "SET");
882 if( pUpsert->pUpsertWhere ){
883 sqlite3TreeViewItem(pView, "WHERE", (n--)>0);
884 sqlite3TreeViewExpr(pView, pUpsert->pUpsertWhere, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000885 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000886 }
drh2a7dcbf2022-04-06 15:41:53 +0000887 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000888 pUpsert = pUpsert->pNextUpsert;
889 }
drh2a7dcbf2022-04-06 15:41:53 +0000890 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000891}
892
893/*
894** Generate a human-readable diagram of the data structure that go
drhf8ef2db2022-04-06 10:37:44 +0000895** into generating an DELETE statement.
896*/
897void sqlite3TreeViewDelete(
drhf8ef2db2022-04-06 10:37:44 +0000898 const With *pWith,
899 const SrcList *pTabList,
900 const Expr *pWhere,
901 const ExprList *pOrderBy,
drh2a7dcbf2022-04-06 15:41:53 +0000902 const Expr *pLimit,
903 const Trigger *pTrigger
drhf8ef2db2022-04-06 10:37:44 +0000904){
905 int n = 0;
drh2a7dcbf2022-04-06 15:41:53 +0000906 TreeView *pView = 0;
907 sqlite3TreeViewPush(&pView, 0);
drhf8ef2db2022-04-06 10:37:44 +0000908 sqlite3TreeViewLine(pView, "DELETE");
drhf8ef2db2022-04-06 10:37:44 +0000909 if( pWith ) n++;
910 if( pTabList ) n++;
911 if( pWhere ) n++;
912 if( pOrderBy ) n++;
913 if( pLimit ) n++;
drh2a7dcbf2022-04-06 15:41:53 +0000914 if( pTrigger ) n++;
drhf8ef2db2022-04-06 10:37:44 +0000915 if( pWith ){
drh2a7dcbf2022-04-06 15:41:53 +0000916 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +0000917 sqlite3TreeViewWith(pView, pWith, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000918 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +0000919 }
920 if( pTabList ){
drh2a7dcbf2022-04-06 15:41:53 +0000921 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +0000922 sqlite3TreeViewLine(pView, "FROM");
923 sqlite3TreeViewSrcList(pView, pTabList);
drh2a7dcbf2022-04-06 15:41:53 +0000924 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +0000925 }
926 if( pWhere ){
drh2a7dcbf2022-04-06 15:41:53 +0000927 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +0000928 sqlite3TreeViewLine(pView, "WHERE");
929 sqlite3TreeViewExpr(pView, pWhere, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000930 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +0000931 }
932 if( pOrderBy ){
933 sqlite3TreeViewExprList(pView, pOrderBy, (--n)>0, "ORDER-BY");
934 }
935 if( pLimit ){
drh2a7dcbf2022-04-06 15:41:53 +0000936 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +0000937 sqlite3TreeViewLine(pView, "LIMIT");
938 sqlite3TreeViewExpr(pView, pLimit, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000939 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +0000940 }
drh2a7dcbf2022-04-06 15:41:53 +0000941 if( pTrigger ){
942 sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
943 }
944 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +0000945}
946
947/*
948** Generate a human-readable diagram of the data structure that go
drh7d2c1d22022-04-06 00:29:21 +0000949** into generating an INSERT statement.
950*/
951void sqlite3TreeViewInsert(
drh7d2c1d22022-04-06 00:29:21 +0000952 const With *pWith,
953 const SrcList *pTabList,
954 const IdList *pColumnList,
955 const Select *pSelect,
drhc2d0df92022-04-06 18:30:17 +0000956 const ExprList *pExprList,
drh7d2c1d22022-04-06 00:29:21 +0000957 int onError,
drh2a7dcbf2022-04-06 15:41:53 +0000958 const Upsert *pUpsert,
959 const Trigger *pTrigger
drh7d2c1d22022-04-06 00:29:21 +0000960){
drh2a7dcbf2022-04-06 15:41:53 +0000961 TreeView *pView = 0;
drh7d2c1d22022-04-06 00:29:21 +0000962 int n = 0;
963 const char *zLabel = "INSERT";
964 switch( onError ){
965 case OE_Replace: zLabel = "REPLACE"; break;
966 case OE_Ignore: zLabel = "INSERT OR IGNORE"; break;
967 case OE_Rollback: zLabel = "INSERT OR ROLLBACK"; break;
968 case OE_Abort: zLabel = "INSERT OR ABORT"; break;
969 case OE_Fail: zLabel = "INSERT OR FAIL"; break;
970 }
drh2a7dcbf2022-04-06 15:41:53 +0000971 sqlite3TreeViewPush(&pView, 0);
drh7d2c1d22022-04-06 00:29:21 +0000972 sqlite3TreeViewLine(pView, zLabel);
drh7d2c1d22022-04-06 00:29:21 +0000973 if( pWith ) n++;
974 if( pTabList ) n++;
975 if( pColumnList ) n++;
976 if( pSelect ) n++;
drhc2d0df92022-04-06 18:30:17 +0000977 if( pExprList ) n++;
drh7d2c1d22022-04-06 00:29:21 +0000978 if( pUpsert ) n++;
drh2a7dcbf2022-04-06 15:41:53 +0000979 if( pTrigger ) n++;
drh7d2c1d22022-04-06 00:29:21 +0000980 if( pWith ){
drh2a7dcbf2022-04-06 15:41:53 +0000981 sqlite3TreeViewPush(&pView, (--n)>0);
drh7d2c1d22022-04-06 00:29:21 +0000982 sqlite3TreeViewWith(pView, pWith, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000983 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000984 }
985 if( pTabList ){
drh2a7dcbf2022-04-06 15:41:53 +0000986 sqlite3TreeViewPush(&pView, (--n)>0);
drh7d2c1d22022-04-06 00:29:21 +0000987 sqlite3TreeViewLine(pView, "INTO");
988 sqlite3TreeViewSrcList(pView, pTabList);
drh2a7dcbf2022-04-06 15:41:53 +0000989 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000990 }
991 if( pColumnList ){
992 sqlite3TreeViewIdList(pView, pColumnList, (--n)>0, "COLUMNS");
993 }
994 if( pSelect ){
drh2a7dcbf2022-04-06 15:41:53 +0000995 sqlite3TreeViewPush(&pView, (--n)>0);
drh7d2c1d22022-04-06 00:29:21 +0000996 sqlite3TreeViewLine(pView, "DATA-SOURCE");
997 sqlite3TreeViewSelect(pView, pSelect, 0);
drh2a7dcbf2022-04-06 15:41:53 +0000998 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +0000999 }
drhc2d0df92022-04-06 18:30:17 +00001000 if( pExprList ){
1001 sqlite3TreeViewExprList(pView, pExprList, (--n)>0, "VALUES");
1002 }
drh7d2c1d22022-04-06 00:29:21 +00001003 if( pUpsert ){
drh2a7dcbf2022-04-06 15:41:53 +00001004 sqlite3TreeViewPush(&pView, (--n)>0);
drh7d2c1d22022-04-06 00:29:21 +00001005 sqlite3TreeViewLine(pView, "UPSERT");
1006 sqlite3TreeViewUpsert(pView, pUpsert, 0);
drh2a7dcbf2022-04-06 15:41:53 +00001007 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +00001008 }
drh2a7dcbf2022-04-06 15:41:53 +00001009 if( pTrigger ){
1010 sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
1011 }
1012 sqlite3TreeViewPop(&pView);
drh7d2c1d22022-04-06 00:29:21 +00001013}
1014
drhf8ef2db2022-04-06 10:37:44 +00001015/*
1016** Generate a human-readable diagram of the data structure that go
1017** into generating an UPDATE statement.
1018*/
1019void sqlite3TreeViewUpdate(
drhf8ef2db2022-04-06 10:37:44 +00001020 const With *pWith,
1021 const SrcList *pTabList,
1022 const ExprList *pChanges,
1023 const Expr *pWhere,
1024 int onError,
1025 const ExprList *pOrderBy,
1026 const Expr *pLimit,
drh2a7dcbf2022-04-06 15:41:53 +00001027 const Upsert *pUpsert,
1028 const Trigger *pTrigger
drhf8ef2db2022-04-06 10:37:44 +00001029){
1030 int n = 0;
drh2a7dcbf2022-04-06 15:41:53 +00001031 TreeView *pView = 0;
drhf8ef2db2022-04-06 10:37:44 +00001032 const char *zLabel = "UPDATE";
1033 switch( onError ){
1034 case OE_Replace: zLabel = "UPDATE OR REPLACE"; break;
1035 case OE_Ignore: zLabel = "UPDATE OR IGNORE"; break;
1036 case OE_Rollback: zLabel = "UPDATE OR ROLLBACK"; break;
1037 case OE_Abort: zLabel = "UPDATE OR ABORT"; break;
1038 case OE_Fail: zLabel = "UPDATE OR FAIL"; break;
1039 }
drh2a7dcbf2022-04-06 15:41:53 +00001040 sqlite3TreeViewPush(&pView, 0);
drhf8ef2db2022-04-06 10:37:44 +00001041 sqlite3TreeViewLine(pView, zLabel);
drhf8ef2db2022-04-06 10:37:44 +00001042 if( pWith ) n++;
1043 if( pTabList ) n++;
1044 if( pChanges ) n++;
1045 if( pWhere ) n++;
1046 if( pOrderBy ) n++;
1047 if( pLimit ) n++;
1048 if( pUpsert ) n++;
drh2a7dcbf2022-04-06 15:41:53 +00001049 if( pTrigger ) n++;
drhf8ef2db2022-04-06 10:37:44 +00001050 if( pWith ){
drh2a7dcbf2022-04-06 15:41:53 +00001051 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +00001052 sqlite3TreeViewWith(pView, pWith, 0);
drh2a7dcbf2022-04-06 15:41:53 +00001053 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001054 }
1055 if( pTabList ){
drh2a7dcbf2022-04-06 15:41:53 +00001056 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +00001057 sqlite3TreeViewLine(pView, "FROM");
1058 sqlite3TreeViewSrcList(pView, pTabList);
drh2a7dcbf2022-04-06 15:41:53 +00001059 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001060 }
1061 if( pChanges ){
1062 sqlite3TreeViewExprList(pView, pChanges, (--n)>0, "SET");
1063 }
1064 if( pWhere ){
drh2a7dcbf2022-04-06 15:41:53 +00001065 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +00001066 sqlite3TreeViewLine(pView, "WHERE");
1067 sqlite3TreeViewExpr(pView, pWhere, 0);
drh2a7dcbf2022-04-06 15:41:53 +00001068 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001069 }
1070 if( pOrderBy ){
1071 sqlite3TreeViewExprList(pView, pOrderBy, (--n)>0, "ORDER-BY");
1072 }
1073 if( pLimit ){
drh2a7dcbf2022-04-06 15:41:53 +00001074 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +00001075 sqlite3TreeViewLine(pView, "LIMIT");
1076 sqlite3TreeViewExpr(pView, pLimit, 0);
drh2a7dcbf2022-04-06 15:41:53 +00001077 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001078 }
1079 if( pUpsert ){
drh2a7dcbf2022-04-06 15:41:53 +00001080 sqlite3TreeViewPush(&pView, (--n)>0);
drhf8ef2db2022-04-06 10:37:44 +00001081 sqlite3TreeViewLine(pView, "UPSERT");
1082 sqlite3TreeViewUpsert(pView, pUpsert, 0);
drh2a7dcbf2022-04-06 15:41:53 +00001083 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001084 }
drh2a7dcbf2022-04-06 15:41:53 +00001085 if( pTrigger ){
1086 sqlite3TreeViewTrigger(pView, pTrigger, (--n)>0, 1);
1087 }
1088 sqlite3TreeViewPop(&pView);
drhf8ef2db2022-04-06 10:37:44 +00001089}
1090
drh2a7dcbf2022-04-06 15:41:53 +00001091#ifndef SQLITE_OMIT_TRIGGER
1092/*
1093** Show a human-readable graph of a TriggerStep
1094*/
1095void sqlite3TreeViewTriggerStep(
1096 TreeView *pView,
1097 const TriggerStep *pStep,
1098 u8 moreToFollow,
1099 u8 showFullList
1100){
1101 int cnt = 0;
1102 if( pStep==0 ) return;
1103 sqlite3TreeViewPush(&pView,
1104 moreToFollow || (showFullList && pStep->pNext!=0));
1105 do{
1106 if( cnt++ && pStep->pNext==0 ){
1107 sqlite3TreeViewPop(&pView);
1108 sqlite3TreeViewPush(&pView, 0);
1109 }
1110 sqlite3TreeViewLine(pView, "%s", pStep->zSpan ? pStep->zSpan : "RETURNING");
1111 }while( showFullList && (pStep = pStep->pNext)!=0 );
1112 sqlite3TreeViewPop(&pView);
1113}
1114
1115/*
1116** Show a human-readable graph of a Trigger
1117*/
1118void sqlite3TreeViewTrigger(
1119 TreeView *pView,
1120 const Trigger *pTrigger,
1121 u8 moreToFollow,
1122 u8 showFullList
1123){
1124 int cnt = 0;
1125 if( pTrigger==0 ) return;
1126 sqlite3TreeViewPush(&pView,
1127 moreToFollow || (showFullList && pTrigger->pNext!=0));
1128 do{
1129 if( cnt++ && pTrigger->pNext==0 ){
1130 sqlite3TreeViewPop(&pView);
1131 sqlite3TreeViewPush(&pView, 0);
1132 }
1133 sqlite3TreeViewLine(pView, "TRIGGER %s", pTrigger->zName);
1134 sqlite3TreeViewPush(&pView, 0);
1135 sqlite3TreeViewTriggerStep(pView, pTrigger->step_list, 0, 1);
1136 sqlite3TreeViewPop(&pView);
1137 }while( showFullList && (pTrigger = pTrigger->pNext)!=0 );
1138 sqlite3TreeViewPop(&pView);
1139}
1140#endif /* SQLITE_OMIT_TRIGGER */
1141
1142
drh8f1eb6f2022-04-06 12:25:04 +00001143/*
1144** These simplified versions of the tree-view routines omit unnecessary
1145** parameters. These variants are intended to be used from a symbolic
1146** debugger, such as "gdb", during interactive debugging sessions.
1147**
1148** This routines are given external linkage so that they will always be
1149** accessible to the debugging, and to avoid warnings about unused
1150** functions. But these routines only exist in debugging builds, so they
1151** do not contaminate the interface.
1152*/
1153void sqlite3ShowExpr(const Expr *p){ sqlite3TreeViewExpr(0,p,0); }
1154void sqlite3ShowExprList(const ExprList *p){ sqlite3TreeViewExprList(0,p,0,0);}
1155void sqlite3ShowIdList(const IdList *p){ sqlite3TreeViewIdList(0,p,0,0); }
1156void sqlite3ShowSrcList(const SrcList *p){ sqlite3TreeViewSrcList(0,p); }
1157void sqlite3ShowSelect(const Select *p){ sqlite3TreeViewSelect(0,p,0); }
1158void sqlite3ShowWith(const With *p){ sqlite3TreeViewWith(0,p,0); }
1159void sqlite3ShowUpsert(const Upsert *p){ sqlite3TreeViewUpsert(0,p,0); }
drh2a7dcbf2022-04-06 15:41:53 +00001160#ifndef SQLITE_OMIT_TRIGGER
1161void sqlite3ShowTriggerStep(const TriggerStep *p){
1162 sqlite3TreeViewTriggerStep(0,p,0,0);
1163}
1164void sqlite3ShowTriggerStepList(const TriggerStep *p){
1165 sqlite3TreeViewTriggerStep(0,p,0,1);
1166}
1167void sqlite3ShowTrigger(const Trigger *p){ sqlite3TreeViewTrigger(0,p,0,0); }
1168void sqlite3ShowTriggerList(const Trigger *p){ sqlite3TreeViewTrigger(0,p,0,1);}
1169#endif
drh8f1eb6f2022-04-06 12:25:04 +00001170#ifndef SQLITE_OMIT_WINDOWFUNC
1171void sqlite3ShowWindow(const Window *p){ sqlite3TreeViewWindow(0,p,0); }
1172void sqlite3ShowWinFunc(const Window *p){ sqlite3TreeViewWinFunc(0,p,0); }
1173#endif
1174
drh38b41492015-06-08 15:08:15 +00001175#endif /* SQLITE_DEBUG */