OpenCoverage

vdbeaux.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/sqlite/src/src/vdbeaux.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2** 2003 September 6-
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 code used for creating, destroying, and populating-
13** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) -
14*/-
15#include "sqliteInt.h"-
16#include "vdbeInt.h"-
17-
18/*-
19** Create a new virtual database engine.-
20*/-
21Vdbe *sqlite3VdbeCreate(Parse *pParse){-
22 sqlite3 *db = pParse->db;-
23 Vdbe *p;-
24 p = sqlite3DbMallocRawNN(db, sizeof(Vdbe) );-
25 if( p==0 ) return 0;
executed 147 times by 1 test: return 0;
Executed by:
  • Self test (438)
p==0Description
TRUEevaluated 147 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 460917 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)
  • ...
147-460917
26 memset(&p->aOp, 0, sizeof(Vdbe)-offsetof(Vdbe,aOp));-
27 p->db = db;-
28 if( db->pVdbe ){
db->pVdbeDescription
TRUEevaluated 397281 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 63636 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)
  • ...
63636-397281
29 db->pVdbe->pPrev = p;-
30 }
executed 397281 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)
  • ...
397281
31 p->pNext = db->pVdbe;-
32 p->pPrev = 0;-
33 db->pVdbe = p;-
34 p->magic = VDBE_MAGIC_INIT;-
35 p->pParse = pParse;-
36 pParse->pVdbe = p;-
37 assert( pParse->aLabel==0 );-
38 assert( pParse->nLabel==0 );-
39 assert( pParse->nOpAlloc==0 );-
40 assert( pParse->szOpAlloc==0 );-
41 sqlite3VdbeAddOp2(p, OP_Init, 0, 1);-
42 return p;
executed 460917 times by 436 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)
  • ...
460917
43}-
44-
45/*-
46** Change the error string stored in Vdbe.zErrMsg-
47*/-
48void sqlite3VdbeError(Vdbe *p, const char *zFormat, ...){-
49 va_list ap;-
50 sqlite3DbFree(p->db, p->zErrMsg);-
51 va_start(ap, zFormat);-
52 p->zErrMsg = sqlite3VMPrintf(p->db, zFormat, ap);-
53 va_end(ap);-
54}
executed 4498 times by 3 tests: end of block
Executed by:
  • Self test (35)
  • Self test (39)
  • Self test (438)
4498
55-
56/*-
57** Remember the SQL string for a prepared statement.-
58*/-
59void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, u8 prepFlags){-
60 if( p==0 ) return;
executed 44481 times by 51 tests: return;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (15)
  • Self test (19)
  • Self test (23)
  • Self test (26)
  • Self test (27)
  • Self test (29)
  • Self test (30)
  • Self test (31)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (38)
  • Self test (39)
  • Self test (41)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • ...
p==0Description
TRUEevaluated 44481 times by 51 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (15)
  • Self test (19)
  • Self test (23)
  • Self test (26)
  • Self test (27)
  • Self test (29)
  • Self test (30)
  • Self test (31)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (38)
  • Self test (39)
  • Self test (41)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • ...
FALSEevaluated 310972 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)
  • ...
44481-310972
61 p->prepFlags = prepFlags;-
62 if( (prepFlags & SQLITE_PREPARE_SAVESQL)==0 ){
(prepFlags & 0x80)==0Description
TRUEevaluated 8930 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (63)
FALSEevaluated 302042 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)
  • ...
8930-302042
63 p->expmask = 0;-
64 }
executed 8930 times by 2 tests: end of block
Executed by:
  • Self test (438)
  • Self test (63)
8930
65 assert( p->zSql==0 );-
66 p->zSql = sqlite3DbStrNDup(p->db, z, n);-
67}
executed 310972 times by 435 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)
  • ...
310972
68-
69/*-
70** Swap all content between two VDBE structures.-
71*/-
72void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){-
73 Vdbe tmp, *pTmp;-
74 char *zTmp;-
75 assert( pA->db==pB->db );-
76 tmp = *pA;-
77 *pA = *pB;-
78 *pB = tmp;-
79 pTmp = pA->pNext;-
80 pA->pNext = pB->pNext;-
81 pB->pNext = pTmp;-
82 pTmp = pA->pPrev;-
83 pA->pPrev = pB->pPrev;-
84 pB->pPrev = pTmp;-
85 zTmp = pA->zSql;-
86 pA->zSql = pB->zSql;-
87 pB->zSql = zTmp;-
88 pB->expmask = pA->expmask;-
89 pB->prepFlags = pA->prepFlags;-
90 memcpy(pB->aCounter, pA->aCounter, sizeof(pB->aCounter));-
91 pB->aCounter[SQLITE_STMTSTATUS_REPREPARE]++;-
92}
executed 23594 times by 11 tests: end of block
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (30)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (53)
  • Self test (84)
23594
93-
94/*-
95** Resize the Vdbe.aOp array so that it is at least nOp elements larger -
96** than its current size. nOp is guaranteed to be less than or equal-
97** to 1024/sizeof(Op).-
98**-
99** If an out-of-memory error occurs while resizing the array, return-
100** SQLITE_NOMEM. In this case Vdbe.aOp and Parse.nOpAlloc remain -
101** unchanged (this is so that any opcodes already allocated can be -
102** correctly deallocated along with the rest of the Vdbe).-
103*/-
104static int growOpArray(Vdbe *v, int nOp){-
105 VdbeOp *pNew;-
106 Parse *p = v->pParse;-
107-
108 /* The SQLITE_TEST_REALLOC_STRESS compile-time option is designed to force-
109 ** more frequent reallocs and hence provide more opportunities for -
110 ** simulated OOM faults. SQLITE_TEST_REALLOC_STRESS is generally used-
111 ** during testing only. With SQLITE_TEST_REALLOC_STRESS grow the op array-
112 ** by the minimum* amount required until the size reaches 512. Normal-
113 ** operation (without SQLITE_TEST_REALLOC_STRESS) is to double the current-
114 ** size of the op array or add 1KB of space, whichever is smaller. */-
115#ifdef SQLITE_TEST_REALLOC_STRESS-
116 int nNew = (p->nOpAlloc>=512 ? p->nOpAlloc*2 : p->nOpAlloc+nOp);-
117#else-
118 int nNew = (p->nOpAlloc ? p->nOpAlloc*2 : (int)(1024/sizeof(Op)));
p->nOpAllocDescription
TRUEevaluated 28240 times by 15 tests
Evaluated by:
  • Self test
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (57)
  • Self test (58)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
FALSEevaluated 460972 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)
  • ...
28240-460972
119 UNUSED_PARAMETER(nOp);-
120#endif-
121-
122 /* Ensure that the size of a VDBE does not grow too large */-
123 if( nNew > p->db->aLimit[SQLITE_LIMIT_VDBE_OP] ){
nNew > p->db->aLimit[5]Description
TRUEnever evaluated
FALSEevaluated 489212 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)
  • ...
0-489212
124 sqlite3OomFault(p->db);-
125 return SQLITE_NOMEM;
never executed: return 7;
0
126 }-
127-
128 assert( nOp<=(1024/sizeof(Op)) );-
129 assert( nNew>=(p->nOpAlloc+nOp) );-
130 pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op));-
131 if( pNew ){
pNewDescription
TRUEevaluated 489080 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 132 times by 1 test
Evaluated by:
  • Self test (438)
132-489080
132 p->szOpAlloc = sqlite3DbMallocSize(p->db, pNew);-
133 p->nOpAlloc = p->szOpAlloc/sizeof(Op);-
134 v->aOp = pNew;-
135 }
executed 489080 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)
  • ...
489080
136 return (pNew ? SQLITE_OK : SQLITE_NOMEM_BKPT);
executed 489212 times by 436 tests: return (pNew ? 0 : 7);
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)
  • ...
pNewDescription
TRUEevaluated 489080 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 132 times by 1 test
Evaluated by:
  • Self test (438)
132-489212
137}-
138-
139#ifdef SQLITE_DEBUG-
140/* This routine is just a convenient place to set a breakpoint that will-
141** fire after each opcode is inserted and displayed using-
142** "PRAGMA vdbe_addoptrace=on".-
143*/-
144static void test_addop_breakpoint(void){-
145 static int n = 0;-
146 n++;-
147}-
148#endif-
149-
150/*-
151** Add a new instruction to the list of instructions current in the-
152** VDBE. Return the address of the new instruction.-
153**-
154** Parameters:-
155**-
156** p Pointer to the VDBE-
157**-
158** op The opcode for this instruction-
159**-
160** p1, p2, p3 Operands-
161**-
162** Use the sqlite3VdbeResolveLabel() function to fix an address and-
163** the sqlite3VdbeChangeP4() function to change the value of the P4-
164** operand.-
165*/-
166static SQLITE_NOINLINE int growOp3(Vdbe *p, int op, int p1, int p2, int p3){-
167 assert( p->pParse->nOpAlloc<=p->nOp );-
168 if( growOpArray(p, 1) ) return 1;
executed 132 times by 1 test: return 1;
Executed by:
  • Self test (438)
growOpArray(p, 1)Description
TRUEevaluated 132 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 485817 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)
  • ...
132-485817
169 assert( p->pParse->nOpAlloc>p->nOp );-
170 return sqlite3VdbeAddOp3(p, op, p1, p2, p3);
executed 485817 times by 436 tests: return sqlite3VdbeAddOp3(p, op, p1, p2, p3);
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)
  • ...
485817
171}-
172int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){-
173 int i;-
174 VdbeOp *pOp;-
175-
176 i = p->nOp;-
177 assert( p->magic==VDBE_MAGIC_INIT );-
178 assert( op>=0 && op<0xff );-
179 if( p->pParse->nOpAlloc<=i ){
p->pParse->nOpAlloc<=iDescription
TRUEevaluated 485949 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 7622186 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)
  • ...
485949-7622186
180 return growOp3(p, op, p1, p2, p3);
executed 485949 times by 436 tests: return growOp3(p, op, p1, p2, p3);
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)
  • ...
485949
181 }-
182 p->nOp++;-
183 pOp = &p->aOp[i];-
184 pOp->opcode = (u8)op;-
185 pOp->p5 = 0;-
186 pOp->p1 = p1;-
187 pOp->p2 = p2;-
188 pOp->p3 = p3;-
189 pOp->p4.p = 0;-
190 pOp->p4type = P4_NOTUSED;-
191#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS-
192 pOp->zComment = 0;-
193#endif-
194#ifdef SQLITE_DEBUG-
195 if( p->db->flags & SQLITE_VdbeAddopTrace ){-
196 sqlite3VdbePrintOp(0, i, &p->aOp[i]);-
197 test_addop_breakpoint();-
198 }-
199#endif-
200#ifdef VDBE_PROFILE-
201 pOp->cycles = 0;-
202 pOp->cnt = 0;-
203#endif-
204#ifdef SQLITE_VDBE_COVERAGE-
205 pOp->iSrcLine = 0;-
206#endif-
207 return i;
executed 7622186 times by 436 tests: return i;
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)
  • ...
7622186
208}-
209int sqlite3VdbeAddOp0(Vdbe *p, int op){-
210 return sqlite3VdbeAddOp3(p, op, 0, 0, 0);
executed 549402 times by 436 tests: return sqlite3VdbeAddOp3(p, op, 0, 0, 0);
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)
  • ...
549402
211}-
212int sqlite3VdbeAddOp1(Vdbe *p, int op, int p1){-
213 return sqlite3VdbeAddOp3(p, op, p1, 0, 0);
executed 316103 times by 55 tests: return sqlite3VdbeAddOp3(p, op, p1, 0, 0);
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • 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 (4)
  • Self test (42)
  • Self test (43)
  • Self test (438)
  • Self test (44)
  • Self test (45)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (5)
  • ...
316103
214}-
215int sqlite3VdbeAddOp2(Vdbe *p, int op, int p1, int p2){-
216 return sqlite3VdbeAddOp3(p, op, p1, p2, 0);
executed 2509223 times by 436 tests: return sqlite3VdbeAddOp3(p, op, p1, p2, 0);
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)
  • ...
2509223
217}-
218-
219/* Generate code for an unconditional jump to instruction iDest-
220*/-
221int sqlite3VdbeGoto(Vdbe *p, int iDest){-
222 return sqlite3VdbeAddOp3(p, OP_Goto, 0, iDest, 0);
executed 345007 times by 435 tests: return sqlite3VdbeAddOp3(p, 11, 0, iDest, 0);
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)
  • ...
345007
223}-
224-
225/* Generate code to cause the string zStr to be loaded into-
226** register iDest-
227*/-
228int sqlite3VdbeLoadString(Vdbe *p, int iDest, const char *zStr){-
229 return sqlite3VdbeAddOp4(p, OP_String8, 0, iDest, 0, zStr, 0);
executed 276181 times by 58 tests: return sqlite3VdbeAddOp4(p, 106, 0, iDest, 0, zStr, 0);
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (30)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (38)
  • Self test (39)
  • Self test (4)
  • Self test (42)
  • Self test (43)
  • Self test (438)
  • Self test (44)
  • Self test (45)
  • Self test (46)
  • Self test (47)
  • ...
276181
230}-
231-
232/*-
233** Generate code that initializes multiple registers to string or integer-
234** constants. The registers begin with iDest and increase consecutively.-
235** One register is initialized for each characgter in zTypes[]. For each-
236** "s" character in zTypes[], the register is a string if the argument is-
237** not NULL, or OP_Null if the value is a null pointer. For each "i" character-
238** in zTypes[], the register is initialized to an integer.-
239**-
240** If the input string does not end with "X" then an OP_ResultRow instruction-
241** is generated for the values inserted.-
242*/-
243void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){-
244 va_list ap;-
245 int i;-
246 char c;-
247 va_start(ap, zTypes);-
248 for(i=0; (c = zTypes[i])!=0; i++){
(c = zTypes[i])!=0Description
TRUEevaluated 112658 times by 2 tests
Evaluated by:
  • Self test (35)
  • Self test (438)
FALSEevaluated 18670 times by 2 tests
Evaluated by:
  • Self test (35)
  • Self test (438)
18670-112658
249 if( c=='s' ){
c=='s'Description
TRUEevaluated 56187 times by 2 tests
Evaluated by:
  • Self test (35)
  • Self test (438)
FALSEevaluated 56471 times by 1 test
Evaluated by:
  • Self test (438)
56187-56471
250 const char *z = va_arg(ap, const char*);-
251 sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest+i, 0, z, 0);-
252 }else if( c=='i' ){
executed 56187 times by 2 tests: end of block
Executed by:
  • Self test (35)
  • Self test (438)
c=='i'Description
TRUEevaluated 55260 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1211 times by 1 test
Evaluated by:
  • Self test (438)
1211-56187
253 sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest+i);-
254 }else{
executed 55260 times by 1 test: end of block
Executed by:
  • Self test (438)
55260
255 goto skip_op_resultrow;
executed 1211 times by 1 test: goto skip_op_resultrow;
Executed by:
  • Self test (438)
1211
256 }-
257 }-
258 sqlite3VdbeAddOp2(p, OP_ResultRow, iDest, i);-
259skip_op_resultrow:
code before this statement executed 18670 times by 2 tests: skip_op_resultrow:
Executed by:
  • Self test (35)
  • Self test (438)
18670
260 va_end(ap);-
261}
executed 19881 times by 2 tests: end of block
Executed by:
  • Self test (35)
  • Self test (438)
19881
262-
263/*-
264** Add an opcode that includes the p4 value as a pointer.-
265*/-
266int sqlite3VdbeAddOp4(-
267 Vdbe *p, /* Add the opcode to this VM */-
268 int op, /* The new opcode */-
269 int p1, /* The P1 operand */-
270 int p2, /* The P2 operand */-
271 int p3, /* The P3 operand */-
272 const char *zP4, /* The P4 operand */-
273 int p4type /* P4 operand type */-
274){-
275 int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3);-
276 sqlite3VdbeChangeP4(p, addr, zP4, p4type);-
277 return addr;
executed 924268 times by 435 tests: return addr;
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)
  • ...
924268
278}-
279-
280/*-
281** Add an opcode that includes the p4 value with a P4_INT64 or-
282** P4_REAL type.-
283*/-
284int sqlite3VdbeAddOp4Dup8(-
285 Vdbe *p, /* Add the opcode to this VM */-
286 int op, /* The new opcode */-
287 int p1, /* The P1 operand */-
288 int p2, /* The P2 operand */-
289 int p3, /* The P3 operand */-
290 const u8 *zP4, /* The P4 operand */-
291 int p4type /* P4 operand type */-
292){-
293 char *p4copy = sqlite3DbMallocRawNN(sqlite3VdbeDb(p), 8);-
294 if( p4copy ) memcpy(p4copy, zP4, 8);
executed 39071 times by 4 tests: memcpy(p4copy, zP4, 8);
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
p4copyDescription
TRUEevaluated 39071 times by 4 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
4-39071
295 return sqlite3VdbeAddOp4(p, op, p1, p2, p3, p4copy, p4type);
executed 39075 times by 4 tests: return sqlite3VdbeAddOp4(p, op, p1, p2, p3, p4copy, p4type);
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
39075
296}-
297-
298#ifndef SQLITE_OMIT_EXPLAIN-
299/*-
300** Return the address of the current EXPLAIN QUERY PLAN baseline.-
301** 0 means "none".-
302*/-
303int sqlite3VdbeExplainParent(Parse *pParse){-
304 VdbeOp *pOp;-
305 if( pParse->addrExplain==0 ) return 0;
executed 355675 times by 436 tests: return 0;
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)
  • ...
pParse->addrExplain==0Description
TRUEevaluated 355675 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 146 times by 1 test
Evaluated by:
  • Self test (438)
146-355675
306 pOp = sqlite3VdbeGetOp(pParse->pVdbe, pParse->addrExplain);-
307 return pOp->p2;
executed 146 times by 1 test: return pOp->p2;
Executed by:
  • Self test (438)
146
308}-
309-
310/*-
311** Add a new OP_Explain opcode.-
312**-
313** If the bPush flag is true, then make this opcode the parent for-
314** subsequent Explains until sqlite3VdbeExplainPop() is called.-
315*/-
316void sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){-
317 if( pParse->explain==2 ){
pParse->explain==2Description
TRUEevaluated 349 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 252322 times by 1 test
Evaluated by:
  • Self test (438)
349-252322
318 char *zMsg;-
319 Vdbe *v;-
320 va_list ap;-
321 int iThis;-
322 va_start(ap, zFmt);-
323 zMsg = sqlite3VMPrintf(pParse->db, zFmt, ap);-
324 va_end(ap);-
325 v = pParse->pVdbe;-
326 iThis = v->nOp;-
327 sqlite3VdbeAddOp4(v, OP_Explain, iThis, pParse->addrExplain, 0,-
328 zMsg, P4_DYNAMIC);-
329 if( bPush) pParse->addrExplain = iThis;
executed 146 times by 1 test: pParse->addrExplain = iThis;
Executed by:
  • Self test (438)
bPushDescription
TRUEevaluated 146 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 203 times by 1 test
Evaluated by:
  • Self test (438)
146-203
330 }
executed 349 times by 1 test: end of block
Executed by:
  • Self test (438)
349
331}
executed 252671 times by 1 test: end of block
Executed by:
  • Self test (438)
252671
332-
333/*-
334** Pop the EXPLAIN QUERY PLAN stack one level.-
335*/-
336void sqlite3VdbeExplainPop(Parse *pParse){-
337 pParse->addrExplain = sqlite3VdbeExplainParent(pParse);-
338}
executed 355821 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)
  • ...
355821
339#endif /* SQLITE_OMIT_EXPLAIN */-
340-
341/*-
342** Add an OP_ParseSchema opcode. This routine is broken out from-
343** sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees-
344** as having been used.-
345**-
346** The zWhere string must have been obtained from sqlite3_malloc().-
347** This routine will take ownership of the allocated memory.-
348*/-
349void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){-
350 int j;-
351 sqlite3VdbeAddOp4(p, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC);-
352 for(j=0; j<p->db->nDb; j++) sqlite3VdbeUsesBtree(p, j);
executed 63132 times by 33 tests: sqlite3VdbeUsesBtree(p, j);
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 (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)
  • ...
j<p->db->nDbDescription
TRUEevaluated 63132 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)
  • ...
FALSEevaluated 28073 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)
  • ...
28073-63132
353}
executed 28073 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 (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)
  • ...
28073
354-
355/*-
356** Add an opcode that includes the p4 value as an integer.-
357*/-
358int sqlite3VdbeAddOp4Int(-
359 Vdbe *p, /* Add the opcode to this VM */-
360 int op, /* The new opcode */-
361 int p1, /* The P1 operand */-
362 int p2, /* The P2 operand */-
363 int p3, /* The P3 operand */-
364 int p4 /* The P4 operand as an integer */-
365){-
366 int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3);-
367 if( p->db->mallocFailed==0 ){
p->db->mallocFailed==0Description
TRUEevaluated 804632 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 77 times by 1 test
Evaluated by:
  • Self test (438)
77-804632
368 VdbeOp *pOp = &p->aOp[addr];-
369 pOp->p4type = P4_INT32;-
370 pOp->p4.i = p4;-
371 }
executed 804632 times by 435 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)
  • ...
804632
372 return addr;
executed 804709 times by 435 tests: return addr;
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)
  • ...
804709
373}-
374-
375/* Insert the end of a co-routine-
376*/-
377void sqlite3VdbeEndCoroutine(Vdbe *v, int regYield){-
378 sqlite3VdbeAddOp1(v, OP_EndCoroutine, regYield);-
379-
380 /* Clear the temporary register cache, thereby ensuring that each-
381 ** co-routine has its own independent set of registers, because co-routines-
382 ** might expect their registers to be preserved across an OP_Yield, and-
383 ** that could cause problems if two or more co-routines are using the same-
384 ** temporary register.-
385 */-
386 v->pParse->nTempReg = 0;-
387 v->pParse->nRangeReg = 0;-
388}
executed 40271 times by 9 tests: end of block
Executed by:
  • Self test
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (57)
  • Self test (58)
  • Self test (64)
40271
389-
390/*-
391** Create a new symbolic label for an instruction that has yet to be-
392** coded. The symbolic label is really just a negative number. The-
393** label can be used as the P2 value of an operation. Later, when-
394** the label is resolved to a specific address, the VDBE will scan-
395** through its operation list and change all values of P2 which match-
396** the label into the resolved address.-
397**-
398** The VDBE knows that a P2 value is a label because labels are-
399** always negative and P2 values are suppose to be non-negative.-
400** Hence, a negative P2 value is a label that has yet to be resolved.-
401**-
402** Zero is returned if a malloc() fails.-
403*/-
404int sqlite3VdbeMakeLabel(Vdbe *v){-
405 Parse *p = v->pParse;-
406 int i = p->nLabel++;-
407 assert( v->magic==VDBE_MAGIC_INIT );-
408 if( (i & (i-1))==0 ){
(i & (i-1))==0Description
TRUEevaluated 764898 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 762131 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)
  • ...
762131-764898
409 p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel, -
410 (i*2+1)*sizeof(p->aLabel[0]));-
411 }
executed 764898 times by 435 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)
  • ...
764898
412 if( p->aLabel ){
p->aLabelDescription
TRUEevaluated 1526672 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 357 times by 1 test
Evaluated by:
  • Self test (438)
357-1526672
413 p->aLabel[i] = -1;-
414 }
executed 1526672 times by 435 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)
  • ...
1526672
415 return ADDR(i);
executed 1527029 times by 435 tests: return (-1-(i));
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)
  • ...
1527029
416}-
417-
418/*-
419** Resolve label "x" to be the address of the next instruction to-
420** be inserted. The parameter "x" must have been obtained from-
421** a prior call to sqlite3VdbeMakeLabel().-
422*/-
423void sqlite3VdbeResolveLabel(Vdbe *v, int x){-
424 Parse *p = v->pParse;-
425 int j = ADDR(x);-
426 assert( v->magic==VDBE_MAGIC_INIT );-
427 assert( j<p->nLabel );-
428 assert( j>=0 );-
429 if( p->aLabel ){
p->aLabelDescription
TRUEevaluated 1521950 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 98 times by 1 test
Evaluated by:
  • Self test (438)
98-1521950
430#ifdef SQLITE_DEBUG-
431 if( p->db->flags & SQLITE_VdbeAddopTrace ){-
432 printf("RESOLVE LABEL %d to %d\n", x, v->nOp);-
433 }-
434#endif-
435 assert( p->aLabel[j]==(-1) ); /* Labels may only be resolved once */-
436 p->aLabel[j] = v->nOp;-
437 }
executed 1521950 times by 435 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)
  • ...
1521950
438}
executed 1522048 times by 435 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)
  • ...
1522048
439-
440/*-
441** Mark the VDBE as one that can only be run one time.-
442*/-
443void sqlite3VdbeRunOnlyOnce(Vdbe *p){-
444 p->runOnlyOnce = 1;-
445}
executed 35849 times by 52 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
35849
446-
447/*-
448** Mark the VDBE as one that can only be run multiple times.-
449*/-
450void sqlite3VdbeReusable(Vdbe *p){-
451 p->runOnlyOnce = 0;-
452}
executed 57 times by 1 test: end of block
Executed by:
  • Self test (438)
57
453-
454#ifdef SQLITE_DEBUG /* sqlite3AssertMayAbort() logic */-
455-
456/*-
457** The following type and function are used to iterate through all opcodes-
458** in a Vdbe main program and each of the sub-programs (triggers) it may -
459** invoke directly or indirectly. It should be used as follows:-
460**-
461** Op *pOp;-
462** VdbeOpIter sIter;-
463**-
464** memset(&sIter, 0, sizeof(sIter));-
465** sIter.v = v; // v is of type Vdbe* -
466** while( (pOp = opIterNext(&sIter)) ){-
467** // Do something with pOp-
468** }-
469** sqlite3DbFree(v->db, sIter.apSub);-
470** -
471*/-
472typedef struct VdbeOpIter VdbeOpIter;-
473struct VdbeOpIter {-
474 Vdbe *v; /* Vdbe to iterate through the opcodes of */-
475 SubProgram **apSub; /* Array of subprograms */-
476 int nSub; /* Number of entries in apSub */-
477 int iAddr; /* Address of next instruction to return */-
478 int iSub; /* 0 = main program, 1 = first sub-program etc. */-
479};-
480static Op *opIterNext(VdbeOpIter *p){-
481 Vdbe *v = p->v;-
482 Op *pRet = 0;-
483 Op *aOp;-
484 int nOp;-
485-
486 if( p->iSub<=p->nSub ){-
487-
488 if( p->iSub==0 ){-
489 aOp = v->aOp;-
490 nOp = v->nOp;-
491 }else{-
492 aOp = p->apSub[p->iSub-1]->aOp;-
493 nOp = p->apSub[p->iSub-1]->nOp;-
494 }-
495 assert( p->iAddr<nOp );-
496-
497 pRet = &aOp[p->iAddr];-
498 p->iAddr++;-
499 if( p->iAddr==nOp ){-
500 p->iSub++;-
501 p->iAddr = 0;-
502 }-
503 -
504 if( pRet->p4type==P4_SUBPROGRAM ){-
505 int nByte = (p->nSub+1)*sizeof(SubProgram*);-
506 int j;-
507 for(j=0; j<p->nSub; j++){-
508 if( p->apSub[j]==pRet->p4.pProgram ) break;-
509 }-
510 if( j==p->nSub ){-
511 p->apSub = sqlite3DbReallocOrFree(v->db, p->apSub, nByte);-
512 if( !p->apSub ){-
513 pRet = 0;-
514 }else{-
515 p->apSub[p->nSub++] = pRet->p4.pProgram;-
516 }-
517 }-
518 }-
519 }-
520-
521 return pRet;-
522}-
523-
524/*-
525** Check if the program stored in the VM associated with pParse may-
526** throw an ABORT exception (causing the statement, but not entire transaction-
527** to be rolled back). This condition is true if the main program or any-
528** sub-programs contains any of the following:-
529**-
530** * OP_Halt with P1=SQLITE_CONSTRAINT and P2=OE_Abort.-
531** * OP_HaltIfNull with P1=SQLITE_CONSTRAINT and P2=OE_Abort.-
532** * OP_Destroy-
533** * OP_VUpdate-
534** * OP_VRename-
535** * OP_FkCounter with P2==0 (immediate foreign key constraint)-
536** * OP_CreateBtree/BTREE_INTKEY and OP_InitCoroutine -
537** (for CREATE TABLE AS SELECT ...)-
538**-
539** Then check that the value of Parse.mayAbort is true if an-
540** ABORT may be thrown, or false otherwise. Return true if it does-
541** match, or false otherwise. This function is intended to be used as-
542** part of an assert statement in the compiler. Similar to:-
543**-
544** assert( sqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) );-
545*/-
546int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){-
547 int hasAbort = 0;-
548 int hasFkCounter = 0;-
549 int hasCreateTable = 0;-
550 int hasInitCoroutine = 0;-
551 Op *pOp;-
552 VdbeOpIter sIter;-
553 memset(&sIter, 0, sizeof(sIter));-
554 sIter.v = v;-
555-
556 while( (pOp = opIterNext(&sIter))!=0 ){-
557 int opcode = pOp->opcode;-
558 if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename -
559 || ((opcode==OP_Halt || opcode==OP_HaltIfNull) -
560 && ((pOp->p1&0xff)==SQLITE_CONSTRAINT && pOp->p2==OE_Abort))-
561 ){-
562 hasAbort = 1;-
563 break;-
564 }-
565 if( opcode==OP_CreateBtree && pOp->p3==BTREE_INTKEY ) hasCreateTable = 1;-
566 if( opcode==OP_InitCoroutine ) hasInitCoroutine = 1;-
567#ifndef SQLITE_OMIT_FOREIGN_KEY-
568 if( opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1 ){-
569 hasFkCounter = 1;-
570 }-
571#endif-
572 }-
573 sqlite3DbFree(v->db, sIter.apSub);-
574-
575 /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred.-
576 ** If malloc failed, then the while() loop above may not have iterated-
577 ** through all opcodes and hasAbort may be set incorrectly. Return-
578 ** true for this case to prevent the assert() in the callers frame-
579 ** from failing. */-
580 return ( v->db->mallocFailed || hasAbort==mayAbort || hasFkCounter-
581 || (hasCreateTable && hasInitCoroutine) );-
582}-
583#endif /* SQLITE_DEBUG - the sqlite3AssertMayAbort() function */-
584-
585#ifdef SQLITE_DEBUG-
586/*-
587** Increment the nWrite counter in the VDBE if the cursor is not an-
588** ephemeral cursor, or if the cursor argument is NULL.-
589*/-
590void sqlite3VdbeIncrWriteCounter(Vdbe *p, VdbeCursor *pC){-
591 if( pC==0-
592 || (pC->eCurType!=CURTYPE_SORTER-
593 && pC->eCurType!=CURTYPE_PSEUDO-
594 && !pC->isEphemeral)-
595 ){-
596 p->nWrite++;-
597 }-
598}-
599#endif-
600-
601#ifdef SQLITE_DEBUG-
602/*-
603** Assert if an Abort at this point in time might result in a corrupt-
604** database.-
605*/-
606void sqlite3VdbeAssertAbortable(Vdbe *p){-
607 assert( p->nWrite==0 || p->usesStmtJournal );-
608}-
609#endif-
610-
611/*-
612** This routine is called after all opcodes have been inserted. It loops-
613** through all the opcodes and fixes up some details.-
614**-
615** (1) For each jump instruction with a negative P2 value (a label)-
616** resolve the P2 value to an actual address.-
617**-
618** (2) Compute the maximum number of arguments used by any SQL function-
619** and store that value in *pMaxFuncArgs.-
620**-
621** (3) Update the Vdbe.readOnly and Vdbe.bIsReader flags to accurately-
622** indicate what the prepared statement actually does.-
623**-
624** (4) Initialize the p4.xAdvance pointer on opcodes that use it.-
625**-
626** (5) Reclaim the memory allocated for storing labels.-
627**-
628** This routine will only function correctly if the mkopcodeh.tcl generator-
629** script numbers the opcodes correctly. Changes to this routine must be-
630** coordinated with changes to mkopcodeh.tcl.-
631*/-
632static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){-
633 int nMaxArgs = *pMaxFuncArgs;-
634 Op *pOp;-
635 Parse *pParse = p->pParse;-
636 int *aLabel = pParse->aLabel;-
637 p->readOnly = 1;-
638 p->bIsReader = 0;-
639 pOp = &p->aOp[p->nOp-1];-
640 while(1){-
641-
642 /* Only JUMP opcodes and the short list of special opcodes in the switch-
643 ** below need to be considered. The mkopcodeh.tcl generator script groups-
644 ** all these opcodes together near the front of the opcode list. Skip-
645 ** any opcode that does not need processing by virtual of the fact that-
646 ** it is larger than SQLITE_MX_JUMP_OPCODE, as a performance optimization.-
647 */-
648 if( pOp->opcode<=SQLITE_MX_JUMP_OPCODE ){
pOp->opcode<=61Description
TRUEevaluated 2609187 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 5046637 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)
  • ...
2609187-5046637
649 /* NOTE: Be sure to update mkopcodeh.tcl when adding or removing-
650 ** cases from this switch! */-
651 switch( pOp->opcode ){-
652 case OP_Transaction: {
executed 247597 times by 435 tests: case 2:
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)
  • ...
247597
653 if( pOp->p2!=0 ) p->readOnly = 0;
executed 108257 times by 407 tests: p->readOnly = 0;
Executed 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)
  • ...
pOp->p2!=0Description
TRUEevaluated 108257 times by 407 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)
  • ...
FALSEevaluated 139340 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)
  • ...
108257-139340
654 /* fall thru */-
655 }-
656 case OP_AutoCommit:
code before this statement executed 247597 times by 435 tests: case 1:
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)
  • ...
executed 4737 times by 53 tests: case 1:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (20)
  • Self test (22)
  • Self test (3)
  • Self test (30)
  • Self test (31)
  • Self test (34)
  • Self test (35)
  • Self test (38)
  • Self test (4)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (49)
  • Self test (5)
  • Self test (50)
  • Self test (51)
  • Self test (54)
  • ...
4737-247597
657 case OP_Savepoint: {
executed 35034 times by 2 tests: case 0:
Executed by:
  • Self test (438)
  • Self test (64)
35034
658 p->bIsReader = 1;-
659 break;
executed 287368 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)
  • ...
287368
660 }-
661#ifndef SQLITE_OMIT_WAL-
662 case OP_Checkpoint:
executed 4424 times by 8 tests: case 6:
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (438)
  • Self test (72)
  • Self test (73)
  • Self test (84)
  • Self test (85)
4424
663#endif-
664 case OP_Vacuum:
executed 854 times by 2 tests: case 8:
Executed by:
  • Self test (34)
  • Self test (438)
854
665 case OP_JournalMode: {
executed 5365 times by 10 tests: case 7:
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
5365
666 p->readOnly = 0;-
667 p->bIsReader = 1;-
668 break;
executed 10643 times by 14 tests: break;
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (28)
  • Self test (3)
  • Self test (34)
  • Self test (438)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
10643
669 }-
670 case OP_Next:
executed 269405 times by 435 tests: case 5:
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)
  • ...
269405
671 case OP_SorterNext: {
executed 17043 times by 10 tests: case 3:
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
17043
672 pOp->p4.xAdvance = sqlite3BtreeNext;-
673 pOp->p4type = P4_ADVANCE;-
674 /* The code generator never codes any of these opcodes as a jump-
675 ** to a label. They are always coded as a jump backwards to a -
676 ** known address */-
677 assert( pOp->p2>=0 );-
678 break;
executed 286448 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)
  • ...
286448
679 }-
680 case OP_Prev: {
executed 3534 times by 1 test: case 4:
Executed by:
  • Self test (438)
3534
681 pOp->p4.xAdvance = sqlite3BtreePrevious;-
682 pOp->p4type = P4_ADVANCE;-
683 /* The code generator never codes any of these opcodes as a jump-
684 ** to a label. They are always coded as a jump backwards to a -
685 ** known address */-
686 assert( pOp->p2>=0 );-
687 break;
executed 3534 times by 1 test: break;
Executed by:
  • Self test (438)
3534
688 }-
689#ifndef SQLITE_OMIT_VIRTUALTABLE-
690 case OP_VUpdate: {
executed 1079 times by 1 test: case 10:
Executed by:
  • Self test (438)
1079
691 if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
executed 279 times by 1 test: nMaxArgs = pOp->p2;
Executed by:
  • Self test (438)
pOp->p2>nMaxArgsDescription
TRUEevaluated 279 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 800 times by 1 test
Evaluated by:
  • Self test (438)
279-800
692 break;
executed 1079 times by 1 test: break;
Executed by:
  • Self test (438)
1079
693 }-
694 case OP_VFilter: {
executed 11058 times by 1 test: case 9:
Executed by:
  • Self test (438)
11058
695 int n;-
696 assert( (pOp - p->aOp) >= 3 );-
697 assert( pOp[-1].opcode==OP_Integer );-
698 n = pOp[-1].p1;-
699 if( n>nMaxArgs ) nMaxArgs = n;
executed 9510 times by 1 test: nMaxArgs = n;
Executed by:
  • Self test (438)
n>nMaxArgsDescription
TRUEevaluated 9510 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1548 times by 1 test
Evaluated by:
  • Self test (438)
1548-9510
700 /* Fall through into the default case */-
701 }-
702#endif-
703 default: {
code before this statement executed 11058 times by 1 test: default:
Executed by:
  • Self test (438)
executed 2020115 times by 436 tests: default:
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)
  • ...
11058-2020115
704 if( pOp->p2<0 ){
pOp->p2<0Description
TRUEevaluated 697704 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 1322411 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)
  • ...
697704-1322411
705 /* The mkopcodeh.tcl script has so arranged things that the only-
706 ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to-
707 ** have non-negative values for P2. */-
708 assert( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 );-
709 assert( ADDR(pOp->p2)<pParse->nLabel );-
710 pOp->p2 = aLabel[ADDR(pOp->p2)];-
711 }
executed 697704 times by 435 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)
  • ...
697704
712 break;
executed 2020115 times by 436 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)
  • ...
2020115
713 }-
714 }-
715 /* The mkopcodeh.tcl script has so arranged things that the only-
716 ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to-
717 ** have non-negative values for P2. */-
718 assert( (sqlite3OpcodeProperty[pOp->opcode]&OPFLG_JUMP)==0 || pOp->p2>=0);-
719 }
executed 2609187 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)
  • ...
2609187
720 if( pOp==p->aOp ) break;
executed 457795 times by 436 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)
  • ...
pOp==p->aOpDescription
TRUEevaluated 457795 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 7198029 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)
  • ...
457795-7198029
721 pOp--;-
722 }
executed 7198029 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)
  • ...
7198029
723 sqlite3DbFree(p->db, pParse->aLabel);-
724 pParse->aLabel = 0;-
725 pParse->nLabel = 0;-
726 *pMaxFuncArgs = nMaxArgs;-
727 assert( p->bIsReader!=0 || DbMaskAllZero(p->btreeMask) );-
728}
executed 457795 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)
  • ...
457795
729-
730/*-
731** Return the address of the next instruction to be inserted.-
732*/-
733int sqlite3VdbeCurrentAddr(Vdbe *p){-
734 assert( p->magic==VDBE_MAGIC_INIT );-
735 return p->nOp;
executed 862018 times by 435 tests: return p->nOp;
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)
  • ...
862018
736}-
737-
738/*-
739** Verify that at least N opcode slots are available in p without-
740** having to malloc for more space (except when compiled using-
741** SQLITE_TEST_REALLOC_STRESS). This interface is used during testing-
742** to verify that certain calls to sqlite3VdbeAddOpList() can never-
743** fail due to a OOM fault and hence that the return value from-
744** sqlite3VdbeAddOpList() will always be non-NULL.-
745*/-
746#if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)-
747void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){-
748 assert( p->nOp + N <= p->pParse->nOpAlloc );-
749}-
750#endif-
751-
752/*-
753** Verify that the VM passed as the only argument does not contain-
754** an OP_ResultRow opcode. Fail an assert() if it does. This is used-
755** by code in pragma.c to ensure that the implementation of certain-
756** pragmas comports with the flags specified in the mkpragmatab.tcl-
757** script.-
758*/-
759#if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS)-
760void sqlite3VdbeVerifyNoResultRow(Vdbe *p){-
761 int i;-
762 for(i=0; i<p->nOp; i++){-
763 assert( p->aOp[i].opcode!=OP_ResultRow );-
764 }-
765}-
766#endif-
767-
768/*-
769** Generate code (a single OP_Abortable opcode) that will-
770** verify that the VDBE program can safely call Abort in the current-
771** context.-
772*/-
773#if defined(SQLITE_DEBUG)-
774void sqlite3VdbeVerifyAbortable(Vdbe *p, int onError){-
775 if( onError==OE_Abort ) sqlite3VdbeAddOp0(p, OP_Abortable);-
776}-
777#endif-
778-
779/*-
780** This function returns a pointer to the array of opcodes associated with-
781** the Vdbe passed as the first argument. It is the callers responsibility-
782** to arrange for the returned array to be eventually freed using the -
783** vdbeFreeOpArray() function.-
784**-
785** Before returning, *pnOp is set to the number of entries in the returned-
786** array. Also, *pnMaxArg is set to the larger of its current value and -
787** the number of entries in the Vdbe.apArg[] array required to execute the -
788** returned program.-
789*/-
790VdbeOp *sqlite3VdbeTakeOpArray(Vdbe *p, int *pnOp, int *pnMaxArg){-
791 VdbeOp *aOp = p->aOp;-
792 assert( aOp && !p->db->mallocFailed );-
793-
794 /* Check that sqlite3VdbeUsesBtree() was not called on this VM */-
795 assert( DbMaskAllZero(p->btreeMask) );-
796-
797 resolveP2Values(p, pnMaxArg);-
798 *pnOp = p->nOp;-
799 p->aOp = 0;-
800 return aOp;
executed 5896 times by 1 test: return aOp;
Executed by:
  • Self test (438)
5896
801}-
802-
803/*-
804** Add a whole list of operations to the operation stack. Return a-
805** pointer to the first operation inserted.-
806**-
807** Non-zero P2 arguments to jump instructions are automatically adjusted-
808** so that the jump target is relative to the first operation inserted.-
809*/-
810VdbeOp *sqlite3VdbeAddOpList(-
811 Vdbe *p, /* Add opcodes to the prepared statement */-
812 int nOp, /* Number of opcodes to add */-
813 VdbeOpList const *aOp, /* The opcodes to be added */-
814 int iLineno /* Source-file line number of first opcode */-
815){-
816 int i;-
817 VdbeOp *pOut, *pFirst;-
818 assert( nOp>0 );-
819 assert( p->magic==VDBE_MAGIC_INIT );-
820 if( p->nOp + nOp > p->pParse->nOpAlloc && growOpArray(p, nOp) ){
p->nOp + nOp >...arse->nOpAllocDescription
TRUEevaluated 3263 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3636 times by 14 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
growOpArray(p, nOp)Description
TRUEnever evaluated
FALSEevaluated 3263 times by 1 test
Evaluated by:
  • Self test (438)
0-3636
821 return 0;
never executed: return 0;
0
822 }-
823 pFirst = pOut = &p->aOp[p->nOp];-
824 for(i=0; i<nOp; i++, aOp++, pOut++){
i<nOpDescription
TRUEevaluated 48405 times by 14 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
FALSEevaluated 6899 times by 14 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
6899-48405
825 pOut->opcode = aOp->opcode;-
826 pOut->p1 = aOp->p1;-
827 pOut->p2 = aOp->p2;-
828 assert( aOp->p2>=0 );-
829 if( (sqlite3OpcodeProperty[aOp->opcode] & OPFLG_JUMP)!=0 && aOp->p2>0 ){
(sqlite3Opcode...de] & 0x01)!=0Description
TRUEevaluated 13179 times by 14 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
FALSEevaluated 35226 times by 14 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
aOp->p2>0Description
TRUEevaluated 13044 times by 12 tests
Evaluated by:
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
FALSEevaluated 135 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
135-35226
830 pOut->p2 += p->nOp;-
831 }
executed 13044 times by 12 tests: end of block
Executed by:
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
13044
832 pOut->p3 = aOp->p3;-
833 pOut->p4type = P4_NOTUSED;-
834 pOut->p4.p = 0;-
835 pOut->p5 = 0;-
836#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS-
837 pOut->zComment = 0;-
838#endif-
839#ifdef SQLITE_VDBE_COVERAGE-
840 pOut->iSrcLine = iLineno+i;-
841#else-
842 (void)iLineno;-
843#endif-
844#ifdef SQLITE_DEBUG-
845 if( p->db->flags & SQLITE_VdbeAddopTrace ){-
846 sqlite3VdbePrintOp(0, i+p->nOp, &p->aOp[i+p->nOp]);-
847 }-
848#endif-
849 }
executed 48405 times by 14 tests: end of block
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
48405
850 p->nOp += nOp;-
851 return pFirst;
executed 6899 times by 14 tests: return pFirst;
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
6899
852}-
853-
854#if defined(SQLITE_ENABLE_STMT_SCANSTATUS)-
855/*-
856** Add an entry to the array of counters managed by sqlite3_stmt_scanstatus().-
857*/-
858void sqlite3VdbeScanStatus(-
859 Vdbe *p, /* VM to add scanstatus() to */-
860 int addrExplain, /* Address of OP_Explain (or 0) */-
861 int addrLoop, /* Address of loop counter */ -
862 int addrVisit, /* Address of rows visited counter */-
863 LogEst nEst, /* Estimated number of output rows */-
864 const char *zName /* Name of table or index being scanned */-
865){-
866 int nByte = (p->nScan+1) * sizeof(ScanStatus);-
867 ScanStatus *aNew;-
868 aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);-
869 if( aNew ){-
870 ScanStatus *pNew = &aNew[p->nScan++];-
871 pNew->addrExplain = addrExplain;-
872 pNew->addrLoop = addrLoop;-
873 pNew->addrVisit = addrVisit;-
874 pNew->nEst = nEst;-
875 pNew->zName = sqlite3DbStrDup(p->db, zName);-
876 p->aScan = aNew;-
877 }-
878}-
879#endif-
880-
881-
882/*-
883** Change the value of the opcode, or P1, P2, P3, or P5 operands-
884** for a specific instruction.-
885*/-
886void sqlite3VdbeChangeOpcode(Vdbe *p, u32 addr, u8 iNewOpcode){-
887 sqlite3VdbeGetOp(p,addr)->opcode = iNewOpcode;-
888}
executed 59293 times by 435 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)
  • ...
59293
889void sqlite3VdbeChangeP1(Vdbe *p, u32 addr, int val){-
890 sqlite3VdbeGetOp(p,addr)->p1 = val;-
891}
executed 2521 times by 1 test: end of block
Executed by:
  • Self test (438)
2521
892void sqlite3VdbeChangeP2(Vdbe *p, u32 addr, int val){-
893 sqlite3VdbeGetOp(p,addr)->p2 = val;-
894}
executed 539013 times by 435 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)
  • ...
539013
895void sqlite3VdbeChangeP3(Vdbe *p, u32 addr, int val){-
896 sqlite3VdbeGetOp(p,addr)->p3 = val;-
897}
executed 5985 times by 12 tests: end of block
Executed by:
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
5985
898void sqlite3VdbeChangeP5(Vdbe *p, u16 p5){-
899 assert( p->nOp>0 || p->db->mallocFailed );-
900 if( p->nOp>0 ) p->aOp[p->nOp-1].p5 = p5;
executed 1248618 times by 435 tests: p->aOp[p->nOp-1].p5 = p5;
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->nOp>0Description
TRUEevaluated 1248618 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)
  • ...
FALSEnever evaluated
0-1248618
901}
executed 1248618 times by 435 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)
  • ...
1248618
902-
903/*-
904** Change the P2 operand of instruction addr so that it points to-
905** the address of the next instruction to be coded.-
906*/-
907void sqlite3VdbeJumpHere(Vdbe *p, int addr){-
908 sqlite3VdbeChangeP2(p, addr, p->nOp);-
909}
executed 501693 times by 435 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)
  • ...
501693
910-
911-
912/*-
913** If the input FuncDef structure is ephemeral, then free it. If-
914** the FuncDef is not ephermal, then do nothing.-
915*/-
916static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){-
917 if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){
(pDef->funcFlags & 0x0010)!=0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 137652 times by 14 tests
Evaluated by:
  • Self test (27)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (64)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
3-137652
918 sqlite3DbFreeNN(db, pDef);-
919 }
executed 3 times by 1 test: end of block
Executed by:
  • Self test (438)
3
920}
executed 137655 times by 14 tests: end of block
Executed by:
  • Self test (27)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (64)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
137655
921-
922static void vdbeFreeOpArray(sqlite3 *, Op *, int);-
923-
924/*-
925** Delete a P4 value if necessary.-
926*/-
927static SQLITE_NOINLINE void freeP4Mem(sqlite3 *db, Mem *p){-
928 if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
never executed: sqlite3DbFree(db, p->zMalloc);
p->szMallocDescription
TRUEnever evaluated
FALSEnever evaluated
0
929 sqlite3DbFreeNN(db, p);-
930}
never executed: end of block
0
931static SQLITE_NOINLINE void freeP4FuncCtx(sqlite3 *db, sqlite3_context *p){-
932 freeEphemeralFunction(db, p->pFunc);-
933 sqlite3DbFreeNN(db, p);-
934}
executed 82010 times by 14 tests: end of block
Executed by:
  • Self test (27)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (64)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
82010
935static void freeP4(sqlite3 *db, int p4type, void *p4){-
936 assert( db );-
937 switch( p4type ){-
938 case P4_FUNCCTX: {
executed 82010 times by 14 tests: case (-16):
Executed by:
  • Self test (27)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (64)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
82010
939 freeP4FuncCtx(db, (sqlite3_context*)p4);-
940 break;
executed 82010 times by 14 tests: break;
Executed by:
  • Self test (27)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (64)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
82010
941 }-
942 case P4_REAL:
executed 34734 times by 1 test: case (-13):
Executed by:
  • Self test (438)
34734
943 case P4_INT64:
executed 4341 times by 4 tests: case (-14):
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
4341
944 case P4_DYNAMIC:
executed 549523 times by 57 tests: case (-7):
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • 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 (35)
  • Self test (38)
  • Self test (39)
  • Self test (42)
  • Self test (43)
  • Self test (438)
  • Self test (44)
  • Self test (45)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • ...
549523
945 case P4_DYNBLOB:
never executed: case (-17):
0
946 case P4_INTARRAY: {
executed 25229 times by 12 tests: case (-15):
Executed by:
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
25229
947 sqlite3DbFree(db, p4);-
948 break;
executed 613827 times by 57 tests: break;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • 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 (35)
  • Self test (38)
  • Self test (39)
  • Self test (42)
  • Self test (43)
  • Self test (438)
  • Self test (44)
  • Self test (45)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • ...
613827
949 }-
950 case P4_KEYINFO: {
executed 177965 times by 435 tests: case (-9):
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)
  • ...
177965
951 if( db->pnBytesFreed==0 ) sqlite3KeyInfoUnref((KeyInfo*)p4);
executed 177958 times by 435 tests: sqlite3KeyInfoUnref((KeyInfo*)p4);
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)
  • ...
db->pnBytesFreed==0Description
TRUEevaluated 177958 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 7 times by 1 test
Evaluated by:
  • Self test (438)
7-177958
952 break;
executed 177965 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)
  • ...
177965
953 }-
954#ifdef SQLITE_ENABLE_CURSOR_HINTS-
955 case P4_EXPR: {-
956 sqlite3ExprDelete(db, (Expr*)p4);-
957 break;-
958 }-
959#endif-
960 case P4_FUNCDEF: {
executed 55645 times by 1 test: case (-8):
Executed by:
  • Self test (438)
55645
961 freeEphemeralFunction(db, (FuncDef*)p4);-
962 break;
executed 55645 times by 1 test: break;
Executed by:
  • Self test (438)
55645
963 }-
964 case P4_MEM: {
executed 595 times by 1 test: case (-11):
Executed by:
  • Self test (438)
595
965 if( db->pnBytesFreed==0 ){
db->pnBytesFreed==0Description
TRUEevaluated 595 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-595
966 sqlite3ValueFree((sqlite3_value*)p4);-
967 }else{
executed 595 times by 1 test: end of block
Executed by:
  • Self test (438)
595
968 freeP4Mem(db, (Mem*)p4);-
969 }
never executed: end of block
0
970 break;
executed 595 times by 1 test: break;
Executed by:
  • Self test (438)
595
971 }-
972 case P4_VTAB : {
executed 12808 times by 1 test: case (-12) :
Executed by:
  • Self test (438)
12808
973 if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4);
executed 12804 times by 1 test: sqlite3VtabUnlock((VTable *)p4);
Executed by:
  • Self test (438)
db->pnBytesFreed==0Description
TRUEevaluated 12804 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
4-12804
974 break;
executed 12808 times by 1 test: break;
Executed by:
  • Self test (438)
12808
975 }-
976 }-
977}
executed 1117431 times by 435 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)
  • ...
1117431
978-
979/*-
980** Free the space allocated for aOp and any p4 values allocated for the-
981** opcodes contained within. If aOp is not NULL it is assumed to contain -
982** nOp entries. -
983*/-
984static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){-
985 if( aOp ){
aOpDescription
TRUEevaluated 460311 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 6099 times by 1 test
Evaluated by:
  • Self test (438)
6099-460311
986 Op *pOp;-
987 for(pOp=&aOp[nOp-1]; pOp>=aOp; pOp--){
pOp>=aOpDescription
TRUEevaluated 7656089 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 460311 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)
  • ...
460311-7656089
988 if( pOp->p4type <= P4_FREE_IF_LE ) freeP4(db, pOp->p4type, pOp->p4.p);
executed 895743 times by 59 tests: freeP4(db, pOp->p4type, pOp->p4.p);
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (30)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (35)
  • Self test (38)
  • Self test (39)
  • Self test (42)
  • Self test (43)
  • Self test (438)
  • Self test (44)
  • Self test (45)
  • Self test (46)
  • Self test (47)
  • ...
pOp->p4type <= (-7)Description
TRUEevaluated 895743 times by 59 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (30)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (35)
  • Self test (38)
  • Self test (39)
  • Self test (42)
  • Self test (43)
  • Self test (438)
  • Self test (44)
  • Self test (45)
  • Self test (46)
  • Self test (47)
  • ...
FALSEevaluated 6760346 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)
  • ...
895743-6760346
989#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS-
990 sqlite3DbFree(db, pOp->zComment);-
991#endif -
992 }
executed 7656089 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)
  • ...
7656089
993 sqlite3DbFreeNN(db, aOp);-
994 }
executed 460311 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)
  • ...
460311
995}
executed 466410 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)
  • ...
466410
996-
997/*-
998** Link the SubProgram object passed as the second argument into the linked-
999** list at Vdbe.pSubProgram. This list is used to delete all sub-program-
1000** objects when the VM is no longer required.-
1001*/-
1002void sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){-
1003 p->pNext = pVdbe->pProgram;-
1004 pVdbe->pProgram = p;-
1005}
executed 6028 times by 1 test: end of block
Executed by:
  • Self test (438)
6028
1006-
1007/*-
1008** Change the opcode at addr into OP_Noop-
1009*/-
1010int sqlite3VdbeChangeToNoop(Vdbe *p, int addr){-
1011 VdbeOp *pOp;-
1012 if( p->db->mallocFailed ) return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • Self test (438)
p->db->mallocFailedDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 47098 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)
  • ...
1-47098
1013 assert( addr>=0 && addr<p->nOp );-
1014 pOp = &p->aOp[addr];-
1015 freeP4(p->db, pOp->p4type, pOp->p4.p);-
1016 pOp->p4type = P4_NOTUSED;-
1017 pOp->p4.z = 0;-
1018 pOp->opcode = OP_Noop;-
1019 return 1;
executed 47098 times by 435 tests: return 1;
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)
  • ...
47098
1020}-
1021-
1022/*-
1023** If the last opcode is "op" and it is not a jump destination,-
1024** then remove it. Return true if and only if an opcode was removed.-
1025*/-
1026int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){-
1027 if( p->nOp>0 && p->aOp[p->nOp-1].opcode==op ){
p->nOp>0Description
TRUEevaluated 23925 times by 368 tests
Evaluated by:
  • Self test (10)
  • 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 (12)
  • 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)
  • ...
FALSEnever evaluated
p->aOp[p->nOp-1].opcode==opDescription
TRUEevaluated 64 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 23861 times by 368 tests
Evaluated by:
  • Self test (10)
  • 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 (12)
  • 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)
  • ...
0-23925
1028 return sqlite3VdbeChangeToNoop(p, p->nOp-1);
executed 64 times by 1 test: return sqlite3VdbeChangeToNoop(p, p->nOp-1);
Executed by:
  • Self test (438)
64
1029 }else{-
1030 return 0;
executed 23861 times by 368 tests: return 0;
Executed by:
  • Self test (10)
  • 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 (12)
  • 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)
  • ...
23861
1031 }-
1032}-
1033-
1034/*-
1035** Change the value of the P4 operand for a specific instruction.-
1036** This routine is useful when a large program is loaded from a-
1037** static array using sqlite3VdbeAddOpList but we want to make a-
1038** few minor changes to the program.-
1039**-
1040** If n>=0 then the P4 operand is dynamic, meaning that a copy of-
1041** the string is made into memory obtained from sqlite3_malloc().-
1042** A value of n==0 means copy bytes of zP4 up to and including the-
1043** first null byte. If n>0 then copy n+1 bytes of zP4.-
1044** -
1045** Other values of n (P4_STATIC, P4_COLLSEQ etc.) indicate that zP4 points-
1046** to a string or structure that is guaranteed to exist for the lifetime of-
1047** the Vdbe. In these cases we can just copy the pointer.-
1048**-
1049** If addr<0 then change P4 on the most recently inserted instruction.-
1050*/-
1051static void SQLITE_NOINLINE vdbeChangeP4Full(-
1052 Vdbe *p,-
1053 Op *pOp,-
1054 const char *zP4,-
1055 int n-
1056){-
1057 if( pOp->p4type ){
pOp->p4typeDescription
TRUEevaluated 174230 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 439180 times by 391 tests
Evaluated by:
  • Self test
  • 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 (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)
  • ...
174230-439180
1058 freeP4(p->db, pOp->p4type, pOp->p4.p);-
1059 pOp->p4type = 0;-
1060 pOp->p4.p = 0;-
1061 }
executed 174230 times by 435 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)
  • ...
174230
1062 if( n<0 ){
n<0Description
TRUEevaluated 174230 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 439180 times by 391 tests
Evaluated by:
  • Self test
  • 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 (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)
  • ...
174230-439180
1063 sqlite3VdbeChangeP4(p, (int)(pOp - p->aOp), zP4, n);-
1064 }else{
executed 174230 times by 435 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)
  • ...
174230
1065 if( n==0 ) n = sqlite3Strlen30(zP4);
executed 338947 times by 59 tests: n = sqlite3Strlen30(zP4);
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (30)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (35)
  • Self test (38)
  • Self test (39)
  • Self test (4)
  • Self test (42)
  • Self test (43)
  • Self test (438)
  • Self test (44)
  • Self test (45)
  • Self test (46)
  • ...
n==0Description
TRUEevaluated 338947 times by 59 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (30)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (35)
  • Self test (38)
  • Self test (39)
  • Self test (4)
  • Self test (42)
  • Self test (43)
  • Self test (438)
  • Self test (44)
  • Self test (45)
  • Self test (46)
  • ...
FALSEevaluated 100233 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)
  • ...
100233-338947
1066 pOp->p4.z = sqlite3DbStrNDup(p->db, zP4, n);-
1067 pOp->p4type = P4_DYNAMIC;-
1068 }
executed 439180 times by 391 tests: end of block
Executed by:
  • Self test
  • 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 (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)
  • ...
439180
1069}-
1070void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){-
1071 Op *pOp;-
1072 sqlite3 *db;-
1073 assert( p!=0 );-
1074 db = p->db;-
1075 assert( p->magic==VDBE_MAGIC_INIT );-
1076 assert( p->aOp!=0 || db->mallocFailed );-
1077 if( db->mallocFailed ){
db->mallocFailedDescription
TRUEevaluated 352 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1406882 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)
  • ...
352-1406882
1078 if( n!=P4_VTAB ) freeP4(db, n, (void*)*(char**)&zP4);
executed 352 times by 1 test: freeP4(db, n, (void*)*(char**)&zP4);
Executed by:
  • Self test (438)
n!=(-12)Description
TRUEevaluated 352 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-352
1079 return;
executed 352 times by 1 test: return;
Executed by:
  • Self test (438)
352
1080 }-
1081 assert( p->nOp>0 );-
1082 assert( addr<p->nOp );-
1083 if( addr<0 ){
addr<0Description
TRUEevaluated 267463 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 1139419 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)
  • ...
267463-1139419
1084 addr = p->nOp - 1;-
1085 }
executed 267463 times by 435 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)
  • ...
267463
1086 pOp = &p->aOp[addr];-
1087 if( n>=0 || pOp->p4type ){
n>=0Description
TRUEevaluated 439180 times by 391 tests
Evaluated by:
  • Self test
  • 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 (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)
  • ...
FALSEevaluated 967702 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)
  • ...
pOp->p4typeDescription
TRUEevaluated 174230 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 793472 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)
  • ...
174230-967702
1088 vdbeChangeP4Full(p, pOp, zP4, n);-
1089 return;
executed 613410 times by 435 tests: return;
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)
  • ...
613410
1090 }-
1091 if( n==P4_INT32 ){
n==(-3)Description
TRUEevaluated 173996 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 619476 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)
  • ...
173996-619476
1092 /* Note: this cast is safe, because the origin data point was an int-
1093 ** that was cast to a (const char *). */-
1094 pOp->p4.i = SQLITE_PTR_TO_INT(zP4);-
1095 pOp->p4type = P4_INT32;-
1096 }else if( zP4!=0 ){
executed 173996 times by 435 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)
  • ...
zP4!=0Description
TRUEevaluated 539960 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 79516 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)
  • ...
79516-539960
1097 assert( n<0 );-
1098 pOp->p4.p = (void*)zP4;-
1099 pOp->p4type = (signed char)n;-
1100 if( n==P4_VTAB ) sqlite3VtabLock((VTable*)zP4);
executed 12804 times by 1 test: sqlite3VtabLock((VTable*)zP4);
Executed by:
  • Self test (438)
n==(-12)Description
TRUEevaluated 12804 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 527156 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)
  • ...
12804-527156
1101 }
executed 539960 times by 435 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)
  • ...
539960
1102}
executed 793472 times by 435 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)
  • ...
793472
1103-
1104/*-
1105** Change the P4 operand of the most recently coded instruction -
1106** to the value defined by the arguments. This is a high-speed-
1107** version of sqlite3VdbeChangeP4().-
1108**-
1109** The P4 operand must not have been previously defined. And the new-
1110** P4 must not be P4_INT32. Use sqlite3VdbeChangeP4() in either of-
1111** those cases.-
1112*/-
1113void sqlite3VdbeAppendP4(Vdbe *p, void *pP4, int n){-
1114 VdbeOp *pOp;-
1115 assert( n!=P4_INT32 && n!=P4_VTAB );-
1116 assert( n<=0 );-
1117 if( p->db->mallocFailed ){
p->db->mallocFailedDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 249910 times by 405 tests
Evaluated by:
  • 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)
  • Self test (123)
  • ...
8-249910
1118 freeP4(p->db, n, pP4);-
1119 }else{
executed 8 times by 1 test: end of block
Executed by:
  • Self test (438)
8
1120 assert( pP4!=0 );-
1121 assert( p->nOp>0 );-
1122 pOp = &p->aOp[p->nOp-1];-
1123 assert( pOp->p4type==P4_NOTUSED );-
1124 pOp->p4type = n;-
1125 pOp->p4.p = pP4;-
1126 }
executed 249910 times by 405 tests: end of block
Executed by:
  • 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)
  • Self test (123)
  • ...
249910
1127}-
1128-
1129/*-
1130** Set the P4 on the most recently added opcode to the KeyInfo for the-
1131** index given.-
1132*/-
1133void sqlite3VdbeSetP4KeyInfo(Parse *pParse, Index *pIdx){-
1134 Vdbe *v = pParse->pVdbe;-
1135 KeyInfo *pKeyInfo;-
1136 assert( v!=0 );-
1137 assert( pIdx!=0 );-
1138 pKeyInfo = sqlite3KeyInfoOfIndex(pParse, pIdx);-
1139 if( pKeyInfo ) sqlite3VdbeAppendP4(v, pKeyInfo, P4_KEYINFO);
executed 60885 times by 381 tests: sqlite3VdbeAppendP4(v, pKeyInfo, (-9));
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)
  • ...
pKeyInfoDescription
TRUEevaluated 60885 times by 381 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 17 times by 1 test
Evaluated by:
  • Self test (438)
17-60885
1140}
executed 60902 times by 381 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)
  • ...
60902
1141-
1142#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS-
1143/*-
1144** Change the comment on the most recently coded instruction. Or-
1145** insert a No-op and add the comment to that new instruction. This-
1146** makes the code easier to read during debugging. None of this happens-
1147** in a production build.-
1148*/-
1149static void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){-
1150 assert( p->nOp>0 || p->aOp==0 );-
1151 assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->db->mallocFailed );-
1152 if( p->nOp ){-
1153 assert( p->aOp );-
1154 sqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment);-
1155 p->aOp[p->nOp-1].zComment = sqlite3VMPrintf(p->db, zFormat, ap);-
1156 }-
1157}-
1158void sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){-
1159 va_list ap;-
1160 if( p ){-
1161 va_start(ap, zFormat);-
1162 vdbeVComment(p, zFormat, ap);-
1163 va_end(ap);-
1164 }-
1165}-
1166void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){-
1167 va_list ap;-
1168 if( p ){-
1169 sqlite3VdbeAddOp0(p, OP_Noop);-
1170 va_start(ap, zFormat);-
1171 vdbeVComment(p, zFormat, ap);-
1172 va_end(ap);-
1173 }-
1174}-
1175#endif /* NDEBUG */-
1176-
1177#ifdef SQLITE_VDBE_COVERAGE-
1178/*-
1179** Set the value if the iSrcLine field for the previously coded instruction.-
1180*/-
1181void sqlite3VdbeSetLineNumber(Vdbe *v, int iLine){-
1182 sqlite3VdbeGetOp(v,-1)->iSrcLine = iLine;-
1183}-
1184#endif /* SQLITE_VDBE_COVERAGE */-
1185-
1186/*-
1187** Return the opcode for a given address. If the address is -1, then-
1188** return the most recently inserted opcode.-
1189**-
1190** If a memory allocation error has occurred prior to the calling of this-
1191** routine, then a pointer to a dummy VdbeOp will be returned. That opcode-
1192** is readable but not writable, though it is cast to a writable value.-
1193** The return of a dummy opcode allows the call to continue functioning-
1194** after an OOM fault without having to check to see if the return from -
1195** this routine is a valid pointer. But because the dummy.opcode is 0,-
1196** dummy will never be written to. This is verified by code inspection and-
1197** by running with Valgrind.-
1198*/-
1199VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){-
1200 /* C89 specifies that the constant "dummy" will be initialized to all-
1201 ** zeros, which is correct. MSVC generates a warning, nevertheless. */-
1202 static VdbeOp dummy; /* Ignore the MSVC warning about no initializer */-
1203 assert( p->magic==VDBE_MAGIC_INIT );-
1204 if( addr<0 ){
addr<0Description
TRUEevaluated 39774 times by 4 tests
Evaluated by:
  • Self test (103)
  • Self test (104)
  • Self test (34)
  • Self test (438)
FALSEevaluated 907847 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)
  • ...
39774-907847
1205 addr = p->nOp - 1;-
1206 }
executed 39774 times by 4 tests: end of block
Executed by:
  • Self test (103)
  • Self test (104)
  • Self test (34)
  • Self test (438)
39774
1207 assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );-
1208 if( p->db->mallocFailed ){
p->db->mallocFailedDescription
TRUEevaluated 172 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 947449 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)
  • ...
172-947449
1209 return (VdbeOp*)&dummy;
executed 172 times by 1 test: return (VdbeOp*)&dummy;
Executed by:
  • Self test (438)
172
1210 }else{-
1211 return &p->aOp[addr];
executed 947449 times by 435 tests: return &p->aOp[addr];
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)
  • ...
947449
1212 }-
1213}-
1214-
1215#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS)-
1216/*-
1217** Return an integer value for one of the parameters to the opcode pOp-
1218** determined by character c.-
1219*/-
1220static int translateP(char c, const Op *pOp){-
1221 if( c=='1' ) return pOp->p1;-
1222 if( c=='2' ) return pOp->p2;-
1223 if( c=='3' ) return pOp->p3;-
1224 if( c=='4' ) return pOp->p4.i;-
1225 return pOp->p5;-
1226}-
1227-
1228/*-
1229** Compute a string for the "comment" field of a VDBE opcode listing.-
1230**-
1231** The Synopsis: field in comments in the vdbe.c source file gets converted-
1232** to an extra string that is appended to the sqlite3OpcodeName(). In the-
1233** absence of other comments, this synopsis becomes the comment on the opcode.-
1234** Some translation occurs:-
1235**-
1236** "PX" -> "r[X]"-
1237** "PX@PY" -> "r[X..X+Y-1]" or "r[x]" if y is 0 or 1-
1238** "PX@PY+1" -> "r[X..X+Y]" or "r[x]" if y is 0-
1239** "PY..PY" -> "r[X..Y]" or "r[x]" if y<=x-
1240*/-
1241static int displayComment(-
1242 const Op *pOp, /* The opcode to be commented */-
1243 const char *zP4, /* Previously obtained value for P4 */-
1244 char *zTemp, /* Write result here */-
1245 int nTemp /* Space available in zTemp[] */-
1246){-
1247 const char *zOpName;-
1248 const char *zSynopsis;-
1249 int nOpName;-
1250 int ii, jj;-
1251 char zAlt[50];-
1252 zOpName = sqlite3OpcodeName(pOp->opcode);-
1253 nOpName = sqlite3Strlen30(zOpName);-
1254 if( zOpName[nOpName+1] ){-
1255 int seenCom = 0;-
1256 char c;-
1257 zSynopsis = zOpName += nOpName + 1;-
1258 if( strncmp(zSynopsis,"IF ",3)==0 ){-
1259 if( pOp->p5 & SQLITE_STOREP2 ){-
1260 sqlite3_snprintf(sizeof(zAlt), zAlt, "r[P2] = (%s)", zSynopsis+3);-
1261 }else{-
1262 sqlite3_snprintf(sizeof(zAlt), zAlt, "if %s goto P2", zSynopsis+3);-
1263 }-
1264 zSynopsis = zAlt;-
1265 }-
1266 for(ii=jj=0; jj<nTemp-1 && (c = zSynopsis[ii])!=0; ii++){-
1267 if( c=='P' ){-
1268 c = zSynopsis[++ii];-
1269 if( c=='4' ){-
1270 sqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", zP4);-
1271 }else if( c=='X' ){-
1272 sqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", pOp->zComment);-
1273 seenCom = 1;-
1274 }else{-
1275 int v1 = translateP(c, pOp);-
1276 int v2;-
1277 sqlite3_snprintf(nTemp-jj, zTemp+jj, "%d", v1);-
1278 if( strncmp(zSynopsis+ii+1, "@P", 2)==0 ){-
1279 ii += 3;-
1280 jj += sqlite3Strlen30(zTemp+jj);-
1281 v2 = translateP(zSynopsis[ii], pOp);-
1282 if( strncmp(zSynopsis+ii+1,"+1",2)==0 ){-
1283 ii += 2;-
1284 v2++;-
1285 }-
1286 if( v2>1 ){-
1287 sqlite3_snprintf(nTemp-jj, zTemp+jj, "..%d", v1+v2-1);-
1288 }-
1289 }else if( strncmp(zSynopsis+ii+1, "..P3", 4)==0 && pOp->p3==0 ){-
1290 ii += 4;-
1291 }-
1292 }-
1293 jj += sqlite3Strlen30(zTemp+jj);-
1294 }else{-
1295 zTemp[jj++] = c;-
1296 }-
1297 }-
1298 if( !seenCom && jj<nTemp-5 && pOp->zComment ){-
1299 sqlite3_snprintf(nTemp-jj, zTemp+jj, "; %s", pOp->zComment);-
1300 jj += sqlite3Strlen30(zTemp+jj);-
1301 }-
1302 if( jj<nTemp ) zTemp[jj] = 0;-
1303 }else if( pOp->zComment ){-
1304 sqlite3_snprintf(nTemp, zTemp, "%s", pOp->zComment);-
1305 jj = sqlite3Strlen30(zTemp);-
1306 }else{-
1307 zTemp[0] = 0;-
1308 jj = 0;-
1309 }-
1310 return jj;-
1311}-
1312#endif /* SQLITE_DEBUG */-
1313-
1314#if VDBE_DISPLAY_P4 && defined(SQLITE_ENABLE_CURSOR_HINTS)-
1315/*-
1316** Translate the P4.pExpr value for an OP_CursorHint opcode into text-
1317** that can be displayed in the P4 column of EXPLAIN output.-
1318*/-
1319static void displayP4Expr(StrAccum *p, Expr *pExpr){-
1320 const char *zOp = 0;-
1321 switch( pExpr->op ){-
1322 case TK_STRING:-
1323 sqlite3_str_appendf(p, "%Q", pExpr->u.zToken);-
1324 break;-
1325 case TK_INTEGER:-
1326 sqlite3_str_appendf(p, "%d", pExpr->u.iValue);-
1327 break;-
1328 case TK_NULL:-
1329 sqlite3_str_appendf(p, "NULL");-
1330 break;-
1331 case TK_REGISTER: {-
1332 sqlite3_str_appendf(p, "r[%d]", pExpr->iTable);-
1333 break;-
1334 }-
1335 case TK_COLUMN: {-
1336 if( pExpr->iColumn<0 ){-
1337 sqlite3_str_appendf(p, "rowid");-
1338 }else{-
1339 sqlite3_str_appendf(p, "c%d", (int)pExpr->iColumn);-
1340 }-
1341 break;-
1342 }-
1343 case TK_LT: zOp = "LT"; break;-
1344 case TK_LE: zOp = "LE"; break;-
1345 case TK_GT: zOp = "GT"; break;-
1346 case TK_GE: zOp = "GE"; break;-
1347 case TK_NE: zOp = "NE"; break;-
1348 case TK_EQ: zOp = "EQ"; break;-
1349 case TK_IS: zOp = "IS"; break;-
1350 case TK_ISNOT: zOp = "ISNOT"; break;-
1351 case TK_AND: zOp = "AND"; break;-
1352 case TK_OR: zOp = "OR"; break;-
1353 case TK_PLUS: zOp = "ADD"; break;-
1354 case TK_STAR: zOp = "MUL"; break;-
1355 case TK_MINUS: zOp = "SUB"; break;-
1356 case TK_REM: zOp = "REM"; break;-
1357 case TK_BITAND: zOp = "BITAND"; break;-
1358 case TK_BITOR: zOp = "BITOR"; break;-
1359 case TK_SLASH: zOp = "DIV"; break;-
1360 case TK_LSHIFT: zOp = "LSHIFT"; break;-
1361 case TK_RSHIFT: zOp = "RSHIFT"; break;-
1362 case TK_CONCAT: zOp = "CONCAT"; break;-
1363 case TK_UMINUS: zOp = "MINUS"; break;-
1364 case TK_UPLUS: zOp = "PLUS"; break;-
1365 case TK_BITNOT: zOp = "BITNOT"; break;-
1366 case TK_NOT: zOp = "NOT"; break;-
1367 case TK_ISNULL: zOp = "ISNULL"; break;-
1368 case TK_NOTNULL: zOp = "NOTNULL"; break;-
1369-
1370 default:-
1371 sqlite3_str_appendf(p, "%s", "expr");-
1372 break;-
1373 }-
1374-
1375 if( zOp ){-
1376 sqlite3_str_appendf(p, "%s(", zOp);-
1377 displayP4Expr(p, pExpr->pLeft);-
1378 if( pExpr->pRight ){-
1379 sqlite3_str_append(p, ",", 1);-
1380 displayP4Expr(p, pExpr->pRight);-
1381 }-
1382 sqlite3_str_append(p, ")", 1);-
1383 }-
1384}-
1385#endif /* VDBE_DISPLAY_P4 && defined(SQLITE_ENABLE_CURSOR_HINTS) */-
1386-
1387-
1388#if VDBE_DISPLAY_P4-
1389/*-
1390** Compute a string that describes the P4 parameter for an opcode.-
1391** Use zTemp for any required temporary buffer space.-
1392*/-
1393static char *displayP4(Op *pOp, char *zTemp, int nTemp){-
1394 char *zP4 = zTemp;-
1395 StrAccum x;-
1396 assert( nTemp>=20 );-
1397 sqlite3StrAccumInit(&x, 0, zTemp, nTemp, 0);-
1398 switch( pOp->p4type ){-
1399 case P4_KEYINFO: {
executed 479 times by 1 test: case (-9):
Executed by:
  • Self test (438)
479
1400 int j;-
1401 KeyInfo *pKeyInfo = pOp->p4.pKeyInfo;-
1402 assert( pKeyInfo->aSortOrder!=0 );-
1403 sqlite3_str_appendf(&x, "k(%d", pKeyInfo->nKeyField);-
1404 for(j=0; j<pKeyInfo->nKeyField; j++){
j<pKeyInfo->nKeyFieldDescription
TRUEevaluated 1924 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 479 times by 1 test
Evaluated by:
  • Self test (438)
479-1924
1405 CollSeq *pColl = pKeyInfo->aColl[j];-
1406 const char *zColl = pColl ? pColl->zName : "";
pCollDescription
TRUEevaluated 328 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1596 times by 1 test
Evaluated by:
  • Self test (438)
328-1596
1407 if( strcmp(zColl, "BINARY")==0 ) zColl = "B";
never executed: __result = (((const unsigned char *) (const char *) ( zColl ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
never executed: __result = (((const unsigned char *) (const char *) ( "BINARY" ))[3] - __s2[3]);
never executed: end of block
never executed: end of block
executed 293 times by 1 test: zColl = "B";
Executed by:
  • Self test (438)
__extension__ ..." )))); }) ==0Description
TRUEevaluated 293 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1631 times by 1 test
Evaluated by:
  • Self test (438)
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
0-1631
1408 sqlite3_str_appendf(&x, ",%s%s", -
1409 pKeyInfo->aSortOrder[j] ? "-" : "", zColl);-
1410 }
executed 1924 times by 1 test: end of block
Executed by:
  • Self test (438)
1924
1411 sqlite3_str_append(&x, ")", 1);-
1412 break;
executed 479 times by 1 test: break;
Executed by:
  • Self test (438)
479
1413 }-
1414#ifdef SQLITE_ENABLE_CURSOR_HINTS-
1415 case P4_EXPR: {-
1416 displayP4Expr(&x, pOp->p4.pExpr);-
1417 break;-
1418 }-
1419#endif-
1420 case P4_COLLSEQ: {
executed 130 times by 1 test: case (-2):
Executed by:
  • Self test (438)
130
1421 CollSeq *pColl = pOp->p4.pColl;-
1422 sqlite3_str_appendf(&x, "(%.20s)", pColl->zName);-
1423 break;
executed 130 times by 1 test: break;
Executed by:
  • Self test (438)
130
1424 }-
1425 case P4_FUNCDEF: {
executed 92 times by 1 test: case (-8):
Executed by:
  • Self test (438)
92
1426 FuncDef *pDef = pOp->p4.pFunc;-
1427 sqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg);-
1428 break;
executed 92 times by 1 test: break;
Executed by:
  • Self test (438)
92
1429 }-
1430#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)-
1431 case P4_FUNCCTX: {-
1432 FuncDef *pDef = pOp->p4.pCtx->pFunc;-
1433 sqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg);-
1434 break;-
1435 }-
1436#endif-
1437 case P4_INT64: {
executed 2 times by 1 test: case (-14):
Executed by:
  • Self test (438)
2
1438 sqlite3_str_appendf(&x, "%lld", *pOp->p4.pI64);-
1439 break;
executed 2 times by 1 test: break;
Executed by:
  • Self test (438)
2
1440 }-
1441 case P4_INT32: {
executed 1227 times by 1 test: case (-3):
Executed by:
  • Self test (438)
1227
1442 sqlite3_str_appendf(&x, "%d", pOp->p4.i);-
1443 break;
executed 1227 times by 1 test: break;
Executed by:
  • Self test (438)
1227
1444 }-
1445 case P4_REAL: {
executed 7 times by 1 test: case (-13):
Executed by:
  • Self test (438)
7
1446 sqlite3_str_appendf(&x, "%.16g", *pOp->p4.pReal);-
1447 break;
executed 7 times by 1 test: break;
Executed by:
  • Self test (438)
7
1448 }-
1449 case P4_MEM: {
executed 22 times by 1 test: case (-11):
Executed by:
  • Self test (438)
22
1450 Mem *pMem = pOp->p4.pMem;-
1451 if( pMem->flags & MEM_Str ){
pMem->flags & 0x0002Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
8-14
1452 zP4 = pMem->z;-
1453 }else if( pMem->flags & MEM_Int ){
executed 8 times by 1 test: end of block
Executed by:
  • Self test (438)
pMem->flags & 0x0004Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-13
1454 sqlite3_str_appendf(&x, "%lld", pMem->u.i);-
1455 }else if( pMem->flags & MEM_Real ){
executed 13 times by 1 test: end of block
Executed by:
  • Self test (438)
pMem->flags & 0x0008Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-13
1456 sqlite3_str_appendf(&x, "%.16g", pMem->u.r);-
1457 }else if( pMem->flags & MEM_Null ){
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
pMem->flags & 0x0001Description
TRUEnever evaluated
FALSEnever evaluated
0-1
1458 zP4 = "NULL";-
1459 }else{
never executed: end of block
0
1460 assert( pMem->flags & MEM_Blob );-
1461 zP4 = "(blob)";-
1462 }
never executed: end of block
0
1463 break;
executed 22 times by 1 test: break;
Executed by:
  • Self test (438)
22
1464 }-
1465#ifndef SQLITE_OMIT_VIRTUALTABLE-
1466 case P4_VTAB: {
executed 2 times by 1 test: case (-12):
Executed by:
  • Self test (438)
2
1467 sqlite3_vtab *pVtab = pOp->p4.pVtab->pVtab;-
1468 sqlite3_str_appendf(&x, "vtab:%p", pVtab);-
1469 break;
executed 2 times by 1 test: break;
Executed by:
  • Self test (438)
2
1470 }-
1471#endif-
1472 case P4_INTARRAY: {
executed 49 times by 1 test: case (-15):
Executed by:
  • Self test (438)
49
1473 int i;-
1474 int *ai = pOp->p4.ai;-
1475 int n = ai[0]; /* The first element of an INTARRAY is always the-
1476 ** count of the number of elements to follow */-
1477 for(i=1; i<=n; i++){
i<=nDescription
TRUEevaluated 57 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 49 times by 1 test
Evaluated by:
  • Self test (438)
49-57
1478 sqlite3_str_appendf(&x, ",%d", ai[i]);-
1479 }
executed 57 times by 1 test: end of block
Executed by:
  • Self test (438)
57
1480 zTemp[0] = '[';-
1481 sqlite3_str_append(&x, "]", 1);-
1482 break;
executed 49 times by 1 test: break;
Executed by:
  • Self test (438)
49
1483 }-
1484 case P4_SUBPROGRAM: {
executed 10 times by 1 test: case (-4):
Executed by:
  • Self test (438)
10
1485 sqlite3_str_appendf(&x, "program");-
1486 break;
executed 10 times by 1 test: break;
Executed by:
  • Self test (438)
10
1487 }-
1488 case P4_DYNBLOB:
never executed: case (-17):
0
1489 case P4_ADVANCE: {
executed 603 times by 1 test: case (-5):
Executed by:
  • Self test (438)
603
1490 zTemp[0] = 0;-
1491 break;
executed 603 times by 1 test: break;
Executed by:
  • Self test (438)
603
1492 }-
1493 case P4_TABLE: {
executed 60 times by 1 test: case (-6):
Executed by:
  • Self test (438)
60
1494 sqlite3_str_appendf(&x, "%s", pOp->p4.pTab->zName);-
1495 break;
executed 60 times by 1 test: break;
Executed by:
  • Self test (438)
60
1496 }-
1497 default: {
executed 8023 times by 1 test: default:
Executed by:
  • Self test (438)
8023
1498 zP4 = pOp->p4.z;-
1499 if( zP4==0 ){
zP4==0Description
TRUEevaluated 6590 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1433 times by 1 test
Evaluated by:
  • Self test (438)
1433-6590
1500 zP4 = zTemp;-
1501 zTemp[0] = 0;-
1502 }
executed 6590 times by 1 test: end of block
Executed by:
  • Self test (438)
6590
1503 }-
1504 }
executed 8023 times by 1 test: end of block
Executed by:
  • Self test (438)
8023
1505 sqlite3StrAccumFinish(&x);-
1506 assert( zP4!=0 );-
1507 return zP4;
executed 10706 times by 1 test: return zP4;
Executed by:
  • Self test (438)
10706
1508}-
1509#endif /* VDBE_DISPLAY_P4 */-
1510-
1511/*-
1512** Declare to the Vdbe that the BTree object at db->aDb[i] is used.-
1513**-
1514** The prepared statements need to know in advance the complete set of-
1515** attached databases that will be use. A mask of these databases-
1516** is maintained in p->btreeMask. The p->lockMask value is the subset of-
1517** p->btreeMask of databases that will require a lock.-
1518*/-
1519void sqlite3VdbeUsesBtree(Vdbe *p, int i){-
1520 assert( i>=0 && i<p->db->nDb && i<(int)sizeof(yDbMask)*8 );-
1521 assert( i<(int)sizeof(p->btreeMask)*8 );-
1522 DbMaskSet(p->btreeMask, i);-
1523 if( i!=1 && sqlite3BtreeSharable(p->db->aDb[i].pBt) ){
i!=1Description
TRUEevaluated 301488 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 39458 times by 44 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 (43)
  • Self test (438)
  • Self test (44)
  • Self test (45)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (53)
  • Self test (57)
  • Self test (58)
  • ...
sqlite3BtreeSh...b->aDb[i].pBt)Description
TRUEevaluated 2173 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 299315 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)
  • ...
2173-301488
1524 DbMaskSet(p->lockMask, i);-
1525 }
executed 2173 times by 1 test: end of block
Executed by:
  • Self test (438)
2173
1526}
executed 340946 times by 435 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)
  • ...
340946
1527-
1528#if !defined(SQLITE_OMIT_SHARED_CACHE)-
1529/*-
1530** If SQLite is compiled to support shared-cache mode and to be threadsafe,-
1531** this routine obtains the mutex associated with each BtShared structure-
1532** that may be accessed by the VM passed as an argument. In doing so it also-
1533** sets the BtShared.db member of each of the BtShared structures, ensuring-
1534** that the correct busy-handler callback is invoked if required.-
1535**-
1536** If SQLite is not threadsafe but does support shared-cache mode, then-
1537** sqlite3BtreeEnter() is invoked to set the BtShared.db variables-
1538** of all of BtShared structures accessible via the database handle -
1539** associated with the VM.-
1540**-
1541** If SQLite is not threadsafe and does not support shared-cache mode, this-
1542** function is a no-op.-
1543**-
1544** The p->btreeMask field is a bitmask of all btrees that the prepared -
1545** statement p will ever use. Let N be the number of bits in p->btreeMask-
1546** corresponding to btrees that use shared cache. Then the runtime of-
1547** this routine is N*N. But as N is rarely more than 1, this should not-
1548** be a problem.-
1549*/-
1550void sqlite3VdbeEnter(Vdbe *p){-
1551 int i;-
1552 sqlite3 *db;-
1553 Db *aDb;-
1554 int nDb;-
1555 if( DbMaskAllZero(p->lockMask) ) return; /* The common case */
executed 4726071 times by 435 tests: return;
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->lockMask)==0Description
TRUEevaluated 4726071 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 25138 times by 1 test
Evaluated by:
  • Self test (438)
25138-4726071
1556 db = p->db;-
1557 aDb = db->aDb;-
1558 nDb = db->nDb;-
1559 for(i=0; i<nDb; i++){
i<nDbDescription
TRUEevaluated 51570 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 25138 times by 1 test
Evaluated by:
  • Self test (438)
25138-51570
1560 if( i!=1 && DbMaskTest(p->lockMask,i) && ALWAYS(aDb[i].pBt!=0) ){
i!=1Description
TRUEevaluated 26432 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 25138 times by 1 test
Evaluated by:
  • Self test (438)
(((p->lockMask...)1)<<(i)))!=0)Description
TRUEevaluated 25646 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 786 times by 1 test
Evaluated by:
  • Self test (438)
(aDb[i].pBt!=0)Description
TRUEevaluated 25646 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-26432
1561 sqlite3BtreeEnter(aDb[i].pBt);-
1562 }
executed 25646 times by 1 test: end of block
Executed by:
  • Self test (438)
25646
1563 }
executed 51570 times by 1 test: end of block
Executed by:
  • Self test (438)
51570
1564}
executed 25138 times by 1 test: end of block
Executed by:
  • Self test (438)
25138
1565#endif-
1566-
1567#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0-
1568/*-
1569** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter().-
1570*/-
1571static SQLITE_NOINLINE void vdbeLeave(Vdbe *p){-
1572 int i;-
1573 sqlite3 *db;-
1574 Db *aDb;-
1575 int nDb;-
1576 db = p->db;-
1577 aDb = db->aDb;-
1578 nDb = db->nDb;-
1579 for(i=0; i<nDb; i++){
i<nDbDescription
TRUEevaluated 51570 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 25138 times by 1 test
Evaluated by:
  • Self test (438)
25138-51570
1580 if( i!=1 && DbMaskTest(p->lockMask,i) && ALWAYS(aDb[i].pBt!=0) ){
i!=1Description
TRUEevaluated 26432 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 25138 times by 1 test
Evaluated by:
  • Self test (438)
(((p->lockMask...)1)<<(i)))!=0)Description
TRUEevaluated 25646 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 786 times by 1 test
Evaluated by:
  • Self test (438)
(aDb[i].pBt!=0)Description
TRUEevaluated 25646 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-26432
1581 sqlite3BtreeLeave(aDb[i].pBt);-
1582 }
executed 25646 times by 1 test: end of block
Executed by:
  • Self test (438)
25646
1583 }
executed 51570 times by 1 test: end of block
Executed by:
  • Self test (438)
51570
1584}
executed 25138 times by 1 test: end of block
Executed by:
  • Self test (438)
25138
1585void sqlite3VdbeLeave(Vdbe *p){-
1586 if( DbMaskAllZero(p->lockMask) ) return; /* The common case */
executed 4725626 times by 435 tests: return;
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->lockMask)==0Description
TRUEevaluated 4725626 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 25138 times by 1 test
Evaluated by:
  • Self test (438)
25138-4725626
1587 vdbeLeave(p);-
1588}
executed 25138 times by 1 test: end of block
Executed by:
  • Self test (438)
25138
1589#endif-
1590-
1591#if defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)-
1592/*-
1593** Print a single opcode. This routine is used for debugging only.-
1594*/-
1595void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){-
1596 char *zP4;-
1597 char zPtr[50];-
1598 char zCom[100];-
1599 static const char *zFormat1 = "%4d %-13s %4d %4d %4d %-13s %.2X %s\n";-
1600 if( pOut==0 ) pOut = stdout;-
1601 zP4 = displayP4(pOp, zPtr, sizeof(zPtr));-
1602#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS-
1603 displayComment(pOp, zP4, zCom, sizeof(zCom));-
1604#else-
1605 zCom[0] = 0;-
1606#endif-
1607 /* NB: The sqlite3OpcodeName() function is implemented by code created-
1608 ** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the-
1609 ** information from the vdbe.c source text */-
1610 fprintf(pOut, zFormat1, pc, -
1611 sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5,-
1612 zCom-
1613 );-
1614 fflush(pOut);-
1615}-
1616#endif-
1617-
1618/*-
1619** Initialize an array of N Mem element.-
1620*/-
1621static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){-
1622 while( (N--)>0 ){
(N--)>0Description
TRUEevaluated 4022742 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 1110892 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)
  • ...
1110892-4022742
1623 p->db = db;-
1624 p->flags = flags;-
1625 p->szMalloc = 0;-
1626#ifdef SQLITE_DEBUG-
1627 p->pScopyFrom = 0;-
1628#endif-
1629 p++;-
1630 }
executed 4022742 times by 435 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)
  • ...
4022742
1631}
executed 1110892 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)
  • ...
1110892
1632-
1633/*-
1634** Release an array of N Mem elements-
1635*/-
1636static void releaseMemArray(Mem *p, int N){-
1637 if( p && N ){
pDescription
TRUEevaluated 2180738 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 253609 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)
  • ...
NDescription
TRUEevaluated 1589989 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 590749 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)
  • ...
253609-2180738
1638 Mem *pEnd = &p[N];-
1639 sqlite3 *db = p->db;-
1640 if( db->pnBytesFreed ){
db->pnBytesFreedDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1589982 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)
  • ...
7-1589982
1641 do{-
1642 if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc);
executed 11 times by 1 test: sqlite3DbFree(db, p->zMalloc);
Executed by:
  • Self test (438)
p->szMallocDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
11-14
1643 }while( (++p)<pEnd );
executed 25 times by 1 test: end of block
Executed by:
  • Self test (438)
(++p)<pEndDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
7-25
1644 return;
executed 7 times by 1 test: return;
Executed by:
  • Self test (438)
7
1645 }-
1646 do{-
1647 assert( (&p[1])==pEnd || p[0].db==p[1].db );-
1648 assert( sqlite3VdbeCheckMemInvariants(p) );-
1649-
1650 /* This block is really an inlined version of sqlite3VdbeMemRelease()-
1651 ** that takes advantage of the fact that the memory cell value is -
1652 ** being set to NULL after releasing any dynamic resources.-
1653 **-
1654 ** The justification for duplicating code is that according to -
1655 ** callgrind, this causes a certain test case to hit the CPU 4.7 -
1656 ** percent less (x86 linux, gcc version 4.1.2, -O6) than if -
1657 ** sqlite3MemRelease() were called from here. With -O2, this jumps-
1658 ** to 6.6 percent. The test case is inserting 1000 rows into a table -
1659 ** with no indexes using a single prepared INSERT statement, bind() -
1660 ** and reset(). Inserts are grouped into a transaction.-
1661 */-
1662 testcase( p->flags & MEM_Agg );-
1663 testcase( p->flags & MEM_Dyn );-
1664 testcase( p->xDel==sqlite3VdbeFrameMemDel );-
1665 if( p->flags&(MEM_Agg|MEM_Dyn) ){
p->flags&(0x2000|0x0400)Description
TRUEevaluated 179768 times by 116 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • 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 (20)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (34)
  • Self test (353)
  • Self test (354)
  • Self test (355)
  • Self test (356)
  • Self test (357)
  • Self test (358)
  • Self test (359)
  • Self test (360)
  • Self test (361)
  • ...
FALSEevaluated 13244252 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)
  • ...
179768-13244252
1666 sqlite3VdbeMemRelease(p);-
1667 }else if( p->szMalloc ){
executed 179768 times by 116 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • 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 (20)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (34)
  • Self test (353)
  • Self test (354)
  • Self test (355)
  • Self test (356)
  • Self test (357)
  • Self test (358)
  • Self test (359)
  • Self test (360)
  • Self test (361)
  • ...
p->szMallocDescription
TRUEevaluated 3935745 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 9308507 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)
  • ...
179768-9308507
1668 sqlite3DbFreeNN(db, p->zMalloc);-
1669 p->szMalloc = 0;-
1670 }
executed 3935745 times by 435 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)
  • ...
3935745
1671-
1672 p->flags = MEM_Undefined;-
1673 }while( (++p)<pEnd );
executed 13424020 times by 435 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)
  • ...
(++p)<pEndDescription
TRUEevaluated 11834038 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 1589982 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)
  • ...
1589982-13424020
1674 }
executed 1589982 times by 435 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)
  • ...
1589982
1675}
executed 2434340 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)
  • ...
2434340
1676-
1677#ifdef SQLITE_DEBUG-
1678/*-
1679** Verify that pFrame is a valid VdbeFrame pointer. Return true if it is-
1680** and false if something is wrong.-
1681**-
1682** This routine is intended for use inside of assert() statements only.-
1683*/-
1684int sqlite3VdbeFrameIsValid(VdbeFrame *pFrame){-
1685 if( pFrame->iFrameMagic!=SQLITE_FRAME_MAGIC ) return 0;-
1686 return 1;-
1687}-
1688#endif-
1689-
1690-
1691/*-
1692** This is a destructor on a Mem object (which is really an sqlite3_value)-
1693** that deletes the Frame object that is attached to it as a blob.-
1694**-
1695** This routine does not delete the Frame right away. It merely adds the-
1696** frame to a list of frames to be deleted when the Vdbe halts.-
1697*/-
1698void sqlite3VdbeFrameMemDel(void *pArg){-
1699 VdbeFrame *pFrame = (VdbeFrame*)pArg;-
1700 assert( sqlite3VdbeFrameIsValid(pFrame) );-
1701 pFrame->pParent = pFrame->v->pDelFrame;-
1702 pFrame->v->pDelFrame = pFrame;-
1703}
executed 16137 times by 1 test: end of block
Executed by:
  • Self test (438)
16137
1704-
1705-
1706/*-
1707** Delete a VdbeFrame object and its contents. VdbeFrame objects are-
1708** allocated by the OP_Program opcode in sqlite3VdbeExec().-
1709*/-
1710void sqlite3VdbeFrameDelete(VdbeFrame *p){-
1711 int i;-
1712 Mem *aMem = VdbeFrameMem(p);-
1713 VdbeCursor **apCsr = (VdbeCursor **)&aMem[p->nChildMem];-
1714 assert( sqlite3VdbeFrameIsValid(p) );-
1715 for(i=0; i<p->nChildCsr; i++){
i<p->nChildCsrDescription
TRUEevaluated 22365 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 16137 times by 1 test
Evaluated by:
  • Self test (438)
16137-22365
1716 sqlite3VdbeFreeCursor(p->v, apCsr[i]);-
1717 }
executed 22365 times by 1 test: end of block
Executed by:
  • Self test (438)
22365
1718 releaseMemArray(aMem, p->nChildMem);-
1719 sqlite3VdbeDeleteAuxData(p->v->db, &p->pAuxData, -1, 0);-
1720 sqlite3DbFree(p->v->db, p);-
1721}
executed 16137 times by 1 test: end of block
Executed by:
  • Self test (438)
16137
1722-
1723#ifndef SQLITE_OMIT_EXPLAIN-
1724/*-
1725** Give a listing of the program in the virtual machine.-
1726**-
1727** The interface is the same as sqlite3VdbeExec(). But instead of-
1728** running the code, it invokes the callback once for each instruction.-
1729** This feature is used to implement "EXPLAIN".-
1730**-
1731** When p->explain==1, each instruction is listed. When-
1732** p->explain==2, only OP_Explain instructions are listed and these-
1733** are shown in a different format. p->explain==2 is used to implement-
1734** EXPLAIN QUERY PLAN.-
1735** 2018-04-24: In p->explain==2 mode, the OP_Init opcodes of triggers-
1736** are also shown, so that the boundaries between the main program and-
1737** each trigger are clear.-
1738**-
1739** When p->explain==1, first the main program is listed, then each of-
1740** the trigger subprograms are listed one by one.-
1741*/-
1742int sqlite3VdbeList(-
1743 Vdbe *p /* The VDBE */-
1744){-
1745 int nRow; /* Stop when row count reaches this */-
1746 int nSub = 0; /* Number of sub-vdbes seen so far */-
1747 SubProgram **apSub = 0; /* Array of sub-vdbes */-
1748 Mem *pSub = 0; /* Memory cell hold array of subprogs */-
1749 sqlite3 *db = p->db; /* The database connection */-
1750 int i; /* Loop counter */-
1751 int rc = SQLITE_OK; /* Return code */-
1752 Mem *pMem = &p->aMem[1]; /* First Mem of result set */-
1753 int bListSubprogs = (p->explain==1 || (db->flags & SQLITE_TriggerEQP)!=0);
p->explain==1Description
TRUEevaluated 9781 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1901 times by 1 test
Evaluated by:
  • Self test (438)
(db->flags & 0x01000000)!=0Description
TRUEevaluated 55 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1846 times by 1 test
Evaluated by:
  • Self test (438)
55-9781
1754 Op *pOp = 0;-
1755-
1756 assert( p->explain );-
1757 assert( p->magic==VDBE_MAGIC_RUN );-
1758 assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM );-
1759-
1760 /* Even though this opcode does not use dynamic strings for-
1761 ** the result, result columns may become dynamic if the user calls-
1762 ** sqlite3_column_text16(), causing a translation to UTF-16 encoding.-
1763 */-
1764 releaseMemArray(pMem, 8);-
1765 p->pResultSet = 0;-
1766-
1767 if( p->rc==SQLITE_NOMEM ){
p->rc==7Description
TRUEnever evaluated
FALSEevaluated 11682 times by 1 test
Evaluated by:
  • Self test (438)
0-11682
1768 /* This happens if a malloc() inside a call to sqlite3_column_text() or-
1769 ** sqlite3_column_text16() failed. */-
1770 sqlite3OomFault(db);-
1771 return SQLITE_ERROR;
never executed: return 1;
0
1772 }-
1773-
1774 /* When the number of output rows reaches nRow, that means the-
1775 ** listing has finished and sqlite3_step() should return SQLITE_DONE.-
1776 ** nRow is the sum of the number of rows in the main program, plus-
1777 ** the sum of the number of rows in all trigger subprograms encountered-
1778 ** so far. The nRow value will increase as new trigger subprograms are-
1779 ** encountered, but p->pc will eventually catch up to nRow.-
1780 */-
1781 nRow = p->nOp;-
1782 if( bListSubprogs ){
bListSubprogsDescription
TRUEevaluated 9836 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1846 times by 1 test
Evaluated by:
  • Self test (438)
1846-9836
1783 /* The first 8 memory cells are used for the result set. So we will-
1784 ** commandeer the 9th cell to use as storage for an array of pointers-
1785 ** to trigger subprograms. The VDBE is guaranteed to have at least 9-
1786 ** cells. */-
1787 assert( p->nMem>9 );-
1788 pSub = &p->aMem[9];-
1789 if( pSub->flags&MEM_Blob ){
pSub->flags&0x0010Description
TRUEevaluated 149 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 9687 times by 1 test
Evaluated by:
  • Self test (438)
149-9687
1790 /* On the first call to sqlite3_step(), pSub will hold a NULL. It is-
1791 ** initialized to a BLOB by the P4_SUBPROGRAM processing logic below */-
1792 nSub = pSub->n/sizeof(Vdbe*);-
1793 apSub = (SubProgram **)pSub->z;-
1794 }
executed 149 times by 1 test: end of block
Executed by:
  • Self test (438)
149
1795 for(i=0; i<nSub; i++){
i<nSubDescription
TRUEevaluated 149 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 9836 times by 1 test
Evaluated by:
  • Self test (438)
149-9836
1796 nRow += apSub[i]->nOp;-
1797 }
executed 149 times by 1 test: end of block
Executed by:
  • Self test (438)
149
1798 }
executed 9836 times by 1 test: end of block
Executed by:
  • Self test (438)
9836
1799-
1800 while(1){ /* Loop exits via break */-
1801 i = p->pc++;-
1802 if( i>=nRow ){
i>=nRowDescription
TRUEevaluated 975 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 28226 times by 1 test
Evaluated by:
  • Self test (438)
975-28226
1803 p->rc = SQLITE_OK;-
1804 rc = SQLITE_DONE;-
1805 break;
executed 975 times by