line |
true |
false |
branch |
37
|
0 |
138 |
if( pNew==0 ){ |
45
|
0 |
138 |
if( pEList==0 ){ |
101
|
0 |
0 |
for(i=0; i<3 && apAll[i]; i++){ |
|
0 |
0 |
for(i=0; i<3 && apAll[i]; i++){ |
103
|
0 |
0 |
for(j=0; j
|
104
|
0 |
0 |
if( p->n==keywords[j].nChar |
105
|
0 |
0 |
&& sqliteStrNICmp(p->z, keywords[j].zKeyword, p->n)==0 ){ |
110
|
0 |
0 |
if( j>=sizeof(keywords)/sizeof(keywords[0]) ){ |
115
|
0 |
0 |
if( |
116
|
0 |
0 |
(jointype & (JT_INNER|JT_OUTER))==(JT_INNER|JT_OUTER) || |
121
|
0 |
0 |
if( pB==0 ){ pB = &dummy; zSp1 = 0; } |
122
|
0 |
0 |
if( pC==0 ){ pC = &dummy; zSp2 = 0; } |
127
|
0 |
0 |
}else if( jointype & JT_RIGHT ){ |
141
|
0 |
0 |
for(i=0; inCol; i++){ |
142
|
0 |
0 |
if( sqliteStrICmp(pTab->aCol[i].zName, zCol)==0 ) return i; |
177
|
0 |
0 |
if( *ppExpr ){ |
195
|
0 |
0 |
while( p ){ |
213
|
1 |
141 |
for(i=0; inSrc-1; i++){ |
217
|
1 |
0 |
if( pTerm->pTab==0 || pOther->pTab==0 ) continue; |
|
0 |
1 |
if( pTerm->pTab==0 || pOther->pTab==0 ) continue; |
222
|
0 |
1 |
if( pTerm->jointype & JT_NATURAL ){ |
224
|
0 |
0 |
if( pTerm->pOn || pTerm->pUsing ){ |
|
0 |
0 |
if( pTerm->pOn || pTerm->pUsing ){ |
230
|
0 |
0 |
for(j=0; jnCol; j++){ |
231
|
0 |
0 |
if( columnIndex(pOther->pTab, pTab->aCol[j].zName)>=0 ){ |
239
|
0 |
1 |
if( pTerm->pOn && pTerm->pUsing ){ |
|
0 |
0 |
if( pTerm->pOn && pTerm->pUsing ){ |
248
|
0 |
1 |
if( pTerm->pOn ){ |
250
|
0 |
0 |
if( p->pWhere==0 ){ |
265
|
0 |
1 |
if( pTerm->pUsing ){ |
270
|
0 |
0 |
for(j=0; jnId; j++){ |
288
|
1134 |
138 |
if( p==0 ) return; |
318
|
0 |
5 |
if( zSortOrder==0 ) return; |
319
|
11 |
5 |
for(i=0; inExpr; i++){ |
323
|
0 |
11 |
if( (order & SQLITE_SO_TYPEMASK)==SQLITE_SO_TEXT ){ |
325
|
0 |
11 |
}else if( (order & SQLITE_SO_TYPEMASK)==SQLITE_SO_NUM ){ |
327
|
11 |
0 |
}else if( pParse->db->file_format>=4 ){ |
332
|
10 |
1 |
if( (order & SQLITE_SO_DIRMASK)==SQLITE_SO_ASC ){ |
333
|
3 |
7 |
c = type==SQLITE_SO_TEXT ? 'A' : '+'; |
335
|
0 |
1 |
c = type==SQLITE_SO_TEXT ? 'D' : '-'; |
359
|
0 |
2 |
if( zType==0 ) return; |
360
|
2 |
2 |
for(i=0; i
|
361
|
2 |
0 |
zType[i] = sqliteExprType(pEList->a[i].pExpr)==SQLITE_SO_NUM ? 'n' : 't'; |
377
|
0 |
135 |
if( p->iOffset>=0 ){ |
379
|
0 |
0 |
if( nPop>0 ) addr++; |
381
|
0 |
0 |
if( nPop>0 ){ |
386
|
0 |
135 |
if( p->iLimit>=0 ){ |
417
|
0 |
135 |
if( v==0 ) return 0; |
423
|
0 |
135 |
hasDistinct = distinct>=0 && pEList && pEList->nExpr>0; |
|
0 |
0 |
hasDistinct = distinct>=0 && pEList && pEList->nExpr>0; |
|
0 |
0 |
hasDistinct = distinct>=0 && pEList && pEList->nExpr>0; |
424
|
130 |
5 |
if( pOrderBy==0 && !hasDistinct ){ |
|
130 |
0 |
if( pOrderBy==0 && !hasDistinct ){ |
430
|
0 |
135 |
if( nColumn>0 ){ |
431
|
0 |
0 |
for(i=0; i
|
436
|
431 |
135 |
for(i=0; inExpr; i++){ |
445
|
0 |
135 |
if( hasDistinct ){ |
450
|
0 |
0 |
if( pParse->db->file_format>=4 ) sqliteAddKeyType(v, pEList); |
456
|
0 |
0 |
if( pOrderBy==0 ){ |
477
|
0 |
12 |
if( pOrderBy ){ |
510
|
0 |
0 |
if( pOrderBy ){ |
526
|
0 |
0 |
if( pOrderBy ){ |
539
|
5 |
118 |
if( pOrderBy ){ |
553
|
0 |
0 |
if( pOrderBy ){ |
592
|
0 |
5 |
if( eDest==SRT_Sorter ) return; |
625
|
0 |
0 |
for(i=0; i
|
666
|
395 |
123 |
for(i=0; inExpr; i++){ |
669
|
0 |
395 |
if( p==0 ) continue; |
670
|
299 |
96 |
if( p->op==TK_COLUMN && pTabList ){ |
|
299 |
0 |
if( p->op==TK_COLUMN && pTabList ){ |
673
|
300 |
0 |
for(j=0; jnSrc && pTabList->a[j].iCursor!=p->iTable; j++){} |
|
1 |
299 |
for(j=0; jnSrc && pTabList->a[j].iCursor!=p->iTable; j++){} |
676
|
0 |
299 |
if( iCol<0 ) iCol = pTab->iPKey; |
678
|
0 |
299 |
if( iCol<0 ){ |
684
|
9 |
87 |
if( sqliteExprType(p)==SQLITE_SO_TEXT ){ |
710
|
123 |
0 |
if( pParse->colNamesSet || v==0 || sqlite_malloc_failed ) return; |
|
123 |
0 |
if( pParse->colNamesSet || v==0 || sqlite_malloc_failed ) return; |
|
0 |
123 |
if( pParse->colNamesSet || v==0 || sqlite_malloc_failed ) return; |
714
|
395 |
123 |
for(i=0; inExpr; i++){ |
718
|
0 |
395 |
if( p==0 ) continue; |
719
|
3 |
392 |
if( pEList->a[i].zName ){ |
724
|
306 |
86 |
if( p->op==TK_COLUMN && pTabList ){ |
|
306 |
0 |
if( p->op==TK_COLUMN && pTabList ){ |
728
|
306 |
0 |
for(j=0; jnSrc && pTabList->a[j].iCursor!=p->iTable; j++){} |
|
0 |
306 |
for(j=0; jnSrc && pTabList->a[j].iCursor!=p->iTable; j++){} |
731
|
0 |
306 |
if( iCol<0 ) iCol = pTab->iPKey; |
733
|
0 |
306 |
if( iCol<0 ){ |
738
|
306 |
0 |
if( !shortNames && !fullNames && p->span.z && p->span.z[0] ){ |
|
306 |
0 |
if( !shortNames && !fullNames && p->span.z && p->span.z[0] ){ |
|
306 |
0 |
if( !shortNames && !fullNames && p->span.z && p->span.z[0] ){ |
|
306 |
0 |
if( !shortNames && !fullNames && p->span.z && p->span.z[0] ){ |
741
|
0 |
0 |
}else if( fullNames || (!shortNames && pTabList->nSrc>1) ){ |
|
0 |
0 |
}else if( fullNames || (!shortNames && pTabList->nSrc>1) ){ |
|
0 |
0 |
}else if( fullNames || (!shortNames && pTabList->nSrc>1) ){ |
746
|
0 |
0 |
if( fullNames || zTab==0 ) zTab = pTab->zName; |
|
0 |
0 |
if( fullNames || zTab==0 ) zTab = pTab->zName; |
752
|
86 |
0 |
}else if( p->span.z && p->span.z[0] ){ |
|
86 |
0 |
}else if( p->span.z && p->span.z[0] ){ |
793
|
0 |
6 |
if( fillInColumnList(pParse, pSelect) ){ |
797
|
0 |
6 |
if( pTab==0 ){ |
800
|
6 |
0 |
pTab->zName = zTabName ? sqliteStrDup(zTabName) : 0; |
805
|
27 |
6 |
for(i=0; inCol; i++){ |
807
|
24 |
3 |
if( pEList->a[i].zName ){ |
809
|
0 |
3 |
}else if( (p=pEList->a[i].pExpr)->op==TK_DOT |
810
|
0 |
0 |
&& (pR=p->pRight)!=0 && pR->token.z && pR->token.z[0] ){ |
|
0 |
0 |
&& (pR=p->pRight)!=0 && pR->token.z && pR->token.z[0] ){ |
|
0 |
0 |
&& (pR=p->pRight)!=0 && pR->token.z && pR->token.z[0] ){ |
813
|
0 |
0 |
for(j=cnt=0; j
|
814
|
0 |
0 |
if( sqliteStrICmp(aCol[j].zName, aCol[i].zName)==0 ){ |
823
|
3 |
0 |
}else if( p->span.z && p->span.z[0] ){ |
|
3 |
0 |
}else if( p->span.z && p->span.z[0] ){ |
864
|
144 |
0 |
if( p==0 || p->pSrc==0 ) return 1; |
|
0 |
144 |
if( p==0 || p->pSrc==0 ) return 1; |
870
|
119 |
141 |
for(i=0; inSrc; i++){ |
871
|
3 |
116 |
if( pTabList->a[i].pTab ){ |
875
|
6 |
110 |
if( pTabList->a[i].zName==0 ){ |
878
|
6 |
0 |
if( pTabList->a[i].zAlias==0 ){ |
887
|
0 |
6 |
if( pTab==0 ){ |
899
|
0 |
110 |
if( pTab==0 ){ |
902
|
0 |
110 |
if( pTab->pSelect ){ |
904
|
0 |
0 |
if( sqliteViewGetColumnNames(pParse, pTab) ){ |
912
|
0 |
0 |
if( pTabList->a[i].pSelect==0 ){ |
921
|
0 |
141 |
if( sqliteProcessJoin(pParse, p) ) return 1; |
933
|
411 |
113 |
for(k=0; knExpr; k++){ |
935
|
27 |
384 |
if( pE->op==TK_ALL ) break; |
936
|
4 |
380 |
if( pE->op==TK_DOT && pE->pRight && pE->pRight->op==TK_ALL |
|
4 |
0 |
if( pE->op==TK_DOT && pE->pRight && pE->pRight->op==TK_ALL |
|
1 |
3 |
if( pE->op==TK_DOT && pE->pRight && pE->pRight->op==TK_ALL |
937
|
1 |
0 |
&& pE->pLeft && pE->pLeft->op==TK_ID ) break; |
|
1 |
0 |
&& pE->pLeft && pE->pLeft->op==TK_ID ) break; |
940
|
28 |
113 |
if( knExpr ){ |
948
|
29 |
28 |
for(k=0; knExpr; k++){ |
950
|
2 |
27 |
if( pE->op!=TK_ALL && |
|
2 |
0 |
if( pE->op!=TK_ALL && |
951
|
2 |
0 |
(pE->op!=TK_DOT || pE->pRight==0 || pE->pRight->op!=TK_ALL) ){ |
|
1 |
1 |
(pE->op!=TK_DOT || pE->pRight==0 || pE->pRight->op!=TK_ALL) ){ |
963
|
1 |
27 |
if( pE->op==TK_DOT && pE->pLeft ){ |
|
1 |
0 |
if( pE->op==TK_DOT && pE->pLeft ){ |
968
|
28 |
28 |
for(i=0; inSrc; i++){ |
971
|
3 |
25 |
if( zTabName==0 || zTabName[0]==0 ){ |
|
0 |
3 |
if( zTabName==0 || zTabName[0]==0 ){ |
974
|
1 |
27 |
if( zTName && (zTabName==0 || zTabName[0]==0 || |
|
1 |
0 |
if( zTName && (zTabName==0 || zTabName[0]==0 || |
979
|
75 |
28 |
for(j=0; jnCol; j++){ |
983
|
0 |
75 |
if( i>0 && (pTabList->a[i-1].jointype & JT_NATURAL)!=0 && |
989
|
0 |
75 |
if( i>0 && sqliteIdListIndex(pTabList->a[i-1].pUsing, zName)>=0 ){ |
|
0 |
0 |
if( i>0 && sqliteIdListIndex(pTabList->a[i-1].pUsing, zName)>=0 ){ |
995
|
0 |
75 |
if( pRight==0 ) break; |
999
|
75 |
0 |
if( zTabName && pTabList->nSrc>1 ){ |
|
0 |
75 |
if( zTabName && pTabList->nSrc>1 ){ |
1002
|
0 |
0 |
if( pExpr==0 ) break; |
1019
|
0 |
28 |
if( !tableSeen ){ |
1020
|
0 |
0 |
if( zTName ){ |
1053
|
0 |
0 |
if( p==0 ) return; |
1054
|
0 |
0 |
for(i=0; inSrc; i++){ |
1055
|
0 |
0 |
if( (pTab = pSrc->a[i].pTab)!=0 ){ |
1056
|
0 |
0 |
if( pTab->isTransient ){ |
1060
|
0 |
0 |
if( pSrc->a[i].pSelect ){ |
1098
|
0 |
0 |
if( pSelect==0 || pOrderBy==0 ) return 1; |
|
0 |
0 |
if( pSelect==0 || pOrderBy==0 ) return 1; |
1099
|
0 |
0 |
if( mustComplete ){ |
1100
|
0 |
0 |
for(i=0; inExpr; i++){ pOrderBy->a[i].done = 0; } |
1102
|
0 |
0 |
if( fillInColumnList(pParse, pSelect) ){ |
1105
|
0 |
0 |
if( pSelect->pPrior ){ |
1106
|
0 |
0 |
if( matchOrderbyToColumn(pParse, pSelect->pPrior, pOrderBy, iTable, 0) ){ |
1111
|
0 |
0 |
for(i=0; inExpr; i++){ |
1114
|
0 |
0 |
if( pOrderBy->a[i].done ) continue; |
1115
|
0 |
0 |
if( sqliteExprIsInteger(pE, &iCol) ){ |
1116
|
0 |
0 |
if( iCol<=0 || iCol>pEList->nExpr ){ |
|
0 |
0 |
if( iCol<=0 || iCol>pEList->nExpr ){ |
1123
|
0 |
0 |
if( !mustComplete ) continue; |
1126
|
0 |
0 |
for(j=0; iCol<0 && jnExpr; j++){ |
|
0 |
0 |
for(j=0; iCol<0 && jnExpr; j++){ |
1127
|
0 |
0 |
if( pEList->a[j].zName && (pE->op==TK_ID || pE->op==TK_STRING) ){ |
|
0 |
0 |
if( pEList->a[j].zName && (pE->op==TK_ID || pE->op==TK_STRING) ){ |
|
0 |
0 |
if( pEList->a[j].zName && (pE->op==TK_ID || pE->op==TK_STRING) ){ |
1133
|
0 |
0 |
if( sqliteStrICmp(zName, zLabel)==0 ){ |
1138
|
0 |
0 |
if( iCol<0 && sqliteExprCompare(pE, pEList->a[j].pExpr) ){ |
|
0 |
0 |
if( iCol<0 && sqliteExprCompare(pE, pEList->a[j].pExpr) ){ |
1142
|
0 |
0 |
if( iCol>=0 ){ |
1148
|
0 |
0 |
if( iCol<0 && mustComplete ){ |
|
0 |
0 |
if( iCol<0 && mustComplete ){ |
1164
|
348 |
745 |
if( v==0 ){ |
1200
|
0 |
0 |
if( pOrderBy==0 ) return; |
1201
|
0 |
0 |
if( p==0 ){ |
1202
|
0 |
0 |
for(i=0; inExpr; i++){ |
1209
|
0 |
0 |
for(i=0; inExpr; i++){ |
1211
|
0 |
0 |
if( pE->dataType==SQLITE_SO_NUM ) continue; |
1213
|
0 |
0 |
if( pEList->nExpr>pE->iColumn ){ |
1247
|
0 |
135 |
if( p->nLimit>=0 ){ |
1250
|
0 |
0 |
if( v==0 ) return; |
1255
|
0 |
135 |
if( p->nOffset>0 ){ |
1258
|
0 |
0 |
if( v==0 ) return; |
1303
|
9 |
0 |
if( p==0 || p->pPrior==0 ) return 1; |
|
0 |
9 |
if( p==0 || p->pPrior==0 ) return 1; |
1305
|
0 |
9 |
if( pPrior->pOrderBy ){ |
1310
|
9 |
0 |
if( pPrior->nLimit>=0 || pPrior->nOffset>0 ){ |
|
0 |
9 |
if( pPrior->nLimit>=0 || pPrior->nOffset>0 ){ |
1319
|
0 |
9 |
if( v==0 ) return 1; |
1323
|
3 |
6 |
if( eDest==SRT_TempTable ){ |
1332
|
9 |
0 |
if( p->pOrderBy==0 ){ |
1336
|
0 |
9 |
if( rc ) return rc; |
1344
|
0 |
9 |
if( rc ) return rc; |
1357
|
0 |
0 |
priorOp = p->op==TK_ALL ? SRT_Table : SRT_Union; |
1358
|
0 |
0 |
if( eDest==priorOp && p->pOrderBy==0 && p->nLimit<0 && p->nOffset==0 ){ |
|
0 |
0 |
if( eDest==priorOp && p->pOrderBy==0 && p->nLimit<0 && p->nOffset==0 ){ |
|
0 |
0 |
if( eDest==priorOp && p->pOrderBy==0 && p->nLimit<0 && p->nOffset==0 ){ |
|
0 |
0 |
if( eDest==priorOp && p->pOrderBy==0 && p->nLimit<0 && p->nOffset==0 ){ |
1368
|
0 |
0 |
if( p->pOrderBy |
1369
|
0 |
0 |
&& matchOrderbyToColumn(pParse, p, p->pOrderBy, unionTab, 1) ){ |
1372
|
0 |
0 |
if( p->op!=TK_ALL ){ |
1383
|
0 |
0 |
if( rc ) return rc; |
1404
|
0 |
0 |
if( rc ) return rc; |
1409
|
0 |
0 |
if( eDest!=priorOp || unionTab!=iParm ){ |
|
0 |
0 |
if( eDest!=priorOp || unionTab!=iParm ){ |
1412
|
0 |
0 |
if( eDest==SRT_Callback ){ |
1425
|
0 |
0 |
if( rc ) return 1; |
1430
|
0 |
0 |
if( p->pOrderBy ){ |
1447
|
0 |
0 |
if( p->pOrderBy && matchOrderbyToColumn(pParse,p,p->pOrderBy,tab1,1) ){ |
|
0 |
0 |
if( p->pOrderBy && matchOrderbyToColumn(pParse,p,p->pOrderBy,tab1,1) ){ |
1456
|
0 |
0 |
if( rc ) return rc; |
1471
|
0 |
0 |
if( rc ) return rc; |
1477
|
0 |
0 |
if( eDest==SRT_Callback ){ |
1491
|
0 |
0 |
if( rc ) return 1; |
1497
|
0 |
0 |
if( p->pOrderBy ){ |
1504
|
0 |
9 |
if( p->pEList->nExpr!=pPrior->pEList->nExpr ){ |
1527
|
12 |
36 |
if( pExpr==0 ) return; |
1528
|
30 |
6 |
if( pExpr->op==TK_COLUMN && pExpr->iTable==iTable ){ |
|
30 |
0 |
if( pExpr->op==TK_COLUMN && pExpr->iTable==iTable ){ |
1529
|
0 |
30 |
if( pExpr->iColumn<0 ){ |
1560
|
3 |
9 |
if( pList==0 ) return; |
1561
|
33 |
9 |
for(i=0; inExpr; i++){ |
1652
|
0 |
3 |
if( p==0 ) return 0; |
1657
|
0 |
3 |
if( isAgg && subqueryIsAgg ) return 0; |
|
0 |
0 |
if( isAgg && subqueryIsAgg ) return 0; |
1658
|
0 |
3 |
if( subqueryIsAgg && pSrc->nSrc>1 ) return 0; |
|
0 |
0 |
if( subqueryIsAgg && pSrc->nSrc>1 ) return 0; |
1661
|
0 |
3 |
if( pSubSrc->nSrc==0 ) return 0; |
1662
|
3 |
0 |
if( (pSub->isDistinct || pSub->nLimit>=0) && (pSrc->nSrc>1 || isAgg) ){ |
|
0 |
3 |
if( (pSub->isDistinct || pSub->nLimit>=0) && (pSrc->nSrc>1 || isAgg) ){ |
|
0 |
0 |
if( (pSub->isDistinct || pSub->nLimit>=0) && (pSrc->nSrc>1 || isAgg) ){ |
|
0 |
0 |
if( (pSub->isDistinct || pSub->nLimit>=0) && (pSrc->nSrc>1 || isAgg) ){ |
1665
|
3 |
0 |
if( (p->isDistinct || p->nLimit>=0) && subqueryIsAgg ) return 0; |
|
0 |
3 |
if( (p->isDistinct || p->nLimit>=0) && subqueryIsAgg ) return 0; |
|
0 |
0 |
if( (p->isDistinct || p->nLimit>=0) && subqueryIsAgg ) return 0; |
1666
|
3 |
0 |
if( p->pOrderBy && pSub->pOrderBy ) return 0; |
|
0 |
3 |
if( p->pOrderBy && pSub->pOrderBy ) return 0; |
1680
|
0 |
3 |
if( pSubSrc->nSrc>1 && iFrom>0 && (pSrc->a[iFrom-1].jointype & JT_OUTER)!=0 ){ |
|
0 |
0 |
if( pSubSrc->nSrc>1 && iFrom>0 && (pSrc->a[iFrom-1].jointype & JT_OUTER)!=0 ){ |
|
0 |
0 |
if( pSubSrc->nSrc>1 && iFrom>0 && (pSrc->a[iFrom-1].jointype & JT_OUTER)!=0 ){ |
1697
|
0 |
3 |
if( iFrom>0 && (pSrc->a[iFrom-1].jointype & JT_OUTER)!=0 |
|
0 |
0 |
if( iFrom>0 && (pSrc->a[iFrom-1].jointype & JT_OUTER)!=0 |
1698
|
0 |
0 |
&& pSub->pWhere!=0 ){ |
1719
|
3 |
0 |
if( pSrc->a[iFrom].pTab && pSrc->a[iFrom].pTab->isTransient ){ |
|
3 |
0 |
if( pSrc->a[iFrom].pTab && pSrc->a[iFrom].pTab->isTransient ){ |
1725
|
0 |
3 |
if( nSubSrc>1 ){ |
1727
|
0 |
0 |
for(i=1; i
|
1731
|
0 |
0 |
for(i=pSrc->nSrc-1; i-extra>=iFrom; i--){ |
1735
|
3 |
3 |
for(i=0; i
|
1756
|
18 |
3 |
for(i=0; inExpr; i++){ |
1758
|
18 |
0 |
if( pList->a[i].zName==0 && (pExpr = pList->a[i].pExpr)->span.z!=0 ){ |
|
18 |
0 |
if( pList->a[i].zName==0 && (pExpr = pList->a[i].pExpr)->span.z!=0 ){ |
1762
|
0 |
3 |
if( isAgg ){ |
1766
|
0 |
3 |
if( pSub->pOrderBy ){ |
1770
|
3 |
0 |
}else if( p->pOrderBy ){ |
1773
|
0 |
3 |
if( pSub->pWhere ){ |
1778
|
0 |
3 |
if( subqueryIsAgg ){ |
1783
|
0 |
0 |
if( pSub->pHaving ){ |
1785
|
0 |
0 |
if( p->pHaving ){ |
1793
|
0 |
3 |
}else if( p->pWhere==0 ){ |
1797
|
0 |
3 |
if( pWhere ){ |
1805
|
3 |
0 |
p->isDistinct = p->isDistinct || pSub->isDistinct; |
|
0 |
3 |
p->isDistinct = p->isDistinct || pSub->isDistinct; |
1810
|
0 |
3 |
if( pSub->nLimit>=0 ){ |
1811
|
0 |
0 |
if( p->nLimit<0 ){ |
1813
|
0 |
0 |
}else if( p->nLimit+p->nOffset > pSub->nLimit+pSub->nOffset ){ |
1863
|
136 |
2 |
if( p->pGroupBy || p->pHaving || p->pWhere ) return 0; |
|
136 |
0 |
if( p->pGroupBy || p->pHaving || p->pWhere ) return 0; |
|
26 |
110 |
if( p->pGroupBy || p->pHaving || p->pWhere ) return 0; |
1865
|
23 |
87 |
if( pSrc->nSrc!=1 ) return 0; |
1867
|
73 |
14 |
if( pEList->nExpr!=1 ) return 0; |
1869
|
1 |
13 |
if( pExpr->op!=TK_AGG_FUNCTION ) return 0; |
1871
|
13 |
0 |
if( pList==0 || pList->nExpr!=1 ) return 0; |
|
9 |
4 |
if( pList==0 || pList->nExpr!=1 ) return 0; |
1872
|
4 |
0 |
if( pExpr->token.n!=3 ) return 0; |
1873
|
0 |
0 |
if( sqliteStrNICmp(pExpr->token.z,"min",3)==0 ){ |
1875
|
0 |
0 |
}else if( sqliteStrNICmp(pExpr->token.z,"max",3)==0 ){ |
1881
|
0 |
0 |
if( pExpr->op!=TK_COLUMN ) return 0; |
1891
|
0 |
0 |
if( iCol<0 ){ |
1894
|
0 |
0 |
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |
1896
|
0 |
0 |
if( pIdx->aiColumn[0]==iCol ) break; |
1898
|
0 |
0 |
if( pIdx==0 ) return 0; |
1906
|
0 |
0 |
if( v==0 ) return 0; |
1907
|
0 |
0 |
if( eDest==SRT_Callback ){ |
1913
|
0 |
0 |
if( eDest==SRT_TempTable ){ |
1925
|
0 |
0 |
if( pSrc->a[0].pSelect==0 ){ |
1930
|
0 |
0 |
if( pIdx==0 ){ |
1935
|
0 |
0 |
if( seekOp==OP_Rewind ){ |
2032
|
147 |
0 |
if( sqlite_malloc_failed || pParse->nErr || p==0 ) return 1; |
|
147 |
0 |
if( sqlite_malloc_failed || pParse->nErr || p==0 ) return 1; |
|
0 |
147 |
if( sqlite_malloc_failed || pParse->nErr || p==0 ) return 1; |
2033
|
0 |
147 |
if( sqliteAuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; |
2037
|
9 |
138 |
if( p->pPrior ){ |
2058
|
0 |
138 |
if( pParse->nErr>0 ) goto select_end; |
2064
|
0 |
138 |
if( fillInColumnList(pParse, p) ){ |
2069
|
0 |
138 |
if( pEList==0 ) goto select_end; |
2074
|
138 |
0 |
if( (eDest==SRT_Mem || eDest==SRT_Set) && pEList->nExpr>1 ){ |
|
0 |
138 |
if( (eDest==SRT_Mem || eDest==SRT_Set) && pEList->nExpr>1 ){ |
|
0 |
0 |
if( (eDest==SRT_Mem || eDest==SRT_Set) && pEList->nExpr>1 ){ |
2082
|
0 |
138 |
switch( eDest ){ |
2097
|
449 |
138 |
for(i=0; inExpr; i++){ |
2098
|
0 |
449 |
if( sqliteExprResolveIds(pParse, pTabList, 0, pEList->a[i].pExpr) ){ |
2101
|
0 |
449 |
if( sqliteExprCheck(pParse, pEList->a[i].pExpr, 1, &isAgg) ){ |
2105
|
27 |
111 |
if( pWhere ){ |
2106
|
0 |
27 |
if( sqliteExprResolveIds(pParse, pTabList, pEList, pWhere) ){ |
2109
|
0 |
27 |
if( sqliteExprCheck(pParse, pWhere, 0, 0) ){ |
2113
|
0 |
138 |
if( pHaving ){ |
2114
|
0 |
0 |
if( pGroupBy==0 ){ |
2118
|
0 |
0 |
if( sqliteExprResolveIds(pParse, pTabList, pEList, pHaving) ){ |
2121
|
0 |
0 |
if( sqliteExprCheck(pParse, pHaving, 1, &isAgg) ){ |
2125
|
5 |
133 |
if( pOrderBy ){ |
2126
|
11 |
5 |
for(i=0; inExpr; i++){ |
2129
|
0 |
11 |
if( sqliteExprIsInteger(pE, &iCol) && iCol>0 && iCol<=pEList->nExpr ){ |
|
0 |
0 |
if( sqliteExprIsInteger(pE, &iCol) && iCol>0 && iCol<=pEList->nExpr ){ |
|
0 |
0 |
if( sqliteExprIsInteger(pE, &iCol) && iCol>0 && iCol<=pEList->nExpr ){ |
2133
|
0 |
11 |
if( sqliteExprResolveIds(pParse, pTabList, pEList, pE) ){ |
2136
|
0 |
11 |
if( sqliteExprCheck(pParse, pE, isAgg, 0) ){ |
2139
|
0 |
11 |
if( sqliteExprIsConstant(pE) ){ |
2140
|
0 |
0 |
if( sqliteExprIsInteger(pE, &iCol)==0 ){ |
2144
|
0 |
0 |
}else if( iCol<=0 || iCol>pEList->nExpr ){ |
|
0 |
0 |
}else if( iCol<=0 || iCol>pEList->nExpr ){ |
2153
|
2 |
136 |
if( pGroupBy ){ |
2154
|
2 |
2 |
for(i=0; inExpr; i++){ |
2157
|
0 |
2 |
if( sqliteExprIsInteger(pE, &iCol) && iCol>0 && iCol<=pEList->nExpr ){ |
|
0 |
0 |
if( sqliteExprIsInteger(pE, &iCol) && iCol>0 && iCol<=pEList->nExpr ){ |
|
0 |
0 |
if( sqliteExprIsInteger(pE, &iCol) && iCol>0 && iCol<=pEList->nExpr ){ |
2161
|
0 |
2 |
if( sqliteExprResolveIds(pParse, pTabList, pEList, pE) ){ |
2164
|
0 |
2 |
if( sqliteExprCheck(pParse, pE, isAgg, 0) ){ |
2167
|
0 |
2 |
if( sqliteExprIsConstant(pE) ){ |
2168
|
0 |
0 |
if( sqliteExprIsInteger(pE, &iCol)==0 ){ |
2172
|
0 |
0 |
}else if( iCol<=0 || iCol>pEList->nExpr ){ |
|
0 |
0 |
}else if( iCol<=0 || iCol>pEList->nExpr ){ |
2185
|
0 |
138 |
if( v==0 ) goto select_end; |
2190
|
123 |
15 |
if( eDest==SRT_Callback ){ |
2196
|
116 |
138 |
for(i=0; inSrc; i++){ |
2200
|
110 |
6 |
if( pTabList->a[i].pSelect==0 ) continue; |
2201
|
0 |
6 |
if( pTabList->a[i].zName!=0 ){ |
2210
|
0 |
6 |
if( needRestoreContext ){ |
2215
|
6 |
0 |
if( eDest!=SRT_Union && eDest!=SRT_Except && eDest!=SRT_Discard ){ |
|
6 |
0 |
if( eDest!=SRT_Union && eDest!=SRT_Except && eDest!=SRT_Discard ){ |
|
6 |
0 |
if( eDest!=SRT_Union && eDest!=SRT_Except && eDest!=SRT_Discard ){ |
2226
|
0 |
138 |
if( simpleMinMaxQuery(pParse, p, eDest, iParm) ){ |
2234
|
3 |
135 |
if( pParent && pParentAgg && |
2236
|
0 |
3 |
if( isAgg ) *pParentAgg = 1; |
2253
|
123 |
12 |
if( eDest==SRT_Callback ){ |
2259
|
0 |
135 |
if( eDest==SRT_TempTable ){ |
2266
|
120 |
15 |
if( isAgg || pGroupBy ){ |
|
0 |
120 |
if( isAgg || pGroupBy ){ |
2269
|
17 |
15 |
for(i=0; inExpr; i++){ |
2270
|
0 |
17 |
if( sqliteExprAnalyzeAggregates(pParse, pEList->a[i].pExpr) ){ |
2274
|
2 |
13 |
if( pGroupBy ){ |
2275
|
2 |
2 |
for(i=0; inExpr; i++){ |
2276
|
0 |
2 |
if( sqliteExprAnalyzeAggregates(pParse, pGroupBy->a[i].pExpr) ){ |
2281
|
0 |
15 |
if( pHaving && sqliteExprAnalyzeAggregates(pParse, pHaving) ){ |
|
0 |
0 |
if( pHaving && sqliteExprAnalyzeAggregates(pParse, pHaving) ){ |
2284
|
1 |
14 |
if( pOrderBy ){ |
2285
|
1 |
1 |
for(i=0; inExpr; i++){ |
2286
|
0 |
1 |
if( sqliteExprAnalyzeAggregates(pParse, pOrderBy->a[i].pExpr) ){ |
2295
|
15 |
120 |
if( isAgg ){ |
2297
|
18 |
15 |
for(i=0; inAgg; i++){ |
2299
|
15 |
3 |
if( (pFunc = pParse->aAgg[i].pFunc)!=0 && pFunc->xFinalize!=0 ){ |
|
15 |
0 |
if( (pFunc = pParse->aAgg[i].pFunc)!=0 && pFunc->xFinalize!=0 ){ |
2303
|
13 |
2 |
if( pGroupBy==0 ){ |
2311
|
0 |
135 |
if( eDest==SRT_Mem ){ |
2318
|
0 |
135 |
if( isDistinct ){ |
2327
|
133 |
2 |
pWInfo = sqliteWhereBegin(pParse, pTabList, pWhere, 0, |
2329
|
0 |
135 |
if( pWInfo==0 ) goto select_end; |
2334
|
120 |
15 |
if( !isAgg ){ |
2335
|
0 |
120 |
if( selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinct, eDest, |
2346
|
2 |
13 |
if( pGroupBy ){ |
2348
|
2 |
2 |
for(i=0; inExpr; i++){ |
2352
|
2 |
0 |
if( pParse->db->file_format>=4 ) sqliteAddKeyType(v, pGroupBy); |
2355
|
5 |
2 |
for(i=0, pAgg=pParse->aAgg; inAgg; i++, pAgg++){ |
2356
|
2 |
3 |
if( pAgg->isAgg ) continue; |
2362
|
18 |
15 |
for(i=0, pAgg=pParse->aAgg; inAgg; i++, pAgg++){ |
2366
|
3 |
15 |
if( !pAgg->isAgg ) continue; |
2386
|
15 |
120 |
if( isAgg ){ |
2391
|
0 |
15 |
if( pHaving ){ |
2394
|
0 |
15 |
if( selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, distinct, eDest, |
2407
|
5 |
130 |
if( pOrderBy ){ |
2416
|
0 |
135 |
if( pParent ){ |