OpenCoverage

expr.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/sqlite/src/src/expr.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2** 2001 September 15-
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** This file contains routines used for analyzing expressions and-
13** for generating VDBE code that evaluates expressions in SQLite.-
14*/-
15#include "sqliteInt.h"-
16-
17/* Forward declarations */-
18static void exprCodeBetween(Parse*,Expr*,int,void(*)(Parse*,Expr*,int,int),int);-
19static int exprCodeVector(Parse *pParse, Expr *p, int *piToFree);-
20-
21/*-
22** Return the affinity character for a single column of a table.-
23*/-
24char sqlite3TableColumnAffinity(Table *pTab, int iCol){-
25 assert( iCol<pTab->nCol );-
26 return iCol>=0 ? pTab->aCol[iCol].affinity : SQLITE_AFF_INTEGER;
executed 319536 times by 34 tests: return iCol>=0 ? pTab->aCol[iCol].affinity : 'D';
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
iCol>=0Description
TRUEevaluated 312030 times by 34 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
FALSEevaluated 7506 times by 1 test
Evaluated by:
  • Self test (438)
7506-319536
27}-
28-
29/*-
30** Return the 'affinity' of the expression pExpr if any.-
31**-
32** If pExpr is a column, a reference to a column via an 'AS' alias,-
33** or a sub-select with a column as the return value, then the -
34** affinity of that column is returned. Otherwise, 0x00 is returned,-
35** indicating no affinity for the expression.-
36**-
37** i.e. the WHERE clause expressions in the following statements all-
38** have an affinity:-
39**-
40** CREATE TABLE t1(a);-
41** SELECT * FROM t1 WHERE a;-
42** SELECT a AS b FROM t1 WHERE b;-
43** SELECT * FROM t1 WHERE (select a from t1);-
44*/-
45char sqlite3ExprAffinity(Expr *pExpr){-
46 int op;-
47 pExpr = sqlite3ExprSkipCollate(pExpr);-
48 if( pExpr->flags & EP_Generic ) return 0;
executed 292 times by 1 test: return 0;
Executed by:
  • Self test (438)
pExpr->flags & 0x000200Description
TRUEevaluated 292 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 713501 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
292-713501
49 op = pExpr->op;-
50 if( op==TK_SELECT ){
op==127Description
TRUEevaluated 1712 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 711789 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
1712-711789
51 assert( pExpr->flags&EP_xIsSelect );-
52 return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr);
executed 1712 times by 1 test: return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr);
Executed by:
  • Self test (438)
1712
53 }-
54 if( op==TK_REGISTER ) op = pExpr->op2;
executed 26540 times by 4 tests: op = pExpr->op2;
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
op==164Description
TRUEevaluated 26540 times by 4 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
FALSEevaluated 685249 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
26540-685249
55#ifndef SQLITE_OMIT_CAST-
56 if( op==TK_CAST ){
op==36Description
TRUEevaluated 1145 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 710644 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
1145-710644
57 assert( !ExprHasProperty(pExpr, EP_IntValue) );-
58 return sqlite3AffinityType(pExpr->u.zToken, 0);
executed 1145 times by 1 test: return sqlite3AffinityType(pExpr->u.zToken, 0);
Executed by:
  • Self test (438)
1145
59 }-
60#endif-
61 if( (op==TK_AGG_COLUMN || op==TK_COLUMN) && pExpr->y.pTab ){
op==160Description
TRUEevaluated 2807 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 707837 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
op==158Description
TRUEevaluated 313890 times by 34 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
FALSEevaluated 393947 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
pExpr->y.pTabDescription
TRUEevaluated 316686 times by 34 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test (438)
11-707837
62 return sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
executed 316686 times by 34 tests: return sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
316686
63 }-
64 if( op==TK_SELECT_COLUMN ){
op==166Description
TRUEevaluated 4634 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 389324 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
4634-389324
65 assert( pExpr->pLeft->flags&EP_xIsSelect );-
66 return sqlite3ExprAffinity(
executed 4634 times by 1 test: return sqlite3ExprAffinity( pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr );
Executed by:
  • Self test (438)
4634
67 pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr
executed 4634 times by 1 test: return sqlite3ExprAffinity( pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr );
Executed by:
  • Self test (438)
4634
68 );
executed 4634 times by 1 test: return sqlite3ExprAffinity( pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr );
Executed by:
  • Self test (438)
4634
69 }-
70 return pExpr->affinity;
executed 389324 times by 366 tests: return pExpr->affinity;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
389324
71}-
72-
73/*-
74** Set the collating sequence for expression pExpr to be the collating-
75** sequence named by pToken. Return a pointer to a new Expr node that-
76** implements the COLLATE operator.-
77**-
78** If a memory allocation error occurs, that fact is recorded in pParse->db-
79** and the pExpr parameter is returned unchanged.-
80*/-
81Expr *sqlite3ExprAddCollateToken(-
82 Parse *pParse, /* Parsing context */-
83 Expr *pExpr, /* Add the "COLLATE" clause to this expression */-
84 const Token *pCollName, /* Name of collating sequence */-
85 int dequote /* True to dequote pCollName */-
86){-
87 if( pCollName->n>0 ){
pCollName->n>0Description
TRUEevaluated 15719 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-15719
88 Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, dequote);-
89 if( pNew ){
pNewDescription
TRUEevaluated 15719 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-15719
90 pNew->pLeft = pExpr;-
91 pNew->flags |= EP_Collate|EP_Skip;-
92 pExpr = pNew;-
93 }
executed 15719 times by 1 test: end of block
Executed by:
  • Self test (438)
15719
94 }
executed 15719 times by 1 test: end of block
Executed by:
  • Self test (438)
15719
95 return pExpr;
executed 15719 times by 1 test: return pExpr;
Executed by:
  • Self test (438)
15719
96}-
97Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){-
98 Token s;-
99 assert( zC!=0 );-
100 sqlite3TokenInit(&s, (char*)zC);-
101 return sqlite3ExprAddCollateToken(pParse, pExpr, &s, 0);
executed 14695 times by 1 test: return sqlite3ExprAddCollateToken(pParse, pExpr, &s, 0);
Executed by:
  • Self test (438)
14695
102}-
103-
104/*-
105** Skip over any TK_COLLATE operators and any unlikely()-
106** or likelihood() function at the root of an expression.-
107*/-
108Expr *sqlite3ExprSkipCollate(Expr *pExpr){-
109 while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){
pExprDescription
TRUEevaluated 3060105 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 212101 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
(((pExpr)->fla...0x001000))!=0)Description
TRUEevaluated 45611 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3014494 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
45611-3060105
110 if( ExprHasProperty(pExpr, EP_Unlikely) ){
(((pExpr)->fla...0x040000))!=0)Description
TRUEevaluated 130 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 45481 times by 1 test
Evaluated by:
  • Self test (438)
130-45481
111 assert( !ExprHasProperty(pExpr, EP_xIsSelect) );-
112 assert( pExpr->x.pList->nExpr>0 );-
113 assert( pExpr->op==TK_FUNCTION );-
114 pExpr = pExpr->x.pList->a[0].pExpr;-
115 }else{
executed 130 times by 1 test: end of block
Executed by:
  • Self test (438)
130
116 assert( pExpr->op==TK_COLLATE );-
117 pExpr = pExpr->pLeft;-
118 }
executed 45481 times by 1 test: end of block
Executed by:
  • Self test (438)
45481
119 } -
120 return pExpr;
executed 3226595 times by 435 tests: return pExpr;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
3226595
121}-
122-
123/*-
124** Return the collation sequence for the expression pExpr. If-
125** there is no defined collating sequence, return NULL.-
126**-
127** See also: sqlite3ExprNNCollSeq()-
128**-
129** The sqlite3ExprNNCollSeq() works the same exact that it returns the-
130** default collation if pExpr has no defined collation.-
131**-
132** The collating sequence might be determined by a COLLATE operator-
133** or by the presence of a column with a defined collating sequence.-
134** COLLATE operators take first precedence. Left operands take-
135** precedence over right operands.-
136*/-
137CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){-
138 sqlite3 *db = pParse->db;-
139 CollSeq *pColl = 0;-
140 Expr *p = pExpr;-
141 while( p ){
pDescription
TRUEevaluated 533616 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 84 times by 1 test
Evaluated by:
  • Self test (438)
84-533616
142 int op = p->op;-
143 if( p->flags & EP_Generic ) break;
executed 52 times by 1 test: break;
Executed by:
  • Self test (438)
p->flags & 0x000200Description
TRUEevaluated 52 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 533564 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
52-533564
144 if( (op==TK_AGG_COLUMN || op==TK_COLUMN
op==160Description
TRUEevaluated 13349 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 520215 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
op==158Description
TRUEevaluated 283871 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 236344 times by 334 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
13349-520215
145 || op==TK_REGISTER || op==TK_TRIGGER)
op==164Description
TRUEevaluated 13661 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 222683 times by 334 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
op==77Description
TRUEevaluated 4817 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 217866 times by 334 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
4817-222683
146 && p->y.pTab!=0
p->y.pTab!=0Description
TRUEevaluated 307913 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 7785 times by 1 test
Evaluated by:
  • Self test (438)
7785-307913
147 ){-
148 /* op==TK_REGISTER && p->y.pTab!=0 happens when pExpr was originally-
149 ** a TK_COLUMN but was previously evaluated and cached in a register */-
150 int j = p->iColumn;-
151 if( j>=0 ){
j>=0Description
TRUEevaluated 251688 times by 34 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
FALSEevaluated 56225 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
56225-251688
152 const char *zColl = p->y.pTab->aCol[j].zColl;-
153 pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0);-
154 }
executed 251688 times by 34 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
251688
155 break;
executed 307913 times by 435 tests: break;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
307913
156 }-
157 if( op==TK_CAST || op==TK_UPLUS ){
op==36Description
TRUEevaluated 1011 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 224640 times by 334 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
op==162Description
TRUEevaluated 7199 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 217441 times by 334 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
1011-224640
158 p = p->pLeft;-
159 continue;
executed 8210 times by 1 test: continue;
Executed by:
  • Self test (438)
8210
160 }-
161 if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
op==102Description
TRUEevaluated 18987 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 198454 times by 334 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
op==164Description
TRUEevaluated 7500 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 190954 times by 334 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
p->op2==102Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 7490 times by 1 test
Evaluated by:
  • Self test (438)
10-198454
162 pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken);-
163 break;
executed 18997 times by 1 test: break;
Executed by:
  • Self test (438)
18997
164 }-
165 if( p->flags & EP_Collate ){
p->flags & 0x000100Description
TRUEevaluated 110 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 198334 times by 334 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
110-198334
166 if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){
p->pLeftDescription
TRUEevaluated 104 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
(p->pLeft->fla...& 0x000100)!=0Description
TRUEevaluated 21 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 83 times by 1 test
Evaluated by:
  • Self test (438)
6-104
167 p = p->pLeft;-
168 }else{
executed 21 times by 1 test: end of block
Executed by:
  • Self test (438)
21
169 Expr *pNext = p->pRight;-
170 /* The Expr.x union is never used at the same time as Expr.pRight */-
171 assert( p->x.pList==0 || p->pRight==0 );-
172 /* p->flags holds EP_Collate and p->pLeft->flags does not. And-
173 ** p->x.pSelect cannot. So if p->x.pLeft exists, it must hold at-
174 ** least one EP_Collate. Thus the following two ALWAYS. */-
175 if( p->x.pList!=0 && ALWAYS(!ExprHasProperty(p, EP_xIsSelect)) ){
p->x.pList!=0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 83 times by 1 test
Evaluated by:
  • Self test (438)
(!(((p)->flags...x000800))!=0))Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-83
176 int i;-
177 for(i=0; ALWAYS(i<p->x.pList->nExpr); i++){
(i<p->x.pList->nExpr)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-9
178 if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){
(((p->x.pList-...0x000100))!=0)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
3-6
179 pNext = p->x.pList->a[i].pExpr;-
180 break;
executed 6 times by 1 test: break;
Executed by:
  • Self test (438)
6
181 }-
182 }
executed 3 times by 1 test: end of block
Executed by:
  • Self test (438)
3
183 }
executed 6 times by 1 test: end of block
Executed by:
  • Self test (438)
6
184 p = pNext;-
185 }
executed 89 times by 1 test: end of block
Executed by:
  • Self test (438)
89
186 }else{-
187 break;
executed 198334 times by 334 tests: break;
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
198334
188 }-
189 }-
190 if( sqlite3CheckCollSeq(pParse, pColl) ){
sqlite3CheckCo...pParse, pColl)Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 525360 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
20-525360
191 pColl = 0;-
192 }
executed 20 times by 1 test: end of block
Executed by:
  • Self test (438)
20
193 return pColl;
executed 525380 times by 435 tests: return pColl;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
525380
194}-
195-
196/*-
197** Return the collation sequence for the expression pExpr. If-
198** there is no defined collating sequence, return a pointer to the-
199** defautl collation sequence.-
200**-
201** See also: sqlite3ExprCollSeq()-
202**-
203** The sqlite3ExprCollSeq() routine works the same except that it-
204** returns NULL if there is no defined collation.-
205*/-
206CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr){-
207 CollSeq *p = sqlite3ExprCollSeq(pParse, pExpr);-
208 if( p==0 ) p = pParse->db->pDfltColl;
executed 54251 times by 435 tests: p = pParse->db->pDfltColl;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
p==0Description
TRUEevaluated 54251 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 29691 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (47)
29691-54251
209 assert( p!=0 );-
210 return p;
executed 83942 times by 435 tests: return p;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
83942
211}-
212-
213/*-
214** Return TRUE if the two expressions have equivalent collating sequences.-
215*/-
216int sqlite3ExprCollSeqMatch(Parse *pParse, Expr *pE1, Expr *pE2){-
217 CollSeq *pColl1 = sqlite3ExprNNCollSeq(pParse, pE1);-
218 CollSeq *pColl2 = sqlite3ExprNNCollSeq(pParse, pE2);-
219 return sqlite3StrICmp(pColl1->zName, pColl2->zName)==0;
executed 2419 times by 1 test: return sqlite3StrICmp(pColl1->zName, pColl2->zName)==0;
Executed by:
  • Self test (438)
2419
220}-
221-
222/*-
223** pExpr is an operand of a comparison operator. aff2 is the-
224** type affinity of the other operand. This routine returns the-
225** type affinity that should be used for the comparison operator.-
226*/-
227char sqlite3CompareAffinity(Expr *pExpr, char aff2){-
228 char aff1 = sqlite3ExprAffinity(pExpr);-
229 if( aff1 && aff2 ){
aff1Description
TRUEevaluated 138650 times by 34 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
FALSEevaluated 219199 times by 365 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
aff2Description
TRUEevaluated 44909 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 93741 times by 34 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
44909-219199
230 /* Both sides of the comparison are columns. If one has numeric-
231 ** affinity, use that. Otherwise use no affinity.-
232 */-
233 if( sqlite3IsNumericAffinity(aff1) || sqlite3IsNumericAffinity(aff2) ){
((aff1)>='C')Description
TRUEevaluated 5382 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 39527 times by 1 test
Evaluated by:
  • Self test (438)
((aff2)>='C')Description
TRUEevaluated 834 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 38693 times by 1 test
Evaluated by:
  • Self test (438)
834-39527
234 return SQLITE_AFF_NUMERIC;
executed 6216 times by 1 test: return 'C';
Executed by:
  • Self test (438)
6216
235 }else{-
236 return SQLITE_AFF_BLOB;
executed 38693 times by 1 test: return 'A';
Executed by:
  • Self test (438)
38693
237 }-
238 }else if( !aff1 && !aff2 ){
!aff1Description
TRUEevaluated 219199 times by 365 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 93741 times by 34 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
!aff2Description
TRUEevaluated 66588 times by 334 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
FALSEevaluated 152611 times by 33 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • ...
66588-219199
239 /* Neither side of the comparison is a column. Compare the-
240 ** results directly.-
241 */-
242 return SQLITE_AFF_BLOB;
executed 66588 times by 334 tests: return 'A';
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
66588
243 }else{-
244 /* One side is a column, the other is not. Use the columns affinity. */-
245 assert( aff1==0 || aff2==0 );-
246 return (aff1 + aff2);
executed 246352 times by 34 tests: return (aff1 + aff2);
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
246352
247 }-
248}-
249-
250/*-
251** pExpr is a comparison operator. Return the type affinity that should-
252** be applied to both operands prior to doing the comparison.-
253*/-
254static char comparisonAffinity(Expr *pExpr){-
255 char aff;-
256 assert( pExpr->op==TK_EQ || pExpr->op==TK_IN || pExpr->op==TK_LT ||-
257 pExpr->op==TK_GT || pExpr->op==TK_GE || pExpr->op==TK_LE ||-
258 pExpr->op==TK_NE || pExpr->op==TK_IS || pExpr->op==TK_ISNOT );-
259 assert( pExpr->pLeft );-
260 aff = sqlite3ExprAffinity(pExpr->pLeft);-
261 if( pExpr->pRight ){
pExpr->pRightDescription
TRUEevaluated 135182 times by 33 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • ...
FALSEevaluated 896 times by 1 test
Evaluated by:
  • Self test (438)
896-135182
262 aff = sqlite3CompareAffinity(pExpr->pRight, aff);-
263 }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){
executed 135182 times by 33 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • ...
(((pExpr)->fla...0x000800))!=0)Description
TRUEevaluated 462 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 434 times by 1 test
Evaluated by:
  • Self test (438)
434-135182
264 aff = sqlite3CompareAffinity(pExpr->x.pSelect->pEList->a[0].pExpr, aff);-
265 }else if( aff==0 ){
executed 462 times by 1 test: end of block
Executed by:
  • Self test (438)
aff==0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 430 times by 1 test
Evaluated by:
  • Self test (438)
4-462
266 aff = SQLITE_AFF_BLOB;-
267 }
executed 4 times by 1 test: end of block
Executed by:
  • Self test (438)
4
268 return aff;
executed 136078 times by 33 tests: return aff;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • ...
136078
269}-
270-
271/*-
272** pExpr is a comparison expression, eg. '=', '<', IN(...) etc.-
273** idx_affinity is the affinity of an indexed column. Return true-
274** if the index with affinity idx_affinity may be used to implement-
275** the comparison in pExpr.-
276*/-
277int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){-
278 char aff = comparisonAffinity(pExpr);-
279 switch( aff ){-
280 case SQLITE_AFF_BLOB:
executed 74782 times by 3 tests: case 'A':
Executed by:
  • Self test (4)
  • Self test (438)
  • Self test (5)
74782
281 return 1;
executed 74782 times by 3 tests: return 1;
Executed by:
  • Self test (4)
  • Self test (438)
  • Self test (5)
74782
282 case SQLITE_AFF_TEXT:
executed 48042 times by 31 tests: case 'B':
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
48042
283 return idx_affinity==SQLITE_AFF_TEXT;
executed 48042 times by 31 tests: return idx_affinity=='B';
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
48042
284 default:
executed 13254 times by 4 tests: default:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
13254
285 return sqlite3IsNumericAffinity(idx_affinity);
executed 13254 times by 4 tests: return ((idx_affinity)>='C');
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
13254
286 }-
287}-
288-
289/*-
290** Return the P5 value that should be used for a binary comparison-
291** opcode (OP_Eq, OP_Ge etc.) used to compare pExpr1 and pExpr2.-
292*/-
293static u8 binaryCompareP5(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){-
294 u8 aff = (char)sqlite3ExprAffinity(pExpr2);-
295 aff = (u8)sqlite3CompareAffinity(pExpr1, aff) | (u8)jumpIfNull;-
296 return aff;
executed 175734 times by 366 tests: return aff;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
175734
297}-
298-
299/*-
300** Return a pointer to the collation sequence that should be used by-
301** a binary comparison operator comparing pLeft and pRight.-
302**-
303** If the left hand expression has a collating sequence type, then it is-
304** used. Otherwise the collation sequence for the right hand expression-
305** is used, or the default (BINARY) if neither expression has a collating-
306** type.-
307**-
308** Argument pRight (but not pLeft) may be a null pointer. In this case,-
309** it is not considered.-
310*/-
311CollSeq *sqlite3BinaryCompareCollSeq(-
312 Parse *pParse, -
313 Expr *pLeft, -
314 Expr *pRight-
315){-
316 CollSeq *pColl;-
317 assert( pLeft );-
318 if( pLeft->flags & EP_Collate ){
pLeft->flags & 0x000100Description
TRUEevaluated 14152 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 248153 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
14152-248153
319 pColl = sqlite3ExprCollSeq(pParse, pLeft);-
320 }else if( pRight && (pRight->flags & EP_Collate)!=0 ){
executed 14152 times by 1 test: end of block
Executed by:
  • Self test (438)
pRightDescription
TRUEevaluated 247269 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 884 times by 1 test
Evaluated by:
  • Self test (438)
(pRight->flags & 0x000100)!=0Description
TRUEevaluated 5339 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 241930 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
884-247269
321 pColl = sqlite3ExprCollSeq(pParse, pRight);-
322 }else{
executed 5339 times by 1 test: end of block
Executed by:
  • Self test (438)
5339
323 pColl = sqlite3ExprCollSeq(pParse, pLeft);-
324 if( !pColl ){
!pCollDescription
TRUEevaluated 73818 times by 334 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
FALSEevaluated 168996 times by 34 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (4)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • ...
73818-168996
325 pColl = sqlite3ExprCollSeq(pParse, pRight);-
326 }
executed 73818 times by 334 tests: end of block
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
73818
327 }
executed 242814 times by 366 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
242814
328 return pColl;
executed 262305 times by 366 tests: return pColl;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
262305
329}-
330-
331/*-
332** Generate code for a comparison operator.-
333*/-
334static int codeCompare(-
335 Parse *pParse, /* The parsing (and code generating) context */-
336 Expr *pLeft, /* The left operand */-
337 Expr *pRight, /* The right operand */-
338 int opcode, /* The comparison opcode */-
339 int in1, int in2, /* Register holding operands */-
340 int dest, /* Jump here if true. */-
341 int jumpIfNull /* If true, jump if either operand is NULL */-
342){-
343 int p5;-
344 int addr;-
345 CollSeq *p4;-
346-
347 p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight);-
348 p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);-
349 addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,-
350 (void*)p4, P4_COLLSEQ);-
351 sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5);-
352 return addr;
executed 175734 times by 366 tests: return addr;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
175734
353}-
354-
355/*-
356** Return true if expression pExpr is a vector, or false otherwise.-
357**-
358** A vector is defined as any expression that results in two or more-
359** columns of result. Every TK_VECTOR node is an vector because the-
360** parser will not generate a TK_VECTOR with fewer than two entries.-
361** But a TK_SELECT might be either a vector or a scalar. It is only-
362** considered a vector if it has two or more result columns.-
363*/-
364int sqlite3ExprIsVector(Expr *pExpr){-
365 return sqlite3ExprVectorSize(pExpr)>1;
executed 301869 times by 366 tests: return sqlite3ExprVectorSize(pExpr)>1;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
301869
366}-
367-
368/*-
369** If the expression passed as the only argument is of type TK_VECTOR -
370** return the number of expressions in the vector. Or, if the expression-
371** is a sub-select, return the number of columns in the sub-select. For-
372** any other type of expression, return 1.-
373*/-
374int sqlite3ExprVectorSize(Expr *pExpr){-
375 u8 op = pExpr->op;-
376 if( op==TK_REGISTER ) op = pExpr->op2;
executed 43142 times by 30 tests: op = pExpr->op2;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (30)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • ...
op==164Description
TRUEevaluated 43142 times by 30 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (30)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • ...
FALSEevaluated 947802 times by 368 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
43142-947802
377 if( op==TK_VECTOR ){
op==165Description
TRUEevaluated 29545 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 961399 times by 368 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
29545-961399
378 return pExpr->x.pList->nExpr;
executed 29545 times by 1 test: return pExpr->x.pList->nExpr;
Executed by:
  • Self test (438)
29545
379 }else if( op==TK_SELECT ){
op==127Description
TRUEevaluated 10069 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 951330 times by 368 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
10069-951330
380 return pExpr->x.pSelect->pEList->nExpr;
executed 10069 times by 1 test: return pExpr->x.pSelect->pEList->nExpr;
Executed by:
  • Self test (438)
10069
381 }else{-
382 return 1;
executed 951330 times by 368 tests: return 1;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
951330
383 }-
384}-
385-
386/*-
387** Return a pointer to a subexpression of pVector that is the i-th-
388** column of the vector (numbered starting with 0). The caller must-
389** ensure that i is within range.-
390**-
391** If pVector is really a scalar (and "scalar" here includes subqueries-
392** that return a single column!) then return pVector unmodified.-
393**-
394** pVector retains ownership of the returned subexpression.-
395**-
396** If the vector is a (SELECT ...) then the expression returned is-
397** just the expression for the i-th term of the result set, and may-
398** not be ready for evaluation because the table cursor has not yet-
399** been positioned.-
400*/-
401Expr *sqlite3VectorFieldSubexpr(Expr *pVector, int i){-
402 assert( i<sqlite3ExprVectorSize(pVector) );-
403 if( sqlite3ExprIsVector(pVector) ){
sqlite3ExprIsVector(pVector)Description
TRUEevaluated 6099 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 31856 times by 2 tests
Evaluated by:
  • Self test (34)
  • Self test (438)
6099-31856
404 assert( pVector->op2==0 || pVector->op==TK_REGISTER );-
405 if( pVector->op==TK_SELECT || pVector->op2==TK_SELECT ){
pVector->op==127Description
TRUEevaluated 1862 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4237 times by 1 test
Evaluated by:
  • Self test (438)
pVector->op2==127Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4225 times by 1 test
Evaluated by:
  • Self test (438)
12-4237
406 return pVector->x.pSelect->pEList->a[i].pExpr;
executed 1874 times by 1 test: return pVector->x.pSelect->pEList->a[i].pExpr;
Executed by:
  • Self test (438)
1874
407 }else{-
408 return pVector->x.pList->a[i].pExpr;
executed 4225 times by 1 test: return pVector->x.pList->a[i].pExpr;
Executed by:
  • Self test (438)
4225
409 }-
410 }-
411 return pVector;
executed 31856 times by 2 tests: return pVector;
Executed by:
  • Self test (34)
  • Self test (438)
31856
412}-
413-
414/*-
415** Compute and return a new Expr object which when passed to-
416** sqlite3ExprCode() will generate all necessary code to compute-
417** the iField-th column of the vector expression pVector.-
418**-
419** It is ok for pVector to be a scalar (as long as iField==0). -
420** In that case, this routine works like sqlite3ExprDup().-
421**-
422** The caller owns the returned Expr object and is responsible for-
423** ensuring that the returned value eventually gets freed.-
424**-
425** The caller retains ownership of pVector. If pVector is a TK_SELECT,-
426** then the returned object will reference pVector and so pVector must remain-
427** valid for the life of the returned object. If pVector is a TK_VECTOR-
428** or a scalar expression, then it can be deleted as soon as this routine-
429** returns.-
430**-
431** A trick to cause a TK_SELECT pVector to be deleted together with-
432** the returned Expr object is to attach the pVector to the pRight field-
433** of the returned TK_SELECT_COLUMN Expr object.-
434*/-
435Expr *sqlite3ExprForVectorField(-
436 Parse *pParse, /* Parsing context */-
437 Expr *pVector, /* The vector. List of expressions or a sub-SELECT */-
438 int iField /* Which column of the vector to return */-
439){-
440 Expr *pRet;-
441 if( pVector->op==TK_SELECT ){
pVector->op==127Description
TRUEevaluated 1903 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5959 times by 1 test
Evaluated by:
  • Self test (438)
1903-5959
442 assert( pVector->flags & EP_xIsSelect );-
443 /* The TK_SELECT_COLUMN Expr node:-
444 **-
445 ** pLeft: pVector containing TK_SELECT. Not deleted.-
446 ** pRight: not used. But recursively deleted.-
447 ** iColumn: Index of a column in pVector-
448 ** iTable: 0 or the number of columns on the LHS of an assignment-
449 ** pLeft->iTable: First in an array of register holding result, or 0-
450 ** if the result is not yet computed.-
451 **-
452 ** sqlite3ExprDelete() specifically skips the recursive delete of-
453 ** pLeft on TK_SELECT_COLUMN nodes. But pRight is followed, so pVector-
454 ** can be attached to pRight to cause this node to take ownership of-
455 ** pVector. Typically there will be multiple TK_SELECT_COLUMN nodes-
456 ** with the same pLeft pointer to the pVector, but only one of them-
457 ** will own the pVector.-
458 */-
459 pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0);-
460 if( pRet ){
pRetDescription
TRUEevaluated 1903 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-1903
461 pRet->iColumn = iField;-
462 pRet->pLeft = pVector;-
463 }
executed 1903 times by 1 test: end of block
Executed by:
  • Self test (438)
1903
464 assert( pRet==0 || pRet->iTable==0 );-
465 }else{
executed 1903 times by 1 test: end of block
Executed by:
  • Self test (438)
1903
466 if( pVector->op==TK_VECTOR ) pVector = pVector->x.pList->a[iField].pExpr;
executed 5958 times by 1 test: pVector = pVector->x.pList->a[iField].pExpr;
Executed by:
  • Self test (438)
pVector->op==165Description
TRUEevaluated 5958 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-5958
467 pRet = sqlite3ExprDup(pParse->db, pVector, 0);-
468 }
executed 5959 times by 1 test: end of block
Executed by:
  • Self test (438)
5959
469 return pRet;
executed 7862 times by 1 test: return pRet;
Executed by:
  • Self test (438)
7862
470}-
471-
472/*-
473** If expression pExpr is of type TK_SELECT, generate code to evaluate-
474** it. Return the register in which the result is stored (or, if the -
475** sub-select returns more than one column, the first in an array-
476** of registers in which the result is stored).-
477**-
478** If pExpr is not a TK_SELECT expression, return 0.-
479*/-
480static int exprCodeSubselect(Parse *pParse, Expr *pExpr){-
481 int reg = 0;-
482#ifndef SQLITE_OMIT_SUBQUERY-
483 if( pExpr->op==TK_SELECT ){
pExpr->op==127Description
TRUEevaluated 1363 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4613 times by 1 test
Evaluated by:
  • Self test (438)
1363-4613
484 reg = sqlite3CodeSubselect(pParse, pExpr, 0, 0);-
485 }
executed 1363 times by 1 test: end of block
Executed by:
  • Self test (438)
1363
486#endif-
487 return reg;
executed 5976 times by 1 test: return reg;
Executed by:
  • Self test (438)
5976
488}-
489-
490/*-
491** Argument pVector points to a vector expression - either a TK_VECTOR-
492** or TK_SELECT that returns more than one column. This function returns-
493** the register number of a register that contains the value of-
494** element iField of the vector.-
495**-
496** If pVector is a TK_SELECT expression, then code for it must have -
497** already been generated using the exprCodeSubselect() routine. In this-
498** case parameter regSelect should be the first in an array of registers-
499** containing the results of the sub-select. -
500**-
501** If pVector is of type TK_VECTOR, then code for the requested field-
502** is generated. In this case (*pRegFree) may be set to the number of-
503** a temporary register to be freed by the caller before returning.-
504**-
505** Before returning, output parameter (*ppExpr) is set to point to the-
506** Expr object corresponding to element iElem of the vector.-
507*/-
508static int exprVectorRegister(-
509 Parse *pParse, /* Parse context */-
510 Expr *pVector, /* Vector to extract element from */-
511 int iField, /* Field to extract from pVector */-
512 int regSelect, /* First in array of registers */-
513 Expr **ppExpr, /* OUT: Expression element */-
514 int *pRegFree /* OUT: Temp register to free */-
515){-
516 u8 op = pVector->op;-
517 assert( op==TK_VECTOR || op==TK_REGISTER || op==TK_SELECT );-
518 if( op==TK_REGISTER ){
op==164Description
TRUEevaluated 61 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 17361 times by 1 test
Evaluated by:
  • Self test (438)
61-17361
519 *ppExpr = sqlite3VectorFieldSubexpr(pVector, iField);-
520 return pVector->iTable+iField;
executed 61 times by 1 test: return pVector->iTable+iField;
Executed by:
  • Self test (438)
61
521 }-
522 if( op==TK_SELECT ){
op==127Description
TRUEevaluated 3964 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 13397 times by 1 test
Evaluated by:
  • Self test (438)
3964-13397
523 *ppExpr = pVector->x.pSelect->pEList->a[iField].pExpr;-
524 return regSelect+iField;
executed 3964 times by 1 test: return regSelect+iField;
Executed by:
  • Self test (438)
3964
525 }-
526 *ppExpr = pVector->x.pList->a[iField].pExpr;-
527 return sqlite3ExprCodeTemp(pParse, *ppExpr, pRegFree);
executed 13397 times by 1 test: return sqlite3ExprCodeTemp(pParse, *ppExpr, pRegFree);
Executed by:
  • Self test (438)
13397
528}-
529-
530/*-
531** Expression pExpr is a comparison between two vector values. Compute-
532** the result of the comparison (1, 0, or NULL) and write that-
533** result into register dest.-
534**-
535** The caller must satisfy the following preconditions:-
536**-
537** if pExpr->op==TK_IS: op==TK_EQ and p5==SQLITE_NULLEQ-
538** if pExpr->op==TK_ISNOT: op==TK_NE and p5==SQLITE_NULLEQ-
539** otherwise: op==pExpr->op and p5==0-
540*/-
541static void codeVectorCompare(-
542 Parse *pParse, /* Code generator context */-
543 Expr *pExpr, /* The comparison operation */-
544 int dest, /* Write results into this register */-
545 u8 op, /* Comparison operator */-
546 u8 p5 /* SQLITE_NULLEQ or zero */-
547){-
548 Vdbe *v = pParse->pVdbe;-
549 Expr *pLeft = pExpr->pLeft;-
550 Expr *pRight = pExpr->pRight;-
551 int nLeft = sqlite3ExprVectorSize(pLeft);-
552 int i;-
553 int regLeft = 0;-
554 int regRight = 0;-
555 u8 opx = op;-
556 int addrDone = sqlite3VdbeMakeLabel(v);-
557-
558 if( nLeft!=sqlite3ExprVectorSize(pRight) ){
nLeft!=sqlite3...orSize(pRight)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2988 times by 1 test
Evaluated by:
  • Self test (438)
3-2988
559 sqlite3ErrorMsg(pParse, "row value misused");-
560 return;
executed 3 times by 1 test: return;
Executed by:
  • Self test (438)
3
561 }-
562 assert( pExpr->op==TK_EQ || pExpr->op==TK_NE -
563 || pExpr->op==TK_IS || pExpr->op==TK_ISNOT -
564 || pExpr->op==TK_LT || pExpr->op==TK_GT -
565 || pExpr->op==TK_LE || pExpr->op==TK_GE -
566 );-
567 assert( pExpr->op==op || (pExpr->op==TK_IS && op==TK_EQ)-
568 || (pExpr->op==TK_ISNOT && op==TK_NE) );-
569 assert( p5==0 || pExpr->op!=op );-
570 assert( p5==SQLITE_NULLEQ || pExpr->op==op );-
571-
572 p5 |= SQLITE_STOREP2;-
573 if( opx==TK_LE ) opx = TK_LT;
executed 704 times by 1 test: opx = 56;
Executed by:
  • Self test (438)
opx==55Description
TRUEevaluated 704 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2284 times by 1 test
Evaluated by:
  • Self test (438)
704-2284
574 if( opx==TK_GE ) opx = TK_GT;
executed 706 times by 1 test: opx = 54;
Executed by:
  • Self test (438)
opx==57Description
TRUEevaluated 706 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2282 times by 1 test
Evaluated by:
  • Self test (438)
706-2282
575-
576 regLeft = exprCodeSubselect(pParse, pLeft);-
577 regRight = exprCodeSubselect(pParse, pRight);-
578-
579 for(i=0; 1 /*Loop exits by "break"*/; i++){
1Description
TRUEevaluated 8711 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-8711
580 int regFree1 = 0, regFree2 = 0;-
581 Expr *pL, *pR; -
582 int r1, r2;-
583 assert( i>=0 && i<nLeft );-
584 r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, &regFree1);-
585 r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, &regFree2);-
586 codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5);-
587 testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);-
588 testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);-
589 testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);-
590 testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge);-
591 testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq);-
592 testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne);-
593 sqlite3ReleaseTempReg(pParse, regFree1);-
594 sqlite3ReleaseTempReg(pParse, regFree2);-
595 if( i==nLeft-1 ){
i==nLeft-1Description
TRUEevaluated 2988 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5723 times by 1 test
Evaluated by:
  • Self test (438)
2988-5723
596 break;
executed 2988 times by 1 test: break;
Executed by:
  • Self test (438)
2988
597 }-
598 if( opx==TK_EQ ){
opx==53Description
TRUEevaluated 168 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5555 times by 1 test
Evaluated by:
  • Self test (438)
168-5555
599 sqlite3VdbeAddOp2(v, OP_IfNot, dest, addrDone); VdbeCoverage(v);-
600 p5 |= SQLITE_KEEPNULL;-
601 }else if( opx==TK_NE ){
executed 168 times by 1 test: end of block
Executed by:
  • Self test (438)
opx==52Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5508 times by 1 test
Evaluated by:
  • Self test (438)
47-5508
602 sqlite3VdbeAddOp2(v, OP_If, dest, addrDone); VdbeCoverage(v);-
603 p5 |= SQLITE_KEEPNULL;-
604 }else{
executed 47 times by 1 test: end of block
Executed by:
  • Self test (438)
47
605 assert( op==TK_LT || op==TK_GT || op==TK_LE || op==TK_GE );-
606 sqlite3VdbeAddOp2(v, OP_ElseNotEq, 0, addrDone);-
607 VdbeCoverageIf(v, op==TK_LT);-
608 VdbeCoverageIf(v, op==TK_GT);-
609 VdbeCoverageIf(v, op==TK_LE);-
610 VdbeCoverageIf(v, op==TK_GE);-
611 if( i==nLeft-2 ) opx = op;
executed 2818 times by 1 test: opx = op;
Executed by:
  • Self test (438)
i==nLeft-2Description
TRUEevaluated 2818 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2690 times by 1 test
Evaluated by:
  • Self test (438)
2690-2818
612 }
executed 5508 times by 1 test: end of block
Executed by:
  • Self test (438)
5508
613 }-
614 sqlite3VdbeResolveLabel(v, addrDone);-
615}
executed 2988 times by 1 test: end of block
Executed by:
  • Self test (438)
2988
616-
617#if SQLITE_MAX_EXPR_DEPTH>0-
618/*-
619** Check that argument nHeight is less than or equal to the maximum-
620** expression depth allowed. If it is not, leave an error message in-
621** pParse.-
622*/-
623int sqlite3ExprCheckHeight(Parse *pParse, int nHeight){-
624 int rc = SQLITE_OK;-
625 int mxHeight = pParse->db->aLimit[SQLITE_LIMIT_EXPR_DEPTH];-
626 if( nHeight>mxHeight ){
nHeight>mxHeightDescription
TRUEnever evaluated
FALSEevaluated 2545654 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
0-2545654
627 sqlite3ErrorMsg(pParse, -
628 "Expression tree is too large (maximum depth %d)", mxHeight-
629 );-
630 rc = SQLITE_ERROR;-
631 }
never executed: end of block
0
632 return rc;
executed 2545654 times by 435 tests: return rc;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
2545654
633}-
634-
635/* The following three functions, heightOfExpr(), heightOfExprList()-
636** and heightOfSelect(), are used to determine the maximum height-
637** of any expression tree referenced by the structure passed as the-
638** first argument.-
639**-
640** If this maximum height is greater than the current value pointed-
641** to by pnHeight, the second parameter, then set *pnHeight to that-
642** value.-
643*/-
644static void heightOfExpr(Expr *p, int *pnHeight){-
645 if( p ){
pDescription
TRUEevaluated 1780705 times by 391 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
FALSEevaluated 1439632 times by 388 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • ...
1439632-1780705
646 if( p->nHeight>*pnHeight ){
p->nHeight>*pnHeightDescription
TRUEevaluated 956161 times by 391 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
FALSEevaluated 824544 times by 371 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
824544-956161
647 *pnHeight = p->nHeight;-
648 }
executed 956161 times by 391 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
956161
649 }
executed 1780705 times by 391 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
1780705
650}
executed 3220337 times by 392 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • ...
3220337
651static void heightOfExprList(ExprList *p, int *pnHeight){-
652 if( p ){
pDescription
TRUEevaluated 422185 times by 368 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 586593 times by 1 test
Evaluated by:
  • Self test (438)
422185-586593
653 int i;-
654 for(i=0; i<p->nExpr; i++){
i<p->nExprDescription
TRUEevaluated 524842 times by 368 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 422185 times by 368 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
422185-524842
655 heightOfExpr(p->a[i].pExpr, pnHeight);-
656 }
executed 524842 times by 368 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
524842
657 }
executed 422185 times by 368 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
422185
658}
executed 1008778 times by 368 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
1008778
659static void heightOfSelect(Select *pSelect, int *pnHeight){-
660 Select *p;-
661 for(p=pSelect; p; p=p->pPrior){
pDescription
TRUEevaluated 293973 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 90396 times by 1 test
Evaluated by:
  • Self test (438)
90396-293973
662 heightOfExpr(p->pWhere, pnHeight);-
663 heightOfExpr(p->pHaving, pnHeight);-
664 heightOfExpr(p->pLimit, pnHeight);-
665 heightOfExprList(p->pEList, pnHeight);-
666 heightOfExprList(p->pGroupBy, pnHeight);-
667 heightOfExprList(p->pOrderBy, pnHeight);-
668 }
executed 293973 times by 1 test: end of block
Executed by:
  • Self test (438)
293973
669}
executed 90396 times by 1 test: end of block
Executed by:
  • Self test (438)
90396
670-
671/*-
672** Set the Expr.nHeight variable in the structure passed as an -
673** argument. An expression with no children, Expr.pList or -
674** Expr.pSelect member has a height of 1. Any other expression-
675** has a height equal to the maximum height of any other -
676** referenced Expr plus one.-
677**-
678** Also propagate EP_Propagate flags up from Expr.x.pList to Expr.flags,-
679** if appropriate.-
680*/-
681static void exprSetHeight(Expr *p){-
682 int nHeight = 0;-
683 heightOfExpr(p->pLeft, &nHeight);-
684 heightOfExpr(p->pRight, &nHeight);-
685 if( ExprHasProperty(p, EP_xIsSelect) ){
(((p)->flags&(0x000800))!=0)Description
TRUEevaluated 19298 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 887490 times by 392 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • ...
19298-887490
686 heightOfSelect(p->x.pSelect, &nHeight);-
687 }else if( p->x.pList ){
executed 19298 times by 1 test: end of block
Executed by:
  • Self test (438)
p->x.pListDescription
TRUEevaluated 126859 times by 368 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 760631 times by 370 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • ...
19298-760631
688 heightOfExprList(p->x.pList, &nHeight);-
689 p->flags |= EP_Propagate & sqlite3ExprListFlags(p->x.pList);-
690 }
executed 126859 times by 368 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
126859
691 p->nHeight = nHeight + 1;-
692}
executed 906788 times by 392 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • ...
906788
693-
694/*-
695** Set the Expr.nHeight variable using the exprSetHeight() function. If-
696** the height is greater than the maximum allowed expression depth,-
697** leave an error in pParse.-
698**-
699** Also propagate all EP_Propagate flags from the Expr.x.pList into-
700** Expr.flags. -
701*/-
702void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){-
703 if( pParse->nErr ) return;
executed 3 times by 1 test: return;
Executed by:
  • Self test (438)
pParse->nErrDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 152604 times by 370 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
3-152604
704 exprSetHeight(p);-
705 sqlite3ExprCheckHeight(pParse, p->nHeight);-
706}
executed 152604 times by 370 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
152604
707-
708/*-
709** Return the maximum height of any expression tree referenced-
710** by the select statement passed as an argument.-
711*/-
712int sqlite3SelectExprHeight(Select *p){-
713 int nHeight = 0;-
714 heightOfSelect(p, &nHeight);-
715 return nHeight;
executed 71098 times by 1 test: return nHeight;
Executed by:
  • Self test (438)
71098
716}-
717#else /* ABOVE: Height enforcement enabled. BELOW: Height enforcement off */-
718/*-
719** Propagate all EP_Propagate flags from the Expr.x.pList into-
720** Expr.flags. -
721*/-
722void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){-
723 if( p && p->x.pList && !ExprHasProperty(p, EP_xIsSelect) ){-
724 p->flags |= EP_Propagate & sqlite3ExprListFlags(p->x.pList);-
725 }-
726}-
727#define exprSetHeight(y)-
728#endif /* SQLITE_MAX_EXPR_DEPTH>0 */-
729-
730/*-
731** This routine is the core allocator for Expr nodes.-
732**-
733** Construct a new expression node and return a pointer to it. Memory-
734** for this node and for the pToken argument is a single allocation-
735** obtained from sqlite3DbMalloc(). The calling function-
736** is responsible for making sure the node eventually gets freed.-
737**-
738** If dequote is true, then the token (if it exists) is dequoted.-
739** If dequote is false, no dequoting is performed. The deQuote-
740** parameter is ignored if pToken is NULL or if the token does not-
741** appear to be quoted. If the quotes were of the form "..." (double-quotes)-
742** then the EP_DblQuoted flag is set on the expression node.-
743**-
744** Special case: If op==TK_INTEGER and pToken points to a string that-
745** can be translated into a 32-bit integer, then the token is not-
746** stored in u.zToken. Instead, the integer values is written-
747** into u.iValue and the EP_IntValue flag is set. No extra storage-
748** is allocated to hold the integer text and the dequote flag is ignored.-
749*/-
750Expr *sqlite3ExprAlloc(-
751 sqlite3 *db, /* Handle for sqlite3DbMallocRawNN() */-
752 int op, /* Expression opcode */-
753 const Token *pToken, /* Token argument. Might be NULL */-
754 int dequote /* True to dequote */-
755){-
756 Expr *pNew;-
757 int nExtra = 0;-
758 int iValue = 0;-
759-
760 assert( db!=0 );-
761 if( pToken ){
pTokenDescription
TRUEevaluated 1581153 times by 424 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 79561 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
79561-1581153
762 if( op!=TK_INTEGER || pToken->z==0
op!=143Description
TRUEevaluated 778522 times by 417 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 802631 times by 395 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
pToken->z==0Description
TRUEevaluated 1154 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 801477 times by 395 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
1154-802631
763 || sqlite3GetInt32(pToken->z, &iValue)==0 ){
sqlite3GetInt3...z, &iValue)==0Description
TRUEevaluated 3278 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 798199 times by 395 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
3278-798199
764 nExtra = pToken->n+1;-
765 assert( iValue>=0 );-
766 }
executed 782954 times by 417 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
782954
767 }
executed 1581153 times by 424 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
1581153
768 pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra);-
769 if( pNew ){
pNewDescription
TRUEevaluated 1659951 times by 424 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 763 times by 1 test
Evaluated by:
  • Self test (438)
763-1659951
770 memset(pNew, 0, sizeof(Expr));-
771 pNew->op = (u8)op;-
772 pNew->iAgg = -1;-
773 if( pToken ){
pTokenDescription
TRUEevaluated 1580412 times by 424 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 79539 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
79539-1580412
774 if( nExtra==0 ){
nExtra==0Description
TRUEevaluated 798178 times by 395 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
FALSEevaluated 782234 times by 417 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
782234-798178
775 pNew->flags |= EP_IntValue|EP_Leaf;-
776 pNew->u.iValue = iValue;-
777 }else{
executed 798178 times by 395 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
798178
778 pNew->u.zToken = (char*)&pNew[1];-
779 assert( pToken->z!=0 || pToken->n==0 );-
780 if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
executed 750315 times by 412 tests: memcpy(pNew->u.zToken, pToken->z, pToken->n);
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
pToken->nDescription
TRUEevaluated 750315 times by 412 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 31919 times by 63 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (12)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (16)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (20)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • ...
31919-750315
781 pNew->u.zToken[pToken->n] = 0;-
782 if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
dequoteDescription
TRUEevaluated 302444 times by 370 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
FALSEevaluated 479790 times by 413 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • ...
(sqlite3CtypeM...ken[0])]&0x80)Description
TRUEevaluated 443 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 302001 times by 370 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
443-479790
783 if( pNew->u.zToken[0]=='"' ) pNew->flags |= EP_DblQuoted;
executed 235 times by 1 test: pNew->flags |= 0x000040;
Executed by:
  • Self test (438)
pNew->u.zToken[0]=='"'Description
TRUEevaluated 235 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 208 times by 1 test
Evaluated by:
  • Self test (438)
208-235
784 sqlite3Dequote(pNew->u.zToken);-
785 }
executed 443 times by 1 test: end of block
Executed by:
  • Self test (438)
443
786 }
executed 782234 times by 417 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
782234
787 }-
788#if SQLITE_MAX_EXPR_DEPTH>0-
789 pNew->nHeight = 1;-
790#endif -
791 }
executed 1659951 times by 424 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
1659951
792 return pNew;
executed 1660714 times by 424 tests: return pNew;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
1660714
793}-
794-
795/*-
796** Allocate a new expression node from a zero-terminated token that has-
797** already been dequoted.-
798*/-
799Expr *sqlite3Expr(-
800 sqlite3 *db, /* Handle for sqlite3DbMallocZero() (may be null) */-
801 int op, /* Expression opcode */-
802 const char *zToken /* Token argument. Might be NULL */-
803){-
804 Token x;-
805 x.z = zToken;-
806 x.n = sqlite3Strlen30(zToken);-
807 return sqlite3ExprAlloc(db, op, &x, 0);
executed 459932 times by 63 tests: return sqlite3ExprAlloc(db, op, &x, 0);
Executed by:
  • Self test
  • Self test (10)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (12)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (16)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (20)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • ...
459932
808}-
809-
810/*-
811** Attach subtrees pLeft and pRight to the Expr node pRoot.-
812**-
813** If pRoot==NULL that means that a memory allocation error has occurred.-
814** In that case, delete the subtrees pLeft and pRight.-
815*/-
816void sqlite3ExprAttachSubtrees(-
817 sqlite3 *db,-
818 Expr *pRoot,-
819 Expr *pLeft,-
820 Expr *pRight-
821){-
822 if( pRoot==0 ){
pRoot==0Description
TRUEevaluated 496 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 754184 times by 369 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
496-754184
823 assert( db->mallocFailed );-
824 sqlite3ExprDelete(db, pLeft);-
825 sqlite3ExprDelete(db, pRight);-
826 }else{
executed 496 times by 1 test: end of block
Executed by:
  • Self test (438)
496
827 if( pRight ){
pRightDescription
TRUEevaluated 567056 times by 369 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 187128 times by 33 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (30)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • ...
187128-567056
828 pRoot->pRight = pRight;-
829 pRoot->flags |= EP_Propagate & pRight->flags;-
830 }
executed 567056 times by 369 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
567056
831 if( pLeft ){
pLeftDescription
TRUEevaluated 662120 times by 369 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 92064 times by 33 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (30)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • ...
92064-662120
832 pRoot->pLeft = pLeft;-
833 pRoot->flags |= EP_Propagate & pLeft->flags;-
834 }
executed 662120 times by 369 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
662120
835 exprSetHeight(pRoot);-
836 }
executed 754184 times by 369 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
754184
837}-
838-
839/*-
840** Allocate an Expr node which joins as many as two subtrees.-
841**-
842** One or both of the subtrees can be NULL. Return a pointer to the new-
843** Expr node. Or, if an OOM error occurs, set pParse->db->mallocFailed,-
844** free the subtrees and return NULL.-
845*/-
846Expr *sqlite3PExpr(-
847 Parse *pParse, /* Parsing context */-
848 int op, /* Expression opcode */-
849 Expr *pLeft, /* Left operand */-
850 Expr *pRight /* Right operand */-
851){-
852 Expr *p;-
853 if( op==TK_AND && pParse->nErr==0 ){
op==44Description
TRUEevaluated 56784 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 689669 times by 369 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
pParse->nErr==0Description
TRUEevaluated 56783 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-689669
854 /* Take advantage of short-circuit false optimization for AND */-
855 p = sqlite3ExprAnd(pParse->db, pLeft, pRight);-
856 }else{
executed 56783 times by 31 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
56783
857 p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr));-
858 if( p ){
pDescription
TRUEevaluated 689196 times by 369 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 474 times by 1 test
Evaluated by:
  • Self test (438)
474-689196
859 memset(p, 0, sizeof(Expr));-
860 p->op = op & TKFLG_MASK;-
861 p->iAgg = -1;-
862 }
executed 689196 times by 369 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
689196
863 sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight);-
864 }
executed 689670 times by 369 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
689670
865 if( p ) {
pDescription
TRUEevaluated 745969 times by 369 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 484 times by 1 test
Evaluated by:
  • Self test (438)
484-745969
866 sqlite3ExprCheckHeight(pParse, p->nHeight);-
867 }
executed 745969 times by 369 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
745969
868 return p;
executed 746453 times by 369 tests: return p;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
746453
869}-
870-
871/*-
872** Add pSelect to the Expr.x.pSelect field. Or, if pExpr is NULL (due-
873** do a memory allocation failure) then delete the pSelect object.-
874*/-
875void sqlite3PExprAddSelect(Parse *pParse, Expr *pExpr, Select *pSelect){-
876 if( pExpr ){
pExprDescription
TRUEevaluated 19298 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-19298
877 pExpr->x.pSelect = pSelect;-
878 ExprSetProperty(pExpr, EP_xIsSelect|EP_Subquery);-
879 sqlite3ExprSetHeightAndFlags(pParse, pExpr);-
880 }else{
executed 19298 times by 1 test: end of block
Executed by:
  • Self test (438)
19298
881 assert( pParse->db->mallocFailed );-
882 sqlite3SelectDelete(pParse->db, pSelect);-
883 }
never executed: end of block
0
884}-
885-
886-
887/*-
888** If the expression is always either TRUE or FALSE (respectively),-
889** then return 1. If one cannot determine the truth value of the-
890** expression at compile-time return 0.-
891**-
892** This is an optimization. If is OK to return 0 here even if-
893** the expression really is always false or false (a false negative).-
894** But it is a bug to return 1 if the expression might have different-
895** boolean values in different circumstances (a false positive.)-
896**-
897** Note that if the expression is part of conditional for a-
898** LEFT JOIN, then we cannot determine at compile-time whether or not-
899** is it true or false, so always return 0.-
900*/-
901static int exprAlwaysTrue(Expr *p){-
902 int v = 0;-
903 if( ExprHasProperty(p, EP_FromJoin) ) return 0;
executed 19 times by 1 test: return 0;
Executed by:
  • Self test (438)
(((p)->flags&(0x000001))!=0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 20769 times by 6 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (47)
19-20769
904 if( !sqlite3ExprIsInteger(p, &v) ) return 0;
executed 20655 times by 6 tests: return 0;
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (47)
!sqlite3ExprIsInteger(p, &v)Description
TRUEevaluated 20655 times by 6 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (47)
FALSEevaluated 114 times by 1 test
Evaluated by:
  • Self test (438)
114-20655
905 return v!=0;
executed 114 times by 1 test: return v!=0;
Executed by:
  • Self test (438)
114
906}-
907static int exprAlwaysFalse(Expr *p){-
908 int v = 0;-
909 if( ExprHasProperty(p, EP_FromJoin) ) return 0;
executed 319 times by 1 test: return 0;
Executed by:
  • Self test (438)
(((p)->flags&(0x000001))!=0)Description
TRUEevaluated 319 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 140660 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
319-140660
910 if( !sqlite3ExprIsInteger(p, &v) ) return 0;
executed 137039 times by 31 tests: return 0;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
!sqlite3ExprIsInteger(p, &v)Description
TRUEevaluated 137039 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 3621 times by 1 test
Evaluated by:
  • Self test (438)
3621-137039
911 return v==0;
executed 3621 times by 1 test: return v==0;
Executed by:
  • Self test (438)
3621
912}-
913-
914/*-
915** Join two expressions using an AND operator. If either expression is-
916** NULL, then just return the other expression.-
917**-
918** If one side or the other of the AND is known to be false, then instead-
919** of returning an AND expression, just return a constant expression with-
920** a value of false.-
921*/-
922Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){-
923 if( pLeft==0 ){
pLeft==0Description
TRUEevaluated 35959 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (47)
FALSEevaluated 61025 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
35959-61025
924 return pRight;
executed 35959 times by 2 tests: return pRight;
Executed by:
  • Self test (438)
  • Self test (47)
35959
925 }else if( pRight==0 ){
pRight==0Description
TRUEevaluated 689 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 60336 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
689-60336
926 return pLeft;
executed 689 times by 1 test: return pLeft;
Executed by:
  • Self test (438)
689
927 }else if( exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight) ){
exprAlwaysFalse(pLeft)Description
TRUEevaluated 564 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 59772 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
exprAlwaysFalse(pRight)Description
TRUEevaluated 358 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 59414 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
358-59772
928 sqlite3ExprDelete(db, pLeft);-
929 sqlite3ExprDelete(db, pRight);-
930 return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0);
executed 922 times by 1 test: return sqlite3ExprAlloc(db, 143, &sqlite3IntTokens[0], 0);
Executed by:
  • Self test (438)
922
931 }else{-
932 Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0);-
933 sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight);-
934 return pNew;
executed 59414 times by 31 tests: return pNew;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
59414
935 }-
936}-
937-
938/*-
939** Construct a new expression node for a function with multiple-
940** arguments.-
941*/-
942Expr *sqlite3ExprFunction(-
943 Parse *pParse, /* Parsing context */-
944 ExprList *pList, /* Argument list */-
945 Token *pToken, /* Name of the function */-
946 int eDistinct /* SF_Distinct or SF_ALL or 0 */-
947){-
948 Expr *pNew;-
949 sqlite3 *db = pParse->db;-
950 assert( pToken );-
951 pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1);-
952 if( pNew==0 ){
pNew==0Description
TRUEnever evaluated
FALSEevaluated 116918 times by 370 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
0-116918
953 sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */-
954 return 0;
never executed: return 0;
0
955 }-
956 if( pList && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
pListDescription
TRUEevaluated 110471 times by 368 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 6447 times by 4 tests
Evaluated by:
  • Self test (103)
  • Self test (104)
  • Self test (34)
  • Self test (438)
pList->nExpr >...>db->aLimit[6]Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 110470 times by 368 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
1-110471
957 sqlite3ErrorMsg(pParse, "too many arguments on function %T", pToken);-
958 }
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
1
959 pNew->x.pList = pList;-
960 ExprSetProperty(pNew, EP_HasFunc);-
961 assert( !ExprHasProperty(pNew, EP_xIsSelect) );-
962 sqlite3ExprSetHeightAndFlags(pParse, pNew);-
963 if( eDistinct==SF_Distinct ) ExprSetProperty(pNew, EP_Distinct);
executed 3354 times by 1 test: (pNew)->flags|=(0x000010);
Executed by:
  • Self test (438)
eDistinct==0x00001Description
TRUEevaluated 3354 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 113564 times by 370 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
3354-113564
964 return pNew;
executed 116918 times by 370 tests: return pNew;
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
116918
965}-
966-
967/*-
968** Assign a variable number to an expression that encodes a wildcard-
969** in the original SQL statement. -
970**-
971** Wildcards consisting of a single "?" are assigned the next sequential-
972** variable number.-
973**-
974** Wildcards of the form "?nnn" are assigned the number "nnn". We make-
975** sure "nnn" is not too big to avoid a denial of service attack when-
976** the SQL statement comes from an external source.-
977**-
978** Wildcards of the form ":aaa", "@aaa", or "$aaa" are assigned the same number-
979** as the previous instance of the same wildcard. Or if this is the first-
980** instance of the wildcard, the next sequential variable number is-
981** assigned.-
982*/-
983void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n){-
984 sqlite3 *db = pParse->db;-
985 const char *z;-
986 ynVar x;-
987-
988 if( pExpr==0 ) return;
executed 10 times by 1 test: return;
Executed by:
  • Self test (438)
pExpr==0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 51997 times by 1 test
Evaluated by:
  • Self test (438)
10-51997
989 assert( !ExprHasProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) );-
990 z = pExpr->u.zToken;-
991 assert( z!=0 );-
992 assert( z[0]!=0 );-
993 assert( n==(u32)sqlite3Strlen30(z) );-
994 if( z[1]==0 ){
z[1]==0Description
TRUEevaluated 19010 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 32987 times by 1 test
Evaluated by:
  • Self test (438)
19010-32987
995 /* Wildcard of the form "?". Assign the next variable number */-
996 assert( z[0]=='?' );-
997 x = (ynVar)(++pParse->nVar);-
998 }else{
executed 19010 times by 1 test: end of block
Executed by:
  • Self test (438)
19010
999 int doAdd = 0;-
1000 if( z[0]=='?' ){
z[0]=='?'Description
TRUEevaluated 2327 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 30660 times by 1 test
Evaluated by:
  • Self test (438)
2327-30660
1001 /* Wildcard of the form "?nnn". Convert "nnn" to an integer and-
1002 ** use it as the variable number */-
1003 i64 i;-
1004 int bOk;-
1005 if( n==2 ){ /*OPTIMIZATION-IF-TRUE*/
n==2Description
TRUEevaluated 2299 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 28 times by 1 test
Evaluated by:
  • Self test (438)
28-2299
1006 i = z[1]-'0'; /* The common case of ?N for a single digit N */-
1007 bOk = 1;-
1008 }else{
executed 2299 times by 1 test: end of block
Executed by:
  • Self test (438)
2299
1009 bOk = 0==sqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8);-
1010 }
executed 28 times by 1 test: end of block
Executed by:
  • Self test (438)
28
1011 testcase( i==0 );-
1012 testcase( i==1 );-
1013 testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 );-
1014 testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] );-
1015 if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
bOk==0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2322 times by 1 test
Evaluated by:
  • Self test (438)
i<1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2320 times by 1 test
Evaluated by:
  • Self test (438)
i>db->aLimit[9]Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2313 times by 1 test
Evaluated by:
  • Self test (438)
2-2322
1016 sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",-
1017 db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);-
1018 return;
executed 14 times by 1 test: return;
Executed by:
  • Self test (438)
14
1019 }-
1020 x = (ynVar)i;-
1021 if( x>pParse->nVar ){
x>pParse->nVarDescription
TRUEevaluated 2285 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 28 times by 1 test
Evaluated by:
  • Self test (438)
28-2285
1022 pParse->nVar = (int)x;-
1023 doAdd = 1;-
1024 }else if( sqlite3VListNumToName(pParse->pVList, x)==0 ){
executed 2285 times by 1 test: end of block
Executed by:
  • Self test (438)
sqlite3VListNu...>pVList, x)==0Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
12-2285
1025 doAdd = 1;-
1026 }
executed 12 times by 1 test: end of block
Executed by:
  • Self test (438)
12
1027 }else{
executed 2313 times by 1 test: end of block
Executed by:
  • Self test (438)
2313
1028 /* Wildcards like ":aaa", "$aaa" or "@aaa". Reuse the same variable-
1029 ** number as the prior appearance of the same name, or if the name-
1030 ** has never appeared before, reuse the same variable number-
1031 */-
1032 x = (ynVar)sqlite3VListNameToNum(pParse->pVList, z, n);-
1033 if( x==0 ){
x==0Description
TRUEevaluated 30350 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 310 times by 1 test
Evaluated by:
  • Self test (438)
310-30350
1034 x = (ynVar)(++pParse->nVar);-
1035 doAdd = 1;-
1036 }
executed 30350 times by 1 test: end of block
Executed by:
  • Self test (438)
30350
1037 }
executed 30660 times by 1 test: end of block
Executed by:
  • Self test (438)
30660
1038 if( doAdd ){
doAddDescription
TRUEevaluated 32647 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 326 times by 1 test
Evaluated by:
  • Self test (438)
326-32647
1039 pParse->pVList = sqlite3VListAdd(db, pParse->pVList, z, n, x);-
1040 }
executed 32647 times by 1 test: end of block
Executed by:
  • Self test (438)
32647
1041 }
executed 32973 times by 1 test: end of block
Executed by:
  • Self test (438)
32973
1042 pExpr->iColumn = x;-
1043 if( x>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
x>db->aLimit[9]Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 51977 times by 1 test
Evaluated by:
  • Self test (438)
6-51977
1044 sqlite3ErrorMsg(pParse, "too many SQL variables");-
1045 }
executed 6 times by 1 test: end of block
Executed by:
  • Self test (438)
6
1046}
executed 51983 times by 1 test: end of block
Executed by:
  • Self test (438)
51983
1047-
1048/*-
1049** Recursively delete an expression tree.-
1050*/-
1051static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){-
1052 assert( p!=0 );-
1053 /* Sanity check: Assert that the IntValue is non-negative if it exists */-
1054 assert( !ExprHasProperty(p, EP_IntValue) || p->u.iValue>=0 );-
1055-
1056 assert( !ExprHasProperty(p, EP_WinFunc) || p->y.pWin!=0 || db->mallocFailed );-
1057 assert( p->op!=TK_FUNCTION || ExprHasProperty(p, EP_TokenOnly|EP_Reduced)-
1058 || p->y.pWin==0 || ExprHasProperty(p, EP_WinFunc) );-
1059#ifdef SQLITE_DEBUG-
1060 if( ExprHasProperty(p, EP_Leaf) && !ExprHasProperty(p, EP_TokenOnly) ){-
1061 assert( p->pLeft==0 );-
1062 assert( p->pRight==0 );-
1063 assert( p->x.pSelect==0 );-
1064 }-
1065#endif-
1066 if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){
!(((p)->flags&...x800000)))!=0)Description
TRUEevaluated 1959260 times by 412 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 2964256 times by 435 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
1959260-2964256
1067 /* The Expr.x union is never used at the same time as Expr.pRight */-
1068 assert( p->x.pList==0 || p->pRight==0 );-
1069 if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);
executed 922421 times by 369 tests: sqlite3ExprDeleteNN(db, p->pLeft);
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
p->pLeftDescription
TRUEevaluated 924360 times by 369 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 1034900 times by 411 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
p->op!=166Description
TRUEevaluated 922421 times by 369 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 1939 times by 1 test
Evaluated by:
  • Self test (438)
1939-1034900
1070 if( p->pRight ){
p->pRightDescription
TRUEevaluated 781879 times by 369 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 1177381 times by 411 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
781879-1177381
1071 sqlite3ExprDeleteNN(db, p->pRight);-
1072 }else if( ExprHasProperty(p, EP_xIsSelect) ){
executed 781879 times by 369 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
(((p)->flags&(0x000800))!=0)Description
TRUEevaluated 23370 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1154011 times by 411 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
23370-1154011
1073 sqlite3SelectDelete(db, p->x.pSelect);-
1074 }else{
executed 23370 times by 1 test: end of block
Executed by:
  • Self test (438)
23370
1075 sqlite3ExprListDelete(db, p->x.pList);-
1076 }
executed 1154011 times by 411 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
1154011
1077 if( ExprHasProperty(p, EP_WinFunc) ){
(((p)->flags&(0x1000000))!=0)Description
TRUEevaluated 2197 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1957063 times by 412 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
2197-1957063
1078 assert( p->op==TK_FUNCTION );-
1079 sqlite3WindowDelete(db, p->y.pWin);-
1080 }
executed 2197 times by 1 test: end of block
Executed by:
  • Self test (438)
2197
1081 }
executed 1959260 times by 412 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
1959260
1082 if( ExprHasProperty(p, EP_MemToken) ) sqlite3DbFree(db, p->u.zToken);
executed 14387 times by 2 tests: sqlite3DbFree(db, p->u.zToken);
Executed by:
  • Self test (438)
  • Self test (47)
(((p)->flags&(0x010000))!=0)Description
TRUEevaluated 14387 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (47)
FALSEevaluated 4909129 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
14387-4909129
1083 if( !ExprHasProperty(p, EP_Static) ){
!(((p)->flags&(0x008000))!=0)Description
TRUEevaluated 4849016 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 74500 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (47)
74500-4849016
1084 sqlite3DbFreeNN(db, p);-
1085 }
executed 4849016 times by 436 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
4849016
1086}
executed 4923516 times by 436 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
4923516
1087void sqlite3ExprDelete(sqlite3 *db, Expr *p){-
1088 if( p ) sqlite3ExprDeleteNN(db, p);
executed 3219216 times by 436 tests: sqlite3ExprDeleteNN(db, p);
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
pDescription
TRUEevaluated 3219216 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
FALSEevaluated 6705638 times by 436 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
3219216-6705638
1089}
executed 9924854 times by 436 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
9924854
1090-
1091/*-
1092** Return the number of bytes allocated for the expression structure -
1093** passed as the first argument. This is always one of EXPR_FULLSIZE,-
1094** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE.-
1095*/-
1096static int exprStructSize(Expr *p){-
1097 if( ExprHasProperty(p, EP_TokenOnly) ) return EXPR_TOKENONLYSIZE;
executed 723253 times by 2 tests: return __builtin_offsetof ( Expr , pLeft ) ;
Executed by:
  • Self test (438)
  • Self test (47)
(((p)->flags&(0x004000))!=0)Description
TRUEevaluated 723253 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (47)
FALSEevaluated 880438 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
723253-880438
1098 if( ExprHasProperty(p, EP_Reduced) ) return EXPR_REDUCEDSIZE;
executed 198236 times by 1 test: return __builtin_offsetof ( Expr , iTable ) ;
Executed by:
  • Self test (438)
(((p)->flags&(0x002000))!=0)Description
TRUEevaluated 198236 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 682202 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
198236-682202
1099 return EXPR_FULLSIZE;
executed 682202 times by 389 tests: return sizeof(Expr);
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
682202
1100}-
1101-
1102/*-
1103** The dupedExpr*Size() routines each return the number of bytes required-
1104** to store a copy of an expression or expression tree. They differ in-
1105** how much of the tree is measured.-
1106**-
1107** dupedExprStructSize() Size of only the Expr structure -
1108** dupedExprNodeSize() Size of Expr + space for token-
1109** dupedExprSize() Expr + token + subtree components-
1110**-
1111***************************************************************************-
1112**-
1113** The dupedExprStructSize() function returns two values OR-ed together: -
1114** (1) the space required for a copy of the Expr structure only and -
1115** (2) the EP_xxx flags that indicate what the structure size should be.-
1116** The return values is always one of:-
1117**-
1118** EXPR_FULLSIZE-
1119** EXPR_REDUCEDSIZE | EP_Reduced-
1120** EXPR_TOKENONLYSIZE | EP_TokenOnly-
1121**-
1122** The size of the structure can be found by masking the return value-
1123** of this routine with 0xfff. The flags can be found by masking the-
1124** return value with EP_Reduced|EP_TokenOnly.-
1125**-
1126** Note that with flags==EXPRDUP_REDUCE, this routines works on full-size-
1127** (unreduced) Expr objects as they or originally constructed by the parser.-
1128** During expression analysis, extra information is computed and moved into-
1129** later parts of the Expr object and that extra information might get chopped-
1130** off if the expression is reduced. Note also that it does not work to-
1131** make an EXPRDUP_REDUCE copy of a reduced expression. It is only legal-
1132** to reduce a pristine expression tree from the parser. The implementation-
1133** of dupedExprStructSize() contain multiple assert() statements that attempt-
1134** to enforce this constraint.-
1135*/-
1136static int dupedExprStructSize(Expr *p, int flags){-
1137 int nSize;-
1138 assert( flags==EXPRDUP_REDUCE || flags==0 ); /* Only one flag value allowed */-
1139 assert( EXPR_FULLSIZE<=0xfff );-
1140 assert( (0xfff & (EP_Reduced|EP_TokenOnly))==0 );-
1141 if( 0==flags || p->op==TK_SELECT_COLUMN
0==flagsDescription
TRUEevaluated 3207870 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
FALSEevaluated 295169 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
p->op==166Description
TRUEevaluated 44 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 295125 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
44-3207870
1142#ifndef SQLITE_OMIT_WINDOWFUNC-
1143 || ExprHasProperty(p, EP_WinFunc)
(((p)->flags&(0x1000000))!=0)Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 295085 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
40-295085
1144#endif-
1145 ){-
1146 nSize = EXPR_FULLSIZE;-
1147 }else{
executed 3207954 times by 389 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
3207954
1148 assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) );-
1149 assert( !ExprHasProperty(p, EP_FromJoin) ); -
1150 assert( !ExprHasProperty(p, EP_MemToken) );-
1151 assert( !ExprHasProperty(p, EP_NoReduce) );-
1152 if( p->pLeft || p->x.pList ){
p->pLeftDescription
TRUEevaluated 91440 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 203645 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
p->x.pListDescription
TRUEevaluated 8606 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 195039 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
8606-203645
1153 nSize = EXPR_REDUCEDSIZE | EP_Reduced;-
1154 }else{
executed 100046 times by 1 test: end of block
Executed by:
  • Self test (438)
100046
1155 assert( p->pRight==0 );-
1156 nSize = EXPR_TOKENONLYSIZE | EP_TokenOnly;-
1157 }
executed 195039 times by 7 tests: end of block
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
195039
1158 }-
1159 return nSize;
executed 3503039 times by 389 tests: return nSize;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
3503039
1160}-
1161-
1162/*-
1163** This function returns the space in bytes required to store the copy -
1164** of the Expr structure and a copy of the Expr.u.zToken string (if that-
1165** string is defined.)-
1166*/-
1167static int dupedExprNodeSize(Expr *p, int flags){-
1168 int nByte = dupedExprStructSize(p, flags) & 0xfff;-
1169 if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){
!(((p)->flags&(0x000400))!=0)Description
TRUEevaluated 1387750 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 413205 times by 373 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
p->u.zTokenDescription
TRUEevaluated 990669 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 397081 times by 1 test
Evaluated by:
  • Self test (438)
397081-1387750
1170 nByte += sqlite3Strlen30(p->u.zToken)+1;-
1171 }
executed 990669 times by 31 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
990669
1172 return ROUND8(nByte);
executed 1800955 times by 389 tests: return (((nByte)+7)&~7);
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
1800955
1173}-
1174-
1175/*-
1176** Return the number of bytes required to create a duplicate of the -
1177** expression passed as the first argument. The second argument is a-
1178** mask containing EXPRDUP_XXX flags.-
1179**-
1180** The value returned includes space to create a copy of the Expr struct-
1181** itself and the buffer referred to by Expr.u.zToken, if any.-
1182**-
1183** If the EXPRDUP_REDUCE flag is set, then the return value includes -
1184** space to duplicate all Expr nodes in the tree formed by Expr.pLeft -
1185** and Expr.pRight variables (but not for any structures pointed to or -
1186** descended from the Expr.x.pList or Expr.x.pSelect variables).-
1187*/-
1188static int dupedExprSize(Expr *p, int flags){-
1189 int nByte = 0;-
1190 if( p ){
pDescription
TRUEevaluated 1702604 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
FALSEevaluated 139562 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
139562-1702604
1191 nByte = dupedExprNodeSize(p, flags);-
1192 if( flags&EXPRDUP_REDUCE ){
flags&0x0001Description
TRUEevaluated 98425 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
FALSEevaluated 1604179 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
98425-1604179
1193 nByte += dupedExprSize(p->pLeft, flags) + dupedExprSize(p->pRight, flags);-
1194 }
executed 98425 times by 7 tests: end of block
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
98425
1195 }
executed 1702604 times by 389 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
1702604
1196 return nByte;
executed 1842166 times by 389 tests: return nByte;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
1842166
1197}-
1198-
1199/*-
1200** This function is similar to sqlite3ExprDup(), except that if pzBuffer -
1201** is not NULL then *pzBuffer is assumed to point to a buffer large enough -
1202** to store the copy of expression p, the copies of p->u.zToken-
1203** (if applicable), and the copies of the p->pLeft and p->pRight expressions,-
1204** if any. Before returning, *pzBuffer is set to the first byte past the-
1205** portion of the buffer copied into by this function.-
1206*/-
1207static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){-
1208 Expr *pNew; /* Value to return */-
1209 u8 *zAlloc; /* Memory space from which to build Expr object */-
1210 u32 staticFlag; /* EP_Static if space not obtained from malloc */-
1211-
1212 assert( db!=0 );-
1213 assert( p );-
1214 assert( dupFlags==0 || dupFlags==EXPRDUP_REDUCE );-
1215 assert( pzBuffer==0 || dupFlags==EXPRDUP_REDUCE );-
1216-
1217 /* Figure out where to write the new Expr structure. */-
1218 if( pzBuffer ){
pzBufferDescription
TRUEevaluated 57256 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1645316 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
57256-1645316
1219 zAlloc = *pzBuffer;-
1220 staticFlag = EP_Static;-
1221 }else{
executed 57256 times by 1 test: end of block
Executed by:
  • Self test (438)
57256
1222 zAlloc = sqlite3DbMallocRawNN(db, dupedExprSize(p, dupFlags));-
1223 staticFlag = 0;-
1224 }
executed 1645316 times by 389 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
1645316
1225 pNew = (Expr *)zAlloc;-
1226-
1227 if( pNew ){
pNewDescription
TRUEevaluated 1702084 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
FALSEevaluated 488 times by 1 test
Evaluated by:
  • Self test (438)
488-1702084
1228 /* Set nNewSize to the size allocated for the structure pointed to-
1229 ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or-
1230 ** EXPR_TOKENONLYSIZE. nToken is set to the number of bytes consumed-
1231 ** by the copy of the p->u.zToken string (if any).-
1232 */-
1233 const unsigned nStructSize = dupedExprStructSize(p, dupFlags);-
1234 const int nNewSize = nStructSize & 0xfff;-
1235 int nToken;-
1236 if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){
!(((p)->flags&(0x000400))!=0)Description
TRUEevaluated 1295173 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 406911 times by 373 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
p->u.zTokenDescription
TRUEevaluated 926715 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 368458 times by 1 test
Evaluated by:
  • Self test (438)
368458-1295173
1237 nToken = sqlite3Strlen30(p->u.zToken) + 1;-
1238 }else{
executed 926715 times by 31 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
926715
1239 nToken = 0;-
1240 }
executed 775369 times by 373 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
775369
1241 if( dupFlags ){
dupFlagsDescription
TRUEevaluated 98393 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
FALSEevaluated 1603691 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
98393-1603691
1242 assert( ExprHasProperty(p, EP_Reduced)==0 );-
1243 memcpy(zAlloc, p, nNewSize);-
1244 }else{
executed 98393 times by 7 tests: end of block
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
98393
1245 u32 nSize = (u32)exprStructSize(p);-
1246 memcpy(zAlloc, p, nSize);-
1247 if( nSize<EXPR_FULLSIZE ){
nSize<sizeof(Expr)Description
TRUEevaluated 921489 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (47)
FALSEevaluated 682202 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
682202-921489
1248 memset(&zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);-
1249 }
executed 921489 times by 2 tests: end of block
Executed by:
  • Self test (438)
  • Self test (47)
921489
1250 }
executed 1603691 times by 389 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
1603691
1251-
1252 /* Set the EP_Reduced, EP_TokenOnly, and EP_Static flags appropriately. */-
1253 pNew->flags &= ~(EP_Reduced|EP_TokenOnly|EP_Static|EP_MemToken);-
1254 pNew->flags |= nStructSize & (EP_Reduced|EP_TokenOnly);-
1255 pNew->flags |= staticFlag;-
1256-
1257 /* Copy the p->u.zToken string, if any. */-
1258 if( nToken ){
nTokenDescription
TRUEevaluated 926715 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 775369 times by 373 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
775369-926715
1259 char *zToken = pNew->u.zToken = (char*)&zAlloc[nNewSize];-
1260 memcpy(zToken, p->u.zToken, nToken);-
1261 }
executed 926715 times by 31 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
926715
1262-
1263 if( 0==((p->flags|pNew->flags) & (EP_TokenOnly|EP_Leaf)) ){
0==((p->flags|...000|0x800000))Description
TRUEevaluated 388472 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1313612 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
388472-1313612
1264 /* Fill in the pNew->x.pSelect or pNew->x.pList member. */-
1265 if( ExprHasProperty(p, EP_xIsSelect) ){
(((p)->flags&(0x000800))!=0)Description
TRUEevaluated 4072 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 384400 times by 1 test
Evaluated by:
  • Self test (438)
4072-384400
1266 pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, dupFlags);-
1267 }else{
executed 4072 times by 1 test: end of block
Executed by:
  • Self test (438)
4072
1268 pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, dupFlags);-
1269 }
executed 384400 times by 1 test: end of block
Executed by:
  • Self test (438)
384400
1270 }-
1271-
1272 /* Fill in pNew->pLeft and pNew->pRight. */-
1273 if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly) ){
(((pNew)->flag...0x004000))!=0)Description
TRUEevaluated 98351 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
FALSEevaluated 1603733 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
98351-1603733
1274 zAlloc += dupedExprNodeSize(p, dupFlags);-
1275 if( !ExprHasProperty(pNew, EP_TokenOnly|EP_Leaf) ){
!(((pNew)->fla...0x800000))!=0)Description
TRUEevaluated 33338 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 65013 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
33338-65013
1276 pNew->pLeft = p->pLeft ?
p->pLeftDescription
TRUEevaluated 30480 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2858 times by 1 test
Evaluated by:
  • Self test (438)
2858-30480
1277 exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc) : 0;-
1278 pNew->pRight = p->pRight ?
p->pRightDescription
TRUEevaluated 26776 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6562 times by 1 test
Evaluated by:
  • Self test (438)
6562-26776
1279 exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc) : 0;-
1280 }
executed 33338 times by 1 test: end of block
Executed by:
  • Self test (438)
33338
1281 if( pzBuffer ){
pzBufferDescription
TRUEevaluated 57256 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 41095 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
41095-57256
1282 *pzBuffer = zAlloc;-
1283 }
executed 57256 times by 1 test: end of block
Executed by:
  • Self test (438)
57256
1284 }else{
executed 98351 times by 7 tests: end of block
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
98351
1285#ifndef SQLITE_OMIT_WINDOWFUNC-
1286 if( ExprHasProperty(p, EP_WinFunc) ){
(((p)->flags&(0x1000000))!=0)Description
TRUEevaluated 228 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1603505 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
228-1603505
1287 pNew->y.pWin = sqlite3WindowDup(db, pNew, p->y.pWin);-
1288 assert( ExprHasProperty(pNew, EP_WinFunc) );-
1289 }
executed 228 times by 1 test: end of block
Executed by:
  • Self test (438)
228
1290#endif /* SQLITE_OMIT_WINDOWFUNC */-
1291 if( !ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){
!(((p)->flags&...0x800000))!=0)Description
TRUEevaluated 355134 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1248599 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
355134-1248599
1292 if( pNew->op==TK_SELECT_COLUMN ){
pNew->op==166Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 355098 times by 1 test
Evaluated by:
  • Self test (438)
36-355098
1293 pNew->pLeft = p->pLeft;-
1294 assert( p->iColumn==0 || p->pRight==0 );-
1295 assert( p->pRight==0 || p->pRight==p->pLeft );-
1296 }else{
executed 36 times by 1 test: end of block
Executed by:
  • Self test (438)
36
1297 pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0);-
1298 }
executed 355098 times by 1 test: end of block
Executed by:
  • Self test (438)
355098
1299 pNew->pRight = sqlite3ExprDup(db, p->pRight, 0);-
1300 }
executed 355134 times by 1 test: end of block
Executed by:
  • Self test (438)
355134
1301 }
executed 1603733 times by 389 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
1603733
1302 }-
1303 return pNew;
executed 1702572 times by 389 tests: return pNew;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
1702572
1304}-
1305-
1306/*-
1307** Create and return a deep copy of the object passed as the second -
1308** argument. If an OOM condition is encountered, NULL is returned-
1309** and the db->mallocFailed flag set.-
1310*/-
1311#ifndef SQLITE_OMIT_CTE-
1312static With *withDup(sqlite3 *db, With *p){-
1313 With *pRet = 0;-
1314 if( p ){
pDescription
TRUEevaluated 415 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 523252 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
415-523252
1315 int nByte = sizeof(*p) + sizeof(p->a[0]) * (p->nCte-1);-
1316 pRet = sqlite3DbMallocZero(db, nByte);-
1317 if( pRet ){
pRetDescription
TRUEevaluated 405 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
10-405
1318 int i;-
1319 pRet->nCte = p->nCte;-
1320 for(i=0; i<p->nCte; i++){
i<p->nCteDescription
TRUEevaluated 424 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 405 times by 1 test
Evaluated by:
  • Self test (438)
405-424
1321 pRet->a[i].pSelect = sqlite3SelectDup(db, p->a[i].pSelect, 0);-
1322 pRet->a[i].pCols = sqlite3ExprListDup(db, p->a[i].pCols, 0);-
1323 pRet->a[i].zName = sqlite3DbStrDup(db, p->a[i].zName);-
1324 }
executed 424 times by 1 test: end of block
Executed by:
  • Self test (438)
424
1325 }
executed 405 times by 1 test: end of block
Executed by:
  • Self test (438)
405
1326 }
executed 415 times by 1 test: end of block
Executed by:
  • Self test (438)
415
1327 return pRet;
executed 523667 times by 7 tests: return pRet;
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
523667
1328}-
1329#else-
1330# define withDup(x,y) 0-
1331#endif-
1332-
1333/*-
1334** The following group of routines make deep copies of expressions,-
1335** expression lists, ID lists, and select statements. The copies can-
1336** be deleted (by being passed to their respective ...Delete() routines)-
1337** without effecting the originals.-
1338**-
1339** The expression list, ID, and source lists return by sqlite3ExprListDup(),-
1340** sqlite3IdListDup(), and sqlite3SrcListDup() can not be further expanded -
1341** by subsequent calls to sqlite*ListAppend() routines.-
1342**-
1343** Any tables that the SrcList might point to are not duplicated.-
1344**-
1345** The flags parameter contains a combination of the EXPRDUP_XXX flags.-
1346** If the EXPRDUP_REDUCE flag is set, then the structure returned is a-
1347** truncated version of the usual Expr structure that will be stored as-
1348** part of the in-memory representation of the database schema.-
1349*/-
1350Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){-
1351 assert( flags==0 || flags==EXPRDUP_REDUCE );-
1352 return p ? exprDup(db, p, flags, 0) : 0;
executed 3870031 times by 389 tests: return p ? exprDup(db, p, flags, 0) : 0;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
pDescription
TRUEevaluated 1645316 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
FALSEevaluated 2224715 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
1645316-3870031
1353}-
1354ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags){-
1355 ExprList *pNew;-
1356 struct ExprList_item *pItem, *pOldItem;-
1357 int i;-
1358 Expr *pPriorSelectCol = 0;-
1359 assert( db!=0 );-
1360 if( p==0 ) return 0;
executed 1409359 times by 7 tests: return 0;
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
p==0Description
TRUEevaluated 1409359 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
FALSEevaluated 560564 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
560564-1409359
1361 pNew = sqlite3DbMallocRawNN(db, sqlite3DbMallocSize(db, p));-
1362 if( pNew==0 ) return 0;
executed 24 times by 1 test: return 0;
Executed by:
  • Self test (438)
pNew==0Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 560540 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
24-560540
1363 pNew->nExpr = p->nExpr;-
1364 pItem = pNew->a;-
1365 pOldItem = p->a;-
1366 for(i=0; i<p->nExpr; i++, pItem++, pOldItem++){
i<p->nExprDescription
TRUEevaluated 621843 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
FALSEevaluated 560540 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
560540-621843
1367 Expr *pOldExpr = pOldItem->pExpr;-
1368 Expr *pNewExpr;-
1369 pItem->pExpr = sqlite3ExprDup(db, pOldExpr, flags);-
1370 if( pOldExpr
pOldExprDescription
TRUEevaluated 621746 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
FALSEevaluated 97 times by 1 test
Evaluated by:
  • Self test (438)
97-621746
1371 && pOldExpr->op==TK_SELECT_COLUMN
pOldExpr->op==166Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 621710 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
36-621710
1372 && (pNewExpr = pItem->pExpr)!=0
(pNewExpr = pItem->pExpr)!=0Description
TRUEevaluated 36 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-36
1373 ){-
1374 assert( pNewExpr->iColumn==0 || i>0 );-
1375 if( pNewExpr->iColumn==0 ){
pNewExpr->iColumn==0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 20 times by 1 test
Evaluated by:
  • Self test (438)
16-20
1376 assert( pOldExpr->pLeft==pOldExpr->pRight );-
1377 pPriorSelectCol = pNewExpr->pLeft = pNewExpr->pRight;-
1378 }else{
executed 16 times by 1 test: end of block
Executed by:
  • Self test (438)
16
1379 assert( i>0 );-
1380 assert( pItem[-1].pExpr!=0 );-
1381 assert( pNewExpr->iColumn==pItem[-1].pExpr->iColumn+1 );-
1382 assert( pPriorSelectCol==pItem[-1].pExpr->pLeft );-
1383 pNewExpr->pLeft = pPriorSelectCol;-
1384 }
executed 20 times by 1 test: end of block
Executed by:
  • Self test (438)
20
1385 }-
1386 pItem->zName = sqlite3DbStrDup(db, pOldItem->zName);-
1387 pItem->zSpan = sqlite3DbStrDup(db, pOldItem->zSpan);-
1388 pItem->sortOrder = pOldItem->sortOrder;-
1389 pItem->done = 0;-
1390 pItem->bSpanIsTab = pOldItem->bSpanIsTab;-
1391 pItem->bSorterRef = pOldItem->bSorterRef;-
1392 pItem->u = pOldItem->u;-
1393 }
executed 621843 times by 7 tests: end of block
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
621843
1394 return pNew;
executed 560540 times by 7 tests: return pNew;
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
560540
1395}-
1396-
1397/*-
1398** If cursors, triggers, views and subqueries are all omitted from-
1399** the build, then none of the following routines, except for -
1400** sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes-
1401** called with a NULL argument.-
1402*/-
1403#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) \-
1404 || !defined(SQLITE_OMIT_SUBQUERY)-
1405SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){-
1406 SrcList *pNew;-
1407 int i;-
1408 int nByte;-
1409 assert( db!=0 );-
1410 if( p==0 ) return 0;
executed 256 times by 1 test: return 0;
Executed by:
  • Self test (438)
p==0Description
TRUEevaluated 256 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 523501 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
256-523501
1411 nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);
p->nSrc>0Description
TRUEevaluated 507457 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
FALSEevaluated 16044 times by 1 test
Evaluated by:
  • Self test (438)
16044-507457
1412 pNew = sqlite3DbMallocRawNN(db, nByte );-
1413 if( pNew==0 ) return 0;
executed 138 times by 1 test: return 0;
Executed by:
  • Self test (438)
pNew==0Description
TRUEevaluated 138 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 523363 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
138-523363
1414 pNew->nSrc = pNew->nAlloc = p->nSrc;-
1415 for(i=0; i<p->nSrc; i++){
i<p->nSrcDescription
TRUEevaluated 510514 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
FALSEevaluated 523363 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
510514-523363
1416 struct SrcList_item *pNewItem = &pNew->a[i];-
1417 struct SrcList_item *pOldItem = &p->a[i];-
1418 Table *pTab;-
1419 pNewItem->pSchema = pOldItem->pSchema;-
1420 pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase);-
1421 pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);-
1422 pNewItem->zAlias = sqlite3DbStrDup(db, pOldItem->zAlias);-
1423 pNewItem->fg = pOldItem->fg;-
1424 pNewItem->iCursor = pOldItem->iCursor;-
1425 pNewItem->addrFillSub = pOldItem->addrFillSub;-
1426 pNewItem->regReturn = pOldItem->regReturn;-
1427 if( pNewItem->fg.isIndexedBy ){
pNewItem->fg.isIndexedByDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 510506 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (438)
  • Self test (47)
8-510506
1428 pNewItem->u1.zIndexedBy = sqlite3DbStrDup(db, pOldItem->u1.zIndexedBy);-
1429 }
executed