OpenCoverage

vdbe.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/sqlite/src/src/vdbe.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2** 2001 September 15-
3**-
4** The author disclaims copyright to this source code. In place of-
5** a legal notice, here is a blessing:-
6**-
7** May you do good and not evil.-
8** May you find forgiveness for yourself and forgive others.-
9** May you share freely, never taking more than you give.-
10**-
11*************************************************************************-
12** The code in this file implements the function that runs the-
13** bytecode of a prepared statement.-
14**-
15** Various scripts scan this source file in order to generate HTML-
16** documentation, headers files, or other derived files. The formatting-
17** of the code in this file is, therefore, important. See other comments-
18** in this file for details. If in doubt, do not deviate from existing-
19** commenting and indentation practices when changing or adding code.-
20*/-
21#include "sqliteInt.h"-
22#include "vdbeInt.h"-
23-
24/*-
25** Invoke this macro on memory cells just prior to changing the-
26** value of the cell. This macro verifies that shallow copies are-
27** not misused. A shallow copy of a string or blob just copies a-
28** pointer to the string or blob, not the content. If the original-
29** is changed while the copy is still in use, the string or blob might-
30** be changed out from under the copy. This macro verifies that nothing-
31** like that ever happens.-
32*/-
33#ifdef SQLITE_DEBUG-
34# define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M)-
35#else-
36# define memAboutToChange(P,M)-
37#endif-
38-
39/*-
40** The following global variable is incremented every time a cursor-
41** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test-
42** procedures use this information to make sure that indices are-
43** working correctly. This variable has no function other than to-
44** help verify the correct operation of the library.-
45*/-
46#ifdef SQLITE_TEST-
47int sqlite3_search_count = 0;-
48#endif-
49-
50/*-
51** When this global variable is positive, it gets decremented once before-
52** each instruction in the VDBE. When it reaches zero, the u1.isInterrupted-
53** field of the sqlite3 structure is set in order to simulate an interrupt.-
54**-
55** This facility is used for testing purposes only. It does not function-
56** in an ordinary build.-
57*/-
58#ifdef SQLITE_TEST-
59int sqlite3_interrupt_count = 0;-
60#endif-
61-
62/*-
63** The next global variable is incremented each type the OP_Sort opcode-
64** is executed. The test procedures use this information to make sure that-
65** sorting is occurring or not occurring at appropriate times. This variable-
66** has no function other than to help verify the correct operation of the-
67** library.-
68*/-
69#ifdef SQLITE_TEST-
70int sqlite3_sort_count = 0;-
71#endif-
72-
73/*-
74** The next global variable records the size of the largest MEM_Blob-
75** or MEM_Str that has been used by a VDBE opcode. The test procedures-
76** use this information to make sure that the zero-blob functionality-
77** is working correctly. This variable has no function other than to-
78** help verify the correct operation of the library.-
79*/-
80#ifdef SQLITE_TEST-
81int sqlite3_max_blobsize = 0;-
82static void updateMaxBlobsize(Mem *p){-
83 if( (p->flags & (MEM_Str|MEM_Blob))!=0 && p->n>sqlite3_max_blobsize ){
(p->flags & (0...02|0x0010))!=0Description
TRUEevaluated 32678942 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 23091609 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)
  • ...
p->n>sqlite3_max_blobsizeDescription
TRUEevaluated 1808 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 32677134 times by 429 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)
  • ...
1808-32678942
84 sqlite3_max_blobsize = p->n;-
85 }
executed 1808 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)
  • ...
1808
86}
executed 55770551 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)
  • ...
55770551
87#endif-
88-
89/*-
90** This macro evaluates to true if either the update hook or the preupdate-
91** hook are enabled for database connect DB.-
92*/-
93#ifdef SQLITE_ENABLE_PREUPDATE_HOOK-
94# define HAS_UPDATE_HOOK(DB) ((DB)->xPreUpdateCallback||(DB)->xUpdateCallback)-
95#else-
96# define HAS_UPDATE_HOOK(DB) ((DB)->xUpdateCallback)-
97#endif-
98-
99/*-
100** The next global variable is incremented each time the OP_Found opcode-
101** is executed. This is used to test whether or not the foreign key-
102** operation implemented using OP_FkIsZero is working. This variable-
103** has no function other than to help verify the correct operation of the-
104** library.-
105*/-
106#ifdef SQLITE_TEST-
107int sqlite3_found_count = 0;-
108#endif-
109-
110/*-
111** Test a register to see if it exceeds the current maximum blob size.-
112** If it does, record the new maximum blob size.-
113*/-
114#if defined(SQLITE_TEST) && !defined(SQLITE_UNTESTABLE)-
115# define UPDATE_MAX_BLOBSIZE(P) updateMaxBlobsize(P)-
116#else-
117# define UPDATE_MAX_BLOBSIZE(P)-
118#endif-
119-
120/*-
121** Invoke the VDBE coverage callback, if that callback is defined. This-
122** feature is used for test suite validation only and does not appear an-
123** production builds.-
124**-
125** M is an integer between 2 and 4. 2 indicates a ordinary two-way-
126** branch (I=0 means fall through and I=1 means taken). 3 indicates-
127** a 3-way branch where the third way is when one of the operands is-
128** NULL. 4 indicates the OP_Jump instruction which has three destinations-
129** depending on whether the first operand is less than, equal to, or greater-
130** than the second. -
131**-
132** iSrcLine is the source code line (from the __LINE__ macro) that-
133** generated the VDBE instruction combined with flag bits. The source-
134** code line number is in the lower 24 bits of iSrcLine and the upper-
135** 8 bytes are flags. The lower three bits of the flags indicate-
136** values for I that should never occur. For example, if the branch is-
137** always taken, the flags should be 0x05 since the fall-through and-
138** alternate branch are never taken. If a branch is never taken then-
139** flags should be 0x06 since only the fall-through approach is allowed.-
140**-
141** Bit 0x04 of the flags indicates an OP_Jump opcode that is only-
142** interested in equal or not-equal. In other words, I==0 and I==2-
143** should be treated the same.-
144**-
145** Since only a line number is retained, not the filename, this macro-
146** only works for amalgamation builds. But that is ok, since these macros-
147** should be no-ops except for special builds used to measure test coverage.-
148*/-
149#if !defined(SQLITE_VDBE_COVERAGE)-
150# define VdbeBranchTaken(I,M)-
151#else-
152# define VdbeBranchTaken(I,M) vdbeTakeBranch(pOp->iSrcLine,I,M)-
153 static void vdbeTakeBranch(u32 iSrcLine, u8 I, u8 M){-
154 u8 mNever;-
155 assert( I<=2 ); /* 0: fall through, 1: taken, 2: alternate taken */-
156 assert( M<=4 ); /* 2: two-way branch, 3: three-way branch, 4: OP_Jump */-
157 assert( I<M ); /* I can only be 2 if M is 3 or 4 */-
158 /* Transform I from a integer [0,1,2] into a bitmask of [1,2,4] */-
159 I = 1<<I;-
160 /* The upper 8 bits of iSrcLine are flags. The lower three bits of-
161 ** the flags indicate directions that the branch can never go. If-
162 ** a branch really does go in one of those directions, assert right-
163 ** away. */-
164 mNever = iSrcLine >> 24;-
165 assert( (I & mNever)==0 );-
166 if( sqlite3GlobalConfig.xVdbeBranch==0 ) return; /*NO_TEST*/-
167 I |= mNever;-
168 if( M==2 ) I |= 0x04;-
169 if( M==4 ){-
170 I |= 0x08;-
171 if( (mNever&0x08)!=0 && (I&0x05)!=0) I |= 0x05; /*NO_TEST*/-
172 }-
173 sqlite3GlobalConfig.xVdbeBranch(sqlite3GlobalConfig.pVdbeBranchArg,-
174 iSrcLine&0xffffff, I, M);-
175 }-
176#endif-
177-
178/*-
179** Convert the given register into a string if it isn't one-
180** already. Return non-zero if a malloc() fails.-
181*/-
182#define Stringify(P, enc) \-
183 if(((P)->flags&(MEM_Str|MEM_Blob))==0 && sqlite3VdbeMemStringify(P,enc,0)) \-
184 { goto no_mem; }-
185-
186/*-
187** An ephemeral string value (signified by the MEM_Ephem flag) contains-
188** a pointer to a dynamically allocated string where some other entity-
189** is responsible for deallocating that string. Because the register-
190** does not control the string, it might be deleted without the register-
191** knowing it.-
192**-
193** This routine converts an ephemeral string into a dynamically allocated-
194** string that the register itself controls. In other words, it-
195** converts an MEM_Ephem string into a string with P.z==P.zMalloc.-
196*/-
197#define Deephemeralize(P) \-
198 if( ((P)->flags&MEM_Ephem)!=0 \-
199 && sqlite3VdbeMemMakeWriteable(P) ){ goto no_mem;}-
200-
201/* Return true if the cursor was opened using the OP_OpenSorter opcode. */-
202#define isSorter(x) ((x)->eCurType==CURTYPE_SORTER)-
203-
204/*-
205** Allocate VdbeCursor number iCur. Return a pointer to it. Return NULL-
206** if we run out of memory.-
207*/-
208static VdbeCursor *allocateCursor(-
209 Vdbe *p, /* The virtual machine */-
210 int iCur, /* Index of the new VdbeCursor */-
211 int nField, /* Number of fields in the table or index */-
212 int iDb, /* Database the cursor belongs to, or -1 */-
213 u8 eCurType /* Type of the new cursor */-
214){-
215 /* Find the memory cell that will be used to store the blob of memory-
216 ** required for this VdbeCursor structure. It is convenient to use a -
217 ** vdbe memory cell to manage the memory allocation required for a-
218 ** VdbeCursor structure for the following reasons:-
219 **-
220 ** * Sometimes cursor numbers are used for a couple of different-
221 ** purposes in a vdbe program. The different uses might require-
222 ** different sized allocations. Memory cells provide growable-
223 ** allocations.-
224 **-
225 ** * When using ENABLE_MEMORY_MANAGEMENT, memory cell buffers can-
226 ** be freed lazily via the sqlite3_release_memory() API. This-
227 ** minimizes the number of malloc calls made by the system.-
228 **-
229 ** The memory cell for cursor 0 is aMem[0]. The rest are allocated from-
230 ** the top of the register space. Cursor 1 is at Mem[p->nMem-1].-
231 ** Cursor 2 is at Mem[p->nMem-2]. And so forth.-
232 */-
233 Mem *pMem = iCur>0 ? &p->aMem[p->nMem-iCur] : p->aMem;
iCur>0Description
TRUEevaluated 1212955 times by 399 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • ...
FALSEevaluated 790623 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)
  • ...
790623-1212955
234-
235 int nByte;-
236 VdbeCursor *pCx = 0;-
237 nByte = -
238 ROUND8(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField + -
239 (eCurType==CURTYPE_BTREE?sqlite3BtreeCursorSize():0);
eCurType==0Description
TRUEevaluated 1915184 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 88394 times by 10 tests
Evaluated 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)
88394-1915184
240-
241 assert( iCur>=0 && iCur<p->nCursor );-
242 if( p->apCsr[iCur] ){ /*OPTIMIZATION-IF-FALSE*/
p->apCsr[iCur]Description
TRUEevaluated 250681 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 1752897 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)
  • ...
250681-1752897
243 sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);-
244 p->apCsr[iCur] = 0;-
245 }
executed 250681 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)
250681
246 if( SQLITE_OK==sqlite3VdbeMemClearAndResize(pMem, nByte) ){
0==sqlite3Vdbe...e(pMem, nByte)Description
TRUEevaluated 2003533 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 45 times by 1 test
Evaluated by:
  • Self test (438)
45-2003533
247 p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z;-
248 memset(pCx, 0, offsetof(VdbeCursor,pAltCursor));-
249 pCx->eCurType = eCurType;-
250 pCx->iDb = iDb;-
251 pCx->nField = nField;-
252 pCx->aOffset = &pCx->aType[nField];-
253 if( eCurType==CURTYPE_BTREE ){
eCurType==0Description
TRUEevaluated 1915141 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 88392 times by 10 tests
Evaluated 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)
88392-1915141
254 pCx->uc.pCursor = (BtCursor*)-
255 &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];-
256 sqlite3BtreeCursorZero(pCx->uc.pCursor);-
257 }
executed 1915141 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)
  • ...
1915141
258 }
executed 2003533 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)
  • ...
2003533
259 return pCx;
executed 2003578 times by 435 tests: return pCx;
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)
  • ...
2003578
260}-
261-
262/*-
263** Try to convert a value into a numeric representation if we can-
264** do so without loss of information. In other words, if the string-
265** looks like a number, convert it into a number. If it does not-
266** look like a number, leave it alone.-
267**-
268** If the bTryForInt flag is true, then extra effort is made to give-
269** an integer representation. Strings that look like floating point-
270** values but which have no fractional component (example: '48.00')-
271** will have a MEM_Int representation when bTryForInt is true.-
272**-
273** If bTryForInt is false, then if the input string contains a decimal-
274** point or exponential notation, the result is only MEM_Real, even-
275** if there is an exact integer representation of the quantity.-
276*/-
277static void applyNumericAffinity(Mem *pRec, int bTryForInt){-
278 double rValue;-
279 i64 iValue;-
280 u8 enc = pRec->enc;-
281 assert( (pRec->flags & (MEM_Str|MEM_Int|MEM_Real))==MEM_Str );-
282 if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return;
executed 657859 times by 1 test: return;
Executed by:
  • Self test (438)
sqlite3AtoF(pR...ec->n, enc)==0Description
TRUEevaluated 657859 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4047635 times by 1 test
Evaluated by:
  • Self test (438)
657859-4047635
283 if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){
0==sqlite3Atoi... pRec->n, enc)Description
TRUEevaluated 4028759 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 18876 times by 1 test
Evaluated by:
  • Self test (438)
18876-4028759
284 pRec->u.i = iValue;-
285 pRec->flags |= MEM_Int;-
286 }else{
executed 4028759 times by 1 test: end of block
Executed by:
  • Self test (438)
4028759
287 pRec->u.r = rValue;-
288 pRec->flags |= MEM_Real;-
289 if( bTryForInt ) sqlite3VdbeIntegerAffinity(pRec);
executed 280 times by 1 test: sqlite3VdbeIntegerAffinity(pRec);
Executed by:
  • Self test (438)
bTryForIntDescription
TRUEevaluated 280 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 18596 times by 1 test
Evaluated by:
  • Self test (438)
280-18596
290 }
executed 18876 times by 1 test: end of block
Executed by:
  • Self test (438)
18876
291 /* TEXT->NUMERIC is many->one. Hence, it is important to invalidate the-
292 ** string representation after computing a numeric equivalent, because the-
293 ** string representation might not be the canonical representation for the-
294 ** numeric value. Ticket [343634942dd54ab57b7024] 2018-01-31. */-
295 pRec->flags &= ~MEM_Str;-
296}
executed 4047635 times by 1 test: end of block
Executed by:
  • Self test (438)
4047635
297-
298/*-
299** Processing is determine by the affinity parameter:-
300**-
301** SQLITE_AFF_INTEGER:-
302** SQLITE_AFF_REAL:-
303** SQLITE_AFF_NUMERIC:-
304** Try to convert pRec to an integer representation or a -
305** floating-point representation if an integer representation-
306** is not possible. Note that the integer representation is-
307** always preferred, even if the affinity is REAL, because-
308** an integer representation is more space efficient on disk.-
309**-
310** SQLITE_AFF_TEXT:-
311** Convert pRec to a text representation.-
312**-
313** SQLITE_AFF_BLOB:-
314** No-op. pRec is unchanged.-
315*/-
316static void applyAffinity(-
317 Mem *pRec, /* The value to apply affinity to */-
318 char affinity, /* The affinity to be applied */-
319 u8 enc /* Use this text encoding */-
320){-
321 if( affinity>=SQLITE_AFF_NUMERIC ){
affinity>='C'Description
TRUEevaluated 1056190 times by 363 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 403693 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
403693-1056190
322 assert( affinity==SQLITE_AFF_INTEGER || affinity==SQLITE_AFF_REAL-
323 || affinity==SQLITE_AFF_NUMERIC );-
324 if( (pRec->flags & MEM_Int)==0 ){ /*OPTIMIZATION-IF-FALSE*/
(pRec->flags & 0x0004)==0Description
TRUEevaluated 406915 times by 336 tests
Evaluated by:
  • Self test
  • 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)
  • ...
FALSEevaluated 649275 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
406915-649275
325 if( (pRec->flags & MEM_Real)==0 ){
(pRec->flags & 0x0008)==0Description
TRUEevaluated 341820 times by 333 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
FALSEevaluated 65095 times by 4 tests
Evaluated by:
  • Self test
  • Self test (438)
  • Self test (57)
  • Self test (58)
65095-341820
326 if( pRec->flags & MEM_Str ) applyNumericAffinity(pRec,1);
executed 5247 times by 1 test: applyNumericAffinity(pRec,1);
Executed by:
  • Self test (438)
pRec->flags & 0x0002Description
TRUEevaluated 5247 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 336573 times by 333 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)
  • ...
5247-336573
327 }else{
executed 341820 times by 333 tests: end of block
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
341820
328 sqlite3VdbeIntegerAffinity(pRec);-
329 }
executed 65095 times by 4 tests: end of block
Executed by:
  • Self test
  • Self test (438)
  • Self test (57)
  • Self test (58)
65095
330 }-
331 }else if( affinity==SQLITE_AFF_TEXT ){
executed 1056190 times by 363 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
affinity=='B'Description
TRUEevaluated 388680 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 15013 times by 1 test
Evaluated by:
  • Self test (438)
15013-1056190
332 /* Only attempt the conversion to TEXT if there is an integer or real-
333 ** representation (blob and NULL do not get converted) but no string-
334 ** representation. It would be harmless to repeat the conversion if -
335 ** there is already a string rep, but it is pointless to waste those-
336 ** CPU cycles. */-
337 if( 0==(pRec->flags&MEM_Str) ){ /*OPTIMIZATION-IF-FALSE*/
0==(pRec->flags&0x0002)Description
TRUEevaluated 149637 times by 13 tests
Evaluated by:
  • Self test (100)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • Self test (99)
FALSEevaluated 239043 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
149637-239043
338 if( (pRec->flags&(MEM_Real|MEM_Int)) ){
(pRec->flags&(0x0008|0x0004))Description
TRUEevaluated 147272 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2365 times by 13 tests
Evaluated by:
  • Self test (100)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • Self test (99)
2365-147272
339 sqlite3VdbeMemStringify(pRec, enc, 1);-
340 }
executed 147272 times by 1 test: end of block
Executed by:
  • Self test (438)
147272
341 }
executed 149637 times by 13 tests: end of block
Executed by:
  • Self test (100)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • Self test (99)
149637
342 pRec->flags &= ~(MEM_Real|MEM_Int);-
343 }
executed 388680 times by 31 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
388680
344}
executed 1459883 times by 363 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
1459883
345-
346/*-
347** Try to convert the type of a function argument or a result column-
348** into a numeric representation. Use either INTEGER or REAL whichever-
349** is appropriate. But only do the conversion if it is possible without-
350** loss of information and return the revised type of the argument.-
351*/-
352int sqlite3_value_numeric_type(sqlite3_value *pVal){-
353 int eType = sqlite3_value_type(pVal);-
354 if( eType==SQLITE_TEXT ){
eType==3Description
TRUEevaluated 4000403 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 252504 times by 1 test
Evaluated by:
  • Self test (438)
252504-4000403
355 Mem *pMem = (Mem*)pVal;-
356 applyNumericAffinity(pMem, 0);-
357 eType = sqlite3_value_type(pVal);-
358 }
executed 4000403 times by 1 test: end of block
Executed by:
  • Self test (438)
4000403
359 return eType;
executed 4252907 times by 1 test: return eType;
Executed by:
  • Self test (438)
4252907
360}-
361-
362/*-
363** Exported version of applyAffinity(). This one works on sqlite3_value*, -
364** not the internal Mem* type.-
365*/-
366void sqlite3ValueApplyAffinity(-
367 sqlite3_value *pVal, -
368 u8 affinity, -
369 u8 enc-
370){-
371 applyAffinity((Mem *)pVal, affinity, enc);-
372}
executed 145921 times by 1 test: end of block
Executed by:
  • Self test (438)
145921
373-
374/*-
375** pMem currently only holds a string type (or maybe a BLOB that we can-
376** interpret as a string if we want to). Compute its corresponding-
377** numeric type, if has one. Set the pMem->u.r and pMem->u.i fields-
378** accordingly.-
379*/-
380static u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){-
381 assert( (pMem->flags & (MEM_Int|MEM_Real))==0 );-
382 assert( (pMem->flags & (MEM_Str|MEM_Blob))!=0 );-
383 if( sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc)==0 ){
sqlite3AtoF(pM... pMem->enc)==0Description
TRUEevaluated 897 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1705 times by 1 test
Evaluated by:
  • Self test (438)
897-1705
384 return 0;
executed 897 times by 1 test: return 0;
Executed by:
  • Self test (438)
897
385 }-
386 if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==0 ){
sqlite3Atoi64(... pMem->enc)==0Description
TRUEevaluated 1336 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 369 times by 1 test
Evaluated by:
  • Self test (438)
369-1336
387 return MEM_Int;
executed 1336 times by 1 test: return 0x0004;
Executed by:
  • Self test (438)
1336
388 }-
389 return MEM_Real;
executed 369 times by 1 test: return 0x0008;
Executed by:
  • Self test (438)
369
390}-
391-
392/*-
393** Return the numeric type for pMem, either MEM_Int or MEM_Real or both or-
394** none. -
395**-
396** Unlike applyNumericAffinity(), this routine does not modify pMem->flags.-
397** But it does set pMem->u.r and pMem->u.i appropriately.-
398*/-
399static u16 numericType(Mem *pMem){-
400 if( pMem->flags & (MEM_Int|MEM_Real) ){
pMem->flags & (0x0004|0x0008)Description
TRUEevaluated 15748132 times by 335 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
FALSEevaluated 3142 times by 1 test
Evaluated by:
  • Self test (438)
3142-15748132
401 return pMem->flags & (MEM_Int|MEM_Real);
executed 15748132 times by 335 tests: return pMem->flags & (0x0004|0x0008);
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
15748132
402 }-
403 if( pMem->flags & (MEM_Str|MEM_Blob) ){
pMem->flags & (0x0002|0x0010)Description
TRUEevaluated 2602 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 540 times by 1 test
Evaluated by:
  • Self test (438)
540-2602
404 return computeNumericType(pMem);
executed 2602 times by 1 test: return computeNumericType(pMem);
Executed by:
  • Self test (438)
2602
405 }-
406 return 0;
executed 540 times by 1 test: return 0;
Executed by:
  • Self test (438)
540
407}-
408-
409#ifdef SQLITE_DEBUG-
410/*-
411** Write a nice string representation of the contents of cell pMem-
412** into buffer zBuf, length nBuf.-
413*/-
414void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){-
415 char *zCsr = zBuf;-
416 int f = pMem->flags;-
417-
418 static const char *const encnames[] = {"(X)", "(8)", "(16LE)", "(16BE)"};-
419-
420 if( f&MEM_Blob ){-
421 int i;-
422 char c;-
423 if( f & MEM_Dyn ){-
424 c = 'z';-
425 assert( (f & (MEM_Static|MEM_Ephem))==0 );-
426 }else if( f & MEM_Static ){-
427 c = 't';-
428 assert( (f & (MEM_Dyn|MEM_Ephem))==0 );-
429 }else if( f & MEM_Ephem ){-
430 c = 'e';-
431 assert( (f & (MEM_Static|MEM_Dyn))==0 );-
432 }else{-
433 c = 's';-
434 }-
435 *(zCsr++) = c;-
436 sqlite3_snprintf(100, zCsr, "%d[", pMem->n);-
437 zCsr += sqlite3Strlen30(zCsr);-
438 for(i=0; i<16 && i<pMem->n; i++){-
439 sqlite3_snprintf(100, zCsr, "%02X", ((int)pMem->z[i] & 0xFF));-
440 zCsr += sqlite3Strlen30(zCsr);-
441 }-
442 for(i=0; i<16 && i<pMem->n; i++){-
443 char z = pMem->z[i];-
444 if( z<32 || z>126 ) *zCsr++ = '.';-
445 else *zCsr++ = z;-
446 }-
447 *(zCsr++) = ']';-
448 if( f & MEM_Zero ){-
449 sqlite3_snprintf(100, zCsr,"+%dz",pMem->u.nZero);-
450 zCsr += sqlite3Strlen30(zCsr);-
451 }-
452 *zCsr = '\0';-
453 }else if( f & MEM_Str ){-
454 int j, k;-
455 zBuf[0] = ' ';-
456 if( f & MEM_Dyn ){-
457 zBuf[1] = 'z';-
458 assert( (f & (MEM_Static|MEM_Ephem))==0 );-
459 }else if( f & MEM_Static ){-
460 zBuf[1] = 't';-
461 assert( (f & (MEM_Dyn|MEM_Ephem))==0 );-
462 }else if( f & MEM_Ephem ){-
463 zBuf[1] = 'e';-
464 assert( (f & (MEM_Static|MEM_Dyn))==0 );-
465 }else{-
466 zBuf[1] = 's';-
467 }-
468 k = 2;-
469 sqlite3_snprintf(100, &zBuf[k], "%d", pMem->n);-
470 k += sqlite3Strlen30(&zBuf[k]);-
471 zBuf[k++] = '[';-
472 for(j=0; j<15 && j<pMem->n; j++){-
473 u8 c = pMem->z[j];-
474 if( c>=0x20 && c<0x7f ){-
475 zBuf[k++] = c;-
476 }else{-
477 zBuf[k++] = '.';-
478 }-
479 }-
480 zBuf[k++] = ']';-
481 sqlite3_snprintf(100,&zBuf[k], encnames[pMem->enc]);-
482 k += sqlite3Strlen30(&zBuf[k]);-
483 zBuf[k++] = 0;-
484 }-
485}-
486#endif-
487-
488#ifdef SQLITE_DEBUG-
489/*-
490** Print the value of a register for tracing purposes:-
491*/-
492static void memTracePrint(Mem *p){-
493 if( p->flags & MEM_Undefined ){-
494 printf(" undefined");-
495 }else if( p->flags & MEM_Null ){-
496 printf(p->flags & MEM_Zero ? " NULL-nochng" : " NULL");-
497 }else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){-
498 printf(" si:%lld", p->u.i);-
499 }else if( p->flags & MEM_Int ){-
500 printf(" i:%lld", p->u.i);-
501#ifndef SQLITE_OMIT_FLOATING_POINT-
502 }else if( p->flags & MEM_Real ){-
503 printf(" r:%g", p->u.r);-
504#endif-
505 }else if( sqlite3VdbeMemIsRowSet(p) ){-
506 printf(" (rowset)");-
507 }else{-
508 char zBuf[200];-
509 sqlite3VdbeMemPrettyPrint(p, zBuf);-
510 printf(" %s", zBuf);-
511 }-
512 if( p->flags & MEM_Subtype ) printf(" subtype=0x%02x", p->eSubtype);-
513}-
514static void registerTrace(int iReg, Mem *p){-
515 printf("REG[%d] = ", iReg);-
516 memTracePrint(p);-
517 printf("\n");-
518 sqlite3VdbeCheckMemInvariants(p);-
519}-
520#endif-
521-
522#ifdef SQLITE_DEBUG-
523# define REGISTER_TRACE(R,M) if(db->flags&SQLITE_VdbeTrace)registerTrace(R,M)-
524#else-
525# define REGISTER_TRACE(R,M)-
526#endif-
527-
528-
529#ifdef VDBE_PROFILE-
530-
531/* -
532** hwtime.h contains inline assembler code for implementing -
533** high-performance timing routines.-
534*/-
535#include "hwtime.h"-
536-
537#endif-
538-
539#ifndef NDEBUG-
540/*-
541** This function is only called from within an assert() expression. It-
542** checks that the sqlite3.nTransaction variable is correctly set to-
543** the number of non-transaction savepoints currently in the -
544** linked list starting at sqlite3.pSavepoint.-
545** -
546** Usage:-
547**-
548** assert( checkSavepointCount(db) );-
549*/-
550static int checkSavepointCount(sqlite3 *db){-
551 int n = 0;-
552 Savepoint *p;-
553 for(p=db->pSavepoint; p; p=p->pNext) n++;-
554 assert( n==(db->nSavepoint + db->isTransactionSavepoint) );-
555 return 1;-
556}-
557#endif-
558-
559/*-
560** Return the register of pOp->p2 after first preparing it to be-
561** overwritten with an integer value.-
562*/-
563static SQLITE_NOINLINE Mem *out2PrereleaseWithClear(Mem *pOut){-
564 sqlite3VdbeMemSetNull(pOut);-
565 pOut->flags = MEM_Int;-
566 return pOut;
executed 12633 times by 1 test: return pOut;
Executed by:
  • Self test (438)
12633
567}-
568static Mem *out2Prerelease(Vdbe *p, VdbeOp *pOp){-
569 Mem *pOut;-
570 assert( pOp->p2>0 );-
571 assert( pOp->p2<=(p->nMem+1 - p->nCursor) );-
572 pOut = &p->aMem[pOp->p2];-
573 memAboutToChange(p, pOut);-
574 if( VdbeMemDynamic(pOut) ){ /*OPTIMIZATION-IF-FALSE*/
(((pOut)->flag...0|0x0400))!=0)Description
TRUEevaluated 12633 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 15847728 times by 425 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)
  • ...
12633-15847728
575 return out2PrereleaseWithClear(pOut);
executed 12633 times by 1 test: return out2PrereleaseWithClear(pOut);
Executed by:
  • Self test (438)
12633
576 }else{-
577 pOut->flags = MEM_Int;-
578 return pOut;
executed 15847728 times by 425 tests: return pOut;
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)
  • ...
15847728
579 }-
580}-
581-
582-
583/*-
584** Execute as much of a VDBE program as we can.-
585** This is the core of sqlite3_step(). -
586*/-
587int sqlite3VdbeExec(-
588 Vdbe *p /* The VDBE */-
589){-
590 Op *aOp = p->aOp; /* Copy of p->aOp */-
591 Op *pOp = aOp; /* Current operation */-
592#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)-
593 Op *pOrigOp; /* Value of pOp at the top of the loop */-
594#endif-
595#ifdef SQLITE_DEBUG-
596 int nExtraDelete = 0; /* Verifies FORDELETE and AUXDELETE flags */-
597#endif-
598 int rc = SQLITE_OK; /* Value to return */-
599 sqlite3 *db = p->db; /* The database */-
600 u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */-
601 u8 encoding = ENC(db); /* The database encoding */-
602 int iCompare = 0; /* Result of last comparison */-
603 unsigned nVmStep = 0; /* Number of virtual machine steps */-
604#ifndef SQLITE_OMIT_PROGRESS_CALLBACK-
605 unsigned nProgressLimit; /* Invoke xProgress() when nVmStep reaches this */-
606#endif-
607 Mem *aMem = p->aMem; /* Copy of p->aMem */-
608 Mem *pIn1 = 0; /* 1st input operand */-
609 Mem *pIn2 = 0; /* 2nd input operand */-
610 Mem *pIn3 = 0; /* 3rd input operand */-
611 Mem *pOut = 0; /* Output operand */-
612#ifdef VDBE_PROFILE-
613 u64 start; /* CPU clock count at start of opcode */-
614#endif-
615 /*** INSERT STACK UNION HERE ***/-
616-
617 assert( p->magic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */-
618 sqlite3VdbeEnter(p);-
619 if( p->rc==SQLITE_NOMEM ){
p->rc==7Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3754154 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-3754154
620 /* This happens if a malloc() inside a call to sqlite3_column_text() or-
621 ** sqlite3_column_text16() failed. */-
622 goto no_mem;
executed 7 times by 1 test: goto no_mem;
Executed by:
  • Self test (438)
7
623 }-
624 assert( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_BUSY );-
625 assert( p->bIsReader || p->readOnly!=0 );-
626 p->iCurrentTime = 0;-
627 assert( p->explain==0 );-
628 p->pResultSet = 0;-
629 db->busyHandler.nBusy = 0;-
630 if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
executed 73 times by 1 test: goto abort_due_to_interrupt;
Executed by:
  • Self test (438)
db->u1.isInterruptedDescription
TRUEevaluated 73 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3754081 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)
  • ...
73-3754081
631 sqlite3VdbeIOTraceSql(p);-
632#ifndef SQLITE_OMIT_PROGRESS_CALLBACK-
633 if( db->xProgress ){
db->xProgressDescription
TRUEevaluated 33 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3754048 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)
  • ...
33-3754048
634 u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP];-
635 assert( 0 < db->nProgressOps );-
636 nProgressLimit = db->nProgressOps - (iPrior % db->nProgressOps);-
637 }else{
executed 33 times by 1 test: end of block
Executed by:
  • Self test (438)
33
638 nProgressLimit = 0xffffffff;-
639 }
executed 3754048 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)
  • ...
3754048
640#endif-
641#ifdef SQLITE_DEBUG-
642 sqlite3BeginBenignMalloc();-
643 if( p->pc==0-
644 && (p->db->flags & (SQLITE_VdbeListing|SQLITE_VdbeEQP|SQLITE_VdbeTrace))!=0-
645 ){-
646 int i;-
647 int once = 1;-
648 sqlite3VdbePrintSql(p);-
649 if( p->db->flags & SQLITE_VdbeListing ){-
650 printf("VDBE Program Listing:\n");-
651 for(i=0; i<p->nOp; i++){-
652 sqlite3VdbePrintOp(stdout, i, &aOp[i]);-
653 }-
654 }-
655 if( p->db->flags & SQLITE_VdbeEQP ){-
656 for(i=0; i<p->nOp; i++){-
657 if( aOp[i].opcode==OP_Explain ){-
658 if( once ) printf("VDBE Query Plan:\n");-
659 printf("%s\n", aOp[i].p4.z);-
660 once = 0;-
661 }-
662 }-
663 }-
664 if( p->db->flags & SQLITE_VdbeTrace ) printf("VDBE Trace:\n");-
665 }-
666 sqlite3EndBenignMalloc();-
667#endif-
668 for(pOp=&aOp[p->pc]; 1; pOp++){
1Description
TRUEevaluated 182117017 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-182117017
669 /* Errors are detected by individual opcodes, with an immediate-
670 ** jumps to abort_due_to_error. */-
671 assert( rc==SQLITE_OK );-
672-
673 assert( pOp>=aOp && pOp<&aOp[p->nOp]);-
674#ifdef VDBE_PROFILE-
675 start = sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();-
676#endif-
677 nVmStep++;-
678#ifdef SQLITE_ENABLE_STMT_SCANSTATUS-
679 if( p->anExec ) p->anExec[(int)(pOp-aOp)]++;-
680#endif-
681-
682 /* Only allow tracing if SQLITE_DEBUG is defined.-
683 */-
684#ifdef SQLITE_DEBUG-
685 if( db->flags & SQLITE_VdbeTrace ){-
686 sqlite3VdbePrintOp(stdout, (int)(pOp - aOp), pOp);-
687 }-
688#endif-
689 -
690-
691 /* Check to see if we need to simulate an interrupt. This only happens-
692 ** if we have a special test build.-
693 */-
694#ifdef SQLITE_TEST-
695 if( sqlite3_interrupt_count>0 ){
sqlite3_interrupt_count>0Description
TRUEevaluated 1593078 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 180523939 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)
  • ...
1593078-180523939
696 sqlite3_interrupt_count--;-
697 if( sqlite3_interrupt_count==0 ){
sqlite3_interrupt_count==0Description
TRUEevaluated 2125 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1590953 times by 1 test
Evaluated by:
  • Self test (438)
2125-1590953
698 sqlite3_interrupt(db);-
699 }
executed 2125 times by 1 test: end of block
Executed by:
  • Self test (438)
2125
700 }
executed 1593078 times by 1 test: end of block
Executed by:
  • Self test (438)
1593078
701#endif-
702-
703 /* Sanity checking on other operands */-
704#ifdef SQLITE_DEBUG-
705 {-
706 u8 opProperty = sqlite3OpcodeProperty[pOp->opcode];-
707 if( (opProperty & OPFLG_IN1)!=0 ){-
708 assert( pOp->p1>0 );-
709 assert( pOp->p1<=(p->nMem+1 - p->nCursor) );-
710 assert( memIsValid(&aMem[pOp->p1]) );-
711 assert( sqlite3VdbeCheckMemInvariants(&aMem[pOp->p1]) );-
712 REGISTER_TRACE(pOp->p1, &aMem[pOp->p1]);-
713 }-
714 if( (opProperty & OPFLG_IN2)!=0 ){-
715 assert( pOp->p2>0 );-
716 assert( pOp->p2<=(p->nMem+1 - p->nCursor) );-
717 assert( memIsValid(&aMem[pOp->p2]) );-
718 assert( sqlite3VdbeCheckMemInvariants(&aMem[pOp->p2]) );-
719 REGISTER_TRACE(pOp->p2, &aMem[pOp->p2]);-
720 }-
721 if( (opProperty & OPFLG_IN3)!=0 ){-
722 assert( pOp->p3>0 );-
723 assert( pOp->p3<=(p->nMem+1 - p->nCursor) );-
724 assert( memIsValid(&aMem[pOp->p3]) );-
725 assert( sqlite3VdbeCheckMemInvariants(&aMem[pOp->p3]) );-
726 REGISTER_TRACE(pOp->p3, &aMem[pOp->p3]);-
727 }-
728 if( (opProperty & OPFLG_OUT2)!=0 ){-
729 assert( pOp->p2>0 );-
730 assert( pOp->p2<=(p->nMem+1 - p->nCursor) );-
731 memAboutToChange(p, &aMem[pOp->p2]);-
732 }-
733 if( (opProperty & OPFLG_OUT3)!=0 ){-
734 assert( pOp->p3>0 );-
735 assert( pOp->p3<=(p->nMem+1 - p->nCursor) );-
736 memAboutToChange(p, &aMem[pOp->p3]);-
737 }-
738 }-
739#endif-
740#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)-
741 pOrigOp = pOp;-
742#endif-
743 -
744 switch( pOp->opcode ){-
745-
746/*****************************************************************************-
747** What follows is a massive switch statement where each case implements a-
748** separate instruction in the virtual machine. If we follow the usual-
749** indentation conventions, each case should be indented by 6 spaces. But-
750** that is a lot of wasted space on the left margin. So the code within-
751** the switch statement will break with convention and be flush-left. Another-
752** big comment (similar to this one) will mark the point in the code where-
753** we transition back to normal indentation.-
754**-
755** The formatting of each case is important. The makefile for SQLite-
756** generates two C files "opcodes.h" and "opcodes.c" by scanning this-
757** file looking for lines that begin with "case OP_". The opcodes.h files-
758** will be filled with #defines that give unique integer values to each-
759** opcode and the opcodes.c file is filled with an array of strings where-
760** each string is the symbolic name for the corresponding opcode. If the-
761** case statement is followed by a comment of the form "/# same as ... #/"-
762** that comment is used to determine the particular value of the opcode.-
763**-
764** Other keywords in the comment that follows each case are used to-
765** construct the OPFLG_INITIALIZER value that initializes opcodeProperty[].-
766** Keywords include: in1, in2, in3, out2, out3. See-
767** the mkopcodeh.awk script for additional information.-
768**-
769** Documentation about VDBE opcodes is generated by scanning this file-
770** for lines of that contain "Opcode:". That line and all subsequent-
771** comment lines are used in the generation of the opcode.html documentation-
772** file.-
773**-
774** SUMMARY:-
775**-
776** Formatting is important to scripts that scan this file.-
777** Do not deviate from the formatting style currently in use.-
778**-
779*****************************************************************************/-
780-
781/* Opcode: Goto * P2 * * *-
782**-
783** An unconditional jump to address P2.-
784** The next instruction executed will be -
785** the one at index P2 from the beginning of-
786** the program.-
787**-
788** The P1 parameter is not actually used by this opcode. However, it-
789** is sometimes set to 1 instead of 0 as a hint to the command-line shell-
790** that this Goto is the bottom of a loop and that the lines from P2 down-
791** to the current line should be indented for EXPLAIN output.-
792*/-
793case
executed 6426550 times by 435 tests: case 11:
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)
  • ...
OP_Goto: { /* jump */
executed 6426550 times by 435 tests: case 11:
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)
  • ...
6426550
794jump_to_p2_and_check_for_interrupt:-
795 pOp = &aOp[pOp->p2 - 1];-
796-
797 /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev,-
798 ** OP_VNext, or OP_SorterNext) all jump here upon-
799 ** completion. Check to see if sqlite3_interrupt() has been called-
800 ** or if the progress callback needs to be invoked. -
801 **-
802 ** This code uses unstructured "goto" statements and does not look clean.-
803 ** But that is not due to sloppy coding habits. The code is written this-
804 ** way for performance, to avoid having to run the interrupt and progress-
805 ** checks on every opcode. This helps sqlite3_step() to run about 1.5%-
806 ** faster according to "valgrind --tool=cachegrind" */-
807check_for_interrupt:
code before this statement executed 30361641 times by 435 tests: check_for_interrupt:
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)
  • ...
30361641
808 if( db->u1.isInterrupted ) goto abort_due_to_interrupt;
executed 2037 times by 1 test: goto abort_due_to_interrupt;
Executed by:
  • Self test (438)
db->u1.isInterruptedDescription
TRUEevaluated 2037 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 30756026 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)
  • ...
2037-30756026
809#ifndef SQLITE_OMIT_PROGRESS_CALLBACK-
810 /* Call the progress callback if it is configured and the required number-
811 ** of VDBE ops have been executed (either since this invocation of-
812 ** sqlite3VdbeExec() or since last time the progress callback was called).-
813 ** If the progress callback returns non-zero, exit the virtual machine with-
814 ** a return code SQLITE_ABORT.-
815 */-
816 if( nVmStep>=nProgressLimit && db->xProgress!=0 ){
nVmStep>=nProgressLimitDescription
TRUEevaluated 46 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 30755980 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)
  • ...
db->xProgress!=0Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
6-30755980
817 assert( db->nProgressOps!=0 );-
818 nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps);-
819 if( db->xProgress(db->pProgressArg) ){
db->xProgress(...>pProgressArg)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 36 times by 1 test
Evaluated by:
  • Self test (438)
4-36
820 rc = SQLITE_INTERRUPT;-
821 goto abort_due_to_error;
executed 4 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
4
822 }-
823 }
executed 36 times by 1 test: end of block
Executed by:
  • Self test (438)
36
824#endif-
825 -
826 break;
executed 30756022 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)
  • ...
30756022
827}-
828-
829/* Opcode: Gosub P1 P2 * * *-
830**-
831** Write the current address onto register P1-
832** and then jump to address P2.-
833*/-
834case
executed 545027 times by 1 test: case 12:
Executed by:
  • Self test (438)
OP_Gosub: { /* jump */
executed 545027 times by 1 test: case 12:
Executed by:
  • Self test (438)
545027
835 assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );-
836 pIn1 = &aMem[pOp->p1];-
837 assert( VdbeMemDynamic(pIn1)==0 );-
838 memAboutToChange(p, pIn1);-
839 pIn1->flags = MEM_Int;-
840 pIn1->u.i = (int)(pOp-aOp);-
841 REGISTER_TRACE(pOp->p1, pIn1);-
842-
843 /* Most jump operations do a goto to this spot in order to update-
844 ** the pOp pointer. */-
845jump_to_p2:
code before this statement executed 545027 times by 1 test: jump_to_p2:
Executed by:
  • Self test (438)
545027
846 pOp = &aOp[pOp->p2 - 1];-
847 break;
executed 12709055 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)
  • ...
12709055
848}-
849-
850/* Opcode: Return P1 * * * *-
851**-
852** Jump to the next instruction after the address in register P1. After-
853** the jump, register P1 becomes undefined.-
854*/-
855case
executed 549440 times by 1 test: case 66:
Executed by:
  • Self test (438)
OP_Return: { /* in1 */
executed 549440 times by 1 test: case 66:
Executed by:
  • Self test (438)
549440
856 pIn1 = &aMem[pOp->p1];-
857 assert( pIn1->flags==MEM_Int );-
858 pOp = &aOp[pIn1->u.i];-
859 pIn1->flags = MEM_Undefined;-
860 break;
executed 549440 times by 1 test: break;
Executed by:
  • Self test (438)
549440
861}-
862-
863/* Opcode: InitCoroutine P1 P2 P3 * *-
864**-
865** Set up register P1 so that it will Yield to the coroutine-
866** located at address P3.-
867**-
868** If P2!=0 then the coroutine implementation immediately follows-
869** this opcode. So jump over the coroutine implementation to-
870** address P2.-
871**-
872** See also: EndCoroutine-
873*/-
874case
executed 97343 times by 9 tests: case 13:
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)
OP_InitCoroutine: { /* jump */
executed 97343 times by 9 tests: case 13:
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)
97343
875 assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );-
876 assert( pOp->p2>=0 && pOp->p2<p->nOp );-
877 assert( pOp->p3>=0 && pOp->p3<p->nOp );-
878 pOut = &aMem[pOp->p1];-
879 assert( !VdbeMemDynamic(pOut) );-
880 pOut->u.i = pOp->p3 - 1;-
881 pOut->flags = MEM_Int;-
882 if( pOp->p2 ) goto jump_to_p2;
executed 52402 times by 9 tests: goto jump_to_p2;
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)
pOp->p2Description
TRUEevaluated 52402 times by 9 tests
Evaluated 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)
FALSEevaluated 44941 times by 1 test
Evaluated by:
  • Self test (438)
44941-52402
883 break;
executed 44941 times by 1 test: break;
Executed by:
  • Self test (438)
44941
884}-
885-
886/* Opcode: EndCoroutine P1 * * * *-
887**-
888** The instruction at the address in register P1 is a Yield.-
889** Jump to the P2 parameter of that Yield.-
890** After the jump, register P1 becomes undefined.-
891**-
892** See also: InitCoroutine-
893*/-
894case
executed 14467 times by 9 tests: case 67:
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)
OP_EndCoroutine: { /* in1 */
executed 14467 times by 9 tests: case 67:
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)
14467
895 VdbeOp *pCaller;-
896 pIn1 = &aMem[pOp->p1];-
897 assert( pIn1->flags==MEM_Int );-
898 assert( pIn1->u.i>=0 && pIn1->u.i<p->nOp );-
899 pCaller = &aOp[pIn1->u.i];-
900 assert( pCaller->opcode==OP_Yield );-
901 assert( pCaller->p2>=0 && pCaller->p2<p->nOp );-
902 pOp = &aOp[pCaller->p2 - 1];-
903 pIn1->flags = MEM_Undefined;-
904 break;
executed 14467 times by 9 tests: break;
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)
14467
905}-
906-
907/* Opcode: Yield P1 P2 * * *-
908**-
909** Swap the program counter with the value in register P1. This-
910** has the effect of yielding to a coroutine.-
911**-
912** If the coroutine that is launched by this instruction ends with-
913** Yield or Return then continue to the next instruction. But if-
914** the coroutine launched by this instruction ends with-
915** EndCoroutine, then jump to P2 rather than continuing with the-
916** next instruction.-
917**-
918** See also: InitCoroutine-
919*/-
920case
executed 7816689 times by 9 tests: case 14:
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)
OP_Yield: { /* in1, jump */
executed 7816689 times by 9 tests: case 14:
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)
7816689
921 int pcDest;-
922 pIn1 = &aMem[pOp->p1];-
923 assert( VdbeMemDynamic(pIn1)==0 );-
924 pIn1->flags = MEM_Int;-
925 pcDest = (int)pIn1->u.i;-
926 pIn1->u.i = (int)(pOp - aOp);-
927 REGISTER_TRACE(pOp->p1, pIn1);-
928 pOp = &aOp[pcDest];-
929 break;
executed 7816689 times by 9 tests: break;
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)
7816689
930}-
931-
932/* Opcode: HaltIfNull P1 P2 P3 P4 P5-
933** Synopsis: if r[P3]=null halt-
934**-
935** Check the value in register P3. If it is NULL then Halt using-
936** parameter P1, P2, and P4 as if this were a Halt instruction. If the-
937** value in register P3 is not NULL, then this routine is a no-op.-
938** The P5 parameter should be 1.-
939*/-
940case
executed 23473 times by 1 test: case 68:
Executed by:
  • Self test (438)
OP_HaltIfNull: { /* in3 */
executed 23473 times by 1 test: case 68:
Executed by:
  • Self test (438)
23473
941 pIn3 = &aMem[pOp->p3];-
942#ifdef SQLITE_DEBUG-
943 if( pOp->p2==OE_Abort ){ sqlite3VdbeAssertAbortable(p); }-
944#endif-
945 if( (pIn3->flags & MEM_Null)==0 ) break;
executed 23413 times by 1 test: break;
Executed by:
  • Self test (438)
(pIn3->flags & 0x0001)==0Description
TRUEevaluated 23413 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 60 times by 1 test
Evaluated by:
  • Self test (438)
60-23413
946 /* Fall through into OP_Halt */-
947}-
948-
949/* Opcode: Halt P1 P2 * P4 P5-
950**-
951** Exit immediately. All open cursors, etc are closed-
952** automatically.-
953**-
954** P1 is the result code returned by sqlite3_exec(), sqlite3_reset(),-
955** or sqlite3_finalize(). For a normal halt, this should be SQLITE_OK (0).-
956** For errors, it can be some other value. If P1!=0 then P2 will determine-
957** whether or not to rollback the current transaction. Do not rollback-
958** if P2==OE_Fail. Do the rollback if P2==OE_Rollback. If P2==OE_Abort,-
959** then back out all changes that have occurred during this execution of the-
960** VDBE, but do not rollback the transaction. -
961**-
962** If P4 is not null then it is an error message string.-
963**-
964** P5 is a value between 0 and 4, inclusive, that modifies the P4 string.-
965**-
966** 0: (no change)-
967** 1: NOT NULL contraint failed: P4-
968** 2: UNIQUE constraint failed: P4-
969** 3: CHECK constraint failed: P4-
970** 4: FOREIGN KEY constraint failed: P4-
971**-
972** If P5 is not zero and P4 is NULL, then everything after the ":" is-
973** omitted.-
974**-
975** There is an implied "Halt 0 0 0" instruction inserted at the very end of-
976** every program. So a jump past the last instruction of the program-
977** is the same as executing Halt.-
978*/-
979case
code before this statement executed 60 times by 1 test: case 69:
Executed by:
  • Self test (438)
executed 1179804 times by 435 tests: case 69:
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)
  • ...
OP_Halt: {
code before this statement executed 60 times by 1 test: case 69:
Executed by:
  • Self test (438)
executed 1179804 times by 435 tests: case 69:
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)
  • ...
60-1179804
980 VdbeFrame *pFrame;-
981 int pcx;-
982-
983 pcx = (int)(pOp - aOp);-
984#ifdef SQLITE_DEBUG-
985 if( pOp->p2==OE_Abort ){ sqlite3VdbeAssertAbortable(p); }-
986#endif-
987 if( pOp->p1==SQLITE_OK && p->pFrame ){
pOp->p1==0Description
TRUEevaluated 1179295 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 569 times by 1 test
Evaluated by:
  • Self test (438)
p->pFrameDescription
TRUEevaluated 134479 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1044816 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)
  • ...
569-1179295
988 /* Halt the sub-program. Return control to the parent frame. */-
989 pFrame = p->pFrame;-
990 p->pFrame = pFrame->pParent;-
991 p->nFrame--;-
992 sqlite3VdbeSetChanges(db, p->nChange);-
993 pcx = sqlite3VdbeFrameRestore(pFrame);-
994 if( pOp->p2==OE_Ignore ){
pOp->p2==4Description
TRUEevaluated 124857 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 9622 times by 1 test
Evaluated by:
  • Self test (438)
9622-124857
995 /* Instruction pcx is the OP_Program that invoked the sub-program -
996 ** currently being halted. If the p2 instruction of this OP_Halt-
997 ** instruction is set to OE_Ignore, then the sub-program is throwing-
998 ** an IGNORE exception. In this case jump to the address specified-
999 ** as the p2 of the calling OP_Program. */-
1000 pcx = p->aOp[pcx].p2-1;-
1001 }
executed 124857 times by 1 test: end of block
Executed by:
  • Self test (438)
124857
1002 aOp = p->aOp;-
1003 aMem = p->aMem;-
1004 pOp = &aOp[pcx];-
1005 break;
executed 134479 times by 1 test: break;
Executed by:
  • Self test (438)
134479
1006 }-
1007 p->rc = pOp->p1;-
1008 p->errorAction = (u8)pOp->p2;-
1009 p->pc = pcx;-
1010 assert( pOp->p5<=4 );-
1011 if( p->rc ){
p->rcDescription
TRUEevaluated 569 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1044816 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)
  • ...
569-1044816
1012 if( pOp->p5 ){
pOp->p5Description
TRUEevaluated 546 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 23 times by 1 test
Evaluated by:
  • Self test (438)
23-546
1013 static const char * const azType[] = { "NOT NULL", "UNIQUE", "CHECK",-
1014 "FOREIGN KEY" };-
1015 testcase( pOp->p5==1 );-
1016 testcase( pOp->p5==2 );-
1017 testcase( pOp->p5==3 );-
1018 testcase( pOp->p5==4 );-
1019 sqlite3VdbeError(p, "%s constraint failed", azType[pOp->p5-1]);-
1020 if( pOp->p4.z ){
pOp->p4.zDescription
TRUEevaluated 446 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 100 times by 1 test
Evaluated by:
  • Self test (438)
100-446
1021 p->zErrMsg = sqlite3MPrintf(db, "%z: %s", p->zErrMsg, pOp->p4.z);-
1022 }
executed 446 times by 1 test: end of block
Executed by:
  • Self test (438)
446
1023 }else{
executed 546 times by 1 test: end of block
Executed by:
  • Self test (438)
546
1024 sqlite3VdbeError(p, "%s", pOp->p4.z);-
1025 }
executed 23 times by 1 test: end of block
Executed by:
  • Self test (438)
23
1026 sqlite3_log(pOp->p1, "abort at %d in [%s]: %s", pcx, p->zSql, p->zErrMsg);-
1027 }
executed 569 times by 1 test: end of block
Executed by:
  • Self test (438)
569
1028 rc = sqlite3VdbeHalt(p);-
1029 assert( rc==SQLITE_BUSY || rc==SQLITE_OK || rc==SQLITE_ERROR );-
1030 if( rc==SQLITE_BUSY ){
rc==5Description
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (55)
FALSEevaluated 1045273 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)
  • ...
18-1045273
1031 p->rc = SQLITE_BUSY;-
1032 }else{
executed 18 times by 2 tests: end of block
Executed by:
  • Self test (438)
  • Self test (55)
18
1033 assert( rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT );-
1034 assert( rc==SQLITE_OK || db->nDeferredCons>0 || db->nDeferredImmCons>0 );-
1035 rc = p->rc ? SQLITE_ERROR : SQLITE_DONE;
p->rcDescription
TRUEevaluated 948 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1044325 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)
  • ...
948-1044325
1036 }
executed 1045273 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)
  • ...
1045273
1037 goto vdbe_return;
executed 1045291 times by 435 tests: goto vdbe_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)
  • ...
1045291
1038}-
1039-
1040/* Opcode: Integer P1 P2 * * *-
1041** Synopsis: r[P2]=P1-
1042**-
1043** The 32-bit integer value P1 is written into register P2.-
1044*/-
1045case
executed 2937853 times by 404 tests: case 70:
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
OP_Integer: { /* out2 */
executed 2937853 times by 404 tests: case 70:
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
2937853
1046 pOut = out2Prerelease(p, pOp);-
1047 pOut->u.i = pOp->p1;-
1048 break;
executed 2937853 times by 404 tests: break;
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
2937853
1049}-
1050-
1051/* Opcode: Int64 * P2 * P4 *-
1052** Synopsis: r[P2]=P4-
1053**-
1054** P4 is a pointer to a 64-bit integer value.-
1055** Write that value into register P2.-
1056*/-
1057case
executed 12939 times by 4 tests: case 71:
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
OP_Int64: { /* out2 */
executed 12939 times by 4 tests: case 71:
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
12939
1058 pOut = out2Prerelease(p, pOp);-
1059 assert( pOp->p4.pI64!=0 );-
1060 pOut->u.i = *pOp->p4.pI64;-
1061 break;
executed 12939 times by 4 tests: break;
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
12939
1062}-
1063-
1064#ifndef SQLITE_OMIT_FLOATING_POINT-
1065/* Opcode: Real * P2 * P4 *-
1066** Synopsis: r[P2]=P4-
1067**-
1068** P4 is a pointer to a 64-bit floating point value.-
1069** Write that value into register P2.-
1070*/-
1071case
executed 39344 times by 1 test: case 141:
Executed by:
  • Self test (438)
OP_Real: { /* same as TK_FLOAT, out2 */
executed 39344 times by 1 test: case 141:
Executed by:
  • Self test (438)
39344
1072 pOut = out2Prerelease(p, pOp);-
1073 pOut->flags = MEM_Real;-
1074 assert( !sqlite3IsNaN(*pOp->p4.pReal) );-
1075 pOut->u.r = *pOp->p4.pReal;-
1076 break;
executed 39344 times by 1 test: break;
Executed by:
  • Self test (438)
39344
1077}-
1078#endif-
1079-
1080/* Opcode: String8 * P2 * P4 *-
1081** Synopsis: r[P2]='P4'-
1082**-
1083** P4 points to a nul terminated UTF-8 string. This opcode is transformed -
1084** into a String opcode before it is executed for the first time. During-
1085** this transformation, the length of string P4 is computed and stored-
1086** as the P1 parameter.-
1087*/-
1088case
executed 253113 times by 58 tests: case 106:
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 (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)
  • Self test (47)
  • ...
OP_String8: { /* same as TK_STRING, out2 */
executed 253113 times by 58 tests: case 106:
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 (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)
  • Self test (47)
  • ...
253113
1089 assert( pOp->p4.z!=0 );-
1090 pOut = out2Prerelease(p, pOp);-
1091 pOp->opcode = OP_String;-
1092 pOp->p1 = sqlite3Strlen30(pOp->p4.z);-
1093-
1094#ifndef SQLITE_OMIT_UTF16-
1095 if( encoding!=SQLITE_UTF8 ){
encoding!=1Description
TRUEevaluated 488 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 252625 times by 58 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 (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)
  • Self test (47)
  • ...
488-252625
1096 rc = sqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC);-
1097 assert( rc==SQLITE_OK || rc==SQLITE_TOOBIG );-
1098 if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem;
never executed: goto no_mem;
0!=sqlite3Vdbe...Out, encoding)Description
TRUEnever evaluated
FALSEevaluated 488 times by 1 test
Evaluated by:
  • Self test (438)
0-488
1099 assert( pOut->szMalloc>0 && pOut->zMalloc==pOut->z );-
1100 assert( VdbeMemDynamic(pOut)==0 );-
1101 pOut->szMalloc = 0;-
1102 pOut->flags |= MEM_Static;-
1103 if( pOp->p4type==P4_DYNAMIC ){
pOp->p4type==(-7)Description
TRUEevaluated 486 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
2-486
1104 sqlite3DbFree(db, pOp->p4.z);-
1105 }
executed 486 times by 1 test: end of block
Executed by:
  • Self test (438)
486
1106 pOp->p4type = P4_DYNAMIC;-
1107 pOp->p4.z = pOut->z;-
1108 pOp->p1 = pOut->n;-
1109 }
executed 488 times by 1 test: end of block
Executed by:
  • Self test (438)
488
1110 testcase( rc==SQLITE_TOOBIG );-
1111#endif-
1112 if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
pOp->p1>db->aLimit[0]Description
TRUEnever evaluated
FALSEevaluated 253113 times by 58 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 (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)
  • Self test (47)
  • ...
0-253113
1113 goto too_big;
never executed: goto too_big;
0
1114 }-
1115 assert( rc==SQLITE_OK );-
1116 /* Fall through to the next case, OP_String */-
1117}-
1118 -
1119/* Opcode: String P1 P2 P3 P4 P5-
1120** Synopsis: r[P2]='P4' (len=P1)-
1121**-
1122** The string value P4 of length P1 (bytes) is stored in register P2.-
1123**-
1124** If P3 is not zero and the content of register P3 is equal to P5, then-
1125** the datatype of the register P2 is converted to BLOB. The content is-
1126** the same sequence of bytes, it is merely interpreted as a BLOB instead-
1127** of a string, as if it had been CAST. In other words:-
1128**-
1129** if( P3!=0 and reg[P3]==P5 ) reg[P2] := CAST(reg[P2] as BLOB)-
1130*/-
1131case
code before this statement executed 253113 times by 58 tests: case 72:
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 (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)
  • Self test (47)
  • ...
executed 441644 times by 2 tests: case 72:
Executed by:
  • Self test (38)
  • Self test (438)
OP_String: { /* out2 */
code before this statement executed 253113 times by 58 tests: case 72:
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 (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)
  • Self test (47)
  • ...
executed 441644 times by 2 tests: case 72:
Executed by:
  • Self test (38)
  • Self test (438)
253113-441644
1132 assert( pOp->p4.z!=0 );-
1133 pOut = out2Prerelease(p, pOp);-
1134 pOut->flags = MEM_Str|MEM_Static|MEM_Term;-
1135 pOut->z = pOp->p4.z;-
1136 pOut->n = pOp->p1;-
1137 pOut->enc = encoding;-
1138 UPDATE_MAX_BLOBSIZE(pOut);-
1139#ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS-
1140 if( pOp->p3>0 ){
pOp->p3>0Description
TRUEevaluated 5987 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 688770 times by 58 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 (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)
  • Self test (47)
  • ...
5987-688770
1141 assert( pOp->p3<=(p->nMem+1 - p->nCursor) );-
1142 pIn3 = &aMem[pOp->p3];-
1143 assert( pIn3->flags & MEM_Int );-
1144 if( pIn3->u.i==pOp->p5 ) pOut->flags = MEM_Blob|MEM_Static|MEM_Term;
executed 2628 times by 1 test: pOut->flags = 0x0010|0x0800|0x0200;
Executed by:
  • Self test (438)
pIn3->u.i==pOp->p5Description
TRUEevaluated 2628 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3359 times by 1 test
Evaluated by:
  • Self test (438)
2628-3359
1145 }
executed 5987 times by 1 test: end of block
Executed by:
  • Self test (438)
5987
1146#endif-
1147 break;
executed 694757 times by 58 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 (3)
  • 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)
  • Self test (47)
  • ...
694757
1148}-
1149-
1150/* Opcode: Null P1 P2 P3 * *-
1151** Synopsis: r[P2..P3]=NULL-
1152**-
1153** Write a NULL into registers P2. If P3 greater than P2, then also write-
1154** NULL into register P3 and every register in between P2 and P3. If P3-
1155** is less than P2 (typically P3 is zero) then only register P2 is-
1156** set to NULL.-
1157**-
1158** If the P1 value is non-zero, then also set the MEM_Cleared flag so that-
1159** NULL values will not compare equal even if SQLITE_NULLEQ is set on-
1160** OP_Ne or OP_Eq.-
1161*/-
1162case
executed 472719 times by 382 tests: case 73:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
OP_Null: { /* out2 */
executed 472719 times by 382 tests: case 73:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
472719
1163 int cnt;-
1164 u16 nullFlag;-
1165 pOut = out2Prerelease(p, pOp);-
1166 cnt = pOp->p3-pOp->p2;-
1167 assert( pOp->p3<=(p->nMem+1 - p->nCursor) );-
1168 pOut->flags = nullFlag = pOp->p1 ? (MEM_Null|MEM_Cleared) : MEM_Null;
pOp->p1Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 472681 times by 382 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
38-472681
1169 pOut->n = 0;-
1170#ifdef SQLITE_DEBUG-
1171 pOut->uTemp = 0;-
1172#endif-
1173 while( cnt>0 ){
cnt>0Description
TRUEevaluated 106565 times by 374 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
FALSEevaluated 472719 times by 382 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
106565-472719
1174 pOut++;-
1175 memAboutToChange(p, pOut);-
1176 sqlite3VdbeMemSetNull(pOut);-
1177 pOut->flags = nullFlag;-
1178 pOut->n = 0;-
1179 cnt--;-
1180 }
executed 106565 times by 374 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
106565
1181 break;
executed 472719 times by 382 tests: break;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
472719
1182}-
1183-
1184/* Opcode: SoftNull P1 * * * *-
1185** Synopsis: r[P1]=NULL-
1186**-
1187** Set register P1 to have the value NULL as seen by the OP_MakeRecord-
1188** instruction, but do not free any string or blob memory associated with-
1189** the register, so that if the value was a string or blob that was-
1190** previously copied using OP_SCopy, the copies will continue to be valid.-
1191*/-
1192case
executed 312623 times by 1 test: case 74:
Executed by:
  • Self test (438)
OP_SoftNull: {
executed 312623 times by 1 test: case 74:
Executed by:
  • Self test (438)
312623
1193 assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );-
1194 pOut = &aMem[pOp->p1];-
1195 pOut->flags = (pOut->flags&~(MEM_Undefined|MEM_AffMask))|MEM_Null;-
1196 break;
executed 312623 times by 1 test: break;
Executed by:
  • Self test (438)
312623
1197}-
1198-
1199/* Opcode: Blob P1 P2 * P4 *-
1200** Synopsis: r[P2]=P4 (len=P1)-
1201**-
1202** P4 points to a blob of data P1 bytes long. Store this-
1203** blob in register P2.-
1204*/-
1205case
executed 78777 times by 28 tests: case 75:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
OP_Blob: { /* out2 */
executed 78777 times by 28 tests: case 75:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
78777
1206 assert( pOp->p1 <= SQLITE_MAX_LENGTH );-
1207 pOut = out2Prerelease(p, pOp);-
1208 sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0);-
1209 pOut->enc = encoding;-
1210 UPDATE_MAX_BLOBSIZE(pOut);-
1211 break;
executed 78777 times by 28 tests: break;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
78777
1212}-
1213-
1214/* Opcode: Variable P1 P2 * P4 *-
1215** Synopsis: r[P2]=parameter(P1,P4)-
1216**-
1217** Transfer the values of bound parameter P1 into register P2-
1218**-
1219** If the parameter is named, then its name appears in P4.-
1220** The P4 value is used by sqlite3_bind_parameter_name().-
1221*/-
1222case
executed 4835440 times by 1 test: case 76:
Executed by:
  • Self test (438)
OP_Variable: { /* out2 */
executed 4835440 times by 1 test: case 76:
Executed by:
  • Self test (438)
4835440
1223 Mem *pVar; /* Value being transferred */-
1224-
1225 assert( pOp->p1>0 && pOp->p1<=p->nVar );-
1226 assert( pOp->p4.z==0 || pOp->p4.z==sqlite3VListNumToName(p->pVList,pOp->p1) );-
1227 pVar = &p->aVar[pOp->p1 - 1];-
1228 if( sqlite3VdbeMemTooBig(pVar) ){
sqlite3VdbeMemTooBig(pVar)Description
TRUEnever evaluated
FALSEevaluated 4835440 times by 1 test
Evaluated by:
  • Self test (438)
0-4835440
1229 goto too_big;
never executed: goto too_big;
0
1230 }-
1231 pOut = &aMem[pOp->p2];-
1232 sqlite3VdbeMemShallowCopy(pOut, pVar, MEM_Static);-
1233 UPDATE_MAX_BLOBSIZE(pOut);-
1234 break;
executed 4835440 times by 1 test: break;
Executed by:
  • Self test (438)
4835440
1235}-
1236-
1237/* Opcode: Move P1 P2 P3 * *-
1238** Synopsis: r[P2@P3]=r[P1@P3]-
1239**-
1240** Move the P3 values in register P1..P1+P3-1 over into-
1241** registers P2..P2+P3-1. Registers P1..P1+P3-1 are-
1242** left holding a NULL. It is an error for register ranges-
1243** P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error-
1244** for P3 to be less than 1.-
1245*/-
1246case
executed 44795 times by 1 test: case 77:
Executed by:
  • Self test (438)
OP_Move: {
executed 44795 times by 1 test: case 77:
Executed by:
  • Self test (438)
44795
1247 int n; /* Number of registers left to copy */-
1248 int p1; /* Register to copy from */-
1249 int p2; /* Register to copy to */-
1250-
1251 n = pOp->p3;-
1252 p1 = pOp->p1;-
1253 p2 = pOp->p2;-
1254 assert( n>0 && p1>0 && p2>0 );-
1255 assert( p1+n<=p2 || p2+n<=p1 );-
1256-
1257 pIn1 = &aMem[p1];-
1258 pOut = &aMem[p2];-
1259 do{-
1260 assert( pOut<=&aMem[(p->nMem+1 - p->nCursor)] );-
1261 assert( pIn1<=&aMem[(p->nMem+1 - p->nCursor)] );-
1262 assert( memIsValid(pIn1) );-
1263 memAboutToChange(p, pOut);-
1264 sqlite3VdbeMemMove(pOut, pIn1);-
1265#ifdef SQLITE_DEBUG-
1266 if( pOut->pScopyFrom>=&aMem[p1] && pOut->pScopyFrom<pOut ){-
1267 pOut->pScopyFrom += pOp->p2 - p1;-
1268 }-
1269#endif-
1270 Deephemeralize(pOut);
never executed: goto no_mem;
((pOut)->flags&0x1000)!=0Description
TRUEnever evaluated
FALSEevaluated 49558 times by 1 test
Evaluated by:
  • Self test (438)
sqlite3VdbeMem...riteable(pOut)Description
TRUEnever evaluated
FALSEnever evaluated
0-49558
1271 REGISTER_TRACE(p2++, pOut);-
1272 pIn1++;-
1273 pOut++;-
1274 }while( --n );
executed 49558 times by 1 test: end of block
Executed by:
  • Self test (438)
--nDescription
TRUEevaluated 4763 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 44795 times by 1 test
Evaluated by:
  • Self test (438)
4763-49558
1275 break;
executed 44795 times by 1 test: break;
Executed by:
  • Self test (438)
44795
1276}-
1277-
1278/* Opcode: Copy P1 P2 P3 * *-
1279** Synopsis: r[P2@P3+1]=r[P1@P3+1]-
1280**-
1281** Make a copy of registers P1..P1+P3 into registers P2..P2+P3.-
1282**-
1283** This instruction makes a deep copy of the value. A duplicate-
1284** is made of any string or blob constant. See also OP_SCopy.-
1285*/-
1286case
executed 3768705 times by 32 tests: case 78:
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 (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
OP_Copy: {
executed 3768705 times by 32 tests: case 78:
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 (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
3768705
1287 int n;-
1288-
1289 n = pOp->p3;-
1290 pIn1 = &aMem[pOp->p1];-
1291 pOut = &aMem[pOp->p2];-
1292 assert( pOut!=pIn1 );-
1293 while( 1 ){-
1294 memAboutToChange(p, pOut);-
1295 sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);-
1296 Deephemeralize(pOut);
never executed: goto no_mem;
((pOut)->flags&0x1000)!=0Description
TRUEevaluated 3827793 times by 32 tests
Evaluated 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 (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
FALSEevaluated 15403 times by 1 test
Evaluated by:
  • Self test (438)
sqlite3VdbeMem...riteable(pOut)Description
TRUEnever evaluated
FALSEevaluated 3827793 times by 32 tests
Evaluated 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 (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
0-3827793
1297#ifdef SQLITE_DEBUG-
1298 pOut->pScopyFrom = 0;-
1299#endif-
1300 REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut);-
1301 if( (n--)==0 ) break;
executed 3768705 times by 32 tests: break;
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 (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
(n--)==0Description
TRUEevaluated 3768705 times by 32 tests
Evaluated 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 (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
FALSEevaluated 74491 times by 1 test
Evaluated by:
  • Self test (438)
74491-3768705
1302 pOut++;-
1303 pIn1++;-
1304 }
executed 74491 times by 1 test: end of block
Executed by:
  • Self test (438)
74491
1305 break;
executed 3768705 times by 32 tests: break;
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 (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
3768705
1306}-
1307-
1308/* Opcode: SCopy P1 P2 * * *-
1309** Synopsis: r[P2]=r[P1]-
1310**-
1311** Make a shallow copy of register P1 into register P2.-
1312**-
1313** This instruction makes a shallow copy of the value. If the value-
1314** is a string or blob, then the copy is only a pointer to the-
1315** original and hence if the original changes so will the copy.-
1316** Worse, if the original is deallocated, the copy becomes invalid.-
1317** Thus the program must guarantee that the original will not change-
1318** during the lifetime of the copy. Use OP_Copy to make a complete-
1319** copy.-
1320*/-
1321case
executed 1539627 times by 368 tests: case 79:
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)
  • ...
OP_SCopy: { /* out2 */
executed 1539627 times by 368 tests: case 79:
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)
  • ...
1539627
1322 pIn1 = &aMem[pOp->p1];-
1323 pOut = &aMem[pOp->p2];-
1324 assert( pOut!=pIn1 );-
1325 sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);-
1326#ifdef SQLITE_DEBUG-
1327 pOut->pScopyFrom = pIn1;-
1328 pOut->mScopyFlags = pIn1->flags;-
1329#endif-
1330 break;
executed 1539627 times by 368 tests: break;
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)
  • ...
1539627
1331}-
1332-
1333/* Opcode: IntCopy P1 P2 * * *-
1334** Synopsis: r[P2]=r[P1]-
1335**-
1336** Transfer the integer value held in register P1 into register P2.-
1337**-
1338** This is an optimized version of SCopy that works only for integer-
1339** values.-
1340*/-
1341case
executed 1105171 times by 368 tests: case 80:
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)
  • ...
OP_IntCopy: { /* out2 */
executed 1105171 times by 368 tests: case 80:
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)
  • ...
1105171
1342 pIn1 = &aMem[pOp->p1];-
1343 assert( (pIn1->flags & MEM_Int)!=0 );-
1344 pOut = &aMem[pOp->p2];-
1345 sqlite3VdbeMemSetInt64(pOut, pIn1->u.i);-
1346 break;
executed 1105171 times by 368 tests: break;
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)
  • ...
1105171
1347}-
1348-
1349/* Opcode: ResultRow P1 P2 * * *-
1350** Synopsis: output=r[P1@P2]-
1351**-
1352** The registers P1 through P1+P2-1 contain a single row of-
1353** results. This opcode causes the sqlite3_step() call to terminate-
1354** with an SQLITE_ROW return code and it sets up the sqlite3_stmt-
1355** structure to provide access to the r(P1)..r(P1+P2-1) values as-
1356** the result row.-
1357*/-
1358case
executed 2694812 times by 434 tests: case 81:
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)
  • ...
OP_ResultRow: {
executed 2694812 times by 434 tests: case 81:
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)
  • ...
2694812
1359 Mem *pMem;-
1360 int i;-
1361 assert( p->nResColumn==pOp->p2 );-
1362 assert( pOp->p1>0 );-
1363 assert( pOp->p1+pOp->p2<=(p->nMem+1 - p->nCursor)+1 );-
1364-
1365#ifndef SQLITE_OMIT_PROGRESS_CALLBACK-
1366 /* Run the progress counter just before returning.-
1367 */-
1368 if( db->xProgress!=0
db->xProgress!=0Description
TRUEevaluated 21 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2694791 times by 434 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)
  • ...
21-2694791
1369 && nVmStep>=nProgressLimit
nVmStep>=nProgressLimitDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
4-17
1370 && db->xProgress(db->pProgressArg)!=0
db->xProgress(...rogressArg)!=0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 12 times by 1 test
Evaluated by:
  • Self test (438)
5-12
1371 ){-
1372 rc = SQLITE_INTERRUPT;-
1373 goto abort_due_to_error;
executed 5 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
5
1374 }-
1375#endif-
1376-
1377 /* If this statement has violated immediate foreign key constraints, do-
1378 ** not return the number of rows modified. And do not RELEASE the statement-
1379 ** transaction. It needs to be rolled back. */-
1380 if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){
0!=(rc = sqlit...CheckFk(p, 0))Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2694775 times by 434 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)
  • ...
32-2694775
1381 assert( db->flags&SQLITE_CountRows );-
1382 assert( p->usesStmtJournal );-
1383 goto abort_due_to_error;
executed 32 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
32
1384 }-
1385-
1386 /* If the SQLITE_CountRows flag is set in sqlite3.flags mask, then -
1387 ** DML statements invoke this opcode to return the number of rows -
1388 ** modified to the user. This is the only way that a VM that-
1389 ** opens a statement transaction may invoke this opcode.-
1390 **-
1391 ** In case this is such a statement, close any statement transaction-
1392 ** opened by this VM before returning control to the user. This is to-
1393 ** ensure that statement-transactions are always nested, not overlapping.-
1394 ** If the open statement-transaction is not closed here, then the user-
1395 ** may step another VM that opens its own statement transaction. This-
1396 ** may lead to overlapping statement transactions.-
1397 **-
1398 ** The statement transaction is never a top-level transaction. Hence-
1399 ** the RELEASE call below can never fail.-
1400 */-
1401 assert( p->iStatement==0 || db->flags&SQLITE_CountRows );-
1402 rc = sqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE);-
1403 assert( rc==SQLITE_OK );-
1404-
1405 /* Invalidate all ephemeral cursor row caches */-
1406 p->cacheCtr = (p->cacheCtr + 2)|1;-
1407-
1408 /* Make sure the results of the current row are \000 terminated-
1409 ** and have an assigned type. The results are de-ephemeralized as-
1410 ** a side effect.-
1411 */-
1412 pMem = p->pResultSet = &aMem[pOp->p1];-
1413 for(i=0; i<pOp->p2; i++){
i<pOp->p2Description
TRUEevaluated 6568060 times by 434 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 2694775 times by 434 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)
  • ...
2694775-6568060
1414 assert( memIsValid(&pMem[i]) );-
1415 Deephemeralize(&pMem[i]);
never executed: goto no_mem;
((&pMem[i])->flags&0x1000)!=0Description
TRUEevaluated 2131 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6565929 times by 434 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)
  • ...
sqlite3VdbeMem...able(&pMem[i])Description
TRUEnever evaluated
FALSEevaluated 2131 times by 1 test
Evaluated by:
  • Self test (438)
0-6565929
1416 assert( (pMem[i].flags & MEM_Ephem)==0-
1417 || (pMem[i].flags & (MEM_Str|MEM_Blob))==0 );-
1418 sqlite3VdbeMemNulTerminate(&pMem[i]);-
1419 REGISTER_TRACE(pOp->p1+i, &pMem[i]);-
1420 }
executed 6568060 times by 434 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)
  • ...
6568060
1421 if( db->mallocFailed ) goto no_mem;
never executed: goto no_mem;
db->mallocFailedDescription
TRUEnever evaluated
FALSEevaluated 2694775 times by 434 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-2694775
1422-
1423 if( db->mTrace & SQLITE_TRACE_ROW ){
db->mTrace & 0x04Description
TRUEevaluated 64 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2694711 times by 434 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)
  • ...
64-2694711
1424 db->xTrace(SQLITE_TRACE_ROW, db->pTraceArg, p, 0);-
1425 }
executed 64 times by 1 test: end of block
Executed by:
  • Self test (438)
64
1426-
1427 /* Return SQLITE_ROW-
1428 */-
1429 p->pc = (int)(pOp - aOp) + 1;-
1430 rc = SQLITE_ROW;-
1431 goto vdbe_return;
executed 2694775 times by 434 tests: goto vdbe_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)
  • ...
2694775
1432}-
1433-
1434/* Opcode: Concat P1 P2 P3 * *-
1435** Synopsis: r[P3]=r[P2]+r[P1]-
1436**-
1437** Add the text in register P1 onto the end of the text in-
1438** register P2 and store the result in register P3.-
1439** If either the P1 or P2 text are NULL then store NULL in P3.-
1440**-
1441** P3 = P2 || P1-
1442**-
1443** It is illegal for P1 and P3 to be the same register. Sometimes,-
1444** if P3 is the same register as P2, the implementation is able-
1445** to avoid a memcpy().-
1446*/-
1447case
executed 346937 times by 3 tests: case 101:
Executed by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */
executed 346937 times by 3 tests: case 101:
Executed by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
346937
1448 i64 nByte;-
1449-
1450 pIn1 = &aMem[pOp->p1];-
1451 pIn2 = &aMem[pOp->p2];-
1452 pOut = &aMem[pOp->p3];-
1453 assert( pIn1!=pOut );-
1454 if( (pIn1->flags | pIn2->flags) & MEM_Null ){
(pIn1->flags |...lags) & 0x0001Description
TRUEevaluated 154 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 346783 times by 3 tests
Evaluated by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
154-346783
1455 sqlite3VdbeMemSetNull(pOut);-
1456 break;
executed 154 times by 1 test: break;
Executed by:
  • Self test (438)
154
1457 }-
1458 if( ExpandBlob(pIn1) || ExpandBlob(pIn2) ) goto no_mem;
never executed: goto no_mem;
((pIn1)->flags&0x4000)Description
TRUEnever evaluated
FALSEevaluated 346783 times by 3 tests
Evaluated by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
((pIn2)->flags&0x4000)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 346782 times by 3 tests
Evaluated by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
(((pIn1)->flag...dBlob(pIn1):0)Description
TRUEnever evaluated
FALSEevaluated 346783 times by 3 tests
Evaluated by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
(((pIn2)->flag...dBlob(pIn2):0)Description
TRUEnever evaluated
FALSEevaluated 346783 times by 3 tests
Evaluated by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
0-346783
1459 Stringify(pIn1, encoding);
never executed: goto no_mem;
((pIn1)->flags...02|0x0010))==0Description
TRUEevaluated 40300 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 306483 times by 3 tests
Evaluated by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
sqlite3VdbeMem...n1,encoding,0)Description
TRUEnever evaluated
FALSEevaluated 40300 times by 1 test
Evaluated by:
  • Self test (438)
0-306483
1460 Stringify(pIn2, encoding);
never executed: goto no_mem;
((pIn2)->flags...02|0x0010))==0Description
TRUEevaluated 28628 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 318155 times by 3 tests
Evaluated by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
sqlite3VdbeMem...n2,encoding,0)Description
TRUEnever evaluated
FALSEevaluated 28628 times by 1 test
Evaluated by:
  • Self test (438)
0-318155
1461 nByte = pIn1->n + pIn2->n;-
1462 if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){
nByte>db->aLimit[0]Description
TRUEnever evaluated
FALSEevaluated 346783 times by 3 tests
Evaluated by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
0-346783
1463 goto too_big;
never executed: goto too_big;
0
1464 }-
1465 if( sqlite3VdbeMemGrow(pOut, (int)nByte+2, pOut==pIn2) ){
sqlite3VdbeMem...2, pOut==pIn2)Description
TRUEnever evaluated
FALSEevaluated 346783 times by 3 tests
Evaluated by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
0-346783
1466 goto no_mem;
never executed: goto no_mem;
0
1467 }-
1468 MemSetTypeFlag(pOut, MEM_Str);-
1469 if( pOut!=pIn2 ){
pOut!=pIn2Description
TRUEevaluated 346160 times by 3 tests
Evaluated by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
FALSEevaluated 623 times by 1 test
Evaluated by:
  • Self test (438)
623-346160
1470 memcpy(pOut->z, pIn2->z, pIn2->n);-
1471 }
executed 346160 times by 3 tests: end of block
Executed by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
346160
1472 memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n);-
1473 pOut->z[nByte]=0;-
1474 pOut->z[nByte+1] = 0;-
1475 pOut->flags |= MEM_Term;-
1476 pOut->n = (int)nByte;-
1477 pOut->enc = encoding;-
1478 UPDATE_MAX_BLOBSIZE(pOut);-
1479 break;
executed 346783 times by 3 tests: break;
Executed by:
  • Self test (101)
  • Self test (34)
  • Self test (438)
346783
1480}-
1481-
1482/* Opcode: Add P1 P2 P3 * *-
1483** Synopsis: r[P3]=r[P1]+r[P2]-
1484**-
1485** Add the value in register P1 to the value in register P2-
1486** and store the result in register P3.-
1487** If either input is NULL, the result is NULL.-
1488*/-
1489/* Opcode: Multiply P1 P2 P3 * *-
1490** Synopsis: r[P3]=r[P1]*r[P2]-
1491**-
1492**-
1493** Multiply the value in register P1 by the value in register P2-
1494** and store the result in register P3.-
1495** If either input is NULL, the result is NULL.-
1496*/-
1497/* Opcode: Subtract P1 P2 P3 * *-
1498** Synopsis: r[P3]=r[P2]-r[P1]-
1499**-
1500** Subtract the value in register P1 from the value in register P2-
1501** and store the result in register P3.-
1502** If either input is NULL, the result is NULL.-
1503*/-
1504/* Opcode: Divide P1 P2 P3 * *-
1505** Synopsis: r[P3]=r[P2]/r[P1]-
1506**-
1507** Divide the value in register P1 by the value in register P2-
1508** and store the result in register P3 (P3=P2/P1). If the value in -
1509** register P1 is zero, then the result is NULL. If either input is -
1510** NULL, the result is NULL.-
1511*/-
1512/* Opcode: Remainder P1 P2 P3 * *-
1513** Synopsis: r[P3]=r[P2]%r[P1]-
1514**-
1515** Compute the remainder after integer register P2 is divided by -
1516** register P1 and store the result in register P3. -
1517** If the value in register P1 is zero the result is NULL.-
1518** If either operand is NULL, the result is NULL.-
1519*/-
1520case
executed 2659336 times by 1 test: case 96:
Executed by:
  • Self test (438)
OP_Add: /* same as TK_PLUS, in1, in2, out3 */
executed 2659336 times by 1 test: case 96:
Executed by:
  • Self test (438)
2659336
1521case
executed 1381546 times by 1 test: case 97:
Executed by:
  • Self test (438)
OP_Subtract: /* same as TK_MINUS, in1, in2, out3 */
executed 1381546 times by 1 test: case 97:
Executed by:
  • Self test (438)
1381546
1522case
executed 1418517 times by 1 test: case 98:
Executed by:
  • Self test (438)
OP_Multiply: /* same as TK_STAR, in1, in2, out3 */
executed 1418517 times by 1 test: case 98:
Executed by:
  • Self test (438)
1418517
1523case
executed 873762 times by 1 test: case 99:
Executed by:
  • Self test (438)
OP_Divide: /* same as TK_SLASH, in1, in2, out3 */
executed 873762 times by 1 test: case 99:
Executed by:
  • Self test (438)
873762
1524case
executed 1542476 times by 335 tests: case 100:
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
OP_Remainder: { /* same as TK_REM, in1, in2, out3 */
executed 1542476 times by 335 tests: case 100:
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
1542476
1525 char bIntint; /* Started out as two integer operands */-
1526 u16 flags; /* Combined MEM_* flags from both inputs */-
1527 u16 type1; /* Numeric type of left operand */-
1528 u16 type2; /* Numeric type of right operand */-
1529 i64 iA; /* Integer value of left operand */-
1530 i64 iB; /* Integer value of right operand */-
1531 double rA; /* Real value of left operand */-
1532 double rB; /* Real value of right operand */-
1533-
1534 pIn1 = &aMem[pOp->p1];-
1535 type1 = numericType(pIn1);-
1536 pIn2 = &aMem[pOp->p2];-
1537 type2 = numericType(pIn2);-
1538 pOut = &aMem[pOp->p3];-
1539 flags = pIn1->flags | pIn2->flags;-
1540 if( (type1 & type2 & MEM_Int)!=0 ){
(type1 & type2 & 0x0004)!=0Description
TRUEevaluated 7720532 times by 335 tests
Evaluated by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
FALSEevaluated 155105 times by 1 test
Evaluated by:
  • Self test (438)
155105-7720532
1541 iA = pIn1->u.i;-
1542 iB = pIn2->u.i;-
1543 bIntint = 1;-
1544 switch( pOp->opcode ){-
1545 case OP_Add: if( sqlite3AddInt64(&iB,iA) ) goto fp_math; break;
executed 17 times by 1 test: goto fp_math;
Executed by:
  • Self test (438)
executed 2608572 times by 1 test: break;
Executed by:
  • Self test (438)
sqlite3AddInt64(&iB,iA)Description
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2608572 times by 1 test
Evaluated by:
  • Self test (438)
executed 2608589 times by 1 test: case 96:
Executed by:
  • Self test (438)
17-2608589
1546 case OP_Subtract: if( sqlite3SubInt64(&iB,iA) ) goto fp_math; break;
executed 15 times by 1 test: goto fp_math;
Executed by:
  • Self test (438)
executed 1367017 times by 1 test: break;
Executed by:
  • Self test (438)
sqlite3SubInt64(&iB,iA)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1367017 times by 1 test
Evaluated by:
  • Self test (438)
executed 1367032 times by 1 test: case 97:
Executed by:
  • Self test (438)
15-1367032
1547 case OP_Multiply: if( sqlite3MulInt64(&iB,iA) ) goto fp_math; break;
executed 2206 times by 1 test: goto fp_math;
Executed by:
  • Self test (438)
executed 1326958 times by 1 test: break;
Executed by:
  • Self test (438)
sqlite3MulInt64(&iB,iA)Description
TRUEevaluated 2206 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1326958 times by 1 test
Evaluated by:
  • Self test (438)
executed 1329164 times by 1 test: case 98:
Executed by:
  • Self test (438)
2206-1329164
1548 case OP_Divide: {
executed 873532 times by 1 test: case 99:
Executed by:
  • Self test (438)
873532
1549 if( iA==0 ) goto arithmetic_result_is_null;
executed 764 times by 1 test: goto arithmetic_result_is_null;
Executed by:
  • Self test (438)
iA==0Description
TRUEevaluated 764 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 872768 times by 1 test
Evaluated by:
  • Self test (438)
764-872768
1550 if( iA==-1 && iB==SMALLEST_INT64 ) goto fp_math;
executed 1 time by 1 test: goto fp_math;
Executed by:
  • Self test (438)
iA==-1Description
TRUEevaluated 87 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 872681 times by 1 test
Evaluated by:
  • Self test (438)
iB==(((i64)-1)...ffffff)<<32)))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 86 times by 1 test
Evaluated by:
  • Self test (438)
1-872681
1551 iB /= iA;-
1552 break;
executed 872767 times by 1 test: break;
Executed by:
  • Self test (438)
872767
1553 }-
1554 default: {
executed 1542215 times by 335 tests: default:
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
1542215
1555 if( iA==0 ) goto arithmetic_result_is_null;
executed 762 times by 1 test: goto arithmetic_result_is_null;
Executed by:
  • Self test (438)
iA==0Description
TRUEevaluated 762 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1541453 times by 335 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)
  • ...
762-1541453
1556 if( iA==-1 ) iA = 1;
executed 84 times by 1 test: iA = 1;
Executed by:
  • Self test (438)
iA==-1Description
TRUEevaluated 84 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1541369 times by 335 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)
  • ...
84-1541369
1557 iB %= iA;-
1558 break;
executed 1541453 times by 335 tests: break;
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
1541453
1559 }-
1560 }-
1561 pOut->u.i = iB;-
1562 MemSetTypeFlag(pOut, MEM_Int);-
1563 }else if( (flags & MEM_Null)!=0 ){
executed 7716767 times by 335 tests: end of block
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
(flags & 0x0001)!=0Description
TRUEevaluated 496 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 154609 times by 1 test
Evaluated by:
  • Self test (438)
496-7716767
1564 goto arithmetic_result_is_null;
executed 496 times by 1 test: goto arithmetic_result_is_null;
Executed by:
  • Self test (438)
496
1565 }else{-
1566 bIntint = 0;-
1567fp_math:
code before this statement executed 154609 times by 1 test: fp_math:
Executed by:
  • Self test (438)
154609
1568 rA = sqlite3VdbeRealValue(pIn1);-
1569 rB = sqlite3VdbeRealValue(pIn2);-
1570 switch( pOp->opcode ){-
1571 case OP_Add: rB += rA; break;
executed 50542 times by 1 test: break;
Executed by:
  • Self test (438)
executed 50542 times by 1 test: case 96:
Executed by:
  • Self test (438)
50542
1572 case OP_Subtract: rB -= rA; break;
executed 14442 times by 1 test: break;
Executed by:
  • Self test (438)
executed 14442 times by 1 test: case 97:
Executed by:
  • Self test (438)
14442
1573 case OP_Multiply: rB *= rA; break;
executed 91483 times by 1 test: break;
Executed by:
  • Self test (438)
executed 91483 times by 1 test: case 98:
Executed by:
  • Self test (438)
91483
1574 case OP_Divide: {
executed 173 times by 1 test: case 99:
Executed by:
  • Self test (438)
173
1575 /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */-
1576 if( rA==(double)0 ) goto arithmetic_result_is_null;
executed 94 times by 1 test: goto arithmetic_result_is_null;
Executed by:
  • Self test (438)
rA==(double)0Description
TRUEevaluated 94 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 79 times by 1 test
Evaluated by:
  • Self test (438)
79-94
1577 rB /= rA;-
1578 break;
executed 79 times by 1 test: break;
Executed by:
  • Self test (438)
79
1579 }-
1580 default: {
executed 208 times by 1 test: default:
Executed by:
  • Self test (438)
208
1581 iA = (i64)rA;-
1582 iB = (i64)rB;-
1583 if( iA==0 ) goto arithmetic_result_is_null;
executed 94 times by 1 test: goto arithmetic_result_is_null;
Executed by:
  • Self test (438)
iA==0Description
TRUEevaluated 94 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 114 times by 1 test
Evaluated by:
  • Self test (438)
94-114
1584 if( iA==-1 ) iA = 1;
executed 2 times by 1 test: iA = 1;
Executed by:
  • Self test (438)
iA==-1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 112 times by 1 test
Evaluated by:
  • Self test (438)
2-112
1585 rB = (double)(iB % iA);-
1586 break;
executed 114 times by 1 test: break;
Executed by:
  • Self test (438)
114
1587 }-
1588 }-
1589#ifdef SQLITE_OMIT_FLOATING_POINT-
1590 pOut->u.i = rB;-
1591 MemSetTypeFlag(pOut, MEM_Int);-
1592#else-
1593 if( sqlite3IsNaN(rB) ){
sqlite3IsNaN(rB)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 156654 times by 1 test
Evaluated by:
  • Self test (438)
6-156654
1594 goto arithmetic_result_is_null;
executed 6 times by 1 test: goto arithmetic_result_is_null;
Executed by:
  • Self test (438)
6
1595 }-
1596 pOut->u.r = rB;-
1597 MemSetTypeFlag(pOut, MEM_Real);-
1598 if( ((type1|type2)&MEM_Real)==0 && !bIntint ){
((type1|type2)&0x0008)==0Description
TRUEevaluated 2584 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 154070 times by 1 test
Evaluated by:
  • Self test (438)
!bIntintDescription
TRUEevaluated 345 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2239 times by 1 test
Evaluated by:
  • Self test (438)
345-154070
1599 sqlite3VdbeIntegerAffinity(pOut);-
1600 }
executed 345 times by 1 test: end of block
Executed by:
  • Self test (438)
345
1601#endif-
1602 }
executed 156654 times by 1 test: end of block
Executed by:
  • Self test (438)
156654
1603 break;
executed 7873421 times by 335 tests: break;
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
7873421
1604-
1605arithmetic_result_is_null:-
1606 sqlite3VdbeMemSetNull(pOut);-
1607 break;
executed 2216 times by 1 test: break;
Executed by:
  • Self test (438)
2216
1608}-
1609-
1610/* Opcode: CollSeq P1 * * P4-
1611**-
1612** P4 is a pointer to a CollSeq object. If the next call to a user function-
1613** or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will-
1614** be returned. This is used by the built-in min(), max() and nullif()-
1615** functions.-
1616**-
1617** If P1 is not zero, then it is a register that a subsequent min() or-
1618** max() aggregate will set to 1 if the current row is not the minimum or-
1619** maximum. The P1 register is initialized to 0 by this instruction.-
1620**-
1621** The interface used by the implementation of the aforementioned functions-
1622** to retrieve the collation sequence set by this opcode is not available-
1623** publicly. Only built-in functions have access to this feature.-
1624*/-
1625case
executed 482633 times by 1 test: case 82:
Executed by:
  • Self test (438)
OP_CollSeq: {
executed 482633 times by 1 test: case 82:
Executed by:
  • Self test (438)
482633
1626 assert( pOp->p4type==P4_COLLSEQ );-
1627 if( pOp->p1 ){
pOp->p1Description
TRUEevaluated 102860 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 379773 times by 1 test
Evaluated by:
  • Self test (438)
102860-379773
1628 sqlite3VdbeMemSetInt64(&aMem[pOp->p1], 0);-
1629 }
executed 102860 times by 1 test: end of block
Executed by:
  • Self test (438)
102860
1630 break;
executed 482633 times by 1 test: break;
Executed by:
  • Self test (438)
482633
1631}-
1632-
1633/* Opcode: BitAnd P1 P2 P3 * *-
1634** Synopsis: r[P3]=r[P1]&r[P2]-
1635**-
1636** Take the bit-wise AND of the values in register P1 and P2 and-
1637** store the result in register P3.-
1638** If either input is NULL, the result is NULL.-
1639*/-
1640/* Opcode: BitOr P1 P2 P3 * *-
1641** Synopsis: r[P3]=r[P1]|r[P2]-
1642**-
1643** Take the bit-wise OR of the values in register P1 and P2 and-
1644** store the result in register P3.-
1645** If either input is NULL, the result is NULL.-
1646*/-
1647/* Opcode: ShiftLeft P1 P2 P3 * *-
1648** Synopsis: r[P3]=r[P2]<<r[P1]-
1649**-
1650** Shift the integer value in register P2 to the left by the-
1651** number of bits specified by the integer in register P1.-
1652** Store the result in register P3.-
1653** If either input is NULL, the result is NULL.-
1654*/-
1655/* Opcode: ShiftRight P1 P2 P3 * *-
1656** Synopsis: r[P3]=r[P2]>>r[P1]-
1657**-
1658** Shift the integer value in register P2 to the right by the-
1659** number of bits specified by the integer in register P1.-
1660** Store the result in register P3.-
1661** If either input is NULL, the result is NULL.-
1662*/-
1663case
executed 7926 times by 1 test: case 92:
Executed by:
  • Self test (438)
OP_BitAnd: /* same as TK_BITAND, in1, in2, out3 */
executed 7926 times by 1 test: case 92:
Executed by:
  • Self test (438)
7926
1664case
executed 4849 times by 1 test: case 93:
Executed by:
  • Self test (438)
OP_BitOr: /* same as TK_BITOR, in1, in2, out3 */
executed 4849 times by 1 test: case 93:
Executed by:
  • Self test (438)
4849
1665case
executed 2828 times by 1 test: case 94:
Executed by:
  • Self test (438)
OP_ShiftLeft: /* same as TK_LSHIFT, in1, in2, out3 */
executed 2828 times by 1 test: case 94:
Executed by:
  • Self test (438)
2828
1666case
executed 2811 times by 1 test: case 95:
Executed by:
  • Self test (438)
OP_ShiftRight: { /* same as TK_RSHIFT, in1, in2, out3 */
executed 2811 times by 1 test: case 95:
Executed by:
  • Self test (438)
2811
1667 i64 iA;-
1668 u64 uA;-
1669 i64 iB;-
1670 u8 op;-
1671-
1672 pIn1 = &aMem[pOp->p1];-
1673 pIn2 = &aMem[pOp->p2];-
1674 pOut = &aMem[pOp->p3];-
1675 if( (pIn1->flags | pIn2->flags) & MEM_Null ){
(pIn1->flags |...lags) & 0x0001Description
TRUEevaluated 326 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 18088 times by 1 test
Evaluated by:
  • Self test (438)
326-18088
1676 sqlite3VdbeMemSetNull(pOut);-
1677 break;
executed 326 times by 1 test: break;
Executed by:
  • Self test (438)
326
1678 }-
1679 iA = sqlite3VdbeIntValue(pIn2);-
1680 iB = sqlite3VdbeIntValue(pIn1);-
1681 op = pOp->opcode;-
1682 if( op==OP_BitAnd ){
op==92Description
TRUEevaluated 7786 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 10302 times by 1 test
Evaluated by:
  • Self test (438)
7786-10302
1683 iA &= iB;-
1684 }else if( op==OP_BitOr ){
executed 7786 times by 1 test: end of block
Executed by:
  • Self test (438)
op==93Description
TRUEevaluated 4787 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5515 times by 1 test
Evaluated by:
  • Self test (438)
4787-7786
1685 iA |= iB;-
1686 }else if( iB!=0 ){
executed 4787 times by 1 test: end of block
Executed by:
  • Self test (438)
iB!=0Description
TRUEevaluated 3793 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1722 times by 1 test
Evaluated by:
  • Self test (438)
1722-4787
1687 assert( op==OP_ShiftRight || op==OP_ShiftLeft );-
1688-
1689 /* If shifting by a negative amount, shift in the other direction */-
1690 if( iB<0 ){
iB<0Description
TRUEevaluated 233 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3560 times by 1 test
Evaluated by:
  • Self test (438)
233-3560
1691 assert( OP_ShiftRight==OP_ShiftLeft+1 );-
1692 op = 2*OP_ShiftLeft + 1 - op;-
1693 iB = iB>(-64) ? -iB : 64;
iB>(-64)Description
TRUEevaluated 184 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 49 times by 1 test
Evaluated by:
  • Self test (438)
49-184
1694 }
executed 233 times by 1 test: end of block
Executed by:
  • Self test (438)
233
1695-
1696 if( iB>=64 ){
iB>=64Description
TRUEevaluated 273 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3520 times by 1 test
Evaluated by:
  • Self test (438)
273-3520
1697 iA = (iA>=0 || op==OP_ShiftLeft) ? 0 : -1;
iA>=0Description
TRUEevaluated 252 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 21 times by 1 test
Evaluated by:
  • Self test (438)
op==94Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test (438)
10-252
1698 }else{
executed 273 times by 1 test: end of block
Executed by:
  • Self test (438)
273
1699 memcpy(&uA, &iA, sizeof(uA));-
1700 if( op==OP_ShiftLeft ){
op==94Description
TRUEevaluated 1770 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1750 times by 1 test
Evaluated by:
  • Self test (438)
1750-1770
1701 uA <<= iB;-
1702 }else{
executed 1770 times by 1 test: end of block
Executed by:
  • Self test (438)
1770
1703 uA >>= iB;-
1704 /* Sign-extend on a right shift of a negative number */-
1705 if( iA<0 ) uA |= ((((u64)0xffffffff)<<32)|0xffffffff) << (64-iB);
executed 38 times by 1 test: uA |= ((((u64)0xffffffff)<<32)|0xffffffff) << (64-iB);
Executed by:
  • Self test (438)
iA<0Description
TRUEevaluated 38 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1712 times by 1 test
Evaluated by:
  • Self test (438)
38-1712
1706 }
executed 1750 times by 1 test: end of block
Executed by:
  • Self test (438)
1750
1707 memcpy(&iA, &uA, sizeof(iA));-
1708 }
executed 3520 times by 1 test: end of block
Executed by:
  • Self test (438)
3520
1709 }-
1710 pOut->u.i = iA;-
1711 MemSetTypeFlag(pOut, MEM_Int);-
1712 break;
executed 18088 times by 1 test: break;
Executed by:
  • Self test (438)
18088
1713}-
1714-
1715/* Opcode: AddImm P1 P2 * * *-
1716** Synopsis: r[P1]=r[P1]+P2-
1717** -
1718** Add the constant P2 to the value in register P1.-
1719** The result is always an integer.-
1720**-
1721** To force any register to be an integer, just add 0.-
1722*/-
1723case
executed 2718460 times by 12 tests: case 83:
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)
OP_AddImm: { /* in1 */
executed 2718460 times by 12 tests: case 83:
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)
2718460
1724 pIn1 = &aMem[pOp->p1];-
1725 memAboutToChange(p, pIn1);-
1726 sqlite3VdbeMemIntegerify(pIn1);-
1727 pIn1->u.i += pOp->p2;-
1728 break;
executed 2718460 times by 12 tests: break;
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)
2718460
1729}-
1730-
1731/* Opcode: MustBeInt P1 P2 * * *-
1732** -
1733** Force the value in register P1 to be an integer. If the value-
1734** in P1 is not an integer and cannot be converted into an integer-
1735** without data loss, then jump immediately to P2, or if P2==0-
1736** raise an SQLITE_MISMATCH exception.-
1737*/-
1738case
executed 340000 times by 1 test: case 15:
Executed by:
  • Self test (438)
OP_MustBeInt: { /* jump, in1 */
executed 340000 times by 1 test: case 15:
Executed by:
  • Self test (438)
340000
1739 pIn1 = &aMem[pOp->p1];-
1740 if( (pIn1->flags & MEM_Int)==0 ){
(pIn1->flags & 0x0004)==0Description
TRUEevaluated 98 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 339902 times by 1 test
Evaluated by:
  • Self test (438)
98-339902
1741 applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding);-
1742 VdbeBranchTaken((pIn1->flags&MEM_Int)==0, 2);-
1743 if( (pIn1->flags & MEM_Int)==0 ){
(pIn1->flags & 0x0004)==0Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 50 times by 1 test
Evaluated by:
  • Self test (438)
48-50
1744 if( pOp->p2==0 ){
pOp->p2==0Description
TRUEevaluated 33 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 15 times by 1 test
Evaluated by:
  • Self test (438)
15-33
1745 rc = SQLITE_MISMATCH;-
1746 goto abort_due_to_error;
executed 33 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
33
1747 }else{-
1748 goto jump_to_p2;
executed 15 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
15
1749 }-
1750 }-
1751 }
executed 50 times by 1 test: end of block
Executed by:
  • Self test (438)
50
1752 MemSetTypeFlag(pIn1, MEM_Int);-
1753 break;
executed 339952 times by 1 test: break;
Executed by:
  • Self test (438)
339952
1754}-
1755-
1756#ifndef SQLITE_OMIT_FLOATING_POINT-
1757/* Opcode: RealAffinity P1 * * * *-
1758**-
1759** If register P1 holds an integer convert it to a real value.-
1760**-
1761** This opcode is used when extracting information from a column that-
1762** has REAL affinity. Such column values may still be stored as-
1763** integers, for space efficiency, but after extraction we want them-
1764** to have only a real value.-
1765*/-
1766case
executed 1214168 times by 1 test: case 84:
Executed by:
  • Self test (438)
OP_RealAffinity: { /* in1 */
executed 1214168 times by 1 test: case 84:
Executed by:
  • Self test (438)
1214168
1767 pIn1 = &aMem[pOp->p1];-
1768 if( pIn1->flags & MEM_Int ){
pIn1->flags & 0x0004Description
TRUEevaluated 240045 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 974123 times by 1 test
Evaluated by:
  • Self test (438)
240045-974123
1769 sqlite3VdbeMemRealify(pIn1);-
1770 }
executed 240045 times by 1 test: end of block
Executed by:
  • Self test (438)
240045
1771 break;
executed 1214168 times by 1 test: break;
Executed by:
  • Self test (438)
1214168
1772}-
1773#endif-
1774-
1775#ifndef SQLITE_OMIT_CAST-
1776/* Opcode: Cast P1 P2 * * *-
1777** Synopsis: affinity(r[P1])-
1778**-
1779** Force the value in register P1 to be the type defined by P2.-
1780** -
1781** <ul>-
1782** <li> P2=='A' &rarr; BLOB-
1783** <li> P2=='B' &rarr; TEXT-
1784** <li> P2=='C' &rarr; NUMERIC-
1785** <li> P2=='D' &rarr; INTEGER-
1786** <li> P2=='E' &rarr; REAL-
1787** </ul>-
1788**-
1789** A NULL value is not changed by this routine. It remains NULL.-
1790*/-
1791case
executed 196168 times by 1 test: case 85:
Executed by:
  • Self test (438)
OP_Cast: { /* in1 */
executed 196168 times by 1 test: case 85:
Executed by:
  • Self test (438)
196168
1792 assert( pOp->p2>=SQLITE_AFF_BLOB && pOp->p2<=SQLITE_AFF_REAL );-
1793 testcase( pOp->p2==SQLITE_AFF_TEXT );-
1794 testcase( pOp->p2==SQLITE_AFF_BLOB );-
1795 testcase( pOp->p2==SQLITE_AFF_NUMERIC );-
1796 testcase( pOp->p2==SQLITE_AFF_INTEGER );-
1797 testcase( pOp->p2==SQLITE_AFF_REAL );-
1798 pIn1 = &aMem[pOp->p1];-
1799 memAboutToChange(p, pIn1);-
1800 rc = ExpandBlob(pIn1);
((pIn1)->flags&0x4000)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 196164 times by 1 test
Evaluated by:
  • Self test (438)
4-196164
1801 sqlite3VdbeMemCast(pIn1, pOp->p2, encoding);-
1802 UPDATE_MAX_BLOBSIZE(pIn1);-
1803 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 196168 times by 1 test
Evaluated by:
  • Self test (438)
0-196168
1804 break;
executed 196168 times by 1 test: break;
Executed by:
  • Self test (438)
196168
1805}-
1806#endif /* SQLITE_OMIT_CAST */-
1807-
1808/* Opcode: Eq P1 P2 P3 P4 P5-
1809** Synopsis: IF r[P3]==r[P1]-
1810**-
1811** Compare the values in register P1 and P3. If reg(P3)==reg(P1) then-
1812** jump to address P2. Or if the SQLITE_STOREP2 flag is set in P5, then-
1813** store the result of comparison in register P2.-
1814**-
1815** The SQLITE_AFF_MASK portion of P5 must be an affinity character --
1816** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made -
1817** to coerce both inputs according to this affinity before the-
1818** comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric-
1819** affinity is used. Note that the affinity conversions are stored-
1820** back into the input registers P1 and P3. So this opcode can cause-
1821** persistent changes to registers P1 and P3.-
1822**-
1823** Once any conversions have taken place, and neither value is NULL, -
1824** the values are compared. If both values are blobs then memcmp() is-
1825** used to determine the results of the comparison. If both values-
1826** are text, then the appropriate collating function specified in-
1827** P4 is used to do the comparison. If P4 is not specified then-
1828** memcmp() is used to compare text string. If both values are-
1829** numeric, then a numeric comparison is used. If the two values-
1830** are of different types, then numbers are considered less than-
1831** strings and strings are considered less than blobs.-
1832**-
1833** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either-
1834** true or false and is never NULL. If both operands are NULL then the result-
1835** of comparison is true. If either operand is NULL then the result is false.-
1836** If neither operand is NULL the result is the same as it would be if-
1837** the SQLITE_NULLEQ flag were omitted from P5.-
1838**-
1839** If both SQLITE_STOREP2 and SQLITE_KEEPNULL flags are set then the-
1840** content of r[P2] is only changed if the new value is NULL or 0 (false).-
1841** In other words, a prior r[P2] value will not be overwritten by 1 (true).-
1842*/-
1843/* Opcode: Ne P1 P2 P3 P4 P5-
1844** Synopsis: IF r[P3]!=r[P1]-
1845**-
1846** This works just like the Eq opcode except that the jump is taken if-
1847** the operands in registers P1 and P3 are not equal. See the Eq opcode for-
1848** additional information.-
1849**-
1850** If both SQLITE_STOREP2 and SQLITE_KEEPNULL flags are set then the-
1851** content of r[P2] is only changed if the new value is NULL or 1 (true).-
1852** In other words, a prior r[P2] value will not be overwritten by 0 (false).-
1853*/-
1854/* Opcode: Lt P1 P2 P3 P4 P5-
1855** Synopsis: IF r[P3]<r[P1]-
1856**-
1857** Compare the values in register P1 and P3. If reg(P3)<reg(P1) then-
1858** jump to address P2. Or if the SQLITE_STOREP2 flag is set in P5 store-
1859** the result of comparison (0 or 1 or NULL) into register P2.-
1860**-
1861** If the SQLITE_JUMPIFNULL bit of P5 is set and either reg(P1) or-
1862** reg(P3) is NULL then the take the jump. If the SQLITE_JUMPIFNULL -
1863** bit is clear then fall through if either operand is NULL.-
1864**-
1865** The SQLITE_AFF_MASK portion of P5 must be an affinity character --
1866** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made -
1867** to coerce both inputs according to this affinity before the-
1868** comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric-
1869** affinity is used. Note that the affinity conversions are stored-
1870** back into the input registers P1 and P3. So this opcode can cause-
1871** persistent changes to registers P1 and P3.-
1872**-
1873** Once any conversions have taken place, and neither value is NULL, -
1874** the values are compared. If both values are blobs then memcmp() is-
1875** used to determine the results of the comparison. If both values-
1876** are text, then the appropriate collating function specified in-
1877** P4 is used to do the comparison. If P4 is not specified then-
1878** memcmp() is used to compare text string. If both values are-
1879** numeric, then a numeric comparison is used. If the two values-
1880** are of different types, then numbers are considered less than-
1881** strings and strings are considered less than blobs.-
1882*/-
1883/* Opcode: Le P1 P2 P3 P4 P5-
1884** Synopsis: IF r[P3]<=r[P1]-
1885**-
1886** This works just like the Lt opcode except that the jump is taken if-
1887** the content of register P3 is less than or equal to the content of-
1888** register P1. See the Lt opcode for additional information.-
1889*/-
1890/* Opcode: Gt P1 P2 P3 P4 P5-
1891** Synopsis: IF r[P3]>r[P1]-
1892**-
1893** This works just like the Lt opcode except that the jump is taken if-
1894** the content of register P3 is greater than the content of-
1895** register P1. See the Lt opcode for additional information.-
1896*/-
1897/* Opcode: Ge P1 P2 P3 P4 P5-
1898** Synopsis: IF r[P3]>=r[P1]-
1899**-
1900** This works just like the Lt opcode except that the jump is taken if-
1901** the content of register P3 is greater than or equal to the content of-
1902** register P1. See the Lt opcode for additional information.-
1903*/-
1904case
executed 952351 times by 39 tests: case 53:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (47)
  • Self test (48)
  • Self test (53)
  • Self test (57)
  • Self test (58)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • ...
OP_Eq: /* same as TK_EQ, jump, in1, in3 */
executed 952351 times by 39 tests: case 53:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (47)
  • Self test (48)
  • Self test (53)
  • Self test (57)
  • Self test (58)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • ...
952351
1905case
executed 6113772 times by 365 tests: case 52:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
OP_Ne: /* same as TK_NE, jump, in1, in3 */
executed 6113772 times by 365 tests: case 52:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
6113772
1906case
executed 505314 times by 1 test: case 56:
Executed by:
  • Self test (438)
OP_Lt: /* same as TK_LT, jump, in1, in3 */
executed 505314 times by 1 test: case 56:
Executed by:
  • Self test (438)
505314
1907case
executed 288505 times by 3 tests: case 55:
Executed by:
  • Self test (34)
  • Self test (40)
  • Self test (438)
OP_Le: /* same as TK_LE, jump, in1, in3 */
executed 288505 times by 3 tests: case 55:
Executed by:
  • Self test (34)
  • Self test (40)
  • Self test (438)
288505
1908case
executed 486663 times by 1 test: case 54:
Executed by:
  • Self test (438)
OP_Gt: /* same as TK_GT, jump, in1, in3 */
executed 486663 times by 1 test: case 54:
Executed by:
  • Self test (438)
486663
1909case
executed 972137 times by 1 test: case 57:
Executed by:
  • Self test (438)
OP_Ge: { /* same as TK_GE, jump, in1, in3 */
executed 972137 times by 1 test: case 57:
Executed by:
  • Self test (438)
972137
1910 int res, res2; /* Result of the comparison of pIn1 against pIn3 */-
1911 char affinity; /* Affinity to use for comparison */-
1912 u16 flags1; /* Copy of initial value of pIn1->flags */-
1913 u16 flags3; /* Copy of initial value of pIn3->flags */-
1914-
1915 pIn1 = &aMem[pOp->p1];-
1916 pIn3 = &aMem[pOp->p3];-
1917 flags1 = pIn1->flags;-
1918 flags3 = pIn3->flags;-
1919 if( (flags1 | flags3)&MEM_Null ){
(flags1 | flags3)&0x0001Description
TRUEevaluated 86983 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 9231759 times by 377 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)
  • ...
86983-9231759
1920 /* One or both operands are NULL */-
1921 if( pOp->p5 & SQLITE_NULLEQ ){
pOp->p5 & 0x80Description
TRUEevaluated 2753 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 84230 times by 1 test
Evaluated by:
  • Self test (438)
2753-84230
1922 /* If SQLITE_NULLEQ is set (which will only happen if the operator is-
1923 ** OP_Eq or OP_Ne) then take the jump or not depending on whether-
1924 ** or not both operands are null.-
1925 */-
1926 assert( pOp->opcode==OP_Eq || pOp->opcode==OP_Ne );-
1927 assert( (flags1 & MEM_Cleared)==0 );-
1928 assert( (pOp->p5 & SQLITE_JUMPIFNULL)==0 );-
1929 if( (flags1&flags3&MEM_Null)!=0
(flags1&flags3&0x0001)!=0Description
TRUEevaluated 2153 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 600 times by 1 test
Evaluated by:
  • Self test (438)
600-2153
1930 && (flags3&MEM_Cleared)==0
(flags3&0x0100)==0Description
TRUEevaluated 2152 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-2152
1931 ){-
1932 res = 0; /* Operands are equal */-
1933 }else{
executed 2152 times by 1 test: end of block
Executed by:
  • Self test (438)
2152
1934 res = 1; /* Operands are not equal */-
1935 }
executed 601 times by 1 test: end of block
Executed by:
  • Self test (438)
601
1936 }else{-
1937 /* SQLITE_NULLEQ is clear and at least one operand is NULL,-
1938 ** then the result is always NULL.-
1939 ** The jump is taken if the SQLITE_JUMPIFNULL bit is set.-
1940 */-
1941 if( pOp->p5 & SQLITE_STOREP2 ){
pOp->p5 & 0x20Description
TRUEevaluated 1810 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 82420 times by 1 test
Evaluated by:
  • Self test (438)
1810-82420
1942 pOut = &aMem[pOp->p2];-
1943 iCompare = 1; /* Operands are not equal */-
1944 memAboutToChange(p, pOut);-
1945 MemSetTypeFlag(pOut, MEM_Null);-
1946 REGISTER_TRACE(pOp->p2, pOut);-
1947 }else{
executed 1810 times by 1 test: end of block
Executed by:
  • Self test (438)
1810
1948 VdbeBranchTaken(2,3);-
1949 if( pOp->p5 & SQLITE_JUMPIFNULL ){
pOp->p5 & 0x10Description
TRUEevaluated 41866 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 40554 times by 1 test
Evaluated by:
  • Self test (438)
40554-41866
1950 goto jump_to_p2;
executed 41866 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
41866
1951 }-
1952 }
executed 40554 times by 1 test: end of block
Executed by:
  • Self test (438)
40554
1953 break;
executed 42364 times by 1 test: break;
Executed by:
  • Self test (438)
42364
1954 }-
1955 }else{-
1956 /* Neither operand is NULL. Do a comparison. */-
1957 affinity = pOp->p5 & SQLITE_AFF_MASK;-
1958 if( affinity>=SQLITE_AFF_NUMERIC ){
affinity>='C'Description
TRUEevaluated 1095819 times by 2 tests
Evaluated by:
  • Self test (34)
  • Self test (438)
FALSEevaluated 8135940 times by 377 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)
  • ...
1095819-8135940
1959 if( (flags1 | flags3)&MEM_Str ){
(flags1 | flags3)&0x0002Description
TRUEevaluated 455609 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 640210 times by 2 tests
Evaluated by:
  • Self test (34)
  • Self test (438)
455609-640210
1960 if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
(flags1 & (0x0...0002))==0x0002Description
TRUEevaluated 345807 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 109802 times by 1 test
Evaluated by:
  • Self test (438)
109802-345807
1961 applyNumericAffinity(pIn1,0);-
1962 assert( flags3==pIn3->flags );-
1963 /* testcase( flags3!=pIn3->flags );-
1964 ** this used to be possible with pIn1==pIn3, but not since-
1965 ** the column cache was removed. The following assignment-
1966 ** is essentially a no-op. But, it provides defense-in-depth-
1967 ** in case our analysis is incorrect, so it is left in. */-
1968 flags3 = pIn3->flags;-
1969 }
executed 345807 times by 1 test: end of block
Executed by:
  • Self test (438)
345807
1970 if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
(flags3 & (0x0...0002))==0x0002Description
TRUEevaluated 353904 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 101705 times by 1 test
Evaluated by:
  • Self test (438)
101705-353904
1971 applyNumericAffinity(pIn3,0);-
1972 }
executed 353904 times by 1 test: end of block
Executed by:
  • Self test (438)
353904
1973 }
executed 455609 times by 1 test: end of block
Executed by:
  • Self test (438)
455609
1974 /* Handle the common case of integer comparison here, as an-
1975 ** optimization, to avoid a call to sqlite3MemCompare() */-
1976 if( (pIn1->flags & pIn3->flags & MEM_Int)!=0 ){
(pIn1->flags &...s & 0x0004)!=0Description
TRUEevaluated 547331 times by 2 tests
Evaluated by:
  • Self test (34)
  • Self test (438)
FALSEevaluated 548488 times by 1 test
Evaluated by:
  • Self test (438)
547331-548488
1977 if( pIn3->u.i > pIn1->u.i ){ res = +1; goto compare_op; }
executed 239884 times by 2 tests: goto compare_op;
Executed by:
  • Self test (34)
  • Self test (438)
pIn3->u.i > pIn1->u.iDescription
TRUEevaluated 239884 times by 2 tests
Evaluated by:
  • Self test (34)
  • Self test (438)
FALSEevaluated 307447 times by 1 test
Evaluated by:
  • Self test (438)
239884-307447
1978 if( pIn3->u.i < pIn1->u.i ){ res = -1; goto compare_op; }
executed 273664 times by 1 test: goto compare_op;
Executed by:
  • Self test (438)
pIn3->u.i < pIn1->u.iDescription
TRUEevaluated 273664 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 33783 times by 1 test
Evaluated by:
  • Self test (438)
33783-273664
1979 res = 0;-
1980 goto compare_op;
executed 33783 times by 1 test: goto compare_op;
Executed by:
  • Self test (438)
33783
1981 }-
1982 }else if( affinity==SQLITE_AFF_TEXT ){
executed 548488 times by 1 test: end of block
Executed by:
  • Self test (438)
affinity=='B'Description
TRUEevaluated 4614778 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 3521162 times by 348 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)
  • ...
548488-4614778
1983 if( (flags1 & MEM_Str)==0 && (flags1 & (MEM_Int|MEM_Real))!=0 ){
(flags1 & 0x0002)==0Description
TRUEevaluated 25444 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4589334 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
(flags1 & (0x0004|0x0008))!=0Description
TRUEevaluated 25440 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
4-4589334
1984 testcase( pIn1->flags & MEM_Int );-
1985 testcase( pIn1->flags & MEM_Real );-
1986 sqlite3VdbeMemStringify(pIn1, encoding, 1);-
1987 testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) );-
1988 flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask);-
1989 assert( pIn1!=pIn3 );-
1990 }
executed 25440 times by 1 test: end of block
Executed by:
  • Self test (438)
25440
1991 if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){
(flags3 & 0x0002)==0Description
TRUEevaluated 58 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4614720 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
(flags3 & (0x0004|0x0008))!=0Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
2-4614720
1992 testcase( pIn3->flags & MEM_Int );-
1993 testcase( pIn3->flags & MEM_Real );-
1994 sqlite3VdbeMemStringify(pIn3, encoding, 1);-
1995 testcase( (flags3&MEM_Dyn) != (pIn3->flags&MEM_Dyn) );-
1996 flags3 = (pIn3->flags & ~MEM_TypeMask) | (flags3 & MEM_TypeMask);-
1997 }
executed 56 times by 1 test: end of block
Executed by:
  • Self test (438)
56
1998 }
executed 4614778 times by 31 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
4614778
1999 assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );-
2000 res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);-
2001 }
executed 8684428 times by 377 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
8684428
2002compare_op:
code before this statement executed 8687181 times by 377 tests: compare_op:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
8687181
2003 /* At this point, res is negative, zero, or positive if reg[P1] is-
2004 ** less than, equal to, or greater than reg[P3], respectively. Compute-
2005 ** the answer to this operator in res2, depending on what the comparison-
2006 ** operator actually is. The next block of code depends on the fact-
2007 ** that the 6 comparison operators are consecutive integers in this-
2008 ** order: NE, EQ, GT, LE, LT, GE */-
2009 assert( OP_Eq==OP_Ne+1 ); assert( OP_Gt==OP_Ne+2 ); assert( OP_Le==OP_Ne+3 );-
2010 assert( OP_Lt==OP_Ne+4 ); assert( OP_Ge==OP_Ne+5 );-
2011 if( res<0 ){ /* ne, eq, gt, le, lt, ge */
res<0Description
TRUEevaluated 4587527 times by 32 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
FALSEevaluated 4646985 times by 377 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)
  • ...
4587527-4646985
2012 static const unsigned char aLTb[] = { 1, 0, 0, 1, 1, 0 };-
2013 res2 = aLTb[pOp->opcode - OP_Ne];-
2014 }else if( res==0 ){
executed 4587527 times by 32 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (40)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
res==0Description
TRUEevaluated 764853 times by 376 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 3882132 times by 344 tests
Evaluated by:
  • Self test (100)
  • 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)
  • ...
764853-4587527
2015 static const unsigned char aEQb[] = { 0, 1, 0, 1, 0, 1 };-
2016 res2 = aEQb[pOp->opcode - OP_Ne];-
2017 }else{
executed 764853 times by 376 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
764853
2018 static const unsigned char aGTb[] = { 1, 0, 1, 0, 0, 1 };-
2019 res2 = aGTb[pOp->opcode - OP_Ne];-
2020 }
executed 3882132 times by 344 tests: end of block
Executed by:
  • Self test (100)
  • 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)
  • ...
3882132
2021-
2022 /* Undo any changes made by applyAffinity() to the input registers. */-
2023 assert( (pIn1->flags & MEM_Dyn) == (flags1 & MEM_Dyn) );-
2024 pIn1->flags = flags1;-
2025 assert( (pIn3->flags & MEM_Dyn) == (flags3 & MEM_Dyn) );-
2026 pIn3->flags = flags3;-
2027-
2028 if( pOp->p5 & SQLITE_STOREP2 ){
pOp->p5 & 0x20Description
TRUEevaluated 258017 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 8976495 times by 377 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)
  • ...
258017-8976495
2029 pOut = &aMem[pOp->p2];-
2030 iCompare = res;-
2031 if( (pOp->p5 & SQLITE_KEEPNULL)!=0 ){
(pOp->p5 & 0x08)!=0Description
TRUEevaluated 134 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 257883 times by 1 test
Evaluated by:
  • Self test (438)
134-257883
2032 /* The KEEPNULL flag prevents OP_Eq from overwriting a NULL with 1-
2033 ** and prevents OP_Ne from overwriting NULL with 0. This flag-
2034 ** is only used in contexts where either:-
2035 ** (1) op==OP_Eq && (r[P2]==NULL || r[P2]==0)-
2036 ** (2) op==OP_Ne && (r[P2]==NULL || r[P2]==1)-
2037 ** Therefore it is not necessary to check the content of r[P2] for-
2038 ** NULL. */-
2039 assert( pOp->opcode==OP_Ne || pOp->opcode==OP_Eq );-
2040 assert( res2==0 || res2==1 );-
2041 testcase( res2==0 && pOp->opcode==OP_Eq );-
2042 testcase( res2==1 && pOp->opcode==OP_Eq );-
2043 testcase( res2==0 && pOp->opcode==OP_Ne );-
2044 testcase( res2==1 && pOp->opcode==OP_Ne );-
2045 if( (pOp->opcode==OP_Eq)==res2 ) break;
executed 116 times by 1 test: break;
Executed by:
  • Self test (438)
(pOp->opcode==53)==res2Description
TRUEevaluated 116 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 18 times by 1 test
Evaluated by:
  • Self test (438)
18-116
2046 }
executed 18 times by 1 test: end of block
Executed by:
  • Self test (438)
18
2047 memAboutToChange(p, pOut);-
2048 MemSetTypeFlag(pOut, MEM_Int);-
2049 pOut->u.i = res2;-
2050 REGISTER_TRACE(pOp->p2, pOut);-
2051 }else{
executed 257901 times by 1 test: end of block
Executed by:
  • Self test (438)
257901
2052 VdbeBranchTaken(res!=0, (pOp->p5 & SQLITE_NULLEQ)?2:3);-
2053 if( res2 ){
res2Description
TRUEevaluated 6388558 times by 373 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • 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)
  • ...
FALSEevaluated 2587937 times by 366 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
2587937-6388558
2054 goto jump_to_p2;
executed 6388558 times by 373 tests: goto jump_to_p2;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • 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)
  • ...
6388558
2055 }-
2056 }
executed 2587937 times by 366 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
2587937
2057 break;
executed 2845838 times by 366 tests: break;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
2845838
2058}-
2059-
2060/* Opcode: ElseNotEq * P2 * * *-
2061**-
2062** This opcode must immediately follow an OP_Lt or OP_Gt comparison operator.-
2063** If result of an OP_Eq comparison on the same two operands-
2064** would have be NULL or false (0), then then jump to P2. -
2065** If the result of an OP_Eq comparison on the two previous operands-
2066** would have been true (1), then fall through.-
2067*/-
2068case
executed 163778 times by 1 test: case 58:
Executed by:
  • Self test (438)
OP_ElseNotEq: { /* same as TK_ESCAPE, jump */
executed 163778 times by 1 test: case 58:
Executed by:
  • Self test (438)
163778
2069 assert( pOp>aOp );-
2070 assert( pOp[-1].opcode==OP_Lt || pOp[-1].opcode==OP_Gt );-
2071 assert( pOp[-1].p5 & SQLITE_STOREP2 );-
2072 VdbeBranchTaken(iCompare!=0, 2);-
2073 if( iCompare!=0 ) goto jump_to_p2;
executed 113729 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
iCompare!=0Description
TRUEevaluated 113729 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 50049 times by 1 test
Evaluated by:
  • Self test (438)
50049-113729
2074 break;
executed 50049 times by 1 test: break;
Executed by:
  • Self test (438)
50049
2075}-
2076-
2077-
2078/* Opcode: Permutation * * * P4 *-
2079**-
2080** Set the permutation used by the OP_Compare operator in the next-
2081** instruction. The permutation is stored in the P4 operand.-
2082**-
2083** The permutation is only valid until the next OP_Compare that has-
2084** the OPFLAG_PERMUTE bit set in P5. Typically the OP_Permutation should -
2085** occur immediately prior to the OP_Compare.-
2086**-
2087** The first integer in the P4 integer array is the length of the array-
2088** and does not become part of the permutation.-
2089*/-
2090case
executed 4479 times by 1 test: case 86:
Executed by:
  • Self test (438)
OP_Permutation: {
executed 4479 times by 1 test: case 86:
Executed by:
  • Self test (438)
4479
2091 assert( pOp->p4type==P4_INTARRAY );-
2092 assert( pOp->p4.ai );-
2093 assert( pOp[1].opcode==OP_Compare );-
2094 assert( pOp[1].p5 & OPFLAG_PERMUTE );-
2095 break;
executed 4479 times by 1 test: break;
Executed by:
  • Self test (438)
4479
2096}-
2097-
2098/* Opcode: Compare P1 P2 P3 P4 P5-
2099** Synopsis: r[P1@P3] <-> r[P2@P3]-
2100**-
2101** Compare two vectors of registers in reg(P1)..reg(P1+P3-1) (call this-
2102** vector "A") and in reg(P2)..reg(P2+P3-1) ("B"). Save the result of-
2103** the comparison for use by the next OP_Jump instruct.-
2104**-
2105** If P5 has the OPFLAG_PERMUTE bit set, then the order of comparison is-
2106** determined by the most recent OP_Permutation operator. If the-
2107** OPFLAG_PERMUTE bit is clear, then register are compared in sequential-
2108** order.-
2109**-
2110** P4 is a KeyInfo structure that defines collating sequences and sort-
2111** orders for the comparison. The permutation applies to registers-
2112** only. The KeyInfo elements are used sequentially.-
2113**-
2114** The comparison is a sort comparison, so NULLs compare equal,-
2115** NULLs are less than numbers, numbers are less than strings,-
2116** and strings are less than blobs.-
2117*/-
2118case
executed 803583 times by 1 test: case 87:
Executed by:
  • Self test (438)
OP_Compare: {
executed 803583 times by 1 test: case 87:
Executed by:
  • Self test (438)
803583
2119 int n;-
2120 int i;-
2121 int p1;-
2122 int p2;-
2123 const KeyInfo *pKeyInfo;-
2124 int idx;-
2125 CollSeq *pColl; /* Collating sequence to use on this term */-
2126 int bRev; /* True for DESCENDING sort order */-
2127 int *aPermute; /* The permutation */-
2128-
2129 if( (pOp->p5 & OPFLAG_PERMUTE)==0 ){
(pOp->p5 & 0x01)==0Description
TRUEevaluated 799104 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4479 times by 1 test
Evaluated by:
  • Self test (438)
4479-799104
2130 aPermute = 0;-
2131 }else{
executed 799104 times by 1 test: end of block
Executed by:
  • Self test (438)
799104
2132 assert( pOp>aOp );-
2133 assert( pOp[-1].opcode==OP_Permutation );-
2134 assert( pOp[-1].p4type==P4_INTARRAY );-
2135 aPermute = pOp[-1].p4.ai + 1;-
2136 assert( aPermute!=0 );-
2137 }
executed 4479 times by 1 test: end of block
Executed by:
  • Self test (438)
4479
2138 n = pOp->p3;-
2139 pKeyInfo = pOp->p4.pKeyInfo;-
2140 assert( n>0 );-
2141 assert( pKeyInfo!=0 );-
2142 p1 = pOp->p1;-
2143 p2 = pOp->p2;-
2144#ifdef SQLITE_DEBUG-
2145 if( aPermute ){-
2146 int k, mx = 0;-
2147 for(k=0; k<n; k++) if( aPermute[k]>mx ) mx = aPermute[k];-
2148 assert( p1>0 && p1+mx<=(p->nMem+1 - p->nCursor)+1 );-
2149 assert( p2>0 && p2+mx<=(p->nMem+1 - p->nCursor)+1 );-
2150 }else{-
2151 assert( p1>0 && p1+n<=(p->nMem+1 - p->nCursor)+1 );-
2152 assert( p2>0 && p2+n<=(p->nMem+1 - p->nCursor)+1 );-
2153 }-
2154#endif /* SQLITE_DEBUG */-
2155 for(i=0; i<n; i++){
i<nDescription
TRUEevaluated 858368 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 693661 times by 1 test
Evaluated by:
  • Self test (438)
693661-858368
2156 idx = aPermute ? aPermute[i] : i;
aPermuteDescription
TRUEevaluated 5641 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 852727 times by 1 test
Evaluated by:
  • Self test (438)
5641-852727
2157 assert( memIsValid(&aMem[p1+idx]) );-
2158 assert( memIsValid(&aMem[p2+idx]) );-
2159 REGISTER_TRACE(p1+idx, &aMem[p1+idx]);-
2160 REGISTER_TRACE(p2+idx, &aMem[p2+idx]);-
2161 assert( i<pKeyInfo->nKeyField );-
2162 pColl = pKeyInfo->aColl[i];-
2163 bRev = pKeyInfo->aSortOrder[i];-
2164 iCompare = sqlite3MemCompare(&aMem[p1+idx], &aMem[p2+idx], pColl);-
2165 if( iCompare ){
iCompareDescription
TRUEevaluated 109922 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 748446 times by 1 test
Evaluated by:
  • Self test (438)
109922-748446
2166 if( bRev ) iCompare = -iCompare;
executed 734 times by 1 test: iCompare = -iCompare;
Executed by:
  • Self test (438)
bRevDescription
TRUEevaluated 734 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 109188 times by 1 test
Evaluated by:
  • Self test (438)
734-109188
2167 break;
executed 109922 times by 1 test: break;
Executed by:
  • Self test (438)
109922
2168 }-
2169 }
executed 748446 times by 1 test: end of block
Executed by:
  • Self test (438)
748446
2170 break;
executed 803583 times by 1 test: break;
Executed by:
  • Self test (438)
803583
2171}-
2172-
2173/* Opcode: Jump P1 P2 P3 * *-
2174**-
2175** Jump to the instruction at address P1, P2, or P3 depending on whether-
2176** in the most recent OP_Compare instruction the P1 vector was less than-
2177** equal to, or greater than the P2 vector, respectively.-
2178*/-
2179case
executed 803583 times by 1 test: case 16:
Executed by:
  • Self test (438)
OP_Jump: { /* jump */
executed 803583 times by 1 test: case 16:
Executed by:
  • Self test (438)
803583
2180 if( iCompare<0 ){
iCompare<0Description
TRUEevaluated 12924 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 790659 times by 1 test
Evaluated by:
  • Self test (438)
12924-790659
2181 VdbeBranchTaken(0,4); pOp = &aOp[pOp->p1 - 1];-
2182 }else if( iCompare==0 ){
executed 12924 times by 1 test: end of block
Executed by:
  • Self test (438)
iCompare==0Description
TRUEevaluated 693661 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 96998 times by 1 test
Evaluated by:
  • Self test (438)
12924-693661
2183 VdbeBranchTaken(1,4); pOp = &aOp[pOp->p2 - 1];-
2184 }else{
executed 693661 times by 1 test: end of block
Executed by:
  • Self test (438)
693661
2185 VdbeBranchTaken(2,4); pOp = &aOp[pOp->p3 - 1];-
2186 }
executed 96998 times by 1 test: end of block
Executed by:
  • Self test (438)
96998
2187 break;
executed 803583 times by 1 test: break;
Executed by:
  • Self test (438)
803583
2188}-
2189-
2190/* Opcode: And P1 P2 P3 * *-
2191** Synopsis: r[P3]=(r[P1] && r[P2])-
2192**-
2193** Take the logical AND of the values in registers P1 and P2 and-
2194** write the result into register P3.-
2195**-
2196** If either P1 or P2 is 0 (false) then the result is 0 even if-
2197** the other input is NULL. A NULL and true or two NULLs give-
2198** a NULL output.-
2199*/-
2200/* Opcode: Or P1 P2 P3 * *-
2201** Synopsis: r[P3]=(r[P1] || r[P2])-
2202**-
2203** Take the logical OR of the values in register P1 and P2 and-
2204** store the answer in register P3.-
2205**-
2206** If either P1 or P2 is nonzero (true) then the result is 1 (true)-
2207** even if the other input is NULL. A NULL and false or two NULLs-
2208** give a NULL output.-
2209*/-
2210case
executed 2113 times by 1 test: case 44:
Executed by:
  • Self test (438)
OP_And: /* same as TK_AND, in1, in2, out3 */
executed 2113 times by 1 test: case 44:
Executed by:
  • Self test (438)
2113
2211case
executed 2943 times by 1 test: case 43:
Executed by:
  • Self test (438)
OP_Or: { /* same as TK_OR, in1, in2, out3 */
executed 2943 times by 1 test: case 43:
Executed by:
  • Self test (438)
2943
2212 int v1; /* Left operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */-
2213 int v2; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */-
2214-
2215 v1 = sqlite3VdbeBooleanValue(&aMem[pOp->p1], 2);-
2216 v2 = sqlite3VdbeBooleanValue(&aMem[pOp->p2], 2);-
2217 if( pOp->opcode==OP_And ){
pOp->opcode==44Description
TRUEevaluated 2113 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2943 times by 1 test
Evaluated by:
  • Self test (438)
2113-2943
2218 static const unsigned char and_logic[] = { 0, 0, 0, 0, 1, 2, 0, 2, 2 };-
2219 v1 = and_logic[v1*3+v2];-
2220 }else{
executed 2113 times by 1 test: end of block
Executed by:
  • Self test (438)
2113
2221 static const unsigned char or_logic[] = { 0, 1, 2, 1, 1, 1, 2, 1, 2 };-
2222 v1 = or_logic[v1*3+v2];-
2223 }
executed 2943 times by 1 test: end of block
Executed by:
  • Self test (438)
2943
2224 pOut = &aMem[pOp->p3];-
2225 if( v1==2 ){
v1==2Description
TRUEevaluated 97 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4959 times by 1 test
Evaluated by:
  • Self test (438)
97-4959
2226 MemSetTypeFlag(pOut, MEM_Null);-
2227 }else{
executed 97 times by 1 test: end of block
Executed by:
  • Self test (438)
97
2228 pOut->u.i = v1;-
2229 MemSetTypeFlag(pOut, MEM_Int);-
2230 }
executed 4959 times by 1 test: end of block
Executed by:
  • Self test (438)
4959
2231 break;
executed 5056 times by 1 test: break;
Executed by:
  • Self test (438)
5056
2232}-
2233-
2234/* Opcode: IsTrue P1 P2 P3 P4 *-
2235** Synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4-
2236**-
2237** This opcode implements the IS TRUE, IS FALSE, IS NOT TRUE, and-
2238** IS NOT FALSE operators.-
2239**-
2240** Interpret the value in register P1 as a boolean value. Store that-
2241** boolean (a 0 or 1) in register P2. Or if the value in register P1 is -
2242** NULL, then the P3 is stored in register P2. Invert the answer if P4-
2243** is 1.-
2244**-
2245** The logic is summarized like this:-
2246**-
2247** <ul> -
2248** <li> If P3==0 and P4==0 then r[P2] := r[P1] IS TRUE-
2249** <li> If P3==1 and P4==1 then r[P2] := r[P1] IS FALSE-
2250** <li> If P3==0 and P4==1 then r[P2] := r[P1] IS NOT TRUE-
2251** <li> If P3==1 and P4==0 then r[P2] := r[P1] IS NOT FALSE-
2252** </ul>-
2253*/-
2254case
executed 24 times by 1 test: case 88:
Executed by:
  • Self test (438)
OP_IsTrue: { /* in1, out2 */
executed 24 times by 1 test: case 88:
Executed by:
  • Self test (438)
24
2255 assert( pOp->p4type==P4_INT32 );-
2256 assert( pOp->p4.i==0 || pOp->p4.i==1 );-
2257 assert( pOp->p3==0 || pOp->p3==1 );-
2258 sqlite3VdbeMemSetInt64(&aMem[pOp->p2],-
2259 sqlite3VdbeBooleanValue(&aMem[pOp->p1], pOp->p3) ^ pOp->p4.i);-
2260 break;
executed 24 times by 1 test: break;
Executed by:
  • Self test (438)
24
2261}-
2262-
2263/* Opcode: Not P1 P2 * * *-
2264** Synopsis: r[P2]= !r[P1]-
2265**-
2266** Interpret the value in register P1 as a boolean value. Store the-
2267** boolean complement in register P2. If the value in register P1 is -
2268** NULL, then a NULL is stored in P2.-
2269*/-
2270case
executed 290 times by 1 test: case 19:
Executed by:
  • Self test (438)
OP_Not: { /* same as TK_NOT, in1, out2 */
executed 290 times by 1 test: case 19:
Executed by:
  • Self test (438)
290
2271 pIn1 = &aMem[pOp->p1];-
2272 pOut = &aMem[pOp->p2];-
2273 if( (pIn1->flags & MEM_Null)==0 ){
(pIn1->flags & 0x0001)==0Description
TRUEevaluated 223 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 67 times by 1 test
Evaluated by:
  • Self test (438)
67-223
2274 sqlite3VdbeMemSetInt64(pOut, !sqlite3VdbeBooleanValue(pIn1,0));-
2275 }else{
executed 223 times by 1 test: end of block
Executed by:
  • Self test (438)
223
2276 sqlite3VdbeMemSetNull(pOut);-
2277 }
executed 67 times by 1 test: end of block
Executed by:
  • Self test (438)
67
2278 break;
executed 290 times by 1 test: break;
Executed by:
  • Self test (438)
290
2279}-
2280-
2281/* Opcode: BitNot P1 P2 * * *-
2282** Synopsis: r[P2]= ~r[P1]-
2283**-
2284** Interpret the content of register P1 as an integer. Store the-
2285** ones-complement of the P1 value into register P2. If P1 holds-
2286** a NULL then store a NULL in P2.-
2287*/-
2288case
executed 2496 times by 1 test: case 103:
Executed by:
  • Self test (438)
OP_BitNot: { /* same as TK_BITNOT, in1, out2 */
executed 2496 times by 1 test: case 103:
Executed by:
  • Self test (438)
2496
2289 pIn1 = &aMem[pOp->p1];-
2290 pOut = &aMem[pOp->p2];-
2291 sqlite3VdbeMemSetNull(pOut);-
2292 if( (pIn1->flags & MEM_Null)==0 ){
(pIn1->flags & 0x0001)==0Description
TRUEevaluated 2495 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-2495
2293 pOut->flags = MEM_Int;-
2294 pOut->u.i = ~sqlite3VdbeIntValue(pIn1);-
2295 }
executed 2495 times by 1 test: end of block
Executed by:
  • Self test (438)
2495
2296 break;
executed 2496 times by 1 test: break;
Executed by:
  • Self test (438)
2496
2297}-
2298-
2299/* Opcode: Once P1 P2 * * *-
2300**-
2301** Fall through to the next instruction the first time this opcode is-
2302** encountered on each invocation of the byte-code program. Jump to P2-
2303** on the second and all subsequent encounters during the same invocation.-
2304**-
2305** Top-level programs determine first invocation by comparing the P1-
2306** operand against the P1 operand on the OP_Init opcode at the beginning-
2307** of the program. If the P1 values differ, then fall through and make-
2308** the P1 of this opcode equal to the P1 of OP_Init. If P1 values are-
2309** the same then take the jump.-
2310**-
2311** For subprograms, there is a bitmask in the VdbeFrame that determines-
2312** whether or not the jump should be taken. The bitmask is necessary-
2313** because the self-altering code trick does not work for recursive-
2314** triggers.-
2315*/-
2316case
executed 953466 times by 351 tests: case 17:
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)
  • ...
OP_Once: { /* jump */
executed 953466 times by 351 tests: case 17:
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)
  • ...
953466
2317 u32 iAddr; /* Address of this instruction */-
2318 assert( p->aOp[0].opcode==OP_Init );-
2319 if( p->pFrame ){
p->pFrameDescription
TRUEevaluated 251095 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 702371 times by 351 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)
  • ...
251095-702371
2320 iAddr = (int)(pOp - p->aOp);-
2321 if( (p->pFrame->aOnce[iAddr/8] & (1<<(iAddr & 7)))!=0 ){
(p->pFrame->aO...Addr & 7)))!=0Description
TRUEevaluated 124776 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 126319 times by 1 test
Evaluated by:
  • Self test (438)
124776-126319
2322 VdbeBranchTaken(1, 2);-
2323 goto jump_to_p2;
executed 124776 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
124776
2324 }-
2325 p->pFrame->aOnce[iAddr/8] |= 1<<(iAddr & 7);-
2326 }else{
executed 126319 times by 1 test: end of block
Executed by:
  • Self test (438)
126319
2327 if( p->aOp[0].p1==pOp->p1 ){
p->aOp[0].p1==pOp->p1Description
TRUEevaluated 676453 times by 332 tests
Evaluated by:
  • Self test (10)
  • Self test (12)
  • 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)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • Self test (139)
  • Self test (14)
  • Self test (140)
  • Self test (141)
  • Self test (142)
  • Self test (143)
  • ...
FALSEevaluated 25918 times by 351 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)
  • ...
25918-676453
2328 VdbeBranchTaken(1, 2);-
2329 goto jump_to_p2;
executed 676453 times by 332 tests: goto jump_to_p2;
Executed by:
  • Self test (10)
  • Self test (12)
  • 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)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • Self test (139)
  • Self test (14)
  • Self test (140)
  • Self test (141)
  • Self test (142)
  • Self test (143)
  • ...
676453
2330 }-
2331 }
executed 25918 times by 351 tests: end of block
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)
  • ...
25918
2332 VdbeBranchTaken(0, 2);-
2333 pOp->p1 = p->aOp[0].p1;-
2334 break;
executed 152237 times by 351 tests: break;
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)
  • ...
152237
2335}-
2336-
2337/* Opcode: If P1 P2 P3 * *-
2338**-
2339** Jump to P2 if the value in register P1 is true. The value-
2340** is considered true if it is numeric and non-zero. If the value-
2341** in P1 is NULL then take the jump if and only if P3 is non-zero.-
2342*/-
2343case
executed 585863 times by 29 tests: case 18:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • ...
OP_If: { /* jump, in1 */
executed 585863 times by 29 tests: case 18:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • ...
585863
2344 int c;-
2345 c = sqlite3VdbeBooleanValue(&aMem[pOp->p1], pOp->p3);-
2346 VdbeBranchTaken(c!=0, 2);-
2347 if( c ) goto jump_to_p2;
executed 542592 times by 26 tests: goto jump_to_p2;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • ...
cDescription
TRUEevaluated 542592 times by 26 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • ...
FALSEevaluated 43271 times by 21 tests
Evaluated by:
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • Self test (99)
43271-542592
2348 break;
executed 43271 times by 21 tests: break;
Executed by:
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • Self test (99)
43271
2349}-
2350-
2351/* Opcode: IfNot P1 P2 P3 * *-
2352**-
2353** Jump to P2 if the value in register P1 is False. The value-
2354** is considered false if it has a numeric value of zero. If the value-
2355** in P1 is NULL then take the jump if and only if P3 is non-zero.-
2356*/-
2357case
executed 191976 times by 6 tests: case 20:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (47)
OP_IfNot: { /* jump, in1 */
executed 191976 times by 6 tests: case 20:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (47)
191976
2358 int c;-
2359 c = !sqlite3VdbeBooleanValue(&aMem[pOp->p1], !pOp->p3);-
2360 VdbeBranchTaken(c!=0, 2);-
2361 if( c ) goto jump_to_p2;
executed 77145 times by 6 tests: goto jump_to_p2;
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (47)
cDescription
TRUEevaluated 77145 times by 6 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (47)
FALSEevaluated 114831 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
77145-114831
2362 break;
executed 114831 times by 3 tests: break;
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
114831
2363}-
2364-
2365/* Opcode: IsNull P1 P2 * * *-
2366** Synopsis: if r[P1]==NULL goto P2-
2367**-
2368** Jump to P2 if the value in register P1 is NULL.-
2369*/-
2370case
executed 831965 times by 385 tests: case 50:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
OP_IsNull: { /* same as TK_ISNULL, jump, in1 */
executed 831965 times by 385 tests: case 50:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
831965
2371 pIn1 = &aMem[pOp->p1];-
2372 VdbeBranchTaken( (pIn1->flags & MEM_Null)!=0, 2);-
2373 if( (pIn1->flags & MEM_Null)!=0 ){
(pIn1->flags & 0x0001)!=0Description
TRUEevaluated 15017 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 816948 times by 381 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
15017-816948
2374 goto jump_to_p2;
executed 15017 times by 12 tests: goto jump_to_p2;
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)
15017
2375 }-
2376 break;
executed 816948 times by 381 tests: break;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
816948
2377}-
2378-
2379/* Opcode: NotNull P1 P2 * * *-
2380** Synopsis: if r[P1]!=NULL goto P2-
2381**-
2382** Jump to P2 if the value in register P1 is not NULL. -
2383*/-
2384case
executed 305729 times by 2 tests: case 51:
Executed by:
  • Self test (34)
  • Self test (438)
OP_NotNull: { /* same as TK_NOTNULL, jump, in1 */
executed 305729 times by 2 tests: case 51:
Executed by:
  • Self test (34)
  • Self test (438)
305729
2385 pIn1 = &aMem[pOp->p1];-
2386 VdbeBranchTaken( (pIn1->flags & MEM_Null)==0, 2);-
2387 if( (pIn1->flags & MEM_Null)==0 ){
(pIn1->flags & 0x0001)==0Description
TRUEevaluated 294972 times by 2 tests
Evaluated by:
  • Self test (34)
  • Self test (438)
FALSEevaluated 10757 times by 1 test
Evaluated by:
  • Self test (438)
10757-294972
2388 goto jump_to_p2;
executed 294972 times by 2 tests: goto jump_to_p2;
Executed by:
  • Self test (34)
  • Self test (438)
294972
2389 }-
2390 break;
executed 10757 times by 1 test: break;
Executed by:
  • Self test (438)
10757
2391}-
2392-
2393/* Opcode: IfNullRow P1 P2 P3 * *-
2394** Synopsis: if P1.nullRow then r[P3]=NULL, goto P2-
2395**-
2396** Check the cursor P1 to see if it is currently pointing at a NULL row.-
2397** If it is, then set register P3 to NULL and jump immediately to P2.-
2398** If P1 is not on a NULL row, then fall through without making any-
2399** changes.-
2400*/-
2401case
executed 9 times by 1 test: case 21:
Executed by:
  • Self test (438)
OP_IfNullRow: { /* jump */
executed 9 times by 1 test: case 21:
Executed by:
  • Self test (438)
9
2402 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
2403 assert( p->apCsr[pOp->p1]!=0 );-
2404 if( p->apCsr[pOp->p1]->nullRow ){
p->apCsr[pOp->p1]->nullRowDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
3-6
2405 sqlite3VdbeMemSetNull(aMem + pOp->p3);-
2406 goto jump_to_p2;
executed 3 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
3
2407 }-
2408 break;
executed 6 times by 1 test: break;
Executed by:
  • Self test (438)
6
2409}-
2410-
2411#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC-
2412/* Opcode: Offset P1 P2 P3 * *-
2413** Synopsis: r[P3] = sqlite_offset(P1)-
2414**-
2415** Store in register r[P3] the byte offset into the database file that is the-
2416** start of the payload for the record at which that cursor P1 is currently-
2417** pointing.-
2418**-
2419** P2 is the column number for the argument to the sqlite_offset() function.-
2420** This opcode does not use P2 itself, but the P2 value is used by the-
2421** code generator. The P1, P2, and P3 operands to this opcode are the-
2422** same as for OP_Column.-
2423**-
2424** This opcode is only available if SQLite is compiled with the-
2425** -DSQLITE_ENABLE_OFFSET_SQL_FUNC option.-
2426*/-
2427case OP_Offset: { /* out3 */-
2428 VdbeCursor *pC; /* The VDBE cursor */-
2429 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
2430 pC = p->apCsr[pOp->p1];-
2431 pOut = &p->aMem[pOp->p3];-
2432 if( NEVER(pC==0) || pC->eCurType!=CURTYPE_BTREE ){-
2433 sqlite3VdbeMemSetNull(pOut);-
2434 }else{-
2435 sqlite3VdbeMemSetInt64(pOut, sqlite3BtreeOffset(pC->uc.pCursor));-
2436 }-
2437 break;-
2438}-
2439#endif /* SQLITE_ENABLE_OFFSET_SQL_FUNC */-
2440-
2441/* Opcode: Column P1 P2 P3 P4 P5-
2442** Synopsis: r[P3]=PX-
2443**-
2444** Interpret the data that cursor P1 points to as a structure built using-
2445** the MakeRecord instruction. (See the MakeRecord opcode for additional-
2446** information about the format of the data.) Extract the P2-th column-
2447** from this record. If there are less that (P2+1) -
2448** values in the record, extract a NULL.-
2449**-
2450** The value extracted is stored in register P3.-
2451**-
2452** If the record contains fewer than P2 fields, then extract a NULL. Or,-
2453** if the P4 argument is a P4_MEM use the value of the P4 argument as-
2454** the result.-
2455**-
2456** If the OPFLAG_CLEARCACHE bit is set on P5 and P1 is a pseudo-table cursor,-
2457** then the cache of the cursor is reset prior to extracting the column.-
2458** The first OP_Column against a pseudo-table after the value of the content-
2459** register has changed should have this bit set.-
2460**-
2461** If the OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG bits are set on P5 then-
2462** the result is guaranteed to only be used as the argument of a length()-
2463** or typeof() function, respectively. The loading of large blobs can be-
2464** skipped for length() and all content loading can be skipped for typeof().-
2465*/-
2466case
executed 34114538 times by 434 tests: case 90:
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)
  • ...
OP_Column: {
executed 34114538 times by 434 tests: case 90:
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)
  • ...
34114538
2467 int p2; /* column number to retrieve */-
2468 VdbeCursor *pC; /* The VDBE cursor */-
2469 BtCursor *pCrsr; /* The BTree cursor */-
2470 u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */-
2471 int len; /* The length of the serialized data for the column */-
2472 int i; /* Loop counter */-
2473 Mem *pDest; /* Where to write the extracted value */-
2474 Mem sMem; /* For storing the record being decoded */-
2475 const u8 *zData; /* Part of the record being decoded */-
2476 const u8 *zHdr; /* Next unparsed byte of the header */-
2477 const u8 *zEndHdr; /* Pointer to first byte after the header */-
2478 u64 offset64; /* 64-bit offset */-
2479 u32 t; /* A type code from the record header */-
2480 Mem *pReg; /* PseudoTable input register */-
2481-
2482 pC = p->apCsr[pOp->p1];-
2483 p2 = pOp->p2;-
2484-
2485 /* If the cursor cache is stale (meaning it is not currently point at-
2486 ** the correct row) then bring it up-to-date by doing the necessary -
2487 ** B-Tree seek. */-
2488 rc = sqlite3VdbeCursorMoveto(&pC, &p2);-
2489 if( rc ) goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 34114537 times by 434 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-34114537
2490-
2491 assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );-
2492 pDest = &aMem[pOp->p3];-
2493 memAboutToChange(p, pDest);-
2494 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
2495 assert( pC!=0 );-
2496 assert( p2<pC->nField );-
2497 aOffset = pC->aOffset;-
2498 assert( pC->eCurType!=CURTYPE_VTAB );-
2499 assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow );-
2500 assert( pC->eCurType!=CURTYPE_SORTER );-
2501-
2502 if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/
pC->cacheStatus!=p->cacheCtrDescription
TRUEevaluated 21180429 times by 434 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 12934108 times by 434 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)
  • ...
12934108-21180429
2503 if( pC->nullRow ){
pC->nullRowDescription
TRUEevaluated 2625320 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 18555109 times by 434 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)
  • ...
2625320-18555109
2504 if( pC->eCurType==CURTYPE_PSEUDO ){
pC->eCurType==3Description
TRUEevaluated 2623746 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1574 times by 1 test
Evaluated by:
  • Self test (438)
1574-2623746
2505 /* For the special case of as pseudo-cursor, the seekResult field-
2506 ** identifies the register that holds the record */-
2507 assert( pC->seekResult>0 );-
2508 pReg = &aMem[pC->seekResult];-
2509 assert( pReg->flags & MEM_Blob );-
2510 assert( memIsValid(pReg) );-
2511 pC->payloadSize = pC->szRow = pReg->n;-
2512 pC->aRow = (u8*)pReg->z;-
2513 }else{
executed 2623746 times by 1 test: end of block
Executed by:
  • Self test (438)
2623746
2514 sqlite3VdbeMemSetNull(pDest);-
2515 goto op_column_out;
executed 1574 times by 1 test: goto op_column_out;
Executed by:
  • Self test (438)
1574
2516 }-
2517 }else{-
2518 pCrsr = pC->uc.pCursor;-
2519 assert( pC->eCurType==CURTYPE_BTREE );-
2520 assert( pCrsr );-
2521 assert( sqlite3BtreeCursorIsValid(pCrsr) );-
2522 pC->payloadSize = sqlite3BtreePayloadSize(pCrsr);-
2523 pC->aRow = sqlite3BtreePayloadFetch(pCrsr, &pC->szRow);-
2524 assert( pC->szRow<=pC->payloadSize );-
2525 assert( pC->szRow<=65536 ); /* Maximum page size is 64KiB */-
2526 if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){
pC->payloadSiz...)db->aLimit[0]Description
TRUEnever evaluated
FALSEevaluated 18555109 times by 434 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-18555109
2527 goto too_big;
never executed: goto too_big;
0
2528 }-
2529 }
executed 18555109 times by 434 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)
  • ...
18555109
2530 pC->cacheStatus = p->cacheCtr;-
2531 pC->iHdrOffset = getVarint32(pC->aRow, aOffset[0]);
(*(pC->aRow)<(u8)0x80)Description
TRUEevaluated 21177968 times by 434 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 887 times by 1 test
Evaluated by:
  • Self test (438)
887-21177968
2532 pC->nHdrParsed = 0;-
2533-
2534-
2535 if( pC->szRow<aOffset[0] ){ /*OPTIMIZATION-IF-FALSE*/
pC->szRow<aOffset[0]Description
TRUEevaluated 995 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 21177860 times by 434 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)
  • ...
995-21177860
2536 /* pC->aRow does not have to hold the entire row, but it does at least-
2537 ** need to cover the header of the record. If pC->aRow does not contain-
2538 ** the complete header, then set it to zero, forcing the header to be-
2539 ** dynamically allocated. */-
2540 pC->aRow = 0;-
2541 pC->szRow = 0;-
2542-
2543 /* Make sure a corrupt database has not given us an oversize header.-
2544 ** Do this now to avoid an oversize memory allocation.-
2545 **-
2546 ** Type entries can be between 1 and 5 bytes each. But 4 and 5 byte-
2547 ** types use so much data space that there can only be 4096 and 32 of-
2548 ** them, respectively. So the maximum header length results from a-
2549 ** 3-byte type for each of the maximum of 32768 columns plus three-
2550 ** extra bytes for the header length itself. 32768*3 + 3 = 98307.-
2551 */-
2552 if( aOffset[0] > 98307 || aOffset[0] > pC->payloadSize ){
aOffset[0] > 98307Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 994 times by 1 test
Evaluated by:
  • Self test (438)
aOffset[0] > pC->payloadSizeDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 990 times by 1 test
Evaluated by:
  • Self test (438)
1-994
2553 goto op_column_corrupt;
executed 5 times by 1 test: goto op_column_corrupt;
Executed by:
  • Self test (438)
5
2554 }-
2555 }else{
executed 990 times by 1 test: end of block
Executed by:
  • Self test (438)
990
2556 /* This is an optimization. By skipping over the first few tests-
2557 ** (ex: pC->nHdrParsed<=p2) in the next section, we achieve a-
2558 ** measurable performance gain.-
2559 **-
2560 ** This branch is taken even if aOffset[0]==0. Such a record is never-
2561 ** generated by SQLite, and could be considered corruption, but we-
2562 ** accept it for historical reasons. When aOffset[0]==0, the code this-
2563 ** branch jumps to reads past the end of the record, but never more-
2564 ** than a few bytes. Even if the record occurs at the end of the page-
2565 ** content area, the "page header" comes after the page content and so-
2566 ** this overread is harmless. Similar overreads can occur for a corrupt-
2567 ** database file.-
2568 */-
2569 zData = pC->aRow;-
2570 assert( pC->nHdrParsed<=p2 ); /* Conditional skipped */-
2571 testcase( aOffset[0]==0 );-
2572 goto op_column_read_header;
executed 21177860 times by 434 tests: goto op_column_read_header;
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)
  • ...
21177860
2573 }-
2574 }-
2575-
2576 /* Make sure at least the first p2+1 entries of the header have been-
2577 ** parsed and valid information is in aOffset[] and pC->aType[].-
2578 */-
2579 if( pC->nHdrParsed<=p2 ){
pC->nHdrParsed<=p2Description
TRUEevaluated 4404221 times by 434 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 8530877 times by 47 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (2)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • 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)
  • Self test (53)
  • ...
4404221-8530877
2580 /* If there is more header available for parsing in the record, try-
2581 ** to extract additional fields up through the p2+1-th field -
2582 */-
2583 if( pC->iHdrOffset<aOffset[0] ){
pC->iHdrOffset<aOffset[0]Description
TRUEevaluated 4404083 times by 434 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 138 times by 1 test
Evaluated by:
  • Self test (438)
138-4404083
2584 /* Make sure zData points to enough of the record to cover the header. */-
2585 if( pC->aRow==0 ){
pC->aRow==0Description
TRUEevaluated 101889 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4302194 times by 434 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)
  • ...
101889-4302194
2586 memset(&sMem, 0, sizeof(sMem));-
2587 rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, 0, aOffset[0], &sMem);-
2588 if( rc!=SQLITE_OK ) goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rc!=0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 101888 times by 1 test
Evaluated by:
  • Self test (438)
1-101888
2589 zData = (u8*)sMem.z;-
2590 }else{
executed 101888 times by 1 test: end of block
Executed by:
  • Self test (438)
101888
2591 zData = pC->aRow;-
2592 }
executed 4302194 times by 434 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)
  • ...
4302194
2593 -
2594 /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */-
2595 op_column_read_header:
code before this statement executed 4404082 times by 434 tests: op_column_read_header:
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)
  • ...
4404082
2596 i = pC->nHdrParsed;-
2597 offset64 = aOffset[i];-
2598 zHdr = zData + pC->iHdrOffset;-
2599 zEndHdr = zData + aOffset[0];-
2600 testcase( zHdr>=zEndHdr );-
2601 do{-
2602 if( (t = zHdr[0])<0x80 ){
(t = zHdr[0])<0x80Description
TRUEevaluated 36900007 times by 434 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 4743820 times by 358 tests
Evaluated by:
  • Self test (10)
  • Self test (101)
  • 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)
  • ...
4743820-36900007
2603 zHdr++;-
2604 offset64 += sqlite3VdbeOneByteSerialTypeLen(t);-
2605 }else{
executed 36900007 times by 434 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)
  • ...
36900007
2606 zHdr += sqlite3GetVarint32(zHdr, &t);-
2607 offset64 += sqlite3VdbeSerialTypeLen(t);-
2608 }
executed 4743820 times by 358 tests: end of block
Executed by:
  • Self test (10)
  • Self test (101)
  • 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)
  • ...
4743820
2609 pC->aType[i++] = t;-
2610 aOffset[i] = (u32)(offset64 & 0xffffffff);-
2611 }while( i<=p2 && zHdr<zEndHdr );
executed 41643827 times by 434 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)
  • ...
i<=p2Description
TRUEevaluated 16062301 times by 434 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 25581526 times by 434 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)
  • ...
zHdr<zEndHdrDescription
TRUEevaluated 16061885 times by 434 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 416 times by 1 test
Evaluated by:
  • Self test (438)
416-41643827
2612-
2613 /* The record is corrupt if any of the following are true:-
2614 ** (1) the bytes of the header extend past the declared header size-
2615 ** (2) the entire header was used but not all data was used-
2616 ** (3) the end of the data extends beyond the end of the record.-
2617 */-
2618 if( (zHdr>=zEndHdr && (zHdr>zEndHdr || offset64!=pC->payloadSize))
zHdr>=zEndHdrDescription
TRUEevaluated 14499977 times by 434 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 11081965 times by 434 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)
  • ...
zHdr>zEndHdrDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 14499967 times by 434 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)
  • ...
offset64!=pC->payloadSizeDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 14499958 times by 434 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)
  • ...
9-14499977
2619 || (offset64 > pC->payloadSize)
(offset64 > pC->payloadSize)Description
TRUEnever evaluated
FALSEevaluated 25581923 times by 434 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-25581923
2620 ){-
2621 if( aOffset[0]==0 ){
aOffset[0]==0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 17 times by 1 test
Evaluated by:
  • Self test (438)
2-17
2622 i = 0;-
2623 zHdr = zEndHdr;-
2624 }else{
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
2625 if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem);
never executed: sqlite3VdbeMemRelease(&sMem);
pC->aRow==0Description
TRUEnever evaluated
FALSEevaluated 17 times by 1 test
Evaluated by:
  • Self test (438)
0-17
2626 goto op_column_corrupt;
executed 17 times by 1 test: goto op_column_corrupt;
Executed by:
  • Self test (438)
17
2627 }-
2628 }-
2629-
2630 pC->nHdrParsed = i;-
2631 pC->iHdrOffset = (u32)(zHdr - zData);-
2632 if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem);
executed 101888 times by 1 test: sqlite3VdbeMemRelease(&sMem);
Executed by:
  • Self test (438)
pC->aRow==0Description
TRUEevaluated 101888 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 25480037 times by 434 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)
  • ...
101888-25480037
2633 }else{
executed 25581925 times by 434 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)
  • ...
25581925
2634 t = 0;-
2635 }
executed 138 times by 1 test: end of block
Executed by:
  • Self test (438)
138
2636-
2637 /* If after trying to extract new entries from the header, nHdrParsed is-
2638 ** still not up to p2, that means that the record has fewer than p2-
2639 ** columns. So the result will be either the default value or a NULL.-
2640 */-
2641 if( pC->nHdrParsed<=p2 ){
pC->nHdrParsed<=p2Description
TRUEevaluated 554 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 25581509 times by 434 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)
  • ...
554-25581509
2642 if( pOp->p4type==P4_MEM ){
pOp->p4type==(-11)Description
TRUEevaluated 129 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 425 times by 1 test
Evaluated by:
  • Self test (438)
129-425
2643 sqlite3VdbeMemShallowCopy(pDest, pOp->p4.pMem, MEM_Static);-
2644 }else{
executed 129 times by 1 test: end of block
Executed by:
  • Self test (438)
129
2645 sqlite3VdbeMemSetNull(pDest);-
2646 }
executed 425 times by 1 test: end of block
Executed by:
  • Self test (438)
425
2647 goto op_column_out;
executed 554 times by 1 test: goto op_column_out;
Executed by:
  • Self test (438)
554
2648 }-
2649 }else{
executed 25581509 times by 434 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)
  • ...
25581509
2650 t = pC->aType[p2];-
2651 }
executed 8530877 times by 47 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (2)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • 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)
  • Self test (53)
  • ...
8530877
2652-
2653 /* Extract the content for the p2+1-th column. Control can only-
2654 ** reach this point if aOffset[p2], aOffset[p2+1], and pC->aType[p2] are-
2655 ** all valid.-
2656 */-
2657 assert( p2<pC->nHdrParsed );-
2658 assert( rc==SQLITE_OK );-
2659 assert( sqlite3VdbeCheckMemInvariants(pDest) );-
2660 if( VdbeMemDynamic(pDest) ){
(((pDest)->fla...0|0x0400))!=0)Description
TRUEevaluated 2428 times by 3 tests
Evaluated by:
  • Self test (34)
  • Self test (438)
  • Self test (64)
FALSEevaluated 34109958 times by 434 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)
  • ...
2428-34109958
2661 sqlite3VdbeMemSetNull(pDest);-
2662 }
executed 2428 times by 3 tests: end of block
Executed by:
  • Self test (34)
  • Self test (438)
  • Self test (64)
2428
2663 assert( t==pC->aType[p2] );-
2664 if( pC->szRow>=aOffset[p2+1] ){
pC->szRow>=aOffset[p2+1]Description
TRUEevaluated 33641753 times by 434 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 470633 times by 7 tests
Evaluated by:
  • Self test (101)
  • Self test (2)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (65)
470633-33641753
2665 /* This is the common case where the desired content fits on the original-
2666 ** page - where the content is not on an overflow page */-
2667 zData = pC->aRow + aOffset[p2];-
2668 if( t<12 ){
t<12Description
TRUEevaluated 19201818 times by 434 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 14439935 times by 434 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)
  • ...
14439935-19201818
2669 sqlite3VdbeSerialGet(zData, t, pDest);-
2670 }else{
executed 19201818 times by 434 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)
  • ...
19201818
2671 /* If the column value is a string, we need a persistent value, not-
2672 ** a MEM_Ephem value. This branch is a fast short-cut that is equivalent-
2673 ** to calling sqlite3VdbeSerialGet() and sqlite3VdbeDeephemeralize().-
2674 */-
2675 static const u16 aFlag[] = { MEM_Blob, MEM_Str|MEM_Term };-
2676 pDest->n = len = (t-12)/2;-
2677 pDest->enc = encoding;-
2678 if( pDest->szMalloc < len+2 ){
pDest->szMalloc < len+2Description
TRUEevaluated 194265 times by 434 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 14245670 times by 406 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)
  • ...
194265-14245670
2679 pDest->flags = MEM_Null;-
2680 if( sqlite3VdbeMemGrow(pDest, len+2, 0) ) goto no_mem;
executed 24 times by 1 test: goto no_mem;
Executed by:
  • Self test (438)
sqlite3VdbeMem...est, len+2, 0)Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 194241 times by 434 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)
  • ...
24-194241
2681 }else{
executed 194241 times by 434 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)
  • ...
194241
2682 pDest->z = pDest->zMalloc;-
2683 }
executed 14245670 times by 406 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 (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)
  • ...
14245670
2684 memcpy(pDest->z, zData, len);-
2685 pDest->z[len] = 0;-
2686 pDest->z[len+1] = 0;-
2687 pDest->flags = aFlag[t&1];-
2688 }
executed 14439911 times by 434 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)
  • ...
14439911
2689 }else{-
2690 pDest->enc = encoding;-
2691 /* This branch happens only when content is on overflow pages */-
2692 if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0
(pOp->p5 & (0x40|0x80))!=0Description
TRUEevaluated 195192 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (65)
FALSEevaluated 275441 times by 7 tests
Evaluated by:
  • Self test (101)
  • Self test (2)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (65)
195192-275441
2693 && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0))
t>=12Description
TRUEevaluated 195186 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (65)
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
(t&1)==0Description
TRUEevaluated 52420 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (65)
FALSEevaluated 142766 times by 1 test
Evaluated by:
  • Self test (438)
(pOp->p5 & 0x80)!=0Description
TRUEevaluated 140745 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2027 times by 1 test
Evaluated by:
  • Self test (438)
6-195186
2694 || (len = sqlite3VdbeSerialTypeLen(t))==0
(len = sqlite3...TypeLen(t))==0Description
TRUEevaluated 110 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 277358 times by 7 tests
Evaluated by:
  • Self test (101)
  • Self test (2)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (65)
110-277358
2695 ){-
2696 /* Content is irrelevant for-
2697 ** 1. the typeof() function,-
2698 ** 2. the length(X) function if X is a blob, and-
2699 ** 3. if the content length is zero.-
2700 ** So we might as well use bogus content rather than reading-
2701 ** content from disk. -
2702 **-
2703 ** Although sqlite3VdbeSerialGet() may read at most 8 bytes from the-
2704 ** buffer passed to it, debugging function VdbeMemPrettyPrint() may-
2705 ** read up to 16. So 16 bytes of bogus content is supplied.-
2706 */-
2707 static u8 aZero[16]; /* This is the bogus content */-
2708 sqlite3VdbeSerialGet(aZero, t, pDest);-
2709 }else{
executed 193275 times by 2 tests: end of block
Executed by:
  • Self test (438)
  • Self test (65)
193275
2710 rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, aOffset[p2], len, pDest);-
2711 if( rc!=SQLITE_OK ) goto abort_due_to_error;
executed 4 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rc!=0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 277354 times by 7 tests
Evaluated by:
  • Self test (101)
  • Self test (2)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (65)
4-277354
2712 sqlite3VdbeSerialGet((const u8*)pDest->z, t, pDest);-
2713 pDest->flags &= ~MEM_Ephem;-
2714 }
executed 277354 times by 7 tests: end of block
Executed by:
  • Self test (101)
  • Self test (2)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (65)
277354
2715 }-
2716-
2717op_column_out:
code before this statement executed 34112358 times by 434 tests: op_column_out:
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)
  • ...
34112358
2718 UPDATE_MAX_BLOBSIZE(pDest);-
2719 REGISTER_TRACE(pOp->p3, pDest);-
2720 break;
executed 34114486 times by 434 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)
  • ...
34114486
2721-
2722op_column_corrupt:-
2723 if( aOp[0].p3>0 ){
aOp[0].p3>0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
6-16
2724 pOp = &aOp[aOp[0].p3-1];-
2725 break;
executed 6 times by 1 test: break;
Executed by:
  • Self test (438)
6
2726 }else{-
2727 rc = SQLITE_CORRUPT_BKPT;-
2728 goto abort_due_to_error;
executed 16 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
16
2729 }-
2730}-
2731-
2732/* Opcode: Affinity P1 P2 * P4 *-
2733** Synopsis: affinity(r[P1@P2])-
2734**-
2735** Apply affinities to a range of P2 registers starting with P1.-
2736**-
2737** P4 is a string that is P2 characters long. The N-th character of the-
2738** string indicates the column affinity that should be used for the N-th-
2739** memory cell in the range.-
2740*/-
2741case
executed 437095 times by 333 tests: case 91:
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
OP_Affinity: {
executed 437095 times by 333 tests: case 91:
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
437095
2742 const char *zAffinity; /* The affinity to be applied */-
2743-
2744 zAffinity = pOp->p4.z;-
2745 assert( zAffinity!=0 );-
2746 assert( pOp->p2>0 );-
2747 assert( zAffinity[pOp->p2]==0 );-
2748 pIn1 = &aMem[pOp->p1];-
2749 do{-
2750 assert( pIn1 <= &p->aMem[(p->nMem+1 - p->nCursor)] );-
2751 assert( memIsValid(pIn1) );-
2752 applyAffinity(pIn1, *(zAffinity++), encoding);-
2753 pIn1++;-
2754 }while( zAffinity[0] );
executed 471535 times by 333 tests: end of block
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
zAffinity[0]Description
TRUEevaluated 34440 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 437095 times by 333 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)
  • ...
34440-471535
2755 break;
executed 437095 times by 333 tests: break;
Executed by:
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • Self test (127)
  • Self test (128)
  • Self test (129)
  • Self test (130)
  • ...
437095
2756}-
2757-
2758/* Opcode: MakeRecord P1 P2 P3 P4 *-
2759** Synopsis: r[P3]=mkrec(r[P1@P2])-
2760**-
2761** Convert P2 registers beginning with P1 into the [record format]-
2762** use as a data record in a database table or as a key-
2763** in an index. The OP_Column opcode can decode the record later.-
2764**-
2765** P4 may be a string that is P2 characters long. The N-th character of the-
2766** string indicates the column affinity that should be used for the N-th-
2767** field of the index key.-
2768**-
2769** The mapping from character to affinity is given by the SQLITE_AFF_-
2770** macros defined in sqliteInt.h.-
2771**-
2772** If P4 is NULL then all index fields have the affinity BLOB.-
2773*/-
2774case
executed 8740600 times by 403 tests: case 102:
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)
  • ...
OP_MakeRecord: {
executed 8740600 times by 403 tests: case 102:
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)
  • ...
8740600
2775 u8 *zNewRecord; /* A buffer to hold the data for the new record */-
2776 Mem *pRec; /* The new record */-
2777 u64 nData; /* Number of bytes of data space */-
2778 int nHdr; /* Number of bytes of header space */-
2779 i64 nByte; /* Data space required for this record */-
2780 i64 nZero; /* Number of zero bytes at the end of the record */-
2781 int nVarint; /* Number of bytes in a varint */-
2782 u32 serial_type; /* Type field */-
2783 Mem *pData0; /* First field to be combined into the record */-
2784 Mem *pLast; /* Last field of the record */-
2785 int nField; /* Number of fields in the record */-
2786 char *zAffinity; /* The affinity string for the record */-
2787 int file_format; /* File format to use for encoding */-
2788 int i; /* Space used in zNewRecord[] header */-
2789 int j; /* Space used in zNewRecord[] content */-
2790 u32 len; /* Length of a field */-
2791-
2792 /* Assuming the record contains N fields, the record format looks-
2793 ** like this:-
2794 **-
2795 ** -------------------------------------------------------------------------
2796 ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 | -
2797 ** -------------------------------------------------------------------------
2798 **-
2799 ** Data(0) is taken from register P1. Data(1) comes from register P1+1-
2800 ** and so forth.-
2801 **-
2802 ** Each type field is a varint representing the serial type of the -
2803 ** corresponding data element (see sqlite3VdbeSerialType()). The-
2804 ** hdr-size field is also a varint which is the offset from the beginning-
2805 ** of the record to data0.-
2806 */-
2807 nData = 0; /* Number of bytes of data space */-
2808 nHdr = 0; /* Number of bytes of header space */-
2809 nZero = 0; /* Number of zero bytes at the end of the record */-
2810 nField = pOp->p1;-
2811 zAffinity = pOp->p4.z;-
2812 assert( nField>0 && pOp->p2>0 && pOp->p2+nField<=(p->nMem+1 - p->nCursor)+1 );-
2813 pData0 = &aMem[nField];-
2814 nField = pOp->p2;-
2815 pLast = &pData0[nField-1];-
2816 file_format = p->minWriteFileFormat;-
2817-
2818 /* Identify the output register */-
2819 assert( pOp->p3<pOp->p1 || pOp->p3>=pOp->p1+pOp->p2 );-
2820 pOut = &aMem[pOp->p3];-
2821 memAboutToChange(p, pOut);-
2822-
2823 /* Apply the requested affinity to all inputs-
2824 */-
2825 assert( pData0<=pLast );-
2826 if( zAffinity ){
zAffinityDescription
TRUEevaluated 455985 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 8284615 times by 393 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)
  • ...
455985-8284615
2827 pRec = pData0;-
2828 do{-
2829 applyAffinity(pRec++, *(zAffinity++), encoding);-
2830 assert( zAffinity[0]==0 || pRec<=pLast );-
2831 }while( zAffinity[0] );
executed 841932 times by 31 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
zAffinity[0]Description
TRUEevaluated 385947 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 455985 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
385947-841932
2832 }
executed 455985 times by 31 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
455985
2833-
2834#ifdef SQLITE_ENABLE_NULL_TRIM-
2835 /* NULLs can be safely trimmed from the end of the record, as long as-
2836 ** as the schema format is 2 or more and none of the omitted columns-
2837 ** have a non-NULL default value. Also, the record must be left with-
2838 ** at least one field. If P5>0 then it will be one more than the-
2839 ** index of the right-most column with a non-NULL default value */-
2840 if( pOp->p5 ){-
2841 while( (pLast->flags & MEM_Null)!=0 && nField>pOp->p5 ){-
2842 pLast--;-
2843 nField--;-
2844 }-
2845 }-
2846#endif-
2847-
2848 /* Loop through the elements that will make up the record to figure-
2849 ** out how much space is required for the new record.-
2850 */-
2851 pRec = pLast;-
2852 do{-
2853 assert( memIsValid(pRec) );-
2854 serial_type = sqlite3VdbeSerialType(pRec, file_format, &len);-
2855 if( pRec->flags & MEM_Zero ){
pRec->flags & 0x4000Description
TRUEevaluated 6866 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 16877077 times by 403 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)
  • ...
6866-16877077
2856 if( serial_type==0 ){
serial_type==0Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6819 times by 1 test
Evaluated by:
  • Self test (438)
47-6819
2857 /* Values with MEM_Null and MEM_Zero are created by xColumn virtual-
2858 ** table methods that never invoke sqlite3_result_xxxxx() while-
2859 ** computing an unchanging column value in an UPDATE statement.-
2860 ** Give such values a special internal-use-only serial-type of 10-
2861 ** so that they can be passed through to xUpdate and have-
2862 ** a true sqlite3_value_nochange(). */-
2863 assert( pOp->p5==OPFLAG_NOCHNG_MAGIC || CORRUPT_DB );-
2864 serial_type = 10;-
2865 }else if( nData ){
executed 47 times by 1 test: end of block
Executed by:
  • Self test (438)
nDataDescription
TRUEevaluated 9 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6810 times by 1 test
Evaluated by:
  • Self test (438)
9-6810
2866 if( sqlite3VdbeMemExpandBlob(pRec) ) goto no_mem;
never executed: goto no_mem;
sqlite3VdbeMemExpandBlob(pRec)Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • Self test (438)
0-9
2867 }else{
executed 9 times by 1 test: end of block
Executed by:
  • Self test (438)
9
2868 nZero += pRec->u.nZero;-
2869 len -= pRec->u.nZero;-
2870 }
executed 6810 times by 1 test: end of block
Executed by:
  • Self test (438)
6810
2871 }-
2872 nData += len;-
2873 testcase( serial_type==127 );-
2874 testcase( serial_type==128 );-
2875 nHdr += serial_type<=127 ? 1 : sqlite3VarintLen(serial_type);
serial_type<=127Description
TRUEevaluated 13607329 times by 402 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 3276614 times by 369 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • 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)
  • ...
3276614-13607329
2876 pRec->uTemp = serial_type;-
2877 if( pRec==pData0 ) break;
executed 8740600 times by 403 tests: break;
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)
  • ...
pRec==pData0Description
TRUEevaluated 8740600 times by 403 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 8143343 times by 400 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)
  • ...
8143343-8740600
2878 pRec--;-
2879 }while(1);
executed 8143343 times by 400 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 (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)
  • ...
8143343
2880-
2881 /* EVIDENCE-OF: R-22564-11647 The header begins with a single varint-
2882 ** which determines the total number of bytes in the header. The varint-
2883 ** value is the size of the header in bytes including the size varint-
2884 ** itself. */-
2885 testcase( nHdr==126 );-
2886 testcase( nHdr==127 );-
2887 if( nHdr<=126 ){
nHdr<=126Description
TRUEevaluated 8739708 times by 403 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 892 times by 1 test
Evaluated by:
  • Self test (438)
892-8739708
2888 /* The common case */-
2889 nHdr += 1;-
2890 }else{
executed 8739708 times by 403 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 (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)
  • ...
8739708
2891 /* Rare case of a really large header */-
2892 nVarint = sqlite3VarintLen(nHdr);-
2893 nHdr += nVarint;-
2894 if( nVarint<sqlite3VarintLen(nHdr) ) nHdr++;
executed 10 times by 1 test: nHdr++;
Executed by:
  • Self test (438)
nVarint<sqlite3VarintLen(nHdr)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 882 times by 1 test
Evaluated by:
  • Self test (438)
10-882
2895 }
executed 892 times by 1 test: end of block
Executed by:
  • Self test (438)
892
2896 nByte = nHdr+nData;-
2897-
2898 /* Make sure the output register has a buffer large enough to store -
2899 ** the new record. The output register (pOp->p3) is not allowed to-
2900 ** be one of the input registers (because the following call to-
2901 ** sqlite3VdbeMemClearAndResize() could clobber the value before it is used).-
2902 */-
2903 if( nByte+nZero<=pOut->szMalloc ){
nByte+nZero<=pOut->szMallocDescription
TRUEevaluated 7477017 times by 339 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (101)
  • Self test (12)
  • 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)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • Self test (139)
  • Self test (14)
  • Self test (140)
  • Self test (141)
  • ...
FALSEevaluated 1263583 times by 403 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)
  • ...
1263583-7477017
2904 /* The output register is already large enough to hold the record.-
2905 ** No error checks or buffer enlargement is required */-
2906 pOut->z = pOut->zMalloc;-
2907 }else{
executed 7477017 times by 339 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (101)
  • Self test (12)
  • 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)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • Self test (139)
  • Self test (14)
  • Self test (140)
  • Self test (141)
  • ...
7477017
2908 /* Need to make sure that the output is not too big and then enlarge-
2909 ** the output register to hold the full result */-
2910 if( nByte+nZero>db->aLimit[SQLITE_LIMIT_LENGTH] ){
nByte+nZero>db->aLimit[0]Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1263581 times by 403 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)
  • ...
2-1263581
2911 goto too_big;
executed 2 times by 1 test: goto too_big;
Executed by:
  • Self test (438)
2
2912 }-
2913 if( sqlite3VdbeMemClearAndResize(pOut, (int)nByte) ){
sqlite3VdbeMem...t, (int)nByte)Description
TRUEnever evaluated
FALSEevaluated 1263581 times by 403 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)
  • ...
0-1263581
2914 goto no_mem;
never executed: goto no_mem;
0
2915 }-
2916 }
executed 1263581 times by 403 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 (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)
  • ...
1263581
2917 zNewRecord = (u8 *)pOut->z;-
2918-
2919 /* Write the record */-
2920 i = putVarint32(zNewRecord, nHdr);
((u32)(nHdr)<(u32)0x80)Description
TRUEevaluated 8739706 times by 403 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 892 times by 1 test
Evaluated by:
  • Self test (438)
892-8739706
2921 j = nHdr;-
2922 assert( pData0<=pLast );-
2923 pRec = pData0;-
2924 do{-
2925 serial_type = pRec->uTemp;-
2926 /* EVIDENCE-OF: R-06529-47362 Following the size varint are one or more-
2927 ** additional varints, one per column. */-
2928 i += putVarint32(&zNewRecord[i], serial_type); /* serial type */
((u32)(serial_type)<(u32)0x80)Description
TRUEevaluated 13607329 times by 402 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 3276608 times by 369 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • 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)
  • ...
3276608-13607329
2929 /* EVIDENCE-OF: R-64536-51728 The values for each column in the record-
2930 ** immediately follow the header. */-
2931 j += sqlite3VdbeSerialPut(&zNewRecord[j], pRec, serial_type); /* content */-
2932 }while( (++pRec)<=pLast );
executed 16883937 times by 403 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 (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)
  • ...
(++pRec)<=pLastDescription
TRUEevaluated 8143339 times by 400 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 8740598 times by 403 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)
  • ...
8143339-16883937
2933 assert( i==nHdr );-
2934 assert( j==nByte );-
2935-
2936 assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );-
2937 pOut->n = (int)nByte;-
2938 pOut->flags = MEM_Blob;-
2939 if( nZero ){
nZeroDescription
TRUEevaluated 6801 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 8733797 times by 403 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)
  • ...
6801-8733797
2940 pOut->u.nZero = nZero;-
2941 pOut->flags |= MEM_Zero;-
2942 }
executed 6801 times by 1 test: end of block
Executed by:
  • Self test (438)
6801
2943 REGISTER_TRACE(pOp->p3, pOut);-
2944 UPDATE_MAX_BLOBSIZE(pOut);-
2945 break;
executed 8740598 times by 403 tests: break;
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)
  • ...
8740598
2946}-
2947-
2948/* Opcode: Count P1 P2 * * *-
2949** Synopsis: r[P2]=count()-
2950**-
2951** Store the number of entries (an integer value) in the table or index -
2952** opened by cursor P1 in register P2-
2953*/-
2954#ifndef SQLITE_OMIT_BTREECOUNT-
2955case
executed 131025 times by 15 tests: case 104:
Executed by:
  • Self test (103)
  • Self test (104)
  • Self test (34)
  • 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)
OP_Count: { /* out2 */
executed 131025 times by 15 tests: case 104:
Executed by:
  • Self test (103)
  • Self test (104)
  • Self test (34)
  • 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)
131025
2956 i64 nEntry;-
2957 BtCursor *pCrsr;-
2958-
2959 assert( p->apCsr[pOp->p1]->eCurType==CURTYPE_BTREE );-
2960 pCrsr = p->apCsr[pOp->p1]->uc.pCursor;-
2961 assert( pCrsr );-
2962 nEntry = 0; /* Not needed. Only used to silence a warning. */-
2963 rc = sqlite3BtreeCount(pCrsr, &nEntry);-
2964 if( rc ) goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 131024 times by 15 tests
Evaluated by:
  • Self test (103)
  • Self test (104)
  • Self test (34)
  • 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)
1-131024
2965 pOut = out2Prerelease(p, pOp);-
2966 pOut->u.i = nEntry;-
2967 break;
executed 131024 times by 15 tests: break;
Executed by:
  • Self test (103)
  • Self test (104)
  • Self test (34)
  • 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)
131024
2968}-
2969#endif-
2970-
2971/* Opcode: Savepoint P1 * * P4 *-
2972**-
2973** Open, release or rollback the savepoint named by parameter P4, depending-
2974** on the value of P1. To open a new savepoint, P1==0. To release (commit) an-
2975** existing savepoint, P1==1, or to rollback an existing savepoint P1==2.-
2976*/-
2977case
executed 35272 times by 2 tests: case 0:
Executed by:
  • Self test (438)
  • Self test (64)
OP_Savepoint: {
executed 35272 times by 2 tests: case 0:
Executed by:
  • Self test (438)
  • Self test (64)
35272
2978 int p1; /* Value of P1 operand */-
2979 char *zName; /* Name of savepoint */-
2980 int nName;-
2981 Savepoint *pNew;-
2982 Savepoint *pSavepoint;-
2983 Savepoint *pTmp;-
2984 int iSavepoint;-
2985 int ii;-
2986-
2987 p1 = pOp->p1;-
2988 zName = pOp->p4.z;-
2989-
2990 /* Assert that the p1 parameter is valid. Also that if there is no open-
2991 ** transaction, then there cannot be any savepoints. -
2992 */-
2993 assert( db->pSavepoint==0 || db->autoCommit==0 );-
2994 assert( p1==SAVEPOINT_BEGIN||p1==SAVEPOINT_RELEASE||p1==SAVEPOINT_ROLLBACK );-
2995 assert( db->pSavepoint || db->isTransactionSavepoint==0 );-
2996 assert( checkSavepointCount(db) );-
2997 assert( p->bIsReader );-
2998-
2999 if( p1==SAVEPOINT_BEGIN ){
p1==0Description
TRUEevaluated 34108 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (64)
FALSEevaluated 1164 times by 1 test
Evaluated by:
  • Self test (438)
1164-34108
3000 if( db->nVdbeWrite>0 ){
db->nVdbeWrite>0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 34107 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (64)
1-34107
3001 /* A new savepoint cannot be created if there are active write -
3002 ** statements (i.e. open read/write incremental blob handles).-
3003 */-
3004 sqlite3VdbeError(p, "cannot open savepoint - SQL statements in progress");-
3005 rc = SQLITE_BUSY;-
3006 }else{
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
1
3007 nName = sqlite3Strlen30(zName);-
3008-
3009#ifndef SQLITE_OMIT_VIRTUALTABLE-
3010 /* This call is Ok even if this savepoint is actually a transaction-
3011 ** savepoint (and therefore should not prompt xSavepoint()) callbacks.-
3012 ** If this is a transaction savepoint being opened, it is guaranteed-
3013 ** that the db->aVTrans[] array is empty. */-
3014 assert( db->autoCommit==0 || db->nVTrans==0 );-
3015 rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN,-
3016 db->nStatement+db->nSavepoint);-
3017 if( rc!=SQLITE_OK ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rc!=0Description
TRUEnever evaluated
FALSEevaluated 34107 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (64)
0-34107
3018#endif-
3019-
3020 /* Create a new savepoint structure. */-
3021 pNew = sqlite3DbMallocRawNN(db, sizeof(Savepoint)+nName+1);-
3022 if( pNew ){
pNewDescription
TRUEevaluated 34107 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (64)
FALSEnever evaluated
0-34107
3023 pNew->zName = (char *)&pNew[1];-
3024 memcpy(pNew->zName, zName, nName+1);-
3025 -
3026 /* If there is no open transaction, then mark this as a special-
3027 ** "transaction savepoint". */-
3028 if( db->autoCommit ){
db->autoCommitDescription
TRUEevaluated 115 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (64)
FALSEevaluated 33992 times by 1 test
Evaluated by:
  • Self test (438)
115-33992
3029 db->autoCommit = 0;-
3030 db->isTransactionSavepoint = 1;-
3031 }else{
executed 115 times by 2 tests: end of block
Executed by:
  • Self test (438)
  • Self test (64)
115
3032 db->nSavepoint++;-
3033 }
executed 33992 times by 1 test: end of block
Executed by:
  • Self test (438)
33992
3034-
3035 /* Link the new savepoint into the database handle's list. */-
3036 pNew->pNext = db->pSavepoint;-
3037 db->pSavepoint = pNew;-
3038 pNew->nDeferredCons = db->nDeferredCons;-
3039 pNew->nDeferredImmCons = db->nDeferredImmCons;-
3040 }
executed 34107 times by 2 tests: end of block
Executed by:
  • Self test (438)
  • Self test (64)
34107
3041 }
executed 34107 times by 2 tests: end of block
Executed by:
  • Self test (438)
  • Self test (64)
34107
3042 }else{-
3043 iSavepoint = 0;-
3044-
3045 /* Find the named savepoint. If there is no such savepoint, then an-
3046 ** an error is returned to the user. */-
3047 for(-
3048 pSavepoint = db->pSavepoint; -
3049 pSavepoint && sqlite3StrICmp(pSavepoint->zName, zName);
pSavepointDescription
TRUEevaluated 29208 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
sqlite3StrICmp...>zName, zName)Description
TRUEevaluated 28046 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1162 times by 1 test
Evaluated by:
  • Self test (438)
2-29208
3050 pSavepoint = pSavepoint->pNext-
3051 ){-
3052 iSavepoint++;-
3053 }
executed 28046 times by 1 test: end of block
Executed by:
  • Self test (438)
28046
3054 if( !pSavepoint ){
!pSavepointDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1162 times by 1 test
Evaluated by:
  • Self test (438)
2-1162
3055 sqlite3VdbeError(p, "no such savepoint: %s", zName);-
3056 rc = SQLITE_ERROR;-
3057 }else if( db->nVdbeWrite>0 && p1==SAVEPOINT_RELEASE ){
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
db->nVdbeWrite>0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1161 times by 1 test
Evaluated by:
  • Self test (438)
p1==1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-1161
3058 /* It is not possible to release (commit) a savepoint if there are -
3059 ** active write statements.-
3060 */-
3061 sqlite3VdbeError(p, "cannot release savepoint - "-
3062 "SQL statements in progress");-
3063 rc = SQLITE_BUSY;-
3064 }else{
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
1
3065-
3066 /* Determine whether or not this is a transaction savepoint. If so,-
3067 ** and this is a RELEASE command, then the current transaction -
3068 ** is committed. -
3069 */-
3070 int isTransaction = pSavepoint->pNext==0 && db->isTransactionSavepoint;
pSavepoint->pNext==0Description
TRUEevaluated 253 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 908 times by 1 test
Evaluated by:
  • Self test (438)
db->isTransactionSavepointDescription
TRUEevaluated 103 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 150 times by 1 test
Evaluated by:
  • Self test (438)
103-908
3071 if( isTransaction && p1==SAVEPOINT_RELEASE ){
isTransactionDescription
TRUEevaluated 103 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1058 times by 1 test
Evaluated by:
  • Self test (438)
p1==1Description
TRUEevaluated 57 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 46 times by 1 test
Evaluated by:
  • Self test (438)
46-1058
3072 if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){
(rc = sqlite3V...ckFk(p, 1))!=0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 53 times by 1 test
Evaluated by:
  • Self test (438)
4-53
3073 goto vdbe_return;
executed 4 times by 1 test: goto vdbe_return;
Executed by:
  • Self test (438)
4
3074 }-
3075 db->autoCommit = 1;-
3076 if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){
sqlite3VdbeHalt(p)==5Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 48 times by 1 test
Evaluated by:
  • Self test (438)
5-48
3077 p->pc = (int)(pOp - aOp);-
3078 db->autoCommit = 0;-
3079 p->rc = rc = SQLITE_BUSY;-
3080 goto vdbe_return;
executed 5 times by 1 test: goto vdbe_return;
Executed by:
  • Self test (438)
5
3081 }-
3082 db->isTransactionSavepoint = 0;-
3083 rc = p->rc;-
3084 }else{
executed 48 times by 1 test: end of block
Executed by:
  • Self test (438)
48
3085 int isSchemaChange;-
3086 iSavepoint = db->nSavepoint - iSavepoint - 1;-
3087 if( p1==SAVEPOINT_ROLLBACK ){
p1==2Description
TRUEevaluated 1058 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 46 times by 1 test
Evaluated by:
  • Self test (438)
46-1058
3088 isSchemaChange = (db->mDbFlags & DBFLAG_SchemaChange)!=0;-
3089 for(ii=0; ii<db->nDb; ii++){
ii<db->nDbDescription
TRUEevaluated 2122 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1058 times by 1 test
Evaluated by:
  • Self test (438)
1058-2122
3090 rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt,-
3091 SQLITE_ABORT_ROLLBACK,-
3092 isSchemaChange==0);-
3093 if( rc!=SQLITE_OK ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rc!=0Description
TRUEnever evaluated
FALSEevaluated 2122 times by 1 test
Evaluated by:
  • Self test (438)
0-2122
3094 }
executed 2122 times by 1 test: end of block
Executed by:
  • Self test (438)
2122
3095 }else{
executed 1058 times by 1 test: end of block
Executed by:
  • Self test (438)
1058
3096 isSchemaChange = 0;-
3097 }
executed 46 times by 1 test: end of block
Executed by:
  • Self test (438)
46
3098 for(ii=0; ii<db->nDb; ii++){
ii<db->nDbDescription
TRUEevaluated 2214 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1104 times by 1 test
Evaluated by:
  • Self test (438)
1104-2214
3099 rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint);-
3100 if( rc!=SQLITE_OK ){
rc!=0Description
TRUEnever evaluated
FALSEevaluated 2214 times by 1 test
Evaluated by:
  • Self test (438)
0-2214
3101 goto abort_due_to_error;
never executed: goto abort_due_to_error;
0
3102 }-
3103 }
executed 2214 times by 1 test: end of block
Executed by:
  • Self test (438)
2214
3104 if( isSchemaChange ){
isSchemaChangeDescription
TRUEevaluated 25 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1079 times by 1 test
Evaluated by:
  • Self test (438)
25-1079
3105 sqlite3ExpirePreparedStatements(db, 0);-
3106 sqlite3ResetAllSchemasOfConnection(db);-
3107 db->mDbFlags |= DBFLAG_SchemaChange;-
3108 }
executed 25 times by 1 test: end of block
Executed by:
  • Self test (438)
25
3109 }
executed 1104 times by 1 test: end of block
Executed by:
  • Self test (438)
1104
3110 -
3111 /* Regardless of whether this is a RELEASE or ROLLBACK, destroy all -
3112 ** savepoints nested inside of the savepoint being operated on. */-
3113 while( db->pSavepoint!=pSavepoint ){
db->pSavepoint!=pSavepointDescription
TRUEevaluated 28043 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1152 times by 1 test
Evaluated by:
  • Self test (438)
1152-28043
3114 pTmp = db->pSavepoint;-
3115 db->pSavepoint = pTmp->pNext;-
3116 sqlite3DbFree(db, pTmp);-
3117 db->nSavepoint--;-
3118 }
executed 28043 times by 1 test: end of block
Executed by:
  • Self test (438)
28043
3119-
3120 /* If it is a RELEASE, then destroy the savepoint being operated on -
3121 ** too. If it is a ROLLBACK TO, then set the number of deferred -
3122 ** constraint violations present in the database to the value stored-
3123 ** when the savepoint was created. */-
3124 if( p1==SAVEPOINT_RELEASE ){
p1==1Description
TRUEevaluated 94 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1058 times by 1 test
Evaluated by:
  • Self test (438)
94-1058
3125 assert( pSavepoint==db->pSavepoint );-
3126 db->pSavepoint = pSavepoint->pNext;-
3127 sqlite3DbFree(db, pSavepoint);-
3128 if( !isTransaction ){
!isTransactionDescription
TRUEevaluated 46 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 48 times by 1 test
Evaluated by:
  • Self test (438)
46-48
3129 db->nSavepoint--;-
3130 }
executed 46 times by 1 test: end of block
Executed by:
  • Self test (438)
46
3131 }else{
executed 94 times by 1 test: end of block
Executed by:
  • Self test (438)
94
3132 db->nDeferredCons = pSavepoint->nDeferredCons;-
3133 db->nDeferredImmCons = pSavepoint->nDeferredImmCons;-
3134 }
executed 1058 times by 1 test: end of block
Executed by:
  • Self test (438)
1058
3135-
3136 if( !isTransaction || p1==SAVEPOINT_ROLLBACK ){
!isTransactionDescription
TRUEevaluated 1058 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 94 times by 1 test
Evaluated by:
  • Self test (438)
p1==2Description
TRUEevaluated 46 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 48 times by 1 test
Evaluated by:
  • Self test (438)
46-1058
3137 rc = sqlite3VtabSavepoint(db, p1, iSavepoint);-
3138 if( rc!=SQLITE_OK ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rc!=0Description
TRUEnever evaluated
FALSEevaluated 1104 times by 1 test
Evaluated by:
  • Self test (438)
0-1104
3139 }
executed 1104 times by 1 test: end of block
Executed by:
  • Self test (438)
1104
3140 }
executed 1152 times by 1 test: end of block
Executed by:
  • Self test (438)
1152
3141 }-
3142 if( rc ) goto abort_due_to_error;
executed 4 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 35259 times by 2 tests
Evaluated by:
  • Self test (438)
  • Self test (64)
4-35259
3143-
3144 break;
executed 35259 times by 2 tests: break;
Executed by:
  • Self test (438)
  • Self test (64)
35259
3145}-
3146-
3147/* Opcode: AutoCommit P1 P2 * * *-
3148**-
3149** Set the database auto-commit flag to P1 (1 or 0). If P2 is true, roll-
3150** back any currently active btree transactions. If there are any active-
3151** VMs (apart from this one), then a ROLLBACK fails. A COMMIT fails if-
3152** there are active writing VMs or active VMs that use shared cache.-
3153**-
3154** This instruction causes the VM to halt.-
3155*/-
3156case
executed 7235 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)
  • ...
OP_AutoCommit: {
executed 7235 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)
  • ...
7235
3157 int desiredAutoCommit;-
3158 int iRollback;-
3159-
3160 desiredAutoCommit = pOp->p1;-
3161 iRollback = pOp->p2;-
3162 assert( desiredAutoCommit==1 || desiredAutoCommit==0 );-
3163 assert( desiredAutoCommit==1 || iRollback==0 );-
3164 assert( db->nVdbeActive>0 ); /* At least this one VM is active */-
3165 assert( p->bIsReader );-
3166-
3167 if( desiredAutoCommit!=db->autoCommit ){
desiredAutoCom...db->autoCommitDescription
TRUEevaluated 7018 times by 53 tests
Evaluated 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)
  • ...
FALSEevaluated 217 times by 2 tests
Evaluated by:
  • Self test (35)
  • Self test (438)
217-7018
3168 if( iRollback ){
iRollbackDescription
TRUEevaluated 1194 times by 12 tests
Evaluated by:
  • Self test (10)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (20)
  • Self test (22)
  • Self test (35)
  • Self test (438)
  • Self test (6)
  • Self test (8)
  • Self test (88)
FALSEevaluated 5824 times by 53 tests
Evaluated 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)
  • ...
1194-5824
3169 assert( desiredAutoCommit==1 );-
3170 sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK);-
3171 db->autoCommit = 1;-
3172 }else if( desiredAutoCommit && db->nVdbeWrite>0 ){
executed 1190 times by 8 tests: end of block
Executed by:
  • Self test (10)
  • Self test (14)
  • Self test (18)
  • Self test (22)
  • Self test (35)
  • Self test (438)
  • Self test (6)
  • Self test (88)
desiredAutoCommitDescription
TRUEevaluated 1745 times by 34 tests
Evaluated by:
  • Self test (100)
  • Self test (101)
  • Self test (3)
  • Self test (30)
  • Self test (31)
  • Self test (35)
  • Self test (38)
  • Self test (4)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (5)
  • Self test (50)
  • Self test (51)
  • Self test (62)
  • Self test (63)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • Self test (75)
  • Self test (76)
  • Self test (81)
  • Self test (82)
  • Self test (83)
  • Self test (87)
  • ...
FALSEevaluated 4079 times by 52 tests
Evaluated 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)
  • ...
db->nVdbeWrite>0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1744 times by 34 tests
Evaluated by:
  • Self test (100)
  • Self test (101)
  • Self test (3)
  • Self test (30)
  • Self test (31)
  • Self test (35)
  • Self test (38)
  • Self test (4)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (5)
  • Self test (50)
  • Self test (51)
  • Self test (62)
  • Self test (63)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • Self test (75)
  • Self test (76)
  • Self test (81)
  • Self test (82)
  • Self test (83)
  • Self test (87)
  • ...
1-4079
3173 /* If this instruction implements a COMMIT and other VMs are writing-
3174 ** return an error indicating that the other VMs must complete first. -
3175 */-
3176 sqlite3VdbeError(p, "cannot commit transaction - "-
3177 "SQL statements in progress");-
3178 rc = SQLITE_BUSY;-
3179 goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
1
3180 }else if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){
(rc = sqlite3V...ckFk(p, 1))!=0Description
TRUEevaluated 49 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5774 times by 53 tests
Evaluated 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)
  • ...
49-5774
3181 goto vdbe_return;
executed 49 times by 1 test: goto vdbe_return;
Executed by:
  • Self test (438)
49
3182 }else{-
3183 db->autoCommit = (u8)desiredAutoCommit;-
3184 }
executed 5774 times by 53 tests: end of block
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)
  • ...
5774
3185 if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){
sqlite3VdbeHalt(p)==5Description
TRUEevaluated 19 times by 2 tests
Evaluated by:
  • Self test (38)
  • Self test (438)
FALSEevaluated 6942 times by 53 tests
Evaluated 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)
  • ...
19-6942
3186 p->pc = (int)(pOp - aOp);-
3187 db->autoCommit = (u8)(1-desiredAutoCommit);-
3188 p->rc = rc = SQLITE_BUSY;-
3189 goto vdbe_return;
executed 19 times by 2 tests: goto vdbe_return;
Executed by:
  • Self test (38)
  • Self test (438)
19
3190 }-
3191 assert( db->nStatement==0 );-
3192 sqlite3CloseSavepoints(db);-
3193 if( p->rc==SQLITE_OK ){
p->rc==0Description
TRUEevaluated 6924 times by 53 tests
Evaluated 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)
  • ...
FALSEevaluated 18 times by 1 test
Evaluated by:
  • Self test (438)
18-6924
3194 rc = SQLITE_DONE;-
3195 }else{
executed 6924 times by 53 tests: end of block
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)
  • ...
6924
3196 rc = SQLITE_ERROR;-
3197 }
executed 18 times by 1 test: end of block
Executed by:
  • Self test (438)
18
3198 goto vdbe_return;
executed 6942 times by 53 tests: goto vdbe_return;
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)
  • ...
6942
3199 }else{-
3200 sqlite3VdbeError(p,-
3201 (!desiredAutoCommit)?"cannot start a transaction within a transaction":(-
3202 (iRollback)?"cannot rollback - no transaction is active":-
3203 "cannot commit - no transaction is active"));-
3204 -
3205 rc = SQLITE_ERROR;-
3206 goto abort_due_to_error;
executed 217 times by 2 tests: goto abort_due_to_error;
Executed by:
  • Self test (35)
  • Self test (438)
217
3207 }-
3208 break;
dead code: break;
-
3209}-
3210-
3211/* Opcode: Transaction P1 P2 P3 P4 P5-
3212**-
3213** Begin a transaction on database P1 if a transaction is not already-
3214** active.-
3215** If P2 is non-zero, then a write-transaction is started, or if a -
3216** read-transaction is already active, it is upgraded to a write-transaction.-
3217** If P2 is zero, then a read-transaction is started.-
3218**-
3219** P1 is the index of the database file on which the transaction is-
3220** started. Index 0 is the main database file and index 1 is the-
3221** file used for temporary tables. Indices of 2 or more are used for-
3222** attached databases.-
3223**-
3224** If a write-transaction is started and the Vdbe.usesStmtJournal flag is-
3225** true (this flag is set if the Vdbe may modify more than one row and may-
3226** throw an ABORT exception), a statement transaction may also be opened.-
3227** More specifically, a statement transaction is opened iff the database-
3228** connection is currently not in autocommit mode, or if there are other-
3229** active statements. A statement transaction allows the changes made by this-
3230** VDBE to be rolled back after an error without having to roll back the-
3231** entire transaction. If no error is encountered, the statement transaction-
3232** will automatically commit when the VDBE halts.-
3233**-
3234** If P5!=0 then this opcode also checks the schema cookie against P3-
3235** and the schema generation counter against P4.-
3236** The cookie changes its value whenever the database schema changes.-
3237** This operation is used to detect when that the cookie has changed-
3238** and that the current process needs to reread the schema. If the schema-
3239** cookie in P3 differs from the schema cookie in the database header or-
3240** if the schema generation counter in P4 differs from the current-
3241** generation counter, then an SQLITE_SCHEMA error is raised and execution-
3242** halts. The sqlite3_step() wrapper function might then reprepare the-
3243** statement and rerun it from the beginning.-
3244*/-
3245case
executed 951482 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)
  • ...
OP_Transaction: {
executed 951482 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)
  • ...
951482
3246 Btree *pBt;-
3247 int iMeta = 0;-
3248-
3249 assert( p->bIsReader );-
3250 assert( p->readOnly==0 || pOp->p2==0 );-
3251 assert( pOp->p1>=0 && pOp->p1<db->nDb );-
3252 assert( DbMaskTest(p->btreeMask, pOp->p1) );-
3253 if( pOp->p2 && (db->flags & SQLITE_QueryOnly)!=0 ){
pOp->p2Description
TRUEevaluated 678167 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 273315 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)
  • ...
(db->flags & 0x00100000)!=0Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 678160 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)
  • ...
7-678167
3254 rc = SQLITE_READONLY;-
3255 goto abort_due_to_error;
executed 7 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
7
3256 }-
3257 pBt = db->aDb[pOp->p1].pBt;-
3258-
3259 if( pBt ){
pBtDescription
TRUEevaluated 951399 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 76 times by 1 test
Evaluated by:
  • Self test (438)
76-951399
3260 rc = sqlite3BtreeBeginTrans(pBt, pOp->p2, &iMeta);-
3261 testcase( rc==SQLITE_BUSY_SNAPSHOT );-
3262 testcase( rc==SQLITE_BUSY_RECOVERY );-
3263 if( rc!=SQLITE_OK ){
rc!=0Description
TRUEevaluated 310 times by 8 tests
Evaluated by:
  • Self test (30)
  • Self test (35)
  • Self test (36)
  • Self test (438)
  • Self test (50)
  • Self test (51)
  • Self test (52)
  • Self test (59)
FALSEevaluated 951089 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)
  • ...
310-951089
3264 if( (rc&0xff)==SQLITE_BUSY ){
(rc&0xff)==5Description
TRUEevaluated 110 times by 8 tests
Evaluated by:
  • Self test (30)
  • Self test (35)
  • Self test (36)
  • Self test (438)
  • Self test (50)
  • Self test (51)
  • Self test (52)
  • Self test (59)
FALSEevaluated 200 times by 1 test
Evaluated by:
  • Self test (438)
110-200
3265 p->pc = (int)(pOp - aOp);-
3266 p->rc = rc;-
3267 goto vdbe_return;
executed 110 times by 8 tests: goto vdbe_return;
Executed by:
  • Self test (30)
  • Self test (35)
  • Self test (36)
  • Self test (438)
  • Self test (50)
  • Self test (51)
  • Self test (52)
  • Self test (59)
110
3268 }-
3269 goto abort_due_to_error;
executed 200 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
200
3270 }-
3271-
3272 if( pOp->p2 && p->usesStmtJournal
pOp->p2Description
TRUEevaluated 677896 times by 404 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 273193 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)
  • ...
p->usesStmtJournalDescription
TRUEevaluated 8907 times by 351 tests
Evaluated by:
  • Self test
  • 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)
  • ...
FALSEevaluated 668989 times by 67 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • ...
8907-677896
3273 && (db->autoCommit==0 || db->nVdbeRead>1)
db->autoCommit==0Description
TRUEevaluated 3407 times by 14 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (20)
  • Self test (22)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (8)
FALSEevaluated 5500 times by 338 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)
  • ...
db->nVdbeRead>1Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5485 times by 338 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)
  • ...
15-5500
3274 ){-
3275 assert( sqlite3BtreeIsInTrans(pBt) );-
3276 if( p->iStatement==0 ){
p->iStatement==0Description
TRUEevaluated 3422 times by 14 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (20)
  • Self test (22)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (8)
FALSEnever evaluated
0-3422
3277 assert( db->nStatement>=0 && db->nSavepoint>=0 );-
3278 db->nStatement++; -
3279 p->iStatement = db->nSavepoint + db->nStatement;-
3280 }
executed 3422 times by 14 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (20)
  • Self test (22)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (8)
3422
3281-
3282 rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, p->iStatement-1);-
3283 if( rc==SQLITE_OK ){
rc==0Description
TRUEevaluated 3422 times by 14 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (20)
  • Self test (22)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (8)
FALSEnever evaluated
0-3422
3284 rc = sqlite3BtreeBeginStmt(pBt, p->iStatement);-
3285 }
executed 3422 times by 14 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (20)
  • Self test (22)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (8)
3422
3286-
3287 /* Store the current value of the database handles deferred constraint-
3288 ** counter. If the statement transaction needs to be rolled back,-
3289 ** the value of this counter needs to be restored too. */-
3290 p->nStmtDefCons = db->nDeferredCons;-
3291 p->nStmtDefImmCons = db->nDeferredImmCons;-
3292 }
executed 3422 times by 14 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (20)
  • Self test (22)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (8)
3422
3293 }
executed 951089 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)
  • ...
951089
3294 assert( pOp->p5==0 || pOp->p4type==P4_INT32 );-
3295 if( pOp->p5
pOp->p5Description
TRUEevaluated 912005 times by 430 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 39160 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)
  • ...
39160-912005
3296 && (iMeta!=pOp->p3
iMeta!=pOp->p3Description
TRUEevaluated 2245 times by 10 tests
Evaluated 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)
FALSEevaluated 909760 times by 430 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)
  • ...
2245-909760
3297 || db->aDb[pOp->p1].pSchema->iGeneration!=pOp->p4.i)
db->aDb[pOp->p...ion!=pOp->p4.iDescription
TRUEevaluated 74 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 909686 times by 430 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)
  • ...
74-909686
3298 ){-
3299 /*-
3300 ** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema-
3301 ** version is checked to ensure that the schema has not changed since the-
3302 ** SQL statement was prepared.-
3303 */-
3304 sqlite3DbFree(db, p->zErrMsg);-
3305 p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed");-
3306 /* If the schema-cookie from the database file matches the cookie -
3307 ** stored with the in-memory representation of the schema, do-
3308 ** not reload the schema from the database file.-
3309 **-
3310 ** If virtual-tables are in use, this is not just an optimization.-
3311 ** Often, v-tables store their data in other SQLite tables, which-
3312 ** are queried from within xNext() and other v-table methods using-
3313 ** prepared queries. If such a query is out-of-date, we do not want to-
3314 ** discard the database schema, as the user code implementing the-
3315 ** v-table would have to be ready for the sqlite3_vtab structure itself-
3316 ** to be invalidated whenever sqlite3_step() is called from within -
3317 ** a v-table method.-
3318 */-
3319 if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
db->aDb[pOp->p..._cookie!=iMetaDescription
TRUEevaluated 304 times by 10 tests
Evaluated 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)
FALSEevaluated 2015 times by 2 tests
Evaluated by:
  • Self test (27)
  • Self test (438)
304-2015
3320 sqlite3ResetOneSchema(db, pOp->p1);-
3321 }
executed 304 times by 10 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)
304
3322 p->expired = 1;-
3323 rc = SQLITE_SCHEMA;-
3324 }
executed 2319 times by 10 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)
2319
3325 if( rc ) goto abort_due_to_error;
executed 2321 times by 10 tests: goto abort_due_to_error;
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)
rcDescription
TRUEevaluated 2321 times by 10 tests
Evaluated 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)
FALSEevaluated 948844 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)
  • ...
2321-948844
3326 break;
executed 948844 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)
  • ...
948844
3327}-
3328-
3329/* Opcode: ReadCookie P1 P2 P3 * *-
3330**-
3331** Read cookie number P3 from database P1 and write it into register P2.-
3332** P3==1 is the schema version. P3==2 is the database format.-
3333** P3==3 is the recommended pager cache size, and so forth. P1==0 is-
3334** the main database file and P1==1 is the database file used to store-
3335** temporary tables.-
3336**-
3337** There must be a read-lock on the database (either a transaction-
3338** must be started or there must be an open cursor) before-
3339** executing this instruction.-
3340*/-
3341case
executed 14013 times by 29 tests: case 105:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • ...
OP_ReadCookie: { /* out2 */
executed 14013 times by 29 tests: case 105:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • ...
14013
3342 int iMeta;-
3343 int iDb;-
3344 int iCookie;-
3345-
3346 assert( p->bIsReader );-
3347 iDb = pOp->p1;-
3348 iCookie = pOp->p3;-
3349 assert( pOp->p3<SQLITE_N_BTREE_META );-
3350 assert( iDb>=0 && iDb<db->nDb );-
3351 assert( db->aDb[iDb].pBt!=0 );-
3352 assert( DbMaskTest(p->btreeMask, iDb) );-
3353-
3354 sqlite3BtreeGetMeta(db->aDb[iDb].pBt, iCookie, (u32 *)&iMeta);-
3355 pOut = out2Prerelease(p, pOp);-
3356 pOut->u.i = iMeta;-
3357 break;
executed 14013 times by 29 tests: break;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • ...
14013
3358}-
3359-
3360/* Opcode: SetCookie P1 P2 P3 * *-
3361**-
3362** Write the integer value P3 into cookie number P2 of database P1.-
3363** P2==1 is the schema version. P2==2 is the database format.-
3364** P2==3 is the recommended pager cache -
3365** size, and so forth. P1==0 is the main database file and P1==1 is the -
3366** database file used to store temporary tables.-
3367**-
3368** A transaction must be started before executing this opcode.-
3369*/-
3370case
executed 31317 times by 31 tests: case 107:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
OP_SetCookie: {
executed 31317 times by 31 tests: case 107:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
31317
3371 Db *pDb;-
3372-
3373 sqlite3VdbeIncrWriteCounter(p, 0);-
3374 assert( pOp->p2<SQLITE_N_BTREE_META );-
3375 assert( pOp->p1>=0 && pOp->p1<db->nDb );-
3376 assert( DbMaskTest(p->btreeMask, pOp->p1) );-
3377 assert( p->readOnly==0 );-
3378 pDb = &db->aDb[pOp->p1];-
3379 assert( pDb->pBt!=0 );-
3380 assert( sqlite3SchemaMutexHeld(db, pOp->p1, 0) );-
3381 /* See note about index shifting on OP_ReadCookie */-
3382 rc = sqlite3BtreeUpdateMeta(pDb->pBt, pOp->p2, pOp->p3);-
3383 if( pOp->p2==BTREE_SCHEMA_VERSION ){
pOp->p2==1Description
TRUEevaluated 22464 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEevaluated 8853 times by 24 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (57)
  • Self test (58)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • Self test (99)
8853-22464
3384 /* When the schema cookie changes, record the new cookie internally */-
3385 pDb->pSchema->schema_cookie = pOp->p3;-
3386 db->mDbFlags |= DBFLAG_SchemaChange;-
3387 }else if( pOp->p2==BTREE_FILE_FORMAT ){
executed 22464 times by 31 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
pOp->p2==2Description
TRUEevaluated 4356 times by 21 tests
Evaluated by:
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • Self test (99)
FALSEevaluated 4497 times by 24 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (57)
  • Self test (58)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • Self test (99)
4356-22464
3388 /* Record changes in the file format */-
3389 pDb->pSchema->file_format = pOp->p3;-
3390 }
executed 4356 times by 21 tests: end of block
Executed by:
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • Self test (97)
  • Self test (98)
  • Self test (99)
4356
3391 if( pOp->p1==1 ){
pOp->p1==1Description
TRUEevaluated 1349 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 29968 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
1349-29968
3392 /* Invalidate all prepared statements whenever the TEMP database-
3393 ** schema is changed. Ticket #1644 */-
3394 sqlite3ExpirePreparedStatements(db, 0);-
3395 p->expired = 0;-
3396 }
executed 1349 times by 1 test: end of block
Executed by:
  • Self test (438)
1349
3397 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 31317 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
0-31317
3398 break;
executed 31317 times by 31 tests: break;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
31317
3399}-
3400-
3401/* Opcode: OpenRead P1 P2 P3 P4 P5-
3402** Synopsis: root=P2 iDb=P3-
3403**-
3404** Open a read-only cursor for the database table whose root page is-
3405** P2 in a database file. The database file is determined by P3. -
3406** P3==0 means the main database, P3==1 means the database used for -
3407** temporary tables, and P3>1 means used the corresponding attached-
3408** database. Give the new cursor an identifier of P1. The P1-
3409** values need not be contiguous but all P1 values should be small integers.-
3410** It is an error for P1 to be negative.-
3411**-
3412** Allowed P5 bits:-
3413** <ul>-
3414** <li> <b>0x02 OPFLAG_SEEKEQ</b>: This cursor will only be used for-
3415** equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT-
3416** of OP_SeekLE/OP_IdxGT)-
3417** </ul>-
3418**-
3419** The P4 value may be either an integer (P4_INT32) or a pointer to-
3420** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo -
3421** object, then table being opened must be an [index b-tree] where the-
3422** KeyInfo object defines the content and collating -
3423** sequence of that index b-tree. Otherwise, if P4 is an integer -
3424** value, then the table being opened must be a [table b-tree] with a-
3425** number of columns no less than the value of P4.-
3426**-
3427** See also: OpenWrite, ReopenIdx-
3428*/-
3429/* Opcode: ReopenIdx P1 P2 P3 P4 P5-
3430** Synopsis: root=P2 iDb=P3-
3431**-
3432** The ReopenIdx opcode works like OP_OpenRead except that it first-
3433** checks to see if the cursor on P1 is already open on the same-
3434** b-tree and if it is this opcode becomes a no-op. In other words,-
3435** if the cursor is already open, do not reopen it.-
3436**-
3437** The ReopenIdx opcode may only be used with P5==0 or P5==OPFLAG_SEEKEQ-
3438** and with P4 being a P4_KEYINFO object. Furthermore, the P3 value must-
3439** be the same as every other ReopenIdx or OpenRead for the same cursor-
3440** number.-
3441**-
3442** Allowed P5 bits:-
3443** <ul>-
3444** <li> <b>0x02 OPFLAG_SEEKEQ</b>: This cursor will only be used for-
3445** equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT-
3446** of OP_SeekLE/OP_IdxGT)-
3447** </ul>-
3448**-
3449** See also: OP_OpenRead, OP_OpenWrite-
3450*/-
3451/* Opcode: OpenWrite P1 P2 P3 P4 P5-
3452** Synopsis: root=P2 iDb=P3-
3453**-
3454** Open a read/write cursor named P1 on the table or index whose root-
3455** page is P2 (or whose root page is held in register P2 if the-
3456** OPFLAG_P2ISREG bit is set in P5 - see below).-
3457**-
3458** The P4 value may be either an integer (P4_INT32) or a pointer to-
3459** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo -
3460** object, then table being opened must be an [index b-tree] where the-
3461** KeyInfo object defines the content and collating -
3462** sequence of that index b-tree. Otherwise, if P4 is an integer -
3463** value, then the table being opened must be a [table b-tree] with a-
3464** number of columns no less than the value of P4.-
3465**-
3466** Allowed P5 bits:-
3467** <ul>-
3468** <li> <b>0x02 OPFLAG_SEEKEQ</b>: This cursor will only be used for-
3469** equality lookups (implemented as a pair of opcodes OP_SeekGE/OP_IdxGT-
3470** of OP_SeekLE/OP_IdxGT)-
3471** <li> <b>0x08 OPFLAG_FORDELETE</b>: This cursor is used only to seek-
3472** and subsequently delete entries in an index btree. This is a-
3473** hint to the storage engine that the storage engine is allowed to-
3474** ignore. The hint is not used by the official SQLite b*tree storage-
3475** engine, but is used by COMDB2.-
3476** <li> <b>0x10 OPFLAG_P2ISREG</b>: Use the content of register P2-
3477** as the root page, not the value of P2 itself.-
3478** </ul>-
3479**-
3480** This instruction works like OpenRead except that it opens the cursor-
3481** in read/write mode.-
3482**-
3483** See also: OP_OpenRead, OP_ReopenIdx-
3484*/-
3485case
executed 14080 times by 1 test: case 108:
Executed by:
  • Self test (438)
OP_ReopenIdx: {
executed 14080 times by 1 test: case 108:
Executed by:
  • Self test (438)
14080
3486 int nField;-
3487 KeyInfo *pKeyInfo;-
3488 int p2;-
3489 int iDb;-
3490 int wrFlag;-
3491 Btree *pX;-
3492 VdbeCursor *pCur;-
3493 Db *pDb;-
3494-
3495 assert( pOp->p5==0 || pOp->p5==OPFLAG_SEEKEQ );-
3496 assert( pOp->p4type==P4_KEYINFO );-
3497 pCur = p->apCsr[pOp->p1];-
3498 if( pCur && pCur->pgnoRoot==(u32)pOp->p2 ){
pCurDescription
TRUEevaluated 11767 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2313 times by 1 test
Evaluated by:
  • Self test (438)
pCur->pgnoRoot==(u32)pOp->p2Description
TRUEevaluated 3670 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 8097 times by 1 test
Evaluated by:
  • Self test (438)
2313-11767
3499 assert( pCur->iDb==pOp->p3 ); /* Guaranteed by the code generator */-
3500 goto open_cursor_set_hints;
executed 3670 times by 1 test: goto open_cursor_set_hints;
Executed by:
  • Self test (438)
3670
3501 }-
3502 /* If the cursor is not currently open or is open on a different-
3503 ** index, then fall through into OP_OpenRead to force a reopen */-
3504case
code before this statement executed 10410 times by 1 test: case 109:
Executed by:
  • Self test (438)
executed 576607 times by 435 tests: case 109:
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)
  • ...
OP_OpenRead:
code before this statement executed 10410 times by 1 test: case 109:
Executed by:
  • Self test (438)
executed 576607 times by 435 tests: case 109:
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)
  • ...
10410-576607
3505case
executed 1265577 times by 404 tests: case 110:
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)
  • ...
OP_OpenWrite:
executed 1265577 times by 404 tests: case 110:
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)
  • ...
1265577
3506-
3507 assert( pOp->opcode==OP_OpenWrite || pOp->p5==0 || pOp->p5==OPFLAG_SEEKEQ );-
3508 assert( p->bIsReader );-
3509 assert( pOp->opcode==OP_OpenRead || pOp->opcode==OP_ReopenIdx-
3510 || p->readOnly==0 );-
3511-
3512 if( p->expired==1 ){
p->expired==1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1852592 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)
  • ...
2-1852592
3513 rc = SQLITE_ABORT_ROLLBACK;-
3514 goto abort_due_to_error;
executed 2 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
2
3515 }-
3516-
3517 nField = 0;-
3518 pKeyInfo = 0;-
3519 p2 = pOp->p2;-
3520 iDb = pOp->p3;-
3521 assert( iDb>=0 && iDb<db->nDb );-
3522 assert( DbMaskTest(p->btreeMask, iDb) );-
3523 pDb = &db->aDb[iDb];-
3524 pX = pDb->pBt;-
3525 assert( pX!=0 );-
3526 if( pOp->opcode==OP_OpenWrite ){
pOp->opcode==110Description
TRUEevaluated 1265577 times by 404 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 587015 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)
  • ...
587015-1265577
3527 assert( OPFLAG_FORDELETE==BTREE_FORDELETE );-
3528 wrFlag = BTREE_WRCSR | (pOp->p5 & OPFLAG_FORDELETE);-
3529 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );-
3530 if( pDb->pSchema->file_format < p->minWriteFileFormat ){
pDb->pSchema->...riteFileFormatDescription
TRUEevaluated 668835 times by 404 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 596742 times by 386 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • ...
596742-668835
3531 p->minWriteFileFormat = pDb->pSchema->file_format;-
3532 }
executed 668835 times by 404 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 (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)
  • ...
668835
3533 }else{
executed 1265577 times by 404 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 (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)
  • ...
1265577
3534 wrFlag = 0;-
3535 }
executed 587015 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)
  • ...
587015
3536 if( pOp->p5 & OPFLAG_P2ISREG ){
pOp->p5 & 0x10Description
TRUEevaluated 2601 times by 13 tests
Evaluated by:
  • Self test
  • 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)
  • Self test (57)
  • Self test (58)
FALSEevaluated 1849991 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)
  • ...
2601-1849991
3537 assert( p2>0 );-
3538 assert( p2<=(p->nMem+1 - p->nCursor) );-
3539 assert( pOp->opcode==OP_OpenWrite );-
3540 pIn2 = &aMem[p2];-
3541 assert( memIsValid(pIn2) );-
3542 assert( (pIn2->flags & MEM_Int)!=0 );-
3543 sqlite3VdbeMemIntegerify(pIn2);-
3544 p2 = (int)pIn2->u.i;-
3545 /* The p2 value always comes from a prior OP_CreateBtree opcode and-
3546 ** that opcode will always set the p2 value to 2 or more or else fail.-
3547 ** If there were a failure, the prepared statement would have halted-
3548 ** before reaching this instruction. */-
3549 assert( p2>=2 );-
3550 }
executed 2601 times by 13 tests: end of block
Executed by:
  • Self test
  • 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)
  • Self test (57)
  • Self test (58)
2601
3551 if( pOp->p4type==P4_KEYINFO ){
pOp->p4type==(-9)Description
TRUEevaluated 865479 times by 388 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 987113 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)
  • ...
865479-987113
3552 pKeyInfo = pOp->p4.pKeyInfo;-
3553 assert( pKeyInfo->enc==ENC(db) );-
3554 assert( pKeyInfo->db==db );-
3555 nField = pKeyInfo->nAllField;-
3556 }else if( pOp->p4type==P4_INT32 ){
executed 865479 times by 388 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)
  • ...
pOp->p4type==(-3)Description
TRUEevaluated 986998 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 115 times by 4 tests
Evaluated by:
  • Self test
  • Self test (438)
  • Self test (57)
  • Self test (58)
115-986998
3557 nField = pOp->p4.i;-
3558 }
executed 986998 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)
  • ...
986998
3559 assert( pOp->p1>=0 );-
3560 assert( nField>=0 );-
3561 testcase( nField==0 ); /* Table with INTEGER PRIMARY KEY and nothing else */-
3562 pCur = allocateCursor(p, pOp->p1, nField, iDb, CURTYPE_BTREE);-
3563 if( pCur==0 ) goto no_mem;
executed 37 times by 1 test: goto no_mem;
Executed by:
  • Self test (438)
pCur==0Description
TRUEevaluated 37 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1852555 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)
  • ...
37-1852555
3564 pCur->nullRow = 1;-
3565 pCur->isOrdered = 1;-
3566 pCur->pgnoRoot = p2;-
3567#ifdef SQLITE_DEBUG-
3568 pCur->wrFlag = wrFlag;-
3569#endif-
3570 rc = sqlite3BtreeCursor(pX, p2, wrFlag, pKeyInfo, pCur->uc.pCursor);-
3571 pCur->pKeyInfo = pKeyInfo;-
3572 /* Set the VdbeCursor.isTable variable. Previous versions of-
3573 ** SQLite used to check if the root-page flags were sane at this point-
3574 ** and report database corruption if they were not, but this check has-
3575 ** since moved into the btree layer. */ -
3576 pCur->isTable = pOp->p4type!=P4_KEYINFO;-
3577-
3578open_cursor_set_hints:
code before this statement executed 1852555 times by 435 tests: open_cursor_set_hints:
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)
  • ...
1852555
3579 assert( OPFLAG_BULKCSR==BTREE_BULKLOAD );-
3580 assert( OPFLAG_SEEKEQ==BTREE_SEEK_EQ );-
3581 testcase( pOp->p5 & OPFLAG_BULKCSR );-
3582#ifdef SQLITE_ENABLE_CURSOR_HINTS-
3583 testcase( pOp->p2 & OPFLAG_SEEKEQ );-
3584#endif-
3585 sqlite3BtreeCursorHintFlags(pCur->uc.pCursor,-
3586 (pOp->p5 & (OPFLAG_BULKCSR|OPFLAG_SEEKEQ)));-
3587 if( rc ) goto abort_due_to_error;
executed 3 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1856222 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)
  • ...
3-1856222
3588 break;
executed 1856222 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)
  • ...
1856222
3589}-
3590-
3591/* Opcode: OpenDup P1 P2 * * *-
3592**-
3593** Open a new cursor P1 that points to the same ephemeral table as-
3594** cursor P2. The P2 cursor must have been opened by a prior OP_OpenEphemeral-
3595** opcode. Only ephemeral cursors may be duplicated.-
3596**-
3597** Duplicate ephemeral cursors are used for self-joins of materialized views.-
3598*/-
3599case
executed 2353 times by 1 test: case 111:
Executed by:
  • Self test (438)
OP_OpenDup: {
executed 2353 times by 1 test: case 111:
Executed by:
  • Self test (438)
2353
3600 VdbeCursor *pOrig; /* The original cursor to be duplicated */-
3601 VdbeCursor *pCx; /* The new cursor */-
3602-
3603 pOrig = p->apCsr[pOp->p2];-
3604 assert( pOrig->pBtx!=0 ); /* Only ephemeral cursors can be duplicated */-
3605-
3606 pCx = allocateCursor(p, pOp->p1, pOrig->nField, -1, CURTYPE_BTREE);-
3607 if( pCx==0 ) goto no_mem;
never executed: goto no_mem;
pCx==0Description
TRUEnever evaluated
FALSEevaluated 2353 times by 1 test
Evaluated by:
  • Self test (438)
0-2353
3608 pCx->nullRow = 1;-
3609 pCx->isEphemeral = 1;-
3610 pCx->pKeyInfo = pOrig->pKeyInfo;-
3611 pCx->isTable = pOrig->isTable;-
3612 rc = sqlite3BtreeCursor(pOrig->pBtx, MASTER_ROOT, BTREE_WRCSR,-
3613 pCx->pKeyInfo, pCx->uc.pCursor);-
3614 /* The sqlite3BtreeCursor() routine can only fail for the first cursor-
3615 ** opened for a database. Since there is already an open cursor when this-
3616 ** opcode is run, the sqlite3BtreeCursor() cannot fail */-
3617 assert( rc==SQLITE_OK );-
3618 break;
executed 2353 times by 1 test: break;
Executed by:
  • Self test (438)
2353
3619}-
3620-
3621-
3622/* Opcode: OpenEphemeral P1 P2 * P4 P5-
3623** Synopsis: nColumn=P2-
3624**-
3625** Open a new cursor P1 to a transient table.-
3626** The cursor is always opened read/write even if -
3627** the main database is read-only. The ephemeral-
3628** table is deleted automatically when the cursor is closed.-
3629**-
3630** P2 is the number of columns in the ephemeral table.-
3631** The cursor points to a BTree table if P4==0 and to a BTree index-
3632** if P4 is not 0. If P4 is not NULL, it points to a KeyInfo structure-
3633** that defines the format of keys in the index.-
3634**-
3635** The P5 parameter can be a mask of the BTREE_* flags defined-
3636** in btree.h. These flags control aspects of the operation of-
3637** the btree. The BTREE_OMIT_JOURNAL and BTREE_SINGLE flags are-
3638** added automatically.-
3639*/-
3640/* Opcode: OpenAutoindex P1 P2 * P4 *-
3641** Synopsis: nColumn=P2-
3642**-
3643** This opcode works the same as OP_OpenEphemeral. It has a-
3644** different name to distinguish its use. Tables created using-
3645** by this opcode will be used for automatically created transient-
3646** indices in joins.-
3647*/-
3648case
executed 2824 times by 1 test: case 112:
Executed by:
  • Self test (438)
OP_OpenAutoindex:
executed 2824 times by 1 test: case 112:
Executed by:
  • Self test (438)
2824
3649case
executed 57415 times by 5 tests: case 113:
Executed by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
OP_OpenEphemeral: {
executed 57415 times by 5 tests: case 113:
Executed by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
57415
3650 VdbeCursor *pCx;-
3651 KeyInfo *pKeyInfo;-
3652-
3653 static const int vfsFlags = -
3654 SQLITE_OPEN_READWRITE |-
3655 SQLITE_OPEN_CREATE |-
3656 SQLITE_OPEN_EXCLUSIVE |-
3657 SQLITE_OPEN_DELETEONCLOSE |-
3658 SQLITE_OPEN_TRANSIENT_DB;-
3659 assert( pOp->p1>=0 );-
3660 assert( pOp->p2>=0 );-
3661 pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE);-
3662 if( pCx==0 ) goto no_mem;
executed 6 times by 1 test: goto no_mem;
Executed by:
  • Self test (438)
pCx==0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 60233 times by 5 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
6-60233
3663 pCx->nullRow = 1;-
3664 pCx->isEphemeral = 1;-
3665 rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx, -
3666 BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5, vfsFlags);-
3667 if( rc==SQLITE_OK ){
rc==0Description
TRUEevaluated 60197 times by 5 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
FALSEevaluated 36 times by 1 test
Evaluated by:
  • Self test (438)
36-60197
3668 rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0);-
3669 }
executed 60197 times by 5 tests: end of block
Executed by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
60197
3670 if( rc==SQLITE_OK ){
rc==0Description
TRUEevaluated 60194 times by 5 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
FALSEevaluated 39 times by 1 test
Evaluated by:
  • Self test (438)
39-60194
3671 /* If a transient index is required, create it by calling-
3672 ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before-
3673 ** opening it. If a transient table is required, just use the-
3674 ** automatically created table with root-page 1 (an BLOB_INTKEY table).-
3675 */-
3676 if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){
(pCx->pKeyInfo...4.pKeyInfo)!=0Description
TRUEevaluated 12299 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 47895 times by 5 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
12299-47895
3677 int pgno;-
3678 assert( pOp->p4type==P4_KEYINFO );-
3679 rc = sqlite3BtreeCreateTable(pCx->pBtx, &pgno, BTREE_BLOBKEY | pOp->p5); -
3680 if( rc==SQLITE_OK ){
rc==0Description
TRUEevaluated 12299 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-12299
3681 assert( pgno==MASTER_ROOT+1 );-
3682 assert( pKeyInfo->db==db );-
3683 assert( pKeyInfo->enc==ENC(db) );-
3684 rc = sqlite3BtreeCursor(pCx->pBtx, pgno, BTREE_WRCSR,-
3685 pKeyInfo, pCx->uc.pCursor);-
3686 }
executed 12299 times by 1 test: end of block
Executed by:
  • Self test (438)
12299
3687 pCx->isTable = 0;-
3688 }else{
executed 12299 times by 1 test: end of block
Executed by:
  • Self test (438)
12299
3689 rc = sqlite3BtreeCursor(pCx->pBtx, MASTER_ROOT, BTREE_WRCSR,-
3690 0, pCx->uc.pCursor);-
3691 pCx->isTable = 1;-
3692 }
executed 47895 times by 5 tests: end of block
Executed by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
47895
3693 }-
3694 if( rc ) goto abort_due_to_error;
executed 45 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 45 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 60188 times by 5 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
45-60188
3695 pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED);-
3696 break;
executed 60188 times by 5 tests: break;
Executed by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
60188
3697}-
3698-
3699/* Opcode: SorterOpen P1 P2 P3 P4 *-
3700**-
3701** This opcode works like OP_OpenEphemeral except that it opens-
3702** a transient index that is specifically designed to sort large-
3703** tables using an external merge-sort algorithm.-
3704**-
3705** If argument P3 is non-zero, then it indicates that the sorter may-
3706** assume that a stable sort considering the first P3 fields of each-
3707** key is sufficient to produce the required results.-
3708*/-
3709case
executed 18989 times by 10 tests: case 114:
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)
OP_SorterOpen: {
executed 18989 times by 10 tests: case 114:
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)
18989
3710 VdbeCursor *pCx;-
3711-
3712 assert( pOp->p1>=0 );-
3713 assert( pOp->p2>=0 );-
3714 pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_SORTER);-
3715 if( pCx==0 ) goto no_mem;
never executed: goto no_mem;
pCx==0Description
TRUEnever evaluated
FALSEevaluated 18989 times by 10 tests
Evaluated 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)
0-18989
3716 pCx->pKeyInfo = pOp->p4.pKeyInfo;-
3717 assert( pCx->pKeyInfo->db==db );-
3718 assert( pCx->pKeyInfo->enc==ENC(db) );-
3719 rc = sqlite3VdbeSorterInit(db, pOp->p3, pCx);-
3720 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 18989 times by 10 tests
Evaluated 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)
0-18989
3721 break;
executed 18989 times by 10 tests: break;
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)
18989
3722}-
3723-
3724/* Opcode: SequenceTest P1 P2 * * *-
3725** Synopsis: if( cursor[P1].ctr++ ) pc = P2-
3726**-
3727** P1 is a sorter cursor. If the sequence counter is currently zero, jump-
3728** to P2. Regardless of whether or not the jump is taken, increment the-
3729** the sequence value.-
3730*/-
3731case
executed 23287 times by 1 test: case 115:
Executed by:
  • Self test (438)
OP_SequenceTest: {
executed 23287 times by 1 test: case 115:
Executed by:
  • Self test (438)
23287
3732 VdbeCursor *pC;-
3733 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
3734 pC = p->apCsr[pOp->p1];-
3735 assert( isSorter(pC) );-
3736 if( (pC->seqCount++)==0 ){
(pC->seqCount++)==0Description
TRUEevaluated 232 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 23055 times by 1 test
Evaluated by:
  • Self test (438)
232-23055
3737 goto jump_to_p2;
executed 232 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
232
3738 }-
3739 break;
executed 23055 times by 1 test: break;
Executed by:
  • Self test (438)
23055
3740}-
3741-
3742/* Opcode: OpenPseudo P1 P2 P3 * *-
3743** Synopsis: P3 columns in r[P2]-
3744**-
3745** Open a new cursor that points to a fake table that contains a single-
3746** row of data. The content of that one row is the content of memory-
3747** register P2. In other words, cursor P1 becomes an alias for the -
3748** MEM_Blob content contained in register P2.-
3749**-
3750** A pseudo-table created by this opcode is used to hold a single-
3751** row output from the sorter so that the row can be decomposed into-
3752** individual columns using the OP_Column opcode. The OP_Column opcode-
3753** is the only cursor opcode that works with a pseudo-table.-
3754**-
3755** P3 is the number of fields in the records that will be stored by-
3756** the pseudo-table.-
3757*/-
3758case
executed 58180 times by 1 test: case 116:
Executed by:
  • Self test (438)
OP_OpenPseudo: {
executed 58180 times by 1 test: case 116:
Executed by:
  • Self test (438)
58180
3759 VdbeCursor *pCx;-
3760-
3761 assert( pOp->p1>=0 );-
3762 assert( pOp->p3>=0 );-
3763 pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, CURTYPE_PSEUDO);-
3764 if( pCx==0 ) goto no_mem;
executed 2 times by 1 test: goto no_mem;
Executed by:
  • Self test (438)
pCx==0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 58178 times by 1 test
Evaluated by:
  • Self test (438)
2-58178
3765 pCx->nullRow = 1;-
3766 pCx->seekResult = pOp->p2;-
3767 pCx->isTable = 1;-
3768 /* Give this pseudo-cursor a fake BtCursor pointer so that pCx-
3769 ** can be safely passed to sqlite3VdbeCursorMoveto(). This avoids a test-
3770 ** for pCx->eCurType==CURTYPE_BTREE inside of sqlite3VdbeCursorMoveto()-
3771 ** which is a performance optimization */-
3772 pCx->uc.pCursor = sqlite3BtreeFakeValidCursor();-
3773 assert( pOp->p5==0 );-
3774 break;
executed 58178 times by 1 test: break;
Executed by:
  • Self test (438)
58178
3775}-
3776-
3777/* Opcode: Close P1 * * * *-
3778**-
3779** Close a cursor previously opened as P1. If P1 is not-
3780** currently open, this instruction is a no-op.-
3781*/-
3782case
executed 170989 times by 33 tests: case 117:
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 (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • ...
OP_Close: {
executed 170989 times by 33 tests: case 117:
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 (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • ...
170989
3783 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
3784 sqlite3VdbeFreeCursor(p, p->apCsr[pOp->p1]);-
3785 p->apCsr[pOp->p1] = 0;-
3786 break;
executed 170989 times by 33 tests: break;
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 (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • ...
170989
3787}-
3788-
3789#ifdef SQLITE_ENABLE_COLUMN_USED_MASK-
3790/* Opcode: ColumnsUsed P1 * * P4 *-
3791**-
3792** This opcode (which only exists if SQLite was compiled with-
3793** SQLITE_ENABLE_COLUMN_USED_MASK) identifies which columns of the-
3794** table or index for cursor P1 are used. P4 is a 64-bit integer-
3795** (P4_INT64) in which the first 63 bits are one for each of the-
3796** first 63 columns of the table or index that are actually used-
3797** by the cursor. The high-order bit is set if any column after-
3798** the 64th is used.-
3799*/-
3800case OP_ColumnsUsed: {-
3801 VdbeCursor *pC;-
3802 pC = p->apCsr[pOp->p1];-
3803 assert( pC->eCurType==CURTYPE_BTREE );-
3804 pC->maskUsed = *(u64*)pOp->p4.pI64;-
3805 break;-
3806}-
3807#endif-
3808-
3809/* Opcode: SeekGE P1 P2 P3 P4 *-
3810** Synopsis: key=r[P3@P4]-
3811**-
3812** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), -
3813** use the value in register P3 as the key. If cursor P1 refers -
3814** to an SQL index, then P3 is the first in an array of P4 registers -
3815** that are used as an unpacked index key. -
3816**-
3817** Reposition cursor P1 so that it points to the smallest entry that -
3818** is greater than or equal to the key value. If there are no records -
3819** greater than or equal to the key and P2 is not zero, then jump to P2.-
3820**-
3821** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this-
3822** opcode will always land on a record that equally equals the key, or-
3823** else jump immediately to P2. When the cursor is OPFLAG_SEEKEQ, this-
3824** opcode must be followed by an IdxLE opcode with the same arguments.-
3825** The IdxLE opcode will be skipped if this opcode succeeds, but the-
3826** IdxLE opcode will be used on subsequent loop iterations.-
3827**-
3828** This opcode leaves the cursor configured to move in forward order,-
3829** from the beginning toward the end. In other words, the cursor is-
3830** configured to use Next, not Prev.-
3831**-
3832** See also: Found, NotFound, SeekLt, SeekGt, SeekLe-
3833*/-
3834/* Opcode: SeekGT P1 P2 P3 P4 *-
3835** Synopsis: key=r[P3@P4]-
3836**-
3837** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), -
3838** use the value in register P3 as a key. If cursor P1 refers -
3839** to an SQL index, then P3 is the first in an array of P4 registers -
3840** that are used as an unpacked index key. -
3841**-
3842** Reposition cursor P1 so that it points to the smallest entry that -
3843** is greater than the key value. If there are no records greater than -
3844** the key and P2 is not zero, then jump to P2.-
3845**-
3846** This opcode leaves the cursor configured to move in forward order,-
3847** from the beginning toward the end. In other words, the cursor is-
3848** configured to use Next, not Prev.-
3849**-
3850** See also: Found, NotFound, SeekLt, SeekGe, SeekLe-
3851*/-
3852/* Opcode: SeekLT P1 P2 P3 P4 * -
3853** Synopsis: key=r[P3@P4]-
3854**-
3855** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), -
3856** use the value in register P3 as a key. If cursor P1 refers -
3857** to an SQL index, then P3 is the first in an array of P4 registers -
3858** that are used as an unpacked index key. -
3859**-
3860** Reposition cursor P1 so that it points to the largest entry that -
3861** is less than the key value. If there are no records less than -
3862** the key and P2 is not zero, then jump to P2.-
3863**-
3864** This opcode leaves the cursor configured to move in reverse order,-
3865** from the end toward the beginning. In other words, the cursor is-
3866** configured to use Prev, not Next.-
3867**-
3868** See also: Found, NotFound, SeekGt, SeekGe, SeekLe-
3869*/-
3870/* Opcode: SeekLE P1 P2 P3 P4 *-
3871** Synopsis: key=r[P3@P4]-
3872**-
3873** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), -
3874** use the value in register P3 as a key. If cursor P1 refers -
3875** to an SQL index, then P3 is the first in an array of P4 registers -
3876** that are used as an unpacked index key. -
3877**-
3878** Reposition cursor P1 so that it points to the largest entry that -
3879** is less than or equal to the key value. If there are no records -
3880** less than or equal to the key and P2 is not zero, then jump to P2.-
3881**-
3882** This opcode leaves the cursor configured to move in reverse order,-
3883** from the end toward the beginning. In other words, the cursor is-
3884** configured to use Prev, not Next.-
3885**-
3886** If the cursor P1 was opened using the OPFLAG_SEEKEQ flag, then this-
3887** opcode will always land on a record that equally equals the key, or-
3888** else jump immediately to P2. When the cursor is OPFLAG_SEEKEQ, this-
3889** opcode must be followed by an IdxGE opcode with the same arguments.-
3890** The IdxGE opcode will be skipped if this opcode succeeds, but the-
3891** IdxGE opcode will be used on subsequent loop iterations.-
3892**-
3893** See also: Found, NotFound, SeekGt, SeekGe, SeekLt-
3894*/-
3895case
executed 313 times by 1 test: case 22:
Executed by:
  • Self test (438)
OP_SeekLT: /* jump, in3, group */
executed 313 times by 1 test: case 22:
Executed by:
  • Self test (438)
313
3896case
executed 742 times by 1 test: case 23:
Executed by:
  • Self test (438)
OP_SeekLE: /* jump, in3, group */
executed 742 times by 1 test: case 23:
Executed by:
  • Self test (438)
742
3897case
executed 465684 times by 1 test: case 24:
Executed by:
  • Self test (438)
OP_SeekGE: /* jump, in3, group */
executed 465684 times by 1 test: case 24:
Executed by:
  • Self test (438)
465684
3898case
executed 8088 times by 1 test: case 25:
Executed by:
  • Self test (438)
OP_SeekGT: { /* jump, in3, group */
executed 8088 times by 1 test: case 25:
Executed by:
  • Self test (438)
8088
3899 int res; /* Comparison result */-
3900 int oc; /* Opcode */-
3901 VdbeCursor *pC; /* The cursor to seek */-
3902 UnpackedRecord r; /* The key to seek for */-
3903 int nField; /* Number of columns or fields in the key */-
3904 i64 iKey; /* The rowid we are to seek to */-
3905 int eqOnly; /* Only interested in == results */-
3906-
3907 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
3908 assert( pOp->p2!=0 );-
3909 pC = p->apCsr[pOp->p1];-
3910 assert( pC!=0 );-
3911 assert( pC->eCurType==CURTYPE_BTREE );-
3912 assert( OP_SeekLE == OP_SeekLT+1 );-
3913 assert( OP_SeekGE == OP_SeekLT+2 );-
3914 assert( OP_SeekGT == OP_SeekLT+3 );-
3915 assert( pC->isOrdered );-
3916 assert( pC->uc.pCursor!=0 );-
3917 oc = pOp->opcode;-
3918 eqOnly = 0;-
3919 pC->nullRow = 0;-
3920#ifdef SQLITE_DEBUG-
3921 pC->seekOp = pOp->opcode;-
3922#endif-
3923-
3924 if( pC->isTable ){
pC->isTableDescription
TRUEevaluated 3229 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 471598 times by 1 test
Evaluated by:
  • Self test (438)
3229-471598
3925 /* The BTREE_SEEK_EQ flag is only set on index cursors */-
3926 assert( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ)==0-
3927 || CORRUPT_DB );-
3928-
3929 /* The input value in P3 might be of any type: integer, real, string,-
3930 ** blob, or NULL. But it needs to be an integer before we can do-
3931 ** the seek, so convert it. */-
3932 pIn3 = &aMem[pOp->p3];-
3933 if( (pIn3->flags & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){
(pIn3->flags &...0002))==0x0002Description
TRUEevaluated 133 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3096 times by 1 test
Evaluated by:
  • Self test (438)
133-3096
3934 applyNumericAffinity(pIn3, 0);-
3935 }
executed 133 times by 1 test: end of block
Executed by:
  • Self test (438)
133
3936 iKey = sqlite3VdbeIntValue(pIn3);-
3937-
3938 /* If the P3 value could not be converted into an integer without-
3939 ** loss of information, then special processing is required... */-
3940 if( (pIn3->flags & MEM_Int)==0 ){
(pIn3->flags & 0x0004)==0Description
TRUEevaluated 294 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2935 times by 1 test
Evaluated by:
  • Self test (438)
294-2935
3941 if( (pIn3->flags & MEM_Real)==0 ){
(pIn3->flags & 0x0008)==0Description
TRUEevaluated 261 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 33 times by 1 test
Evaluated by:
  • Self test (438)
33-261
3942 /* If the P3 value cannot be converted into any kind of a number,-
3943 ** then the seek is not possible, so jump to P2 */-
3944 VdbeBranchTaken(1,2); goto jump_to_p2;
executed 261 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
261
3945 break;
dead code: break;
-
3946 }-
3947-
3948 /* If the approximation iKey is larger than the actual real search-
3949 ** term, substitute >= for > and < for <=. e.g. if the search term-
3950 ** is 4.9 and the integer approximation 5:-
3951 **-
3952 ** (x > 4.9) -> (x >= 5)-
3953 ** (x <= 4.9) -> (x < 5)-
3954 */-
3955 if( pIn3->u.r<(double)iKey ){
pIn3->u.r<(double)iKeyDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 21 times by 1 test
Evaluated by:
  • Self test (438)
12-21
3956 assert( OP_SeekGE==(OP_SeekGT-1) );-
3957 assert( OP_SeekLT==(OP_SeekLE-1) );-
3958 assert( (OP_SeekLE & 0x0001)==(OP_SeekGT & 0x0001) );-
3959 if( (oc & 0x0001)==(OP_SeekGT & 0x0001) ) oc--;
executed 6 times by 1 test: oc--;
Executed by:
  • Self test (438)
(oc & 0x0001)==(25 & 0x0001)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
6
3960 }
executed 12 times by 1 test: end of block
Executed by:
  • Self test (438)
12
3961-
3962 /* If the approximation iKey is smaller than the actual real search-
3963 ** term, substitute <= for < and > for >=. */-
3964 else if( pIn3->u.r>(double)iKey ){
pIn3->u.r>(double)iKeyDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
4-17
3965 assert( OP_SeekLE==(OP_SeekLT+1) );-
3966 assert( OP_SeekGT==(OP_SeekGE+1) );-
3967 assert( (OP_SeekLT & 0x0001)==(OP_SeekGE & 0x0001) );-
3968 if( (oc & 0x0001)==(OP_SeekLT & 0x0001) ) oc++;
executed 7 times by 1 test: oc++;
Executed by:
  • Self test (438)
(oc & 0x0001)==(22 & 0x0001)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
7-10
3969 }
executed 17 times by 1 test: end of block
Executed by:
  • Self test (438)
17
3970 }
executed 33 times by 1 test: end of block
Executed by:
  • Self test (438)
33
3971 rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)iKey, 0, &res);-
3972 pC->movetoTarget = iKey; /* Used by OP_Delete */-
3973 if( rc!=SQLITE_OK ){
rc!=0Description
TRUEevaluated 128 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2840 times by 1 test
Evaluated by:
  • Self test (438)
128-2840
3974 goto abort_due_to_error;
executed 128 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
128
3975 }-
3976 }else{
executed 2840 times by 1 test: end of block
Executed by:
  • Self test (438)
2840
3977 /* For a cursor with the BTREE_SEEK_EQ hint, only the OP_SeekGE and-
3978 ** OP_SeekLE opcodes are allowed, and these must be immediately followed-
3979 ** by an OP_IdxGT or OP_IdxLT opcode, respectively, with the same key.-
3980 */-
3981 if( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ) ){
sqlite3BtreeCu...r, 0x00000002)Description
TRUEevaluated 377683 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 93915 times by 1 test
Evaluated by:
  • Self test (438)
93915-377683
3982 eqOnly = 1;-
3983 assert( pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE );-
3984 assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );-
3985 assert( pOp[1].p1==pOp[0].p1 );-
3986 assert( pOp[1].p2==pOp[0].p2 );-
3987 assert( pOp[1].p3==pOp[0].p3 );-
3988 assert( pOp[1].p4.i==pOp[0].p4.i );-
3989 }
executed 377683 times by 1 test: end of block
Executed by:
  • Self test (438)
377683
3990-
3991 nField = pOp->p4.i;-
3992 assert( pOp->p4type==P4_INT32 );-
3993 assert( nField>0 );-
3994 r.pKeyInfo = pC->pKeyInfo;-
3995 r.nField = (u16)nField;-
3996-
3997 /* The next line of code computes as follows, only faster:-
3998 ** if( oc==OP_SeekGT || oc==OP_SeekLE ){-
3999 ** r.default_rc = -1;-
4000 ** }else{-
4001 ** r.default_rc = +1;-
4002 ** }-
4003 */-
4004 r.default_rc = ((1 & (oc - OP_SeekLT)) ? -1 : +1);
(1 & (oc - 22))Description
TRUEevaluated 7949 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 463649 times by 1 test
Evaluated by:
  • Self test (438)
7949-463649
4005 assert( oc!=OP_SeekGT || r.default_rc==-1 );-
4006 assert( oc!=OP_SeekLE || r.default_rc==-1 );-
4007 assert( oc!=OP_SeekGE || r.default_rc==+1 );-
4008 assert( oc!=OP_SeekLT || r.default_rc==+1 );-
4009-
4010 r.aMem = &aMem[pOp->p3];-
4011#ifdef SQLITE_DEBUG-
4012 { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }-
4013#endif-
4014 r.eqSeen = 0;-
4015 rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, &r, 0, 0, &res);-
4016 if( rc!=SQLITE_OK ){
rc!=0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 471593 times by 1 test
Evaluated by:
  • Self test (438)
5-471593
4017 goto abort_due_to_error;
executed 5 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
5
4018 }-
4019 if( eqOnly && r.eqSeen==0 ){
eqOnlyDescription
TRUEevaluated 377681 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 93912 times by 1 test
Evaluated by:
  • Self test (438)
r.eqSeen==0Description
TRUEevaluated 143683 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 233998 times by 1 test
Evaluated by:
  • Self test (438)
93912-377681
4020 assert( res!=0 );-
4021 goto seek_not_found;
executed 143683 times by 1 test: goto seek_not_found;
Executed by:
  • Self test (438)
143683
4022 }-
4023 }
executed 327910 times by 1 test: end of block
Executed by:
  • Self test (438)
327910
4024 pC->deferredMoveto = 0;-
4025 pC->cacheStatus = CACHE_STALE;-
4026#ifdef SQLITE_TEST-
4027 sqlite3_search_count++;-
4028#endif-
4029 if( oc>=OP_SeekGE ){ assert( oc==OP_SeekGE || oc==OP_SeekGT );
oc>=24Description
TRUEevaluated 329824 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 926 times by 1 test
Evaluated by:
  • Self test (438)
926-329824
4030 if( res<0 || (res==0 && oc==OP_SeekGT) ){
res<0Description
TRUEevaluated 135186 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 194638 times by 1 test
Evaluated by:
  • Self test (438)
res==0Description
TRUEevaluated 2415 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 192223 times by 1 test
Evaluated by:
  • Self test (438)
oc==25Description
TRUEevaluated 301 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2114 times by 1 test
Evaluated by:
  • Self test (438)
301-194638
4031 res = 0;-
4032 rc = sqlite3BtreeNext(pC->uc.pCursor, 0);-
4033 if( rc!=SQLITE_OK ){
rc!=0Description
TRUEevaluated 2839 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 132648 times by 1 test
Evaluated by:
  • Self test (438)
2839-132648
4034 if( rc==SQLITE_DONE ){
rc==101Description
TRUEevaluated 2838 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-2838
4035 rc = SQLITE_OK;-
4036 res = 1;-
4037 }else{
executed 2838 times by 1 test: end of block
Executed by:
  • Self test (438)
2838
4038 goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
1
4039 }-
4040 }-
4041 }else{
executed 135486 times by 1 test: end of block
Executed by:
  • Self test (438)
135486
4042 res = 0;-
4043 }
executed 194337 times by 1 test: end of block
Executed by:
  • Self test (438)
194337
4044 }else{-
4045 assert( oc==OP_SeekLT || oc==OP_SeekLE );-
4046 if( res>0 || (res==0 && oc==OP_SeekLT) ){
res>0Description
TRUEevaluated 414 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 512 times by 1 test
Evaluated by:
  • Self test (438)
res==0Description
TRUEevaluated 214 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 298 times by 1 test
Evaluated by:
  • Self test (438)
oc==22Description
TRUEevaluated 131 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 83 times by 1 test
Evaluated by:
  • Self test (438)
83-512
4047 res = 0;-
4048 rc = sqlite3BtreePrevious(pC->uc.pCursor, 0);-
4049 if( rc!=SQLITE_OK ){
rc!=0Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 532 times by 1 test
Evaluated by:
  • Self test (438)
13-532
4050 if( rc==SQLITE_DONE ){
rc==101Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-12
4051 rc = SQLITE_OK;-
4052 res = 1;-
4053 }else{
executed 12 times by 1 test: end of block
Executed by:
  • Self test (438)
12
4054 goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
1
4055 }-
4056 }-
4057 }else{
executed 544 times by 1 test: end of block
Executed by:
  • Self test (438)
544
4058 /* res might be negative because the table is empty. Check to-
4059 ** see if this is the case.-
4060 */-
4061 res = sqlite3BtreeEof(pC->uc.pCursor);-
4062 }
executed 381 times by 1 test: end of block
Executed by:
  • Self test (438)
381
4063 }-
4064seek_not_found:
code before this statement executed 330748 times by 1 test: seek_not_found:
Executed by:
  • Self test (438)
330748
4065 assert( pOp->p2>0 );-
4066 VdbeBranchTaken(res!=0,2);-
4067 if( res ){
resDescription
TRUEevaluated 146537 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 327894 times by 1 test
Evaluated by:
  • Self test (438)
146537-327894
4068 goto jump_to_p2;
executed 146537 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
146537
4069 }else if( eqOnly ){
eqOnlyDescription
TRUEevaluated 233998 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 93896 times by 1 test
Evaluated by:
  • Self test (438)
93896-233998
4070 assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT );-
4071 pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */-
4072 }
executed 233998 times by 1 test: end of block
Executed by:
  • Self test (438)
233998
4073 break;
executed 327894 times by 1 test: break;
Executed by:
  • Self test (438)
327894
4074}-
4075-
4076/* Opcode: SeekHit P1 P2 * * *-
4077** Synopsis: seekHit=P2-
4078**-
4079** Set the seekHit flag on cursor P1 to the value in P2.-
4080** The seekHit flag is used by the IfNoHope opcode.-
4081**-
4082** P1 must be a valid b-tree cursor. P2 must be a boolean value,-
4083** either 0 or 1.-
4084*/-
4085case
executed 1799 times by 1 test: case 119:
Executed by:
  • Self test (438)
OP_SeekHit: {
executed 1799 times by 1 test: case 119:
Executed by:
  • Self test (438)
1799
4086 VdbeCursor *pC;-
4087 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4088 pC = p->apCsr[pOp->p1];-
4089 assert( pC!=0 );-
4090 assert( pOp->p2==0 || pOp->p2==1 );-
4091 pC->seekHit = pOp->p2 & 1;-
4092 break;
executed 1799 times by 1 test: break;
Executed by:
  • Self test (438)
1799
4093}-
4094-
4095/* Opcode: Found P1 P2 P3 P4 *-
4096** Synopsis: key=r[P3@P4]-
4097**-
4098** If P4==0 then register P3 holds a blob constructed by MakeRecord. If-
4099** P4>0 then register P3 is the first of P4 registers that form an unpacked-
4100** record.-
4101**-
4102** Cursor P1 is on an index btree. If the record identified by P3 and P4-
4103** is a prefix of any entry in P1 then a jump is made to P2 and-
4104** P1 is left pointing at the matching entry.-
4105**-
4106** This operation leaves the cursor in a state where it can be-
4107** advanced in the forward direction. The Next instruction will work,-
4108** but not the Prev instruction.-
4109**-
4110** See also: NotFound, NoConflict, NotExists. SeekGe-
4111*/-
4112/* Opcode: NotFound P1 P2 P3 P4 *-
4113** Synopsis: key=r[P3@P4]-
4114**-
4115** If P4==0 then register P3 holds a blob constructed by MakeRecord. If-
4116** P4>0 then register P3 is the first of P4 registers that form an unpacked-
4117** record.-
4118** -
4119** Cursor P1 is on an index btree. If the record identified by P3 and P4-
4120** is not the prefix of any entry in P1 then a jump is made to P2. If P1 -
4121** does contain an entry whose prefix matches the P3/P4 record then control-
4122** falls through to the next instruction and P1 is left pointing at the-
4123** matching entry.-
4124**-
4125** This operation leaves the cursor in a state where it cannot be-
4126** advanced in either direction. In other words, the Next and Prev-
4127** opcodes do not work after this operation.-
4128**-
4129** See also: Found, NotExists, NoConflict, IfNoHope-
4130*/-
4131/* Opcode: IfNoHope P1 P2 P3 P4 *-
4132** Synopsis: key=r[P3@P4]-
4133**-
4134** Register P3 is the first of P4 registers that form an unpacked-
4135** record.-
4136**-
4137** Cursor P1 is on an index btree. If the seekHit flag is set on P1, then-
4138** this opcode is a no-op. But if the seekHit flag of P1 is clear, then-
4139** check to see if there is any entry in P1 that matches the-
4140** prefix identified by P3 and P4. If no entry matches the prefix,-
4141** jump to P2. Otherwise fall through.-
4142**-
4143** This opcode behaves like OP_NotFound if the seekHit-
4144** flag is clear and it behaves like OP_Noop if the seekHit flag is set.-
4145**-
4146** This opcode is used in IN clause processing for a multi-column key.-
4147** If an IN clause is attached to an element of the key other than the-
4148** left-most element, and if there are no matches on the most recent-
4149** seek over the whole key, then it might be that one of the key element-
4150** to the left is prohibiting a match, and hence there is "no hope" of-
4151** any match regardless of how many IN clause elements are checked.-
4152** In such a case, we abandon the IN clause search early, using this-
4153** opcode. The opcode name comes from the fact that the-
4154** jump is taken if there is "no hope" of achieving a match.-
4155**-
4156** See also: NotFound, SeekHit-
4157*/-
4158/* Opcode: NoConflict P1 P2 P3 P4 *-
4159** Synopsis: key=r[P3@P4]-
4160**-
4161** If P4==0 then register P3 holds a blob constructed by MakeRecord. If-
4162** P4>0 then register P3 is the first of P4 registers that form an unpacked-
4163** record.-
4164** -
4165** Cursor P1 is on an index btree. If the record identified by P3 and P4-
4166** contains any NULL value, jump immediately to P2. If all terms of the-
4167** record are not-NULL then a check is done to determine if any row in the-
4168** P1 index btree has a matching key prefix. If there are no matches, jump-
4169** immediately to P2. If there is a match, fall through and leave the P1-
4170** cursor pointing to the matching row.-
4171**-
4172** This opcode is similar to OP_NotFound with the exceptions that the-
4173** branch is always taken if any part of the search key input is NULL.-
4174**-
4175** This operation leaves the cursor in a state where it cannot be-
4176** advanced in either direction. In other words, the Next and Prev-
4177** opcodes do not work after this operation.-
4178**-
4179** See also: NotFound, Found, NotExists-
4180*/-
4181case
executed 1555 times by 1 test: case 26:
Executed by:
  • Self test (438)
OP_IfNoHope: { /* jump, in3 */
executed 1555 times by 1 test: case 26:
Executed by:
  • Self test (438)
1555
4182 VdbeCursor *pC;-
4183 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4184 pC = p->apCsr[pOp->p1];-
4185 assert( pC!=0 );-
4186 if( pC->seekHit ) break;
executed 536 times by 1 test: break;
Executed by:
  • Self test (438)
pC->seekHitDescription
TRUEevaluated 536 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1019 times by 1 test
Evaluated by:
  • Self test (438)
536-1019
4187 /* Fall through into OP_NotFound */-
4188}-
4189case
code before this statement executed 1019 times by 1 test: case 27:
Executed by:
  • Self test (438)
executed 99886 times by 364 tests: case 27:
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)
  • ...
OP_NoConflict: /* jump, in3 */
code before this statement executed 1019 times by 1 test: case 27:
Executed by:
  • Self test (438)
executed 99886 times by 364 tests: case 27:
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)
  • ...
1019-99886
4190case
executed 9151 times by 1 test: case 28:
Executed by:
  • Self test (438)
OP_NotFound: /* jump, in3 */
executed 9151 times by 1 test: case 28:
Executed by:
  • Self test (438)
9151
4191case
executed 740078 times by 12 tests: case 29:
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)
OP_Found: { /* jump, in3 */
executed 740078 times by 12 tests: case 29:
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)
740078
4192 int alreadyExists;-
4193 int takeJump;-
4194 int ii;-
4195 VdbeCursor *pC;-
4196 int res;-
4197 UnpackedRecord *pFree;-
4198 UnpackedRecord *pIdxKey;-
4199 UnpackedRecord r;-
4200-
4201#ifdef SQLITE_TEST-
4202 if( pOp->opcode!=OP_NoConflict ) sqlite3_found_count++;
executed 750248 times by 12 tests: sqlite3_found_count++;
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)
pOp->opcode!=27Description
TRUEevaluated 750248 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 99886 times by 364 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)
  • ...
99886-750248
4203#endif-
4204-
4205 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4206 assert( pOp->p4type==P4_INT32 );-
4207 pC = p->apCsr[pOp->p1];-
4208 assert( pC!=0 );-
4209#ifdef SQLITE_DEBUG-
4210 pC->seekOp = pOp->opcode;-
4211#endif-
4212 pIn3 = &aMem[pOp->p3];-
4213 assert( pC->eCurType==CURTYPE_BTREE );-
4214 assert( pC->uc.pCursor!=0 );-
4215 assert( pC->isTable==0 );-
4216 if( pOp->p4.i>0 ){
pOp->p4.i>0Description
TRUEevaluated 842687 times by 375 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 7447 times by 1 test
Evaluated by:
  • Self test (438)
7447-842687
4217 r.pKeyInfo = pC->pKeyInfo;-
4218 r.nField = (u16)pOp->p4.i;-
4219 r.aMem = pIn3;-
4220#ifdef SQLITE_DEBUG-
4221 for(ii=0; ii<r.nField; ii++){-
4222 assert( memIsValid(&r.aMem[ii]) );-
4223 assert( (r.aMem[ii].flags & MEM_Zero)==0 || r.aMem[ii].n==0 );-
4224 if( ii ) REGISTER_TRACE(pOp->p3+ii, &r.aMem[ii]);-
4225 }-
4226#endif-
4227 pIdxKey = &r;-
4228 pFree = 0;-
4229 }else{
executed 842687 times by 375 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)
  • ...
842687
4230 assert( pIn3->flags & MEM_Blob );-
4231 rc = ExpandBlob(pIn3);
((pIn3)->flags&0x4000)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 7446 times by 1 test
Evaluated by:
  • Self test (438)
1-7446
4232 assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );-
4233 if( rc ) goto no_mem;
never executed: goto no_mem;
rcDescription
TRUEnever evaluated
FALSEevaluated 7447 times by 1 test
Evaluated by:
  • Self test (438)
0-7447
4234 pFree = pIdxKey = sqlite3VdbeAllocUnpackedRecord(pC->pKeyInfo);-
4235 if( pIdxKey==0 ) goto no_mem;
never executed: goto no_mem;
pIdxKey==0Description
TRUEnever evaluated
FALSEevaluated 7447 times by 1 test
Evaluated by:
  • Self test (438)
0-7447
4236 sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z, pIdxKey);-
4237 }
executed 7447 times by 1 test: end of block
Executed by:
  • Self test (438)
7447
4238 pIdxKey->default_rc = 0;-
4239 takeJump = 0;-
4240 if( pOp->opcode==OP_NoConflict ){
pOp->opcode==27Description
TRUEevaluated 99886 times by 364 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 750248 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)
99886-750248
4241 /* For the OP_NoConflict opcode, take the jump if any of the-
4242 ** input fields are NULL, since any key with a NULL will not-
4243 ** conflict */-
4244 for(ii=0; ii<pIdxKey->nField; ii++){
ii<pIdxKey->nFieldDescription
TRUEevaluated 150417 times by 364 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 99613 times by 364 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)
  • ...
99613-150417
4245 if( pIdxKey->aMem[ii].flags & MEM_Null ){
pIdxKey->aMem[...flags & 0x0001Description
TRUEevaluated 273 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 150144 times by 364 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)
  • ...
273-150144
4246 takeJump = 1;-
4247 break;
executed 273 times by 1 test: break;
Executed by:
  • Self test (438)
273
4248 }-
4249 }
executed 150144 times by 364 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)
  • ...
150144
4250 }
executed 99886 times by 364 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)
  • ...
99886
4251 rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, pIdxKey, 0, 0, &res);-
4252 if( pFree ) sqlite3DbFreeNN(db, pFree);
executed 7447 times by 1 test: sqlite3DbFreeNN(db, pFree);
Executed by:
  • Self test (438)
pFreeDescription
TRUEevaluated 7447 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 842687 times by 375 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)
  • ...
7447-842687
4253 if( rc!=SQLITE_OK ){
rc!=0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 850133 times by 375 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
1-850133
4254 goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
1
4255 }-
4256 pC->seekResult = res;-
4257 alreadyExists = (res==0);-
4258 pC->nullRow = 1-alreadyExists;-
4259 pC->deferredMoveto = 0;-
4260 pC->cacheStatus = CACHE_STALE;-
4261 if( pOp->opcode==OP_Found ){
pOp->opcode==29Description
TRUEevaluated 740077 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 110056 times by 364 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)
  • ...
110056-740077
4262 VdbeBranchTaken(alreadyExists!=0,2);-
4263 if( alreadyExists ) goto jump_to_p2;
executed 731864 times by 12 tests: goto jump_to_p2;
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)
alreadyExistsDescription
TRUEevaluated 731864 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 8213 times by 1 test
Evaluated by:
  • Self test (438)
8213-731864
4264 }else{
executed 8213 times by 1 test: end of block
Executed by:
  • Self test (438)
8213
4265 VdbeBranchTaken(takeJump||alreadyExists==0,2);-
4266 if( takeJump || !alreadyExists ) goto jump_to_p2;
executed 95963 times by 364 tests: goto jump_to_p2;
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)
  • ...
takeJumpDescription
TRUEevaluated 273 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 109783 times by 364 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)
  • ...
!alreadyExistsDescription
TRUEevaluated 95690 times by 364 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 14093 times by 1 test
Evaluated by:
  • Self test (438)
273-109783
4267 }
executed 14093 times by 1 test: end of block
Executed by:
  • Self test (438)
14093
4268 break;
executed 22306 times by 1 test: break;
Executed by:
  • Self test (438)
22306
4269}-
4270-
4271/* Opcode: SeekRowid P1 P2 P3 * *-
4272** Synopsis: intkey=r[P3]-
4273**-
4274** P1 is the index of a cursor open on an SQL table btree (with integer-
4275** keys). If register P3 does not contain an integer or if P1 does not-
4276** contain a record with rowid P3 then jump immediately to P2. -
4277** Or, if P2 is 0, raise an SQLITE_CORRUPT error. If P1 does contain-
4278** a record with rowid P3 then -
4279** leave the cursor pointing at that record and fall through to the next-
4280** instruction.-
4281**-
4282** The OP_NotExists opcode performs the same operation, but with OP_NotExists-
4283** the P3 register must be guaranteed to contain an integer value. With this-
4284** opcode, register P3 might not contain an integer.-
4285**-
4286** The OP_NotFound opcode performs the same operation on index btrees-
4287** (with arbitrary multi-value keys).-
4288**-
4289** This opcode leaves the cursor in a state where it cannot be advanced-
4290** in either direction. In other words, the Next and Prev opcodes will-
4291** not work following this opcode.-
4292**-
4293** See also: Found, NotFound, NoConflict, SeekRowid-
4294*/-
4295/* Opcode: NotExists P1 P2 P3 * *-
4296** Synopsis: intkey=r[P3]-
4297**-
4298** P1 is the index of a cursor open on an SQL table btree (with integer-
4299** keys). P3 is an integer rowid. If P1 does not contain a record with-
4300** rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an-
4301** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then -
4302** leave the cursor pointing at that record and fall through to the next-
4303** instruction.-
4304**-
4305** The OP_SeekRowid opcode performs the same operation but also allows the-
4306** P3 register to contain a non-integer value, in which case the jump is-
4307** always taken. This opcode requires that P3 always contain an integer.-
4308**-
4309** The OP_NotFound opcode performs the same operation on index btrees-
4310** (with arbitrary multi-value keys).-
4311**-
4312** This opcode leaves the cursor in a state where it cannot be advanced-
4313** in either direction. In other words, the Next and Prev opcodes will-
4314** not work following this opcode.-
4315**-
4316** See also: Found, NotFound, NoConflict, SeekRowid-
4317*/-
4318case
executed 93795 times by 28 tests: case 30:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
OP_SeekRowid: { /* jump, in3 */
executed 93795 times by 28 tests: case 30:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
93795
4319 VdbeCursor *pC;-
4320 BtCursor *pCrsr;-
4321 int res;-
4322 u64 iKey;-
4323-
4324 pIn3 = &aMem[pOp->p3];-
4325 if( (pIn3->flags & MEM_Int)==0 ){
(pIn3->flags & 0x0004)==0Description
TRUEevaluated 397 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 93398 times by 28 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
397-93398
4326 /* Make sure pIn3->u.i contains a valid integer representation of-
4327 ** the key value, but do not change the datatype of the register, as-
4328 ** other parts of the perpared statement might be depending on the-
4329 ** current datatype. */-
4330 u16 origFlags = pIn3->flags;-
4331 int isNotInt;-
4332 applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding);-
4333 isNotInt = (pIn3->flags & MEM_Int)==0;-
4334 pIn3->flags = origFlags;-
4335 if( isNotInt ) goto jump_to_p2;
executed 277 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
isNotIntDescription
TRUEevaluated 277 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 120 times by 1 test
Evaluated by:
  • Self test (438)
120-277
4336 }
executed 120 times by 1 test: end of block
Executed by:
  • Self test (438)
120
4337 /* Fall through into OP_NotExists */-
4338case
code before this statement executed 93518 times by 28 tests: case 31:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
executed 381911 times by 1 test: case 31:
Executed by:
  • Self test (438)
OP_NotExists: /* jump, in3 */
code before this statement executed 93518 times by 28 tests: case 31:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
executed 381911 times by 1 test: case 31:
Executed by:
  • Self test (438)
93518-381911
4339 pIn3 = &aMem[pOp->p3];-
4340 assert( (pIn3->flags & MEM_Int)!=0 || pOp->opcode==OP_SeekRowid );-
4341 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4342 pC = p->apCsr[pOp->p1];-
4343 assert( pC!=0 );-
4344#ifdef SQLITE_DEBUG-
4345 pC->seekOp = OP_SeekRowid;-
4346#endif-
4347 assert( pC->isTable );-
4348 assert( pC->eCurType==CURTYPE_BTREE );-
4349 pCrsr = pC->uc.pCursor;-
4350 assert( pCrsr!=0 );-
4351 res = 0;-
4352 iKey = pIn3->u.i;-
4353 rc = sqlite3BtreeMovetoUnpacked(pCrsr, 0, iKey, 0, &res);-
4354 assert( rc==SQLITE_OK || res==0 );-
4355 pC->movetoTarget = iKey; /* Used by OP_Delete */-
4356 pC->nullRow = 0;-
4357 pC->cacheStatus = CACHE_STALE;-
4358 pC->deferredMoveto = 0;-
4359 VdbeBranchTaken(res!=0,2);-
4360 pC->seekResult = res;-
4361 if( res!=0 ){
res!=0Description
TRUEevaluated 337070 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 138359 times by 28 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
138359-337070
4362 assert( rc==SQLITE_OK );-
4363 if( pOp->p2==0 ){
pOp->p2==0Description
TRUEnever evaluated
FALSEevaluated 337070 times by 1 test
Evaluated by:
  • Self test (438)
0-337070
4364 rc = SQLITE_CORRUPT_BKPT;-
4365 }else{
never executed: end of block
0
4366 goto jump_to_p2;
executed 337070 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
337070
4367 }-
4368 }-
4369 if( rc ) goto abort_due_to_error;
executed 5 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 138354 times by 28 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
5-138354
4370 break;
executed 138354 times by 28 tests: break;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • Self test (96)
  • ...
138354
4371}-
4372-
4373/* Opcode: Sequence P1 P2 * * *-
4374** Synopsis: r[P2]=cursor[P1].ctr++-
4375**-
4376** Find the next available sequence number for cursor P1.-
4377** Write the sequence number into register P2.-
4378** The sequence number on the cursor is incremented after this-
4379** instruction. -
4380*/-
4381case
executed 152998 times by 1 test: case 120:
Executed by:
  • Self test (438)
OP_Sequence: { /* out2 */
executed 152998 times by 1 test: case 120:
Executed by:
  • Self test (438)
152998
4382 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4383 assert( p->apCsr[pOp->p1]!=0 );-
4384 assert( p->apCsr[pOp->p1]->eCurType!=CURTYPE_VTAB );-
4385 pOut = out2Prerelease(p, pOp);-
4386 pOut->u.i = p->apCsr[pOp->p1]->seqCount++;-
4387 break;
executed 152998 times by 1 test: break;
Executed by:
  • Self test (438)
152998
4388}-
4389-
4390-
4391/* Opcode: NewRowid P1 P2 P3 * *-
4392** Synopsis: r[P2]=rowid-
4393**-
4394** Get a new integer record number (a.k.a "rowid") used as the key to a table.-
4395** The record number is not previously used as a key in the database-
4396** table that cursor P1 points to. The new record number is written-
4397** written to register P2.-
4398**-
4399** If P3>0 then P3 is a register in the root frame of this VDBE that holds -
4400** the largest previously generated record number. No new record numbers are-
4401** allowed to be less than this value. When this value reaches its maximum, -
4402** an SQLITE_FULL error is generated. The P3 register is updated with the '-
4403** generated record number. This P3 mechanism is used to help implement the-
4404** AUTOINCREMENT feature.-
4405*/-
4406case
executed 4909963 times by 64 tests: case 121:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • ...
OP_NewRowid: { /* out2 */
executed 4909963 times by 64 tests: case 121:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • ...
4909963
4407 i64 v; /* The new rowid */-
4408 VdbeCursor *pC; /* Cursor of table to get the new rowid */-
4409 int res; /* Result of an sqlite3BtreeLast() */-
4410 int cnt; /* Counter to limit the number of searches */-
4411 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */-
4412 VdbeFrame *pFrame; /* Root frame of VDBE */-
4413-
4414 v = 0;-
4415 res = 0;-
4416 pOut = out2Prerelease(p, pOp);-
4417 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4418 pC = p->apCsr[pOp->p1];-
4419 assert( pC!=0 );-
4420 assert( pC->isTable );-
4421 assert( pC->eCurType==CURTYPE_BTREE );-
4422 assert( pC->uc.pCursor!=0 );-
4423 {-
4424 /* The next rowid or record number (different terms for the same-
4425 ** thing) is obtained in a two-step algorithm.-
4426 **-
4427 ** First we attempt to find the largest existing rowid and add one-
4428 ** to that. But if the largest existing rowid is already the maximum-
4429 ** positive integer, we have to fall through to the second-
4430 ** probabilistic algorithm-
4431 **-
4432 ** The second algorithm is to select a rowid at random and see if-
4433 ** it already exists in the table. If it does not exist, we have-
4434 ** succeeded. If the random rowid does exist, we select a new one-
4435 ** and try again, up to 100 times.-
4436 */-
4437 assert( pC->isTable );-
4438-
4439#ifdef SQLITE_32BIT_ROWID-
4440# define MAX_ROWID 0x7fffffff-
4441#else-
4442 /* Some compilers complain about constants of the form 0x7fffffffffffffff.-
4443 ** Others complain about 0x7ffffffffffffffffLL. The following macro seems-
4444 ** to provide the constant while making all compilers happy.-
4445 */-
4446# define MAX_ROWID (i64)( (((u64)0x7fffffff)<<32) | (u64)0xffffffff )-
4447#endif-
4448-
4449 if( !pC->useRandomRowid ){
!pC->useRandomRowidDescription
TRUEevaluated 4909963 times by 64 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • ...
FALSEnever evaluated
0-4909963
4450 rc = sqlite3BtreeLast(pC->uc.pCursor, &res);-
4451 if( rc!=SQLITE_OK ){
rc!=0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4909958 times by 64 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • ...
5-4909958
4452 goto abort_due_to_error;
executed 5 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
5
4453 }-
4454 if( res ){
resDescription
TRUEevaluated 1058505 times by 34 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (2)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (55)
  • Self test (56)
  • Self test (57)
  • Self test (58)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • ...
FALSEevaluated 3851453 times by 58 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (31)
  • Self test (32)
  • Self test (33)
  • Self test (38)
  • ...
1058505-3851453
4455 v = 1; /* IMP: R-61914-48074 */-
4456 }else{
executed 1058505 times by 34 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (2)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (55)
  • Self test (56)
  • Self test (57)
  • Self test (58)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • ...
1058505
4457 assert( sqlite3BtreeCursorIsValid(pC->uc.pCursor) );-
4458 v = sqlite3BtreeIntegerKey(pC->uc.pCursor);-
4459 if( v>=MAX_ROWID ){
v>=(i64)( (((u...4)0xffffffff )Description
TRUEevaluated 102 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3851351 times by 58 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (31)
  • Self test (32)
  • Self test (33)
  • Self test (38)
  • ...
102-3851351
4460 pC->useRandomRowid = 1;-
4461 }else{
executed 102 times by 1 test: end of block
Executed by:
  • Self test (438)
102
4462 v++; /* IMP: R-29538-34987 */-
4463 }
executed 3851351 times by 58 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 (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (31)
  • Self test (32)
  • Self test (33)
  • Self test (38)
  • ...
3851351
4464 }-
4465 }-
4466-
4467#ifndef SQLITE_OMIT_AUTOINCREMENT-
4468 if( pOp->p3 ){
pOp->p3Description
TRUEevaluated 87 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4909871 times by 64 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • ...
87-4909871
4469 /* Assert that P3 is a valid memory cell. */-
4470 assert( pOp->p3>0 );-
4471 if( p->pFrame ){
p->pFrameDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test (438)
28-59
4472 for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
executed 8 times by 1 test: ;
Executed by:
  • Self test (438)
pFrame->pParentDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 28 times by 1 test
Evaluated by:
  • Self test (438)
8-28
4473 /* Assert that P3 is a valid memory cell. */-
4474 assert( pOp->p3<=pFrame->nMem );-
4475 pMem = &pFrame->aMem[pOp->p3];-
4476 }else{
executed 28 times by 1 test: end of block
Executed by:
  • Self test (438)
28
4477 /* Assert that P3 is a valid memory cell. */-
4478 assert( pOp->p3<=(p->nMem+1 - p->nCursor) );-
4479 pMem = &aMem[pOp->p3];-
4480 memAboutToChange(p, pMem);-
4481 }
executed 59 times by 1 test: end of block
Executed by:
  • Self test (438)
59
4482 assert( memIsValid(pMem) );-
4483-
4484 REGISTER_TRACE(pOp->p3, pMem);-
4485 sqlite3VdbeMemIntegerify(pMem);-
4486 assert( (pMem->flags & MEM_Int)!=0 ); /* mem(P3) holds an integer */-
4487 if( pMem->u.i==MAX_ROWID || pC->useRandomRowid ){
pMem->u.i==(i6...4)0xffffffff )Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 86 times by 1 test
Evaluated by:
  • Self test (438)
pC->useRandomRowidDescription
TRUEnever evaluated
FALSEevaluated 86 times by 1 test
Evaluated by:
  • Self test (438)
0-86
4488 rc = SQLITE_FULL; /* IMP: R-17817-00630 */-
4489 goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
1
4490 }-
4491 if( v<pMem->u.i+1 ){
v<pMem->u.i+1Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 74 times by 1 test
Evaluated by:
  • Self test (438)
12-74
4492 v = pMem->u.i + 1;-
4493 }
executed 12 times by 1 test: end of block
Executed by:
  • Self test (438)
12
4494 pMem->u.i = v;-
4495 }
executed 86 times by 1 test: end of block
Executed by:
  • Self test (438)
86
4496#endif-
4497 if( pC->useRandomRowid ){
pC->useRandomRowidDescription
TRUEevaluated 101 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4909856 times by 64 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • ...
101-4909856
4498 /* IMPLEMENTATION-OF: R-07677-41881 If the largest ROWID is equal to the-
4499 ** largest possible integer (9223372036854775807) then the database-
4500 ** engine starts picking positive candidate ROWIDs at random until-
4501 ** it finds one that is not previously used. */-
4502 assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is-
4503 ** an AUTOINCREMENT table. */-
4504 cnt = 0;-
4505 do{-
4506 sqlite3_randomness(sizeof(v), &v);-
4507 v &= (MAX_ROWID>>1); v++; /* Ensure that v is greater than zero */-
4508 }while( ((rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)v,
executed 5150 times by 1 test: end of block
Executed by:
  • Self test (438)
((rc = sqlite3... 0, &res))==0)Description
TRUEevaluated 5150 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-5150
4509 0, &res))==SQLITE_OK)
((rc = sqlite3... 0, &res))==0)Description
TRUEevaluated 5150 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-5150
4510 && (res==0)
(res==0)Description
TRUEevaluated 5050 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 100 times by 1 test
Evaluated by:
  • Self test (438)
100-5050
4511 && (++cnt<100));
(++cnt<100)Description
TRUEevaluated 5049 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-5049
4512 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 101 times by 1 test
Evaluated by:
  • Self test (438)
0-101
4513 if( res==0 ){
res==0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 100 times by 1 test
Evaluated by:
  • Self test (438)
1-100
4514 rc = SQLITE_FULL; /* IMP: R-38219-53002 */-
4515 goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
1
4516 }-
4517 assert( v>0 ); /* EV: R-40812-03570 */-
4518 }
executed 100 times by 1 test: end of block
Executed by:
  • Self test (438)
100
4519 pC->deferredMoveto = 0;-
4520 pC->cacheStatus = CACHE_STALE;-
4521 }-
4522 pOut->u.i = v;-
4523 break;
executed 4909956 times by 64 tests: break;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • ...
4909956
4524}-
4525-
4526/* Opcode: Insert P1 P2 P3 P4 P5-
4527** Synopsis: intkey=r[P3] data=r[P2]-
4528**-
4529** Write an entry into the table of cursor P1. A new entry is-
4530** created if it doesn't already exist or the data for an existing-
4531** entry is overwritten. The data is the value MEM_Blob stored in register-
4532** number P2. The key is stored in register P3. The key must-
4533** be a MEM_Int.-
4534**-
4535** If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is-
4536** incremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set,-
4537** then rowid is stored for subsequent return by the-
4538** sqlite3_last_insert_rowid() function (otherwise it is unmodified).-
4539**-
4540** If the OPFLAG_USESEEKRESULT flag of P5 is set, the implementation might-
4541** run faster by avoiding an unnecessary seek on cursor P1. However,-
4542** the OPFLAG_USESEEKRESULT flag must only be set if there have been no prior-
4543** seeks on the cursor or if the most recent seek used a key equal to P3.-
4544**-
4545** If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an-
4546** UPDATE operation. Otherwise (if the flag is clear) then this opcode-
4547** is part of an INSERT operation. The difference is only important to-
4548** the update hook.-
4549**-
4550** Parameter P4 may point to a Table structure, or may be NULL. If it is -
4551** not NULL, then the update-hook (sqlite3.xUpdateCallback) is invoked -
4552** following a successful insert.-
4553**-
4554** (WARNING/TODO: If P1 is a pseudo-cursor and P2 is dynamically-
4555** allocated, then ownership of P2 is transferred to the pseudo-cursor-
4556** and register P2 becomes ephemeral. If the cursor is changed, the-
4557** value of register P2 will then change. Make sure this does not-
4558** cause any problems.)-
4559**-
4560** This instruction only works on tables. The equivalent instruction-
4561** for indices is OP_IdxInsert.-
4562*/-
4563/* Opcode: InsertInt P1 P2 P3 P4 P5-
4564** Synopsis: intkey=P3 data=r[P2]-
4565**-
4566** This works exactly like OP_Insert except that the key is the-
4567** integer value P3, not the value of the integer stored in register P3.-
4568*/-
4569case
executed 5414515 times by 390 tests: case 122:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • ...
OP_Insert:
executed 5414515 times by 390 tests: case 122:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • ...
5414515
4570case
executed 157 times by 1 test: case 123:
Executed by:
  • Self test (438)
OP_InsertInt: {
executed 157 times by 1 test: case 123:
Executed by:
  • Self test (438)
157
4571 Mem *pData; /* MEM cell holding data for the record to be inserted */-
4572 Mem *pKey; /* MEM cell holding key for the record */-
4573 VdbeCursor *pC; /* Cursor to table into which insert is written */-
4574 int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */-
4575 const char *zDb; /* database name - used by the update hook */-
4576 Table *pTab; /* Table structure - used by update and pre-update hooks */-
4577 BtreePayload x; /* Payload to be inserted */-
4578-
4579 pData = &aMem[pOp->p2];-
4580 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4581 assert( memIsValid(pData) );-
4582 pC = p->apCsr[pOp->p1];-
4583 assert( pC!=0 );-
4584 assert( pC->eCurType==CURTYPE_BTREE );-
4585 assert( pC->uc.pCursor!=0 );-
4586 assert( (pOp->p5 & OPFLAG_ISNOOP) || pC->isTable );-
4587 assert( pOp->p4type==P4_TABLE || pOp->p4type>=P4_STATIC );-
4588 REGISTER_TRACE(pOp->p2, pData);-
4589 sqlite3VdbeIncrWriteCounter(p, pC);-
4590-
4591 if( pOp->opcode==OP_Insert ){
pOp->opcode==122Description
TRUEevaluated 5414515 times by 390 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • ...
FALSEevaluated 157 times by 1 test
Evaluated by:
  • Self test (438)
157-5414515
4592 pKey = &aMem[pOp->p3];-
4593 assert( pKey->flags & MEM_Int );-
4594 assert( memIsValid(pKey) );-
4595 REGISTER_TRACE(pOp->p3, pKey);-
4596 x.nKey = pKey->u.i;-
4597 }else{
executed 5414515 times by 390 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 (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • ...
5414515
4598 assert( pOp->opcode==OP_InsertInt );-
4599 x.nKey = pOp->p3;-
4600 }
executed 157 times by 1 test: end of block
Executed by:
  • Self test (438)
157
4601-
4602 if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){
pOp->p4type==(-6)Description
TRUEevaluated 3265951 times by 377 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • ...
FALSEevaluated 2148721 times by 32 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
((db)->xUpdateCallback)Description
TRUEevaluated 25 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3265926 times by 377 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • ...
25-3265951
4603 assert( pC->iDb>=0 );-
4604 zDb = db->aDb[pC->iDb].zDbSName;-
4605 pTab = pOp->p4.pTab;-
4606 assert( (pOp->p5 & OPFLAG_ISNOOP) || HasRowid(pTab) );-
4607 }else{
executed 25 times by 1 test: end of block
Executed by:
  • Self test (438)
25
4608 pTab = 0;-
4609 zDb = 0; /* Not needed. Silence a compiler warning. */-
4610 }
executed 5414647 times by 390 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 (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • ...
5414647
4611-
4612#ifdef SQLITE_ENABLE_PREUPDATE_HOOK-
4613 /* Invoke the pre-update hook, if any */-
4614 if( pTab ){-
4615 if( db->xPreUpdateCallback && !(pOp->p5 & OPFLAG_ISUPDATE) ){-
4616 sqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, x.nKey,pOp->p2);-
4617 }-
4618 if( db->xUpdateCallback==0 || pTab->aCol==0 ){-
4619 /* Prevent post-update hook from running in cases when it should not */-
4620 pTab = 0;-
4621 }-
4622 }-
4623 if( pOp->p5 & OPFLAG_ISNOOP ) break;-
4624#endif-
4625-
4626 if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
executed 3265951 times by 377 tests: p->nChange++;
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • ...
pOp->p5 & 0x01Description
TRUEevaluated 3265951 times by 377 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • ...
FALSEevaluated 2148721 times by 32 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • ...
2148721-3265951
4627 if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = x.nKey;
executed 3166431 times by 51 tests: db->lastRowid = x.nKey;
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • Self test (33)
  • Self test (38)
  • Self test (39)
  • Self test (41)
  • Self test (438)
  • Self test (47)
  • ...
pOp->p5 & 0x20Description
TRUEevaluated 3166431 times by 51 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • Self test (33)
  • Self test (38)
  • Self test (39)
  • Self test (41)
  • Self test (438)
  • Self test (47)
  • ...
FALSEevaluated 2248241 times by 365 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • 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)
  • Self test (129)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • ...
2248241-3166431
4628 assert( pData->flags & (MEM_Blob|MEM_Str) );-
4629 x.pData = pData->z;-
4630 x.nData = pData->n;-
4631 seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0);
(pOp->p5 & 0x10)Description
TRUEevaluated 3096404 times by 59 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (13)
  • Self test (14)
  • Self test (15)
  • Self test (17)
  • Self test (18)
  • Self test (19)
  • Self test (2)
  • Self test (21)
  • Self test (22)
  • Self test (23)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (3)
  • Self test (31)
  • Self test (32)
  • Self test (33)
  • ...
FALSEevaluated 2318268 times by 362 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • 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)
  • Self test (129)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • ...
2318268-3096404
4632 if( pData->flags & MEM_Zero ){
pData->flags & 0x4000Description
TRUEevaluated 6793 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5407879 times by 390 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • ...
6793-5407879
4633 x.nZero = pData->u.nZero;-
4634 }else{
executed 6793 times by 1 test: end of block
Executed by:
  • Self test (438)
6793
4635 x.nZero = 0;-
4636 }
executed 5407879 times by 390 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 (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • ...
5407879
4637 x.pKey = 0;-
4638 rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,-
4639 (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION)), seekResult-
4640 );-
4641 pC->deferredMoveto = 0;-
4642 pC->cacheStatus = CACHE_STALE;-
4643-
4644 /* Invoke the update-hook if required. */-
4645 if( rc ) goto abort_due_to_error;
executed 37 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 37 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5414536 times by 387 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (12)
  • 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 (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • ...
37-5414536
4646 if( pTab ){
pTabDescription
TRUEevaluated 25 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5414511 times by 387 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (12)
  • 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 (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • ...
25-5414511
4647 assert( db->xUpdateCallback!=0 );-
4648 assert( pTab->aCol!=0 );-
4649 db->xUpdateCallback(db->pUpdateArg,-
4650 (pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT,-
4651 zDb, pTab->zName, x.nKey);-
4652 }
executed 25 times by 1 test: end of block
Executed by:
  • Self test (438)
25
4653 break;
executed 5414536 times by 387 tests: break;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (11)
  • Self test (12)
  • 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 (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • ...
5414536
4654}-
4655-
4656/* Opcode: Delete P1 P2 P3 P4 P5-
4657**-
4658** Delete the record at which the P1 cursor is currently pointing.-
4659**-
4660** If the OPFLAG_SAVEPOSITION bit of the P5 parameter is set, then-
4661** the cursor will be left pointing at either the next or the previous-
4662** record in the table. If it is left pointing at the next record, then-
4663** the next Next instruction will be a no-op. As a result, in this case-
4664** it is ok to delete a record from within a Next loop. If -
4665** OPFLAG_SAVEPOSITION bit of P5 is clear, then the cursor will be-
4666** left in an undefined state.-
4667**-
4668** If the OPFLAG_AUXDELETE bit is set on P5, that indicates that this-
4669** delete one of several associated with deleting a table row and all its-
4670** associated index entries. Exactly one of those deletes is the "primary"-
4671** delete. The others are all on OPFLAG_FORDELETE cursors or else are-
4672** marked with the AUXDELETE flag.-
4673**-
4674** If the OPFLAG_NCHANGE flag of P2 (NB: P2 not P5) is set, then the row-
4675** change count is incremented (otherwise not).-
4676**-
4677** P1 must not be pseudo-table. It has to be a real table with-
4678** multiple rows.-
4679**-
4680** If P4 is not NULL then it points to a Table object. In this case either -
4681** the update or pre-update hook, or both, may be invoked. The P1 cursor must-
4682** have been positioned using OP_NotFound prior to invoking this opcode in -
4683** this case. Specifically, if one is configured, the pre-update hook is -
4684** invoked if P4 is not NULL. The update-hook is invoked if one is configured, -
4685** P4 is not NULL, and the OPFLAG_NCHANGE flag is set in P2.-
4686**-
4687** If the OPFLAG_ISUPDATE flag is set in P2, then P3 contains the address-
4688** of the memory cell that contains the value that the rowid of the row will-
4689** be set to by the update.-
4690*/-
4691case
executed 1646235 times by 7 tests: case 124:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (40)
  • Self test (438)
  • Self test (47)
OP_Delete: {
executed 1646235 times by 7 tests: case 124:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (40)
  • Self test (438)
  • Self test (47)
1646235
4692 VdbeCursor *pC;-
4693 const char *zDb;-
4694 Table *pTab;-
4695 int opflags;-
4696-
4697 opflags = pOp->p2;-
4698 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4699 pC = p->apCsr[pOp->p1];-
4700 assert( pC!=0 );-
4701 assert( pC->eCurType==CURTYPE_BTREE );-
4702 assert( pC->uc.pCursor!=0 );-
4703 assert( pC->deferredMoveto==0 );-
4704 sqlite3VdbeIncrWriteCounter(p, pC);-
4705-
4706#ifdef SQLITE_DEBUG-
4707 if( pOp->p4type==P4_TABLE && HasRowid(pOp->p4.pTab) && pOp->p5==0 ){-
4708 /* If p5 is zero, the seek operation that positioned the cursor prior to-
4709 ** OP_Delete will have also set the pC->movetoTarget field to the rowid of-
4710 ** the row that is being deleted */-
4711 i64 iKey = sqlite3BtreeIntegerKey(pC->uc.pCursor);-
4712 assert( pC->movetoTarget==iKey );-
4713 }-
4714#endif-
4715-
4716 /* If the update-hook or pre-update-hook will be invoked, set zDb to-
4717 ** the name of the db to pass as to it. Also set local pTab to a copy-
4718 ** of p4.pTab. Finally, if p5 is true, indicating that this cursor was-
4719 ** last moved with OP_Next or OP_Prev, not Seek or NotFound, set -
4720 ** VdbeCursor.movetoTarget to the current rowid. */-
4721 if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){
pOp->p4type==(-6)Description
TRUEevaluated 452603 times by 4 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (40)
  • Self test (438)
FALSEevaluated 1193632 times by 4 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
((db)->xUpdateCallback)Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 452587 times by 4 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (40)
  • Self test (438)
16-1193632
4722 assert( pC->iDb>=0 );-
4723 assert( pOp->p4.pTab!=0 );-
4724 zDb = db->aDb[pC->iDb].zDbSName;-
4725 pTab = pOp->p4.pTab;-
4726 if( (pOp->p5 & OPFLAG_SAVEPOSITION)!=0 && pC->isTable ){
(pOp->p5 & 0x02)!=0Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
pC->isTableDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
4-12
4727 pC->movetoTarget = sqlite3BtreeIntegerKey(pC->uc.pCursor);-
4728 }
executed 8 times by 1 test: end of block
Executed by:
  • Self test (438)
8
4729 }else{
executed 16 times by 1 test: end of block
Executed by:
  • Self test (438)
16
4730 zDb = 0; /* Not needed. Silence a compiler warning. */-
4731 pTab = 0; /* Not needed. Silence a compiler warning. */-
4732 }
executed 1646219 times by 7 tests: end of block
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (40)
  • Self test (438)
  • Self test (47)
1646219
4733-
4734#ifdef SQLITE_ENABLE_PREUPDATE_HOOK-
4735 /* Invoke the pre-update-hook if required. */-
4736 if( db->xPreUpdateCallback && pOp->p4.pTab ){-
4737 assert( !(opflags & OPFLAG_ISUPDATE) -
4738 || HasRowid(pTab)==0 -
4739 || (aMem[pOp->p3].flags & MEM_Int) -
4740 );-
4741 sqlite3VdbePreUpdateHook(p, pC,-
4742 (opflags & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_DELETE, -
4743 zDb, pTab, pC->movetoTarget,-
4744 pOp->p3-
4745 );-
4746 }-
4747 if( opflags & OPFLAG_ISNOOP ) break;-
4748#endif-
4749 -
4750 /* Only flags that can be set are SAVEPOISTION and AUXDELETE */ -
4751 assert( (pOp->p5 & ~(OPFLAG_SAVEPOSITION|OPFLAG_AUXDELETE))==0 );-
4752 assert( OPFLAG_SAVEPOSITION==BTREE_SAVEPOSITION );-
4753 assert( OPFLAG_AUXDELETE==BTREE_AUXDELETE );-
4754-
4755#ifdef SQLITE_DEBUG-
4756 if( p->pFrame==0 ){-
4757 if( pC->isEphemeral==0-
4758 && (pOp->p5 & OPFLAG_AUXDELETE)==0-
4759 && (pC->wrFlag & OPFLAG_FORDELETE)==0-
4760 ){-
4761 nExtraDelete++;-
4762 }-
4763 if( pOp->p2 & OPFLAG_NCHANGE ){-
4764 nExtraDelete--;-
4765 }-
4766 }-
4767#endif-
4768-
4769 rc = sqlite3BtreeDelete(pC->uc.pCursor, pOp->p5);-
4770 pC->cacheStatus = CACHE_STALE;-
4771 pC->seekResult = 0;-
4772 if( rc ) goto abort_due_to_error;
executed 2 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1646233 times by 7 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (40)
  • Self test (438)
  • Self test (47)
2-1646233
4773-
4774 /* Invoke the update-hook if required. */-
4775 if( opflags & OPFLAG_NCHANGE ){
opflags & 0x01Description
TRUEevaluated 447449 times by 4 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (40)
  • Self test (438)
FALSEevaluated 1198784 times by 4 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
447449-1198784
4776 p->nChange++;-
4777 if( db->xUpdateCallback && HasRowid(pTab) ){
db->xUpdateCallbackDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 447435 times by 4 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (40)
  • Self test (438)
(((pTab)->tabF... & 0x0020)==0)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
4-447435
4778 db->xUpdateCallback(db->pUpdateArg, SQLITE_DELETE, zDb, pTab->zName,-
4779 pC->movetoTarget);-
4780 assert( pC->iDb>=0 );-
4781 }
executed 10 times by 1 test: end of block
Executed by:
  • Self test (438)
10
4782 }
executed 447449 times by 4 tests: end of block
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (40)
  • Self test (438)
447449
4783-
4784 break;
executed 1646233 times by 7 tests: break;
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (32)
  • Self test (33)
  • Self test (40)
  • Self test (438)
  • Self test (47)
1646233
4785}-
4786/* Opcode: ResetCount * * * * *-
4787**-
4788** The value of the change counter is copied to the database handle-
4789** change counter (returned by subsequent calls to sqlite3_changes()).-
4790** Then the VMs internal change counter resets to 0.-
4791** This is used by trigger programs.-
4792*/-
4793case
executed 5170 times by 1 test: case 125:
Executed by:
  • Self test (438)
OP_ResetCount: {
executed 5170 times by 1 test: case 125:
Executed by:
  • Self test (438)
5170
4794 sqlite3VdbeSetChanges(db, p->nChange);-
4795 p->nChange = 0;-
4796 break;
executed 5170 times by 1 test: break;
Executed by:
  • Self test (438)
5170
4797}-
4798-
4799/* Opcode: SorterCompare P1 P2 P3 P4-
4800** Synopsis: if key(P1)!=trim(r[P3],P4) goto P2-
4801**-
4802** P1 is a sorter cursor. This instruction compares a prefix of the-
4803** record blob in register P3 against a prefix of the entry that -
4804** the sorter cursor currently points to. Only the first P4 fields-
4805** of r[P3] and the sorter record are compared.-
4806**-
4807** If either P3 or the sorter contains a NULL in one of their significant-
4808** fields (not counting the P4 fields at the end which are ignored) then-
4809** the comparison is assumed to be equal.-
4810**-
4811** Fall through to next instruction if the two records compare equal to-
4812** each other. Jump to P2 if they are different.-
4813*/-
4814case
executed 41078 times by 1 test: case 126:
Executed by:
  • Self test (438)
OP_SorterCompare: {
executed 41078 times by 1 test: case 126:
Executed by:
  • Self test (438)
41078
4815 VdbeCursor *pC;-
4816 int res;-
4817 int nKeyCol;-
4818-
4819 pC = p->apCsr[pOp->p1];-
4820 assert( isSorter(pC) );-
4821 assert( pOp->p4type==P4_INT32 );-
4822 pIn3 = &aMem[pOp->p3];-
4823 nKeyCol = pOp->p4.i;-
4824 res = 0;-
4825 rc = sqlite3VdbeSorterCompare(pC, pIn3, nKeyCol, &res);-
4826 VdbeBranchTaken(res!=0,2);-
4827 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 41078 times by 1 test
Evaluated by:
  • Self test (438)
0-41078
4828 if( res ) goto jump_to_p2;
executed 41060 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
resDescription
TRUEevaluated 41060 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 18 times by 1 test
Evaluated by:
  • Self test (438)
18-41060
4829 break;
executed 18 times by 1 test: break;
Executed by:
  • Self test (438)
18
4830};-
4831-
4832/* Opcode: SorterData P1 P2 P3 * *-
4833** Synopsis: r[P2]=data-
4834**-
4835** Write into register P2 the current sorter data for sorter cursor P1.-
4836** Then clear the column header cache on cursor P3.-
4837**-
4838** This opcode is normally use to move a record out of the sorter and into-
4839** a register that is the source for a pseudo-table cursor created using-
4840** OpenPseudo. That pseudo-table cursor is the one that is identified by-
4841** parameter P3. Clearing the P3 column cache as part of this opcode saves-
4842** us from having to issue a separate NullRow instruction to clear that cache.-
4843*/-
4844case
executed 2312005 times by 4 tests: case 127:
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
OP_SorterData: {
executed 2312005 times by 4 tests: case 127:
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
2312005
4845 VdbeCursor *pC;-
4846-
4847 pOut = &aMem[pOp->p2];-
4848 pC = p->apCsr[pOp->p1];-
4849 assert( isSorter(pC) );-
4850 rc = sqlite3VdbeSorterRowkey(pC, pOut);-
4851 assert( rc!=SQLITE_OK || (pOut->flags & MEM_Blob) );-
4852 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4853 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 2312005 times by 4 tests
Evaluated by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
0-2312005
4854 p->apCsr[pOp->p3]->cacheStatus = CACHE_STALE;-
4855 break;
executed 2312005 times by 4 tests: break;
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
2312005
4856}-
4857-
4858/* Opcode: RowData P1 P2 P3 * *-
4859** Synopsis: r[P2]=data-
4860**-
4861** Write into register P2 the complete row content for the row at -
4862** which cursor P1 is currently pointing.-
4863** There is no interpretation of the data. -
4864** It is just copied onto the P2 register exactly as -
4865** it is found in the database file.-
4866**-
4867** If cursor P1 is an index, then the content is the key of the row.-
4868** If cursor P2 is a table, then the content extracted is the data.-
4869**-
4870** If the P1 cursor must be pointing to a valid row (not a NULL row)-
4871** of a real table, not a pseudo-table.-
4872**-
4873** If P3!=0 then this opcode is allowed to make an ephemeral pointer-
4874** into the database page. That means that the content of the output-
4875** register will be invalidated as soon as the cursor moves - including-
4876** moves caused by other cursors that "save" the current cursors-
4877** position in order that they can write to the same table. If P3==0-
4878** then a copy of the data is made into memory. P3!=0 is faster, but-
4879** P3==0 is safer.-
4880**-
4881** If P3!=0 then the content of the P2 register is unsuitable for use-
4882** in OP_Result and any OP_Result will invalidate the P2 register content.-
4883** The P2 register content is invalidated by opcodes like OP_Function or-
4884** by any use of another cursor pointing to the same table.-
4885*/-
4886case
executed 1656463 times by 1 test: case 128:
Executed by:
  • Self test (438)
OP_RowData: {
executed 1656463 times by 1 test: case 128:
Executed by:
  • Self test (438)
1656463
4887 VdbeCursor *pC;-
4888 BtCursor *pCrsr;-
4889 u32 n;-
4890-
4891 pOut = out2Prerelease(p, pOp);-
4892-
4893 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4894 pC = p->apCsr[pOp->p1];-
4895 assert( pC!=0 );-
4896 assert( pC->eCurType==CURTYPE_BTREE );-
4897 assert( isSorter(pC)==0 );-
4898 assert( pC->nullRow==0 );-
4899 assert( pC->uc.pCursor!=0 );-
4900 pCrsr = pC->uc.pCursor;-
4901-
4902 /* The OP_RowData opcodes always follow OP_NotExists or-
4903 ** OP_SeekRowid or OP_Rewind/Op_Next with no intervening instructions-
4904 ** that might invalidate the cursor.-
4905 ** If this where not the case, on of the following assert()s-
4906 ** would fail. Should this ever change (because of changes in the code-
4907 ** generator) then the fix would be to insert a call to-
4908 ** sqlite3VdbeCursorMoveto().-
4909 */-
4910 assert( pC->deferredMoveto==0 );-
4911 assert( sqlite3BtreeCursorIsValid(pCrsr) );-
4912#if 0 /* Not required due to the previous to assert() statements */-
4913 rc = sqlite3VdbeCursorMoveto(pC);-
4914 if( rc!=SQLITE_OK ) goto abort_due_to_error;-
4915#endif-
4916-
4917 n = sqlite3BtreePayloadSize(pCrsr);-
4918 if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){
n>(u32)db->aLimit[0]Description
TRUEnever evaluated
FALSEevaluated 1656463 times by 1 test
Evaluated by:
  • Self test (438)
0-1656463
4919 goto too_big;
never executed: goto too_big;
0
4920 }-
4921 testcase( n==0 );-
4922 rc = sqlite3VdbeMemFromBtree(pCrsr, 0, n, pOut);-
4923 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 1656463 times by 1 test
Evaluated by:
  • Self test (438)
0-1656463
4924 if( !pOp->p3 ) Deephemeralize(pOut);
never executed: goto no_mem;
!pOp->p3Description
TRUEevaluated 1123917 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 532546 times by 1 test
Evaluated by:
  • Self test (438)
((pOut)->flags&0x1000)!=0Description
TRUEevaluated 1114900 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 9017 times by 1 test
Evaluated by:
  • Self test (438)
sqlite3VdbeMem...riteable(pOut)Description
TRUEnever evaluated
FALSEevaluated 1114900 times by 1 test
Evaluated by:
  • Self test (438)
0-1123917
4925 UPDATE_MAX_BLOBSIZE(pOut);-
4926 REGISTER_TRACE(pOp->p2, pOut);-
4927 break;
executed 1656463 times by 1 test: break;
Executed by:
  • Self test (438)
1656463
4928}-
4929-
4930/* Opcode: Rowid P1 P2 * * *-
4931** Synopsis: r[P2]=rowid-
4932**-
4933** Store in register P2 an integer which is the key of the table entry that-
4934** P1 is currently point to.-
4935**-
4936** P1 can be either an ordinary table or a virtual table. There used to-
4937** be a separate OP_VRowid opcode for use with virtual tables, but this-
4938** one opcode now works for both table types.-
4939*/-
4940case
executed 3500526 times by 389 tests: case 129:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
OP_Rowid: { /* out2 */
executed 3500526 times by 389 tests: case 129:
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
3500526
4941 VdbeCursor *pC;-
4942 i64 v;-
4943 sqlite3_vtab *pVtab;-
4944 const sqlite3_module *pModule;-
4945-
4946 pOut = out2Prerelease(p, pOp);-
4947 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4948 pC = p->apCsr[pOp->p1];-
4949 assert( pC!=0 );-
4950 assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow );-
4951 if( pC->nullRow ){
pC->nullRowDescription
TRUEevaluated 50 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3500476 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
50-3500476
4952 pOut->flags = MEM_Null;-
4953 break;
executed 50 times by 1 test: break;
Executed by:
  • Self test (438)
50
4954 }else if( pC->deferredMoveto ){
pC->deferredMovetoDescription
TRUEevaluated 115172 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3385304 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
115172-3385304
4955 v = pC->movetoTarget;-
4956#ifndef SQLITE_OMIT_VIRTUALTABLE-
4957 }else if( pC->eCurType==CURTYPE_VTAB ){
executed 115172 times by 1 test: end of block
Executed by:
  • Self test (438)
pC->eCurType==2Description
TRUEevaluated 92320 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3292984 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
92320-3292984
4958 assert( pC->uc.pVCur!=0 );-
4959 pVtab = pC->uc.pVCur->pVtab;-
4960 pModule = pVtab->pModule;-
4961 assert( pModule->xRowid );-
4962 rc = pModule->xRowid(pC->uc.pVCur, &v);-
4963 sqlite3VtabImportErrmsg(p, pVtab);-
4964 if( rc ) goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 92319 times by 1 test
Evaluated by:
  • Self test (438)
1-92319
4965#endif /* SQLITE_OMIT_VIRTUALTABLE */-
4966 }else{
executed 92319 times by 1 test: end of block
Executed by:
  • Self test (438)
92319
4967 assert( pC->eCurType==CURTYPE_BTREE );-
4968 assert( pC->uc.pCursor!=0 );-
4969 rc = sqlite3VdbeCursorRestore(pC);-
4970 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 3292984 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • ...
0-3292984
4971 if( pC->nullRow ){
pC->nullRowDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3292979 times by 389 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
5-3292979
4972 pOut->flags = MEM_Null;-
4973 break;
executed 5 times by 1 test: break;
Executed by:
  • Self test (438)
5
4974 }-
4975 v = sqlite3BtreeIntegerKey(pC->uc.pCursor);-
4976 }
executed 3292979 times by 389 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
3292979
4977 pOut->u.i = v;-
4978 break;
executed 3500470 times by 389 tests: break;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (110)
  • Self test (111)
  • Self test (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)
  • ...
3500470
4979}-
4980-
4981/* Opcode: NullRow P1 * * * *-
4982**-
4983** Move the cursor P1 to a null row. Any OP_Column operations-
4984** that occur while the cursor is on the null row will always-
4985** write a NULL.-
4986*/-
4987case
executed 1133865 times by 1 test: case 130:
Executed by:
  • Self test (438)
OP_NullRow: {
executed 1133865 times by 1 test: case 130:
Executed by:
  • Self test (438)
1133865
4988 VdbeCursor *pC;-
4989-
4990 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
4991 pC = p->apCsr[pOp->p1];-
4992 assert( pC!=0 );-
4993 pC->nullRow = 1;-
4994 pC->cacheStatus = CACHE_STALE;-
4995 if( pC->eCurType==CURTYPE_BTREE ){
pC->eCurType==0Description
TRUEevaluated 11614 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1122251 times by 1 test
Evaluated by:
  • Self test (438)
11614-1122251
4996 assert( pC->uc.pCursor!=0 );-
4997 sqlite3BtreeClearCursor(pC->uc.pCursor);-
4998 }
executed 11614 times by 1 test: end of block
Executed by:
  • Self test (438)
11614
4999#ifdef SQLITE_DEBUG-
5000 if( pC->seekOp==0 ) pC->seekOp = OP_NullRow;-
5001#endif-
5002 break;
executed 1133865 times by 1 test: break;
Executed by:
  • Self test (438)
1133865
5003}-
5004-
5005/* Opcode: SeekEnd P1 * * * *-
5006**-
5007** Position cursor P1 at the end of the btree for the purpose of-
5008** appending a new entry onto the btree.-
5009**-
5010** It is assumed that the cursor is used only for appending and so-
5011** if the cursor is valid, then the cursor must already be pointing-
5012** at the end of the btree and so no changes are made to-
5013** the cursor.-
5014*/-
5015/* Opcode: Last P1 P2 * * *-
5016**-
5017** The next use of the Rowid or Column or Prev instruction for P1 -
5018** will refer to the last entry in the database table or index.-
5019** If the table or index is empty and P2>0, then jump immediately to P2.-
5020** If P2 is 0 or if the table or index is not empty, fall through-
5021** to the following instruction.-
5022**-
5023** This opcode leaves the cursor configured to move in reverse order,-
5024** from the end toward the beginning. In other words, the cursor is-
5025** configured to use Prev, not Next.-
5026*/-
5027case
executed 1269633 times by 4 tests: case 131:
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
OP_SeekEnd:
executed 1269633 times by 4 tests: case 131:
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
1269633
5028case
executed 146836 times by 1 test: case 32:
Executed by:
  • Self test (438)
OP_Last: { /* jump */
executed 146836 times by 1 test: case 32:
Executed by:
  • Self test (438)
146836
5029 VdbeCursor *pC;-
5030 BtCursor *pCrsr;-
5031 int res;-
5032-
5033 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
5034 pC = p->apCsr[pOp->p1];-
5035 assert( pC!=0 );-
5036 assert( pC->eCurType==CURTYPE_BTREE );-
5037 pCrsr = pC->uc.pCursor;-
5038 res = 0;-
5039 assert( pCrsr!=0 );-
5040#ifdef SQLITE_DEBUG-
5041 pC->seekOp = pOp->opcode;-
5042#endif-
5043 if( pOp->opcode==OP_SeekEnd ){
pOp->opcode==131Description
TRUEevaluated 1269633 times by 4 tests
Evaluated by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
FALSEevaluated 146836 times by 1 test
Evaluated by:
  • Self test (438)
146836-1269633
5044 assert( pOp->p2==0 );-
5045 pC->seekResult = -1;-
5046 if( sqlite3BtreeCursorIsValidNN(pCrsr) ){
sqlite3BtreeCu...ValidNN(pCrsr)Description
TRUEevaluated 1037710 times by 4 tests
Evaluated by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
FALSEevaluated 231923 times by 4 tests
Evaluated by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
231923-1037710
5047 break;
executed 1037710 times by 4 tests: break;
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
1037710
5048 }-
5049 }
executed 231923 times by 4 tests: end of block
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
231923
5050 rc = sqlite3BtreeLast(pCrsr, &res);-
5051 pC->nullRow = (u8)res;-
5052 pC->deferredMoveto = 0;-
5053 pC->cacheStatus = CACHE_STALE;-
5054 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 378759 times by 4 tests
Evaluated by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
0-378759
5055 if( pOp->p2>0 ){
pOp->p2>0Description
TRUEevaluated 9187 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 369572 times by 4 tests
Evaluated by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
9187-369572
5056 VdbeBranchTaken(res!=0,2);-
5057 if( res ) goto jump_to_p2;
executed 226 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
resDescription
TRUEevaluated 226 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 8961 times by 1 test
Evaluated by:
  • Self test (438)
226-8961
5058 }
executed 8961 times by 1 test: end of block
Executed by:
  • Self test (438)
8961
5059 break;
executed 378533 times by 4 tests: break;
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
378533
5060}-
5061-
5062/* Opcode: IfSmaller P1 P2 P3 * *-
5063**-
5064** Estimate the number of rows in the table P1. Jump to P2 if that-
5065** estimate is less than approximately 2**(0.1*P3).-
5066*/-
5067case
executed 8 times by 1 test: case 33:
Executed by:
  • Self test (438)
OP_IfSmaller: { /* jump */
executed 8 times by 1 test: case 33:
Executed by:
  • Self test (438)
8
5068 VdbeCursor *pC;-
5069 BtCursor *pCrsr;-
5070 int res;-
5071 i64 sz;-
5072-
5073 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
5074 pC = p->apCsr[pOp->p1];-
5075 assert( pC!=0 );-
5076 pCrsr = pC->uc.pCursor;-
5077 assert( pCrsr );-
5078 rc = sqlite3BtreeFirst(pCrsr, &res);-
5079 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
0-8
5080 if( res==0 ){
res==0Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-8
5081 sz = sqlite3BtreeRowCountEst(pCrsr);-
5082 if( ALWAYS(sz>=0) && sqlite3LogEst((u64)sz)<pOp->p3 ) res = 1;
executed 7 times by 1 test: res = 1;
Executed by:
  • Self test (438)
(sz>=0)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
sqlite3LogEst((u64)sz)<pOp->p3Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
0-8
5083 }
executed 8 times by 1 test: end of block
Executed by:
  • Self test (438)
8
5084 VdbeBranchTaken(res!=0,2);-
5085 if( res ) goto jump_to_p2;
executed 7 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
resDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-7
5086 break;
executed 1 time by 1 test: break;
Executed by:
  • Self test (438)
1
5087}-
5088-
5089-
5090/* Opcode: SorterSort P1 P2 * * *-
5091**-
5092** After all records have been inserted into the Sorter object-
5093** identified by P1, invoke this opcode to actually do the sorting.-
5094** Jump to P2 if there are no records to be sorted.-
5095**-
5096** This opcode is an alias for OP_Sort and OP_Rewind that is used-
5097** for Sorter objects.-
5098*/-
5099/* Opcode: Sort P1 P2 * * *-
5100**-
5101** This opcode does exactly the same thing as OP_Rewind except that-
5102** it increments an undocumented global variable used for testing.-
5103**-
5104** Sorting is accomplished by writing records into a sorting index,-
5105** then rewinding that index and playing it back from beginning to-
5106** end. We use the OP_Sort opcode instead of OP_Rewind to do the-
5107** rewinding so that the global variable will be incremented and-
5108** regression tests can determine whether or not the optimizer is-
5109** correctly optimizing out sorts.-
5110*/-
5111case
executed 19891 times by 10 tests: case 34:
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)
OP_SorterSort: /* jump */
executed 19891 times by 10 tests: case 34:
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)
19891
5112case
executed 1668 times by 1 test: case 35:
Executed by:
  • Self test (438)
OP_Sort: { /* jump */
executed 1668 times by 1 test: case 35:
Executed by:
  • Self test (438)
1668
5113#ifdef SQLITE_TEST-
5114 sqlite3_sort_count++;-
5115 sqlite3_search_count--;-
5116#endif-
5117 p->aCounter[SQLITE_STMTSTATUS_SORT]++;-
5118 /* Fall through into OP_Rewind */-
5119}-
5120/* Opcode: Rewind P1 P2 * * P5-
5121**-
5122** The next use of the Rowid or Column or Next instruction for P1 -
5123** will refer to the first entry in the database table or index.-
5124** If the table or index is empty, jump immediately to P2.-
5125** If the table or index is not empty, fall through to the following -
5126** instruction.-
5127**-
5128** If P5 is non-zero and the table is not empty, then the "skip-next"-
5129** flag is set on the cursor so that the next OP_Next instruction -
5130** executed on it is a no-op.-
5131**-
5132** This opcode leaves the cursor configured to move in forward order,-
5133** from the beginning toward the end. In other words, the cursor is-
5134** configured to use Next, not Prev.-
5135*/-
5136case
code before this statement executed 21559 times by 10 tests: case 36:
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)
executed 1468222 times by 435 tests: case 36:
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)
  • ...
OP_Rewind: { /* jump */
code before this statement executed 21559 times by 10 tests: case 36:
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)
executed 1468222 times by 435 tests: case 36:
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)
  • ...
21559-1468222
5137 VdbeCursor *pC;-
5138 BtCursor *pCrsr;-
5139 int res;-
5140-
5141 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
5142 pC = p->apCsr[pOp->p1];-
5143 assert( pC!=0 );-
5144 assert( isSorter(pC)==(pOp->opcode==OP_SorterSort) );-
5145 res = 1;-
5146#ifdef SQLITE_DEBUG-
5147 pC->seekOp = OP_Rewind;-
5148#endif-
5149 if( isSorter(pC) ){
((pC)->eCurType==1)Description
TRUEevaluated 19891 times by 10 tests
Evaluated 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)
FALSEevaluated 1469890 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)
  • ...
19891-1469890
5150 rc = sqlite3VdbeSorterRewind(pC, &res);-
5151 }else{
executed 19891 times by 10 tests: end of block
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)
19891
5152 assert( pC->eCurType==CURTYPE_BTREE );-
5153 pCrsr = pC->uc.pCursor;-
5154 assert( pCrsr );-
5155 rc = sqlite3BtreeFirst(pCrsr, &res);-
5156#ifndef SQLITE_OMIT_WINDOWFUNC-
5157 if( pOp->p5 ) sqlite3BtreeSkipNext(pCrsr);
executed 33588 times by 1 test: sqlite3BtreeSkipNext(pCrsr);
Executed by:
  • Self test (438)
pOp->p5Description
TRUEevaluated 33588 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1436302 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)
  • ...
33588-1436302
5158#endif-
5159 pC->deferredMoveto = 0;-
5160 pC->cacheStatus = CACHE_STALE;-
5161 }
executed 1469890 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)
  • ...
1469890
5162 if( rc ) goto abort_due_to_error;
executed 21 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 21 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1489760 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)
  • ...
21-1489760
5163 pC->nullRow = (u8)res;-
5164 assert( pOp->p2>0 && pOp->p2<p->nOp );-
5165 VdbeBranchTaken(res!=0,2);-
5166 if( res ) goto jump_to_p2;
executed 47129 times by 42 tests: goto jump_to_p2;
Executed by:
  • 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 (43)
  • Self test (438)
  • Self test (45)
  • Self test (47)
  • Self test (48)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • ...
resDescription
TRUEevaluated 47129 times by 42 tests
Evaluated by:
  • 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 (43)
  • Self test (438)
  • Self test (45)
  • Self test (47)
  • Self test (48)
  • Self test (53)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • ...
FALSEevaluated 1442631 times by 434 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)
  • ...
47129-1442631
5167 break;
executed 1442631 times by 434 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)
  • ...
1442631
5168}-
5169-
5170/* Opcode: Next P1 P2 P3 P4 P5-
5171**-
5172** Advance cursor P1 so that it points to the next key/data pair in its-
5173** table or index. If there are no more key/value pairs then fall through-
5174** to the following instruction. But if the cursor advance was successful,-
5175** jump immediately to P2.-
5176**-
5177** The Next opcode is only valid following an SeekGT, SeekGE, or-
5178** OP_Rewind opcode used to position the cursor. Next is not allowed-
5179** to follow SeekLT, SeekLE, or OP_Last.-
5180**-
5181** The P1 cursor must be for a real table, not a pseudo-table. P1 must have-
5182** been opened prior to this opcode or the program will segfault.-
5183**-
5184** The P3 value is a hint to the btree implementation. If P3==1, that-
5185** means P1 is an SQL index and that this instruction could have been-
5186** omitted if that index had been unique. P3 is usually 0. P3 is-
5187** always either 0 or 1.-
5188**-
5189** P4 is always of type P4_ADVANCE. The function pointer points to-
5190** sqlite3BtreeNext().-
5191**-
5192** If P5 is positive and the jump is taken, then event counter-
5193** number P5-1 in the prepared statement is incremented.-
5194**-
5195** See also: Prev-
5196*/-
5197/* Opcode: Prev P1 P2 P3 P4 P5-
5198**-
5199** Back up cursor P1 so that it points to the previous key/data pair in its-
5200** table or index. If there is no previous key/value pairs then fall through-
5201** to the following instruction. But if the cursor backup was successful,-
5202** jump immediately to P2.-
5203**-
5204**-
5205** The Prev opcode is only valid following an SeekLT, SeekLE, or-
5206** OP_Last opcode used to position the cursor. Prev is not allowed-
5207** to follow SeekGT, SeekGE, or OP_Rewind.-
5208**-
5209** The P1 cursor must be for a real table, not a pseudo-table. If P1 is-
5210** not open then the behavior is undefined.-
5211**-
5212** The P3 value is a hint to the btree implementation. If P3==1, that-
5213** means P1 is an SQL index and that this instruction could have been-
5214** omitted if that index had been unique. P3 is usually 0. P3 is-
5215** always either 0 or 1.-
5216**-
5217** P4 is always of type P4_ADVANCE. The function pointer points to-
5218** sqlite3BtreePrevious().-
5219**-
5220** If P5 is positive and the jump is taken, then event counter-
5221** number P5-1 in the prepared statement is incremented.-
5222*/-
5223/* Opcode: SorterNext P1 P2 * * P5-
5224**-
5225** This opcode works just like OP_Next except that P1 must be a-
5226** sorter object for which the OP_SorterSort opcode has been-
5227** invoked. This opcode advances the cursor to the next sorted-
5228** record, or jumps to P2 if there are no more sorted records.-
5229*/-
5230case
executed 2311718 times by 4 tests: case 3:
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
OP_SorterNext: { /* jump */
executed 2311718 times by 4 tests: case 3:
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
2311718
5231 VdbeCursor *pC;-
5232-
5233 pC = p->apCsr[pOp->p1];-
5234 assert( isSorter(pC) );-
5235 rc = sqlite3VdbeSorterNext(db, pC);-
5236 goto next_tail;
executed 2311718 times by 4 tests: goto next_tail;
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
2311718
5237case
executed 110359 times by 1 test: case 4:
Executed by:
  • Self test (438)
OP_Prev: /* jump */
executed 110359 times by 1 test: case 4:
Executed by:
  • Self test (438)
110359
5238case
executed 20460391 times by 434 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)
  • ...
OP_Next: /* jump */
executed 20460391 times by 434 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)
  • ...
20460391
5239 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
5240 assert( pOp->p5<ArraySize(p->aCounter) );-
5241 pC = p->apCsr[pOp->p1];-
5242 assert( pC!=0 );-
5243 assert( pC->deferredMoveto==0 );-
5244 assert( pC->eCurType==CURTYPE_BTREE );-
5245 assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite3BtreeNext );-
5246 assert( pOp->opcode!=OP_Prev || pOp->p4.xAdvance==sqlite3BtreePrevious );-
5247-
5248 /* The Next opcode is only used after SeekGT, SeekGE, Rewind, and Found.-
5249 ** The Prev opcode is only used after SeekLT, SeekLE, and Last. */-
5250 assert( pOp->opcode!=OP_Next-
5251 || pC->seekOp==OP_SeekGT || pC->seekOp==OP_SeekGE-
5252 || pC->seekOp==OP_Rewind || pC->seekOp==OP_Found -
5253 || pC->seekOp==OP_NullRow);-
5254 assert( pOp->opcode!=OP_Prev-
5255 || pC->seekOp==OP_SeekLT || pC->seekOp==OP_SeekLE-
5256 || pC->seekOp==OP_Last -
5257 || pC->seekOp==OP_NullRow);-
5258-
5259 rc = pOp->p4.xAdvance(pC->uc.pCursor, pOp->p3);-
5260next_tail:
code before this statement executed 20570750 times by 434 tests: next_tail:
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)
  • ...
20570750
5261 pC->cacheStatus = CACHE_STALE;-
5262 VdbeBranchTaken(rc==SQLITE_OK,2);-
5263 if( rc==SQLITE_OK ){
rc==0Description
TRUEevaluated 22535387 times by 415 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 347081 times by 434 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)
  • ...
347081-22535387
5264 pC->nullRow = 0;-
5265 p->aCounter[pOp->p5]++;-
5266#ifdef SQLITE_TEST-
5267 sqlite3_search_count++;-
5268#endif-
5269 goto jump_to_p2_and_check_for_interrupt;
executed 22535387 times by 415 tests: goto jump_to_p2_and_check_for_interrupt;
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)
  • ...
22535387
5270 }-
5271 if( rc!=SQLITE_DONE ) goto abort_due_to_error;
executed 32 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rc!=101Description
TRUEevaluated 32 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 347049 times by 434 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)
  • ...
32-347049
5272 rc = SQLITE_OK;-
5273 pC->nullRow = 1;-
5274 goto check_for_interrupt;
executed 347049 times by 434 tests: goto check_for_interrupt;
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)
  • ...
347049
5275}-
5276-
5277/* Opcode: IdxInsert P1 P2 P3 P4 P5-
5278** Synopsis: key=r[P2]-
5279**-
5280** Register P2 holds an SQL index key made using the-
5281** MakeRecord instructions. This opcode writes that key-
5282** into the index P1. Data for the entry is nil.-
5283**-
5284** If P4 is not zero, then it is the number of values in the unpacked-
5285** key of reg(P2). In that case, P3 is the index of the first register-
5286** for the unpacked key. The availability of the unpacked key can sometimes-
5287** be an optimization.-
5288**-
5289** If P5 has the OPFLAG_APPEND bit set, that is a hint to the b-tree layer-
5290** that this insert is likely to be an append.-
5291**-
5292** If P5 has the OPFLAG_NCHANGE bit set, then the change counter is-
5293** incremented by this instruction. If the OPFLAG_NCHANGE bit is clear,-
5294** then the change counter is unchanged.-
5295**-
5296** If the OPFLAG_USESEEKRESULT flag of P5 is set, the implementation might-
5297** run faster by avoiding an unnecessary seek on cursor P1. However,-
5298** the OPFLAG_USESEEKRESULT flag must only be set if there have been no prior-
5299** seeks on the cursor or if the most recent seek used a key equivalent-
5300** to P2. -
5301**-
5302** This instruction only works for indices. The equivalent instruction-
5303** for tables is OP_Insert.-
5304*/-
5305/* Opcode: SorterInsert P1 P2 * * *-
5306** Synopsis: key=r[P2]-
5307**-
5308** Register P2 holds an SQL index key made using the-
5309** MakeRecord instructions. This opcode writes that key-
5310** into the sorter P1. Data for the entry is nil.-
5311*/-
5312case
executed 2368907 times by 4 tests: case 132:
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
OP_SorterInsert: /* in2 */
executed 2368907 times by 4 tests: case 132:
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
2368907
5313case
executed 2381124 times by 361 tests: case 133:
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • ...
OP_IdxInsert: { /* in2 */
executed 2381124 times by 361 tests: case 133:
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • ...
2381124
5314 VdbeCursor *pC;-
5315 BtreePayload x;-
5316-
5317 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
5318 pC = p->apCsr[pOp->p1];-
5319 sqlite3VdbeIncrWriteCounter(p, pC);-
5320 assert( pC!=0 );-
5321 assert( isSorter(pC)==(pOp->opcode==OP_SorterInsert) );-
5322 pIn2 = &aMem[pOp->p2];-
5323 assert( pIn2->flags & MEM_Blob );-
5324 if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
executed 11151 times by 1 test: p->nChange++;
Executed by:
  • Self test (438)
pOp->p5 & 0x01Description
TRUEevaluated 11151 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4738880 times by 361 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • ...
11151-4738880
5325 assert( pC->eCurType==CURTYPE_BTREE || pOp->opcode==OP_SorterInsert );-
5326 assert( pC->isTable==0 );-
5327 rc = ExpandBlob(pIn2);
((pIn2)->flags&0x4000)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4750024 times by 361 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • ...
7-4750024
5328 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 4750031 times by 361 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • ...
0-4750031
5329 if( pOp->opcode==OP_SorterInsert ){
pOp->opcode==132Description
TRUEevaluated 2368907 times by 4 tests
Evaluated by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
FALSEevaluated 2381124 times by 361 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • ...
2368907-2381124
5330 rc = sqlite3VdbeSorterWrite(pC, pIn2);-
5331 }else{
executed 2368907 times by 4 tests: end of block
Executed by:
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
2368907
5332 x.nKey = pIn2->n;-
5333 x.pKey = pIn2->z;-
5334 x.aMem = aMem + pOp->p3;-
5335 x.nMem = (u16)pOp->p4.i;-
5336 rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,-
5337 (pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION)), -
5338 ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)-
5339 );-
5340 assert( pC->deferredMoveto==0 );-
5341 pC->cacheStatus = CACHE_STALE;-
5342 }
executed 2381100 times by 358 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • ...
2381100
5343 if( rc) goto abort_due_to_error;
executed 5 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4750002 times by 358 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • ...
5-4750002
5344 break;
executed 4750002 times by 358 tests: break;
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (11)
  • 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)
  • Self test (129)
  • Self test (13)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • ...
4750002
5345}-
5346-
5347/* Opcode: IdxDelete P1 P2 P3 * *-
5348** Synopsis: key=r[P2@P3]-
5349**-
5350** The content of P3 registers starting at register P2 form-
5351** an unpacked index key. This opcode removes that entry from the -
5352** index opened by cursor P1.-
5353*/-
5354case
executed 112740 times by 347 tests: case 134:
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)
  • ...
OP_IdxDelete: {
executed 112740 times by 347 tests: case 134:
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)
  • ...
112740
5355 VdbeCursor *pC;-
5356 BtCursor *pCrsr;-
5357 int res;-
5358 UnpackedRecord r;-
5359-
5360 assert( pOp->p3>0 );-
5361 assert( pOp->p2>0 && pOp->p2+pOp->p3<=(p->nMem+1 - p->nCursor)+1 );-
5362 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
5363 pC = p->apCsr[pOp->p1];-
5364 assert( pC!=0 );-
5365 assert( pC->eCurType==CURTYPE_BTREE );-
5366 sqlite3VdbeIncrWriteCounter(p, pC);-
5367 pCrsr = pC->uc.pCursor;-
5368 assert( pCrsr!=0 );-
5369 assert( pOp->p5==0 );-
5370 r.pKeyInfo = pC->pKeyInfo;-
5371 r.nField = (u16)pOp->p3;-
5372 r.default_rc = 0;-
5373 r.aMem = &aMem[pOp->p2];-
5374 rc = sqlite3BtreeMovetoUnpacked(pCrsr, &r, 0, 0, &res);-
5375 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 112740 times by 347 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-112740
5376 if( res==0 ){
res==0Description
TRUEevaluated 112487 times by 347 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)
  • ...
FALSEevaluated 253 times by 1 test
Evaluated by:
  • Self test (438)
253-112487
5377 rc = sqlite3BtreeDelete(pCrsr, BTREE_AUXDELETE);-
5378 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 112363 times by 337 tests
Evaluated by:
  • Self test (10)
  • 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)
  • Self test (129)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • ...
0-112363
5379 }
executed 112363 times by 337 tests: end of block
Executed by:
  • Self test (10)
  • 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)
  • Self test (129)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • ...
112363
5380 assert( pC->deferredMoveto==0 );-
5381 pC->cacheStatus = CACHE_STALE;-
5382 pC->seekResult = 0;-
5383 break;
executed 112616 times by 337 tests: break;
Executed by:
  • Self test (10)
  • 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)
  • Self test (129)
  • Self test (130)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • ...
112616
5384}-
5385-
5386/* Opcode: DeferredSeek P1 * P3 P4 *-
5387** Synopsis: Move P3 to P1.rowid if needed-
5388**-
5389** P1 is an open index cursor and P3 is a cursor on the corresponding-
5390** table. This opcode does a deferred seek of the P3 table cursor-
5391** to the row that corresponds to the current row of P1.-
5392**-
5393** This is a deferred seek. Nothing actually happens until-
5394** the cursor is used to read a record. That way, if no reads-
5395** occur, no unnecessary I/O happens.-
5396**-
5397** P4 may be an array of integers (type P4_INTARRAY) containing-
5398** one entry for each column in the P3 table. If array entry a(i)-
5399** is non-zero, then reading column a(i)-1 from cursor P3 is -
5400** equivalent to performing the deferred seek and then reading column i -
5401** from P1. This information is stored in P3 and used to redirect-
5402** reads against P3 over to P1, thus possibly avoiding the need to-
5403** seek and read cursor P3.-
5404*/-
5405/* Opcode: IdxRowid P1 P2 * * *-
5406** Synopsis: r[P2]=rowid-
5407**-
5408** Write into register P2 an integer which is the last entry in the record at-
5409** the end of the index key pointed to by cursor P1. This integer should be-
5410** the rowid of the table entry to which this index entry points.-
5411**-
5412** See also: Rowid, MakeRecord.-
5413*/-
5414case
executed 824095 times by 1 test: case 135:
Executed by:
  • Self test (438)
OP_DeferredSeek:
executed 824095 times by 1 test: case 135:
Executed by:
  • Self test (438)
824095
5415case
executed 949736 times by 1 test: case 136:
Executed by:
  • Self test (438)
OP_IdxRowid: { /* out2 */
executed 949736 times by 1 test: case 136:
Executed by:
  • Self test (438)
949736
5416 VdbeCursor *pC; /* The P1 index cursor */-
5417 VdbeCursor *pTabCur; /* The P2 table cursor (OP_DeferredSeek only) */-
5418 i64 rowid; /* Rowid that P1 current points to */-
5419-
5420 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
5421 pC = p->apCsr[pOp->p1];-
5422 assert( pC!=0 );-
5423 assert( pC->eCurType==CURTYPE_BTREE );-
5424 assert( pC->uc.pCursor!=0 );-
5425 assert( pC->isTable==0 );-
5426 assert( pC->deferredMoveto==0 );-
5427 assert( !pC->nullRow || pOp->opcode==OP_IdxRowid );-
5428-
5429 /* The IdxRowid and Seek opcodes are combined because of the commonality-
5430 ** of sqlite3VdbeCursorRestore() and sqlite3VdbeIdxRowid(). */-
5431 rc = sqlite3VdbeCursorRestore(pC);-
5432-
5433 /* sqlite3VbeCursorRestore() can only fail if the record has been deleted-
5434 ** out from under the cursor. That will never happens for an IdxRowid-
5435 ** or Seek opcode */-
5436 if( NEVER(rc!=SQLITE_OK) ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
(rc!=0)Description
TRUEnever evaluated
FALSEevaluated 1773831 times by 1 test
Evaluated by:
  • Self test (438)
0-1773831
5437-
5438 if( !pC->nullRow ){
!pC->nullRowDescription
TRUEevaluated 1773778 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 53 times by 1 test
Evaluated by:
  • Self test (438)
53-1773778
5439 rowid = 0; /* Not needed. Only used to silence a warning. */-
5440 rc = sqlite3VdbeIdxRowid(db, pC->uc.pCursor, &rowid);-
5441 if( rc!=SQLITE_OK ){
rc!=0Description
TRUEnever evaluated
FALSEevaluated 1773778 times by 1 test
Evaluated by:
  • Self test (438)
0-1773778
5442 goto abort_due_to_error;
never executed: goto abort_due_to_error;
0
5443 }-
5444 if( pOp->opcode==OP_DeferredSeek ){
pOp->opcode==135Description
TRUEevaluated 824095 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 949683 times by 1 test
Evaluated by:
  • Self test (438)
824095-949683
5445 assert( pOp->p3>=0 && pOp->p3<p->nCursor );-
5446 pTabCur = p->apCsr[pOp->p3];-
5447 assert( pTabCur!=0 );-
5448 assert( pTabCur->eCurType==CURTYPE_BTREE );-
5449 assert( pTabCur->uc.pCursor!=0 );-
5450 assert( pTabCur->isTable );-
5451 pTabCur->nullRow = 0;-
5452 pTabCur->movetoTarget = rowid;-
5453 pTabCur->deferredMoveto = 1;-
5454 assert( pOp->p4type==P4_INTARRAY || pOp->p4.ai==0 );-
5455 pTabCur->aAltMap = pOp->p4.ai;-
5456 pTabCur->pAltCursor = pC;-
5457 }else{
executed 824095 times by 1 test: end of block
Executed by:
  • Self test (438)
824095
5458 pOut = out2Prerelease(p, pOp);-
5459 pOut->u.i = rowid;-
5460 }
executed 949683 times by 1 test: end of block
Executed by:
  • Self test (438)
949683
5461 }else{-
5462 assert( pOp->opcode==OP_IdxRowid );-
5463 sqlite3VdbeMemSetNull(&aMem[pOp->p2]);-
5464 }
executed 53 times by 1 test: end of block
Executed by:
  • Self test (438)
53
5465 break;
executed 1773831 times by 1 test: break;
Executed by:
  • Self test (438)
1773831
5466}-
5467-
5468/* Opcode: IdxGE P1 P2 P3 P4 P5-
5469** Synopsis: key=r[P3@P4]-
5470**-
5471** The P4 register values beginning with P3 form an unpacked index -
5472** key that omits the PRIMARY KEY. Compare this key value against the index -
5473** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID -
5474** fields at the end.-
5475**-
5476** If the P1 index entry is greater than or equal to the key value-
5477** then jump to P2. Otherwise fall through to the next instruction.-
5478*/-
5479/* Opcode: IdxGT P1 P2 P3 P4 P5-
5480** Synopsis: key=r[P3@P4]-
5481**-
5482** The P4 register values beginning with P3 form an unpacked index -
5483** key that omits the PRIMARY KEY. Compare this key value against the index -
5484** that P1 is currently pointing to, ignoring the PRIMARY KEY or ROWID -
5485** fields at the end.-
5486**-
5487** If the P1 index entry is greater than the key value-
5488** then jump to P2. Otherwise fall through to the next instruction.-
5489*/-
5490/* Opcode: IdxLT P1 P2 P3 P4 P5-
5491** Synopsis: key=r[P3@P4]-
5492**-
5493** The P4 register values beginning with P3 form an unpacked index -
5494** key that omits the PRIMARY KEY or ROWID. Compare this key value against-
5495** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or-
5496** ROWID on the P1 index.-
5497**-
5498** If the P1 index entry is less than the key value then jump to P2.-
5499** Otherwise fall through to the next instruction.-
5500*/-
5501/* Opcode: IdxLE P1 P2 P3 P4 P5-
5502** Synopsis: key=r[P3@P4]-
5503**-
5504** The P4 register values beginning with P3 form an unpacked index -
5505** key that omits the PRIMARY KEY or ROWID. Compare this key value against-
5506** the index that P1 is currently pointing to, ignoring the PRIMARY KEY or-
5507** ROWID on the P1 index.-
5508**-
5509** If the P1 index entry is less than or equal to the key value then jump-
5510** to P2. Otherwise fall through to the next instruction.-
5511*/-
5512case
executed 144120 times by 1 test: case 37:
Executed by:
  • Self test (438)
OP_IdxLE: /* jump */
executed 144120 times by 1 test: case 37:
Executed by:
  • Self test (438)
144120
5513case
executed 1033908 times by 8 tests: case 38:
Executed by:
  • Self test (438)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
OP_IdxGT: /* jump */
executed 1033908 times by 8 tests: case 38:
Executed by:
  • Self test (438)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
1033908
5514case
executed 2795 times by 1 test: case 39:
Executed by:
  • Self test (438)
OP_IdxLT: /* jump */
executed 2795 times by 1 test: case 39:
Executed by:
  • Self test (438)
2795
5515case
executed 208567 times by 1 test: case 40:
Executed by:
  • Self test (438)
OP_IdxGE: { /* jump */
executed 208567 times by 1 test: case 40:
Executed by:
  • Self test (438)
208567
5516 VdbeCursor *pC;-
5517 int res;-
5518 UnpackedRecord r;-
5519-
5520 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
5521 pC = p->apCsr[pOp->p1];-
5522 assert( pC!=0 );-
5523 assert( pC->isOrdered );-
5524 assert( pC->eCurType==CURTYPE_BTREE );-
5525 assert( pC->uc.pCursor!=0);-
5526 assert( pC->deferredMoveto==0 );-
5527 assert( pOp->p5==0 || pOp->p5==1 );-
5528 assert( pOp->p4type==P4_INT32 );-
5529 r.pKeyInfo = pC->pKeyInfo;-
5530 r.nField = (u16)pOp->p4.i;-
5531 if( pOp->opcode<OP_IdxLT ){
pOp->opcode<39Description
TRUEevaluated 1178028 times by 8 tests
Evaluated by:
  • Self test (438)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
FALSEevaluated 211362 times by 1 test
Evaluated by:
  • Self test (438)
211362-1178028
5532 assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxGT );-
5533 r.default_rc = -1;-
5534 }else{
executed 1178028 times by 8 tests: end of block
Executed by:
  • Self test (438)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
1178028
5535 assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxLT );-
5536 r.default_rc = 0;-
5537 }
executed 211362 times by 1 test: end of block
Executed by:
  • Self test (438)
211362
5538 r.aMem = &aMem[pOp->p3];-
5539#ifdef SQLITE_DEBUG-
5540 {-
5541 int i;-
5542 for(i=0; i<r.nField; i++){-
5543 assert( memIsValid(&r.aMem[i]) );-
5544 REGISTER_TRACE(pOp->p3+i, &aMem[pOp->p3+i]);-
5545 }-
5546 }-
5547#endif-
5548 res = 0; /* Not needed. Only used to silence a warning. */-
5549 rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res);-
5550 assert( (OP_IdxLE&1)==(OP_IdxLT&1) && (OP_IdxGE&1)==(OP_IdxGT&1) );-
5551 if( (pOp->opcode&1)==(OP_IdxLT&1) ){
(pOp->opcode&1)==(39&1)Description
TRUEevaluated 146915 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1242475 times by 8 tests
Evaluated by:
  • Self test (438)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
146915-1242475
5552 assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxLT );-
5553 res = -res;-
5554 }else{
executed 146915 times by 1 test: end of block
Executed by:
  • Self test (438)
146915
5555 assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxGT );-
5556 res++;-
5557 }
executed 1242475 times by 8 tests: end of block
Executed by:
  • Self test (438)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
1242475
5558 VdbeBranchTaken(res>0,2);-
5559 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 1389390 times by 8 tests
Evaluated by:
  • Self test (438)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
0-1389390
5560 if( res>0 ) goto jump_to_p2;
executed 586699 times by 8 tests: goto jump_to_p2;
Executed by:
  • Self test (438)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
res>0Description
TRUEevaluated 586699 times by 8 tests
Evaluated by:
  • Self test (438)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
FALSEevaluated 802691 times by 1 test
Evaluated by:
  • Self test (438)
586699-802691
5561 break;
executed 802691 times by 1 test: break;
Executed by:
  • Self test (438)
802691
5562}-
5563-
5564/* Opcode: Destroy P1 P2 P3 * *-
5565**-
5566** Delete an entire database table or index whose root page in the database-
5567** file is given by P1.-
5568**-
5569** The table being destroyed is in the main database file if P3==0. If-
5570** P3==1 then the table to be clear is in the auxiliary database file-
5571** that is used to store tables create using CREATE TEMPORARY TABLE.-
5572**-
5573** If AUTOVACUUM is enabled then it is possible that another root page-
5574** might be moved into the newly deleted root page in order to keep all-
5575** root pages contiguous at the beginning of the database. The former-
5576** value of the root page that moved - its value before the move occurred --
5577** is stored in register P2. If no page movement was required (because the-
5578** table being dropped was already the last one in the database) then a -
5579** zero is stored in register P2. If AUTOVACUUM is disabled then a zero -
5580** is stored in register P2.-
5581**-
5582** This opcode throws an error if there are any active reader VMs when-
5583** it is invoked. This is done to avoid the difficulty associated with -
5584** updating existing cursors when a root page is moved in an AUTOVACUUM -
5585** database. This error is thrown even if the database is not an AUTOVACUUM -
5586** db in order to avoid introducing an incompatibility between autovacuum -
5587** and non-autovacuum modes.-
5588**-
5589** See also: Clear-
5590*/-
5591case
executed 5655 times by 4 tests: case 137:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
OP_Destroy: { /* out2 */
executed 5655 times by 4 tests: case 137:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
5655
5592 int iMoved;-
5593 int iDb;-
5594-
5595 sqlite3VdbeIncrWriteCounter(p, 0);-
5596 assert( p->readOnly==0 );-
5597 assert( pOp->p1>1 );-
5598 pOut = out2Prerelease(p, pOp);-
5599 pOut->flags = MEM_Null;-
5600 if( db->nVdbeRead > db->nVDestroy+1 ){
db->nVdbeRead ...b->nVDestroy+1Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5646 times by 4 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
9-5646
5601 rc = SQLITE_LOCKED;-
5602 p->errorAction = OE_Abort;-
5603 goto abort_due_to_error;
executed 9 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
9
5604 }else{-
5605 iDb = pOp->p3;-
5606 assert( DbMaskTest(p->btreeMask, iDb) );-
5607 iMoved = 0; /* Not needed. Only to silence a warning. */-
5608 rc = sqlite3BtreeDropTable(db->aDb[iDb].pBt, pOp->p1, &iMoved);-
5609 pOut->flags = MEM_Int;-
5610 pOut->u.i = iMoved;-
5611 if( rc ) goto abort_due_to_error;
executed 7 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5639 times by 4 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
7-5639
5612#ifndef SQLITE_OMIT_AUTOVACUUM-
5613 if( iMoved!=0 ){
iMoved!=0Description
TRUEevaluated 368 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5271 times by 4 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
368-5271
5614 sqlite3RootPageMoved(db, iDb, iMoved, pOp->p1);-
5615 /* All OP_Destroy operations occur on the same btree */-
5616 assert( resetSchemaOnFault==0 || resetSchemaOnFault==iDb+1 );-
5617 resetSchemaOnFault = iDb+1;-
5618 }
executed 368 times by 1 test: end of block
Executed by:
  • Self test (438)
368
5619#endif-
5620 }
executed 5639 times by 4 tests: end of block
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
5639
5621 break;
executed 5639 times by 4 tests: break;
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
5639
5622}-
5623-
5624/* Opcode: Clear P1 P2 P3-
5625**-
5626** Delete all contents of the database table or index whose root page-
5627** in the database file is given by P1. But, unlike Destroy, do not-
5628** remove the table or index from the database file.-
5629**-
5630** The table being clear is in the main database file if P2==0. If-
5631** P2==1 then the table to be clear is in the auxiliary database file-
5632** that is used to store tables create using CREATE TEMPORARY TABLE.-
5633**-
5634** If the P3 value is non-zero, then the table referred to must be an-
5635** intkey table (an SQL table, not an index). In this case the row change -
5636** count is incremented by the number of rows in the table being cleared. -
5637** If P3 is greater than zero, then the value stored in register P3 is-
5638** also incremented by the number of rows in the table being cleared.-
5639**-
5640** See also: Destroy-
5641*/-
5642case
executed 3291 times by 7 tests: case 138:
Executed by:
  • Self test
  • Self test (104)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (57)
  • Self test (58)
OP_Clear: {
executed 3291 times by 7 tests: case 138:
Executed by:
  • Self test
  • Self test (104)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (57)
  • Self test (58)
3291
5643 int nChange;-
5644 -
5645 sqlite3VdbeIncrWriteCounter(p, 0);-
5646 nChange = 0;-
5647 assert( p->readOnly==0 );-
5648 assert( DbMaskTest(p->btreeMask, pOp->p2) );-
5649 rc = sqlite3BtreeClearTable(-
5650 db->aDb[pOp->p2].pBt, pOp->p1, (pOp->p3 ? &nChange : 0)-
5651 );-
5652 if( pOp->p3 ){
pOp->p3Description
TRUEevaluated 2144 times by 7 tests
Evaluated by:
  • Self test
  • Self test (104)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (57)
  • Self test (58)
FALSEevaluated 1147 times by 4 tests
Evaluated by:
  • Self test
  • Self test (438)
  • Self test (57)
  • Self test (58)
1147-2144
5653 p->nChange += nChange;-
5654 if( pOp->p3>0 ){
pOp->p3>0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2140 times by 7 tests
Evaluated by:
  • Self test
  • Self test (104)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (57)
  • Self test (58)
4-2140
5655 assert( memIsValid(&aMem[pOp->p3]) );-
5656 memAboutToChange(p, &aMem[pOp->p3]);-
5657 aMem[pOp->p3].u.i += nChange;-
5658 }
executed 4 times by 1 test: end of block
Executed by:
  • Self test (438)
4
5659 }
executed 2144 times by 7 tests: end of block
Executed by:
  • Self test
  • Self test (104)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (57)
  • Self test (58)
2144
5660 if( rc ) goto abort_due_to_error;
executed 188 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 188 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3103 times by 7 tests
Evaluated by:
  • Self test
  • Self test (104)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (57)
  • Self test (58)
188-3103
5661 break;
executed 3103 times by 7 tests: break;
Executed by:
  • Self test
  • Self test (104)
  • Self test (34)
  • Self test (438)
  • Self test (47)
  • Self test (57)
  • Self test (58)
3103
5662}-
5663-
5664/* Opcode: ResetSorter P1 * * * *-
5665**-
5666** Delete all contents from the ephemeral table or sorter-
5667** that is open on cursor P1.-
5668**-
5669** This opcode only works for cursors used for sorting and-
5670** opened with OP_OpenEphemeral or OP_SorterOpen.-
5671*/-
5672case
executed 74592 times by 1 test: case 139:
Executed by:
  • Self test (438)
OP_ResetSorter: {
executed 74592 times by 1 test: case 139:
Executed by:
  • Self test (438)
74592
5673 VdbeCursor *pC;-
5674 -
5675 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
5676 pC = p->apCsr[pOp->p1];-
5677 assert( pC!=0 );-
5678 if( isSorter(pC) ){
((pC)->eCurType==1)Description
TRUEevaluated 1319 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 73273 times by 1 test
Evaluated by:
  • Self test (438)
1319-73273
5679 sqlite3VdbeSorterReset(db, pC->uc.pSorter);-
5680 }else{
executed 1319 times by 1 test: end of block
Executed by:
  • Self test (438)
1319
5681 assert( pC->eCurType==CURTYPE_BTREE );-
5682 assert( pC->isEphemeral );-
5683 rc = sqlite3BtreeClearTableOfCursor(pC->uc.pCursor);-
5684 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 73273 times by 1 test
Evaluated by:
  • Self test (438)
0-73273
5685 }
executed 73273 times by 1 test: end of block
Executed by:
  • Self test (438)
73273
5686 break;
executed 74592 times by 1 test: break;
Executed by:
  • Self test (438)
74592
5687}-
5688-
5689/* Opcode: CreateBtree P1 P2 P3 * *-
5690** Synopsis: r[P2]=root iDb=P1 flags=P3-
5691**-
5692** Allocate a new b-tree in the main database file if P1==0 or in the-
5693** TEMP database file if P1==1 or in an attached database if-
5694** P1>1. The P3 argument must be 1 (BTREE_INTKEY) for a rowid table-
5695** it must be 2 (BTREE_BLOBKEY) for an index or WITHOUT ROWID table.-
5696** The root page number of the new b-tree is stored in register P2.-
5697*/-
5698case
executed 15304 times by 32 tests: case 140:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (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)
  • Self test (92)
  • ...
OP_CreateBtree: { /* out2 */
executed 15304 times by 32 tests: case 140:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (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)
  • Self test (92)
  • ...
15304
5699 int pgno;-
5700 Db *pDb;-
5701-
5702 sqlite3VdbeIncrWriteCounter(p, 0);-
5703 pOut = out2Prerelease(p, pOp);-
5704 pgno = 0;-
5705 assert( pOp->p3==BTREE_INTKEY || pOp->p3==BTREE_BLOBKEY );-
5706 assert( pOp->p1>=0 && pOp->p1<db->nDb );-
5707 assert( DbMaskTest(p->btreeMask, pOp->p1) );-
5708 assert( p->readOnly==0 );-
5709 pDb = &db->aDb[pOp->p1];-
5710 assert( pDb->pBt!=0 );-
5711 rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, pOp->p3);-
5712 if( rc ) goto abort_due_to_error;
executed 5 times by 2 tests: goto abort_due_to_error;
Executed by:
  • Self test (39)
  • Self test (438)
rcDescription
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • Self test (39)
  • Self test (438)
FALSEevaluated 15299 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
5-15299
5713 pOut->u.i = pgno;-
5714 break;
executed 15299 times by 31 tests: break;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
15299
5715}-
5716-
5717/* Opcode: SqlExec * * * P4 *-
5718**-
5719** Run the SQL statement or statements specified in the P4 string.-
5720*/-
5721case
executed 1 time by 1 test: case 142:
Executed by:
  • Self test (438)
OP_SqlExec: {
executed 1 time by 1 test: case 142:
Executed by:
  • Self test (438)
1
5722 sqlite3VdbeIncrWriteCounter(p, 0);-
5723 db->nSqlExec++;-
5724 rc = sqlite3_exec(db, pOp->p4.z, 0, 0, 0);-
5725 db->nSqlExec--;-
5726 if( rc ) goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-1
5727 break;
never executed: break;
0
5728}-
5729-
5730/* Opcode: ParseSchema P1 * * P4 *-
5731**-
5732** Read and parse all entries from the SQLITE_MASTER table of database P1-
5733** that match the WHERE clause P4. If P4 is a NULL pointer, then the-
5734** entire schema for P1 is reparsed.-
5735**-
5736** This opcode invokes the parser to create a new virtual machine,-
5737** then runs the new virtual machine. It is thus a re-entrant opcode.-
5738*/-
5739case
executed 17416 times by 31 tests: case 143:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
OP_ParseSchema: {
executed 17416 times by 31 tests: case 143:
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
17416
5740 int iDb;-
5741 const char *zMaster;-
5742 char *zSql;-
5743 InitData initData;-
5744-
5745 /* Any prepared statement that invokes this opcode will hold mutexes-
5746 ** on every btree. This is a prerequisite for invoking -
5747 ** sqlite3InitCallback().-
5748 */-
5749#ifdef SQLITE_DEBUG-
5750 for(iDb=0; iDb<db->nDb; iDb++){-
5751 assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );-
5752 }-
5753#endif-
5754-
5755 iDb = pOp->p1;-
5756 assert( iDb>=0 && iDb<db->nDb );-
5757 assert( DbHasProperty(db, iDb, DB_SchemaLoaded) );-
5758-
5759#ifndef SQLITE_OMIT_ALTERTABLE-
5760 if( pOp->p4.z==0 ){
pOp->p4.z==0Description
TRUEevaluated 780 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 16636 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
780-16636
5761 sqlite3SchemaClear(db->aDb[iDb].pSchema);-
5762 db->mDbFlags &= ~DBFLAG_SchemaKnownOk;-
5763 rc = sqlite3InitOne(db, iDb, &p->zErrMsg, INITFLAG_AlterTable);-
5764 db->mDbFlags |= DBFLAG_SchemaChange;-
5765 p->expired = 0;-
5766 }else
executed 780 times by 1 test: end of block
Executed by:
  • Self test (438)
780
5767#endif-
5768 {-
5769 zMaster = MASTER_NAME;-
5770 initData.db = db;-
5771 initData.iDb = pOp->p1;-
5772 initData.pzErrMsg = &p->zErrMsg;-
5773 initData.mInitFlags = 0;-
5774 zSql = sqlite3MPrintf(db,-
5775 "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid",-
5776 db->aDb[iDb].zDbSName, zMaster, pOp->p4.z);-
5777 if( zSql==0 ){
zSql==0Description
TRUEnever evaluated
FALSEevaluated 16636 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
0-16636
5778 rc = SQLITE_NOMEM_BKPT;-
5779 }else{
never executed: end of block
0
5780 assert( db->init.busy==0 );-
5781 db->init.busy = 1;-
5782 initData.rc = SQLITE_OK;-
5783 assert( !db->mallocFailed );-
5784 rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0);-
5785 if( rc==SQLITE_OK ) rc = initData.rc;
executed 16636 times by 31 tests: rc = initData.rc;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
rc==0Description
TRUEevaluated 16636 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
FALSEnever evaluated
0-16636
5786 sqlite3DbFreeNN(db, zSql);-
5787 db->init.busy = 0;-
5788 }
executed 16636 times by 31 tests: end of block
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
16636
5789 }-
5790 if( rc ){
rcDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 17414 times by 31 tests
Evaluated by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
2-17414
5791 sqlite3ResetAllSchemasOfConnection(db);-
5792 if( rc==SQLITE_NOMEM ){
rc==7Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
0-2
5793 goto no_mem;
never executed: goto no_mem;
0
5794 }-
5795 goto abort_due_to_error;
executed 2 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
2
5796 }-
5797 break;
executed 17414 times by 31 tests: break;
Executed by:
  • Self test
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (32)
  • Self test (33)
  • Self test (34)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (48)
  • Self test (57)
  • Self test (58)
  • Self test (72)
  • Self test (73)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • ...
17414
5798}-
5799-
5800#if !defined(SQLITE_OMIT_ANALYZE)-
5801/* Opcode: LoadAnalysis P1 * * * *-
5802**-
5803** Read the sqlite_stat1 table for database P1 and load the content-
5804** of that table into the internal index hash table. This will cause-
5805** the analysis to be used when preparing all subsequent queries.-
5806*/-
5807case
executed 185 times by 1 test: case 144:
Executed by:
  • Self test (438)
OP_LoadAnalysis: {
executed 185 times by 1 test: case 144:
Executed by:
  • Self test (438)
185
5808 assert( pOp->p1>=0 && pOp->p1<db->nDb );-
5809 rc = sqlite3AnalysisLoad(db, pOp->p1);-
5810 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 185 times by 1 test
Evaluated by:
  • Self test (438)
0-185
5811 break;
executed 185 times by 1 test: break;
Executed by:
  • Self test (438)
185
5812}-
5813#endif /* !defined(SQLITE_OMIT_ANALYZE) */-
5814-
5815/* Opcode: DropTable P1 * * P4 *-
5816**-
5817** Remove the internal (in-memory) data structures that describe-
5818** the table named P4 in database P1. This is called after a table-
5819** is dropped from disk (using the Destroy opcode) in order to keep -
5820** the internal representation of the-
5821** schema consistent with what is on disk.-
5822*/-
5823case
executed 4808 times by 4 tests: case 145:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
OP_DropTable: {
executed 4808 times by 4 tests: case 145:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
4808
5824 sqlite3VdbeIncrWriteCounter(p, 0);-
5825 sqlite3UnlinkAndDeleteTable(db, pOp->p1, pOp->p4.z);-
5826 break;
executed 4808 times by 4 tests: break;
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
4808
5827}-
5828-
5829/* Opcode: DropIndex P1 * * P4 *-
5830**-
5831** Remove the internal (in-memory) data structures that describe-
5832** the index named P4 in database P1. This is called after an index-
5833** is dropped from disk (using the Destroy opcode)-
5834** in order to keep the internal representation of the-
5835** schema consistent with what is on disk.-
5836*/-
5837case
executed 199 times by 4 tests: case 146:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
OP_DropIndex: {
executed 199 times by 4 tests: case 146:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
199
5838 sqlite3VdbeIncrWriteCounter(p, 0);-
5839 sqlite3UnlinkAndDeleteIndex(db, pOp->p1, pOp->p4.z);-
5840 break;
executed 199 times by 4 tests: break;
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
199
5841}-
5842-
5843/* Opcode: DropTrigger P1 * * P4 *-
5844**-
5845** Remove the internal (in-memory) data structures that describe-
5846** the trigger named P4 in database P1. This is called after a trigger-
5847** is dropped from disk (using the Destroy opcode) in order to keep -
5848** the internal representation of the-
5849** schema consistent with what is on disk.-
5850*/-
5851case
executed 353 times by 4 tests: case 147:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
OP_DropTrigger: {
executed 353 times by 4 tests: case 147:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
353
5852 sqlite3VdbeIncrWriteCounter(p, 0);-
5853 sqlite3UnlinkAndDeleteTrigger(db, pOp->p1, pOp->p4.z);-
5854 break;
executed 353 times by 4 tests: break;
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
353
5855}-
5856-
5857-
5858#ifndef SQLITE_OMIT_INTEGRITY_CHECK-
5859/* Opcode: IntegrityCk P1 P2 P3 P4 P5-
5860**-
5861** Do an analysis of the currently open database. Store in-
5862** register P1 the text of an error message describing any problems.-
5863** If no problems are found, store a NULL in register P1.-
5864**-
5865** The register P3 contains one less than the maximum number of allowed errors.-
5866** At most reg(P3) errors will be reported.-
5867** In other words, the analysis stops as soon as reg(P1) errors are -
5868** seen. Reg(P1) is updated with the number of errors remaining.-
5869**-
5870** The root page numbers of all tables in the database are integers-
5871** stored in P4_INTARRAY argument.-
5872**-
5873** If P5 is not zero, the check is done on the auxiliary database-
5874** file, not the main database file.-
5875**-
5876** This opcode is used to implement the integrity_check pragma.-
5877*/-
5878case
executed 11285 times by 12 tests: case 148:
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)
OP_IntegrityCk: {
executed 11285 times by 12 tests: case 148:
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)
11285
5879 int nRoot; /* Number of tables to check. (Number of root pages.) */-
5880 int *aRoot; /* Array of rootpage numbers for tables to be checked */-
5881 int nErr; /* Number of errors reported */-
5882 char *z; /* Text of the error report */-
5883 Mem *pnErr; /* Register keeping track of errors remaining */-
5884-
5885 assert( p->bIsReader );-
5886 nRoot = pOp->p2;-
5887 aRoot = pOp->p4.ai;-
5888 assert( nRoot>0 );-
5889 assert( aRoot[0]==nRoot );-
5890 assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );-
5891 pnErr = &aMem[pOp->p3];-
5892 assert( (pnErr->flags & MEM_Int)!=0 );-
5893 assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 );-
5894 pIn1 = &aMem[pOp->p1];-
5895 assert( pOp->p5<db->nDb );-
5896 assert( DbMaskTest(p->btreeMask, pOp->p5) );-
5897 z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, &aRoot[1], nRoot,-
5898 (int)pnErr->u.i+1, &nErr);-
5899 sqlite3VdbeMemSetNull(pIn1);-
5900 if( nErr==0 ){
nErr==0Description
TRUEevaluated 11117 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 168 times by 1 test
Evaluated by:
  • Self test (438)
168-11117
5901 assert( z==0 );-
5902 }else if( z==0 ){
executed 11117 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)
z==0Description
TRUEnever evaluated
FALSEevaluated 168 times by 1 test
Evaluated by:
  • Self test (438)
0-11117
5903 goto no_mem;
never executed: goto no_mem;
0
5904 }else{-
5905 pnErr->u.i -= nErr-1;-
5906 sqlite3VdbeMemSetStr(pIn1, z, -1, SQLITE_UTF8, sqlite3_free);-
5907 }
executed 168 times by 1 test: end of block
Executed by:
  • Self test (438)
168
5908 UPDATE_MAX_BLOBSIZE(pIn1);-
5909 sqlite3VdbeChangeEncoding(pIn1, encoding);-
5910 break;
executed 11285 times by 12 tests: break;
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)
11285
5911}-
5912#endif /* SQLITE_OMIT_INTEGRITY_CHECK */-
5913-
5914/* Opcode: RowSetAdd P1 P2 * * *-
5915** Synopsis: rowset(P1)=r[P2]-
5916**-
5917** Insert the integer value held by register P2 into a RowSet object-
5918** held in register P1.-
5919**-
5920** An assertion fails if P2 is not an integer.-
5921*/-
5922case
executed 38077 times by 1 test: case 149:
Executed by:
  • Self test (438)
OP_RowSetAdd: { /* in1, in2 */
executed 38077 times by 1 test: case 149:
Executed by:
  • Self test (438)
38077
5923 pIn1 = &aMem[pOp->p1];-
5924 pIn2 = &aMem[pOp->p2];-
5925 assert( (pIn2->flags & MEM_Int)!=0 );-
5926 if( (pIn1->flags & MEM_Blob)==0 ){
(pIn1->flags & 0x0010)==0Description
TRUEevaluated 4308 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 33769 times by 1 test
Evaluated by:
  • Self test (438)
4308-33769
5927 if( sqlite3VdbeMemSetRowSet(pIn1) ) goto no_mem;
never executed: goto no_mem;
sqlite3VdbeMemSetRowSet(pIn1)Description
TRUEnever evaluated
FALSEevaluated 4308 times by 1 test
Evaluated by:
  • Self test (438)
0-4308
5928 }
executed 4308 times by 1 test: end of block
Executed by:
  • Self test (438)
4308
5929 assert( sqlite3VdbeMemIsRowSet(pIn1) );-
5930 sqlite3RowSetInsert((RowSet*)pIn1->z, pIn2->u.i);-
5931 break;
executed 38077 times by 1 test: break;
Executed by:
  • Self test (438)
38077
5932}-
5933-
5934/* Opcode: RowSetRead P1 P2 P3 * *-
5935** Synopsis: r[P3]=rowset(P1)-
5936**-
5937** Extract the smallest value from the RowSet object in P1-
5938** and put that value into register P3.-
5939** Or, if RowSet object P1 is initially empty, leave P3-
5940** unchanged and jump to instruction P2.-
5941*/-
5942case
executed 45731 times by 4 tests: case 41:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
OP_RowSetRead: { /* jump, in1, out3 */
executed 45731 times by 4 tests: case 41:
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
45731
5943 i64 val;-
5944-
5945 pIn1 = &aMem[pOp->p1];-
5946 assert( (pIn1->flags & MEM_Blob)==0 || sqlite3VdbeMemIsRowSet(pIn1) );-
5947 if( (pIn1->flags & MEM_Blob)==0
(pIn1->flags & 0x0010)==0Description
TRUEevaluated 5484 times by 4 tests
Evaluated by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
FALSEevaluated 40247 times by 1 test
Evaluated by:
  • Self test (438)
5484-40247
5948 || sqlite3RowSetNext((RowSet*)pIn1->z, &val)==0
sqlite3RowSetN...1->z, &val)==0Description
TRUEevaluated 2218 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 38029 times by 1 test
Evaluated by:
  • Self test (438)
2218-38029
5949 ){-
5950 /* The boolean index is empty */-
5951 sqlite3VdbeMemSetNull(pIn1);-
5952 VdbeBranchTaken(1,2);-
5953 goto jump_to_p2_and_check_for_interrupt;
executed 7702 times by 4 tests: goto jump_to_p2_and_check_for_interrupt;
Executed by:
  • Self test (24)
  • Self test (28)
  • Self test (438)
  • Self test (47)
7702
5954 }else{-
5955 /* A value was pulled from the index */-
5956 VdbeBranchTaken(0,2);-
5957 sqlite3VdbeMemSetInt64(&aMem[pOp->p3], val);-
5958 }
executed 38029 times by 1 test: end of block
Executed by:
  • Self test (438)
38029
5959 goto check_for_interrupt;
executed 38029 times by 1 test: goto check_for_interrupt;
Executed by:
  • Self test (438)
38029
5960}-
5961-
5962/* Opcode: RowSetTest P1 P2 P3 P4-
5963** Synopsis: if r[P3] in rowset(P1) goto P2-
5964**-
5965** Register P3 is assumed to hold a 64-bit integer value. If register P1-
5966** contains a RowSet object and that RowSet object contains-
5967** the value held in P3, jump to register P2. Otherwise, insert the-
5968** integer in P3 into the RowSet and continue on to the-
5969** next opcode.-
5970**-
5971** The RowSet object is optimized for the case where sets of integers-
5972** are inserted in distinct phases, which each set contains no duplicates.-
5973** Each set is identified by a unique P4 value. The first set-
5974** must have P4==0, the final set must have P4==-1, and for all other sets-
5975** must have P4>0.-
5976**-
5977** This allows optimizations: (a) when P4==0 there is no need to test-
5978** the RowSet object for P3, as it is guaranteed not to contain it,-
5979** (b) when P4==-1 there is no need to insert the value, as it will-
5980** never be tested for, and (c) when a value that is part of set X is-
5981** inserted, there is no need to search to see if the same value was-
5982** previously inserted as part of set X (only if it was previously-
5983** inserted as part of some other set).-
5984*/-
5985case
executed 429180 times by 1 test: case 42:
Executed by:
  • Self test (438)
OP_RowSetTest: { /* jump, in1, in3 */
executed 429180 times by 1 test: case 42:
Executed by:
  • Self test (438)
429180
5986 int iSet;-
5987 int exists;-
5988-
5989 pIn1 = &aMem[pOp->p1];-
5990 pIn3 = &aMem[pOp->p3];-
5991 iSet = pOp->p4.i;-
5992 assert( pIn3->flags&MEM_Int );-
5993-
5994 /* If there is anything other than a rowset object in memory cell P1,-
5995 ** delete it now and initialize P1 with an empty rowset-
5996 */-
5997 if( (pIn1->flags & MEM_Blob)==0 ){
(pIn1->flags & 0x0010)==0Description
TRUEevaluated 2538 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 426642 times by 1 test
Evaluated by:
  • Self test (438)
2538-426642
5998 if( sqlite3VdbeMemSetRowSet(pIn1) ) goto no_mem;
never executed: goto no_mem;
sqlite3VdbeMemSetRowSet(pIn1)Description
TRUEnever evaluated
FALSEevaluated 2538 times by 1 test
Evaluated by:
  • Self test (438)
0-2538
5999 }
executed 2538 times by 1 test: end of block
Executed by:
  • Self test (438)
2538
6000 assert( sqlite3VdbeMemIsRowSet(pIn1) );-
6001 assert( pOp->p4type==P4_INT32 );-
6002 assert( iSet==-1 || iSet>=0 );-
6003 if( iSet ){
iSetDescription
TRUEevaluated 229922 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 199258 times by 1 test
Evaluated by:
  • Self test (438)
199258-229922
6004 exists = sqlite3RowSetTest((RowSet*)pIn1->z, iSet, pIn3->u.i);-
6005 VdbeBranchTaken(exists!=0,2);-
6006 if( exists ) goto jump_to_p2;
executed 210902 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
existsDescription
TRUEevaluated 210902 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 19020 times by 1 test
Evaluated by:
  • Self test (438)
19020-210902
6007 }
executed 19020 times by 1 test: end of block
Executed by:
  • Self test (438)
19020
6008 if( iSet>=0 ){
iSet>=0Description
TRUEevaluated 214934 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3344 times by 1 test
Evaluated by:
  • Self test (438)
3344-214934
6009 sqlite3RowSetInsert((RowSet*)pIn1->z, pIn3->u.i);-
6010 }
executed 214934 times by 1 test: end of block
Executed by:
  • Self test (438)
214934
6011 break;
executed 218278 times by 1 test: break;
Executed by:
  • Self test (438)
218278
6012}-
6013-
6014-
6015#ifndef SQLITE_OMIT_TRIGGER-
6016-
6017/* Opcode: Program P1 P2 P3 P4 P5-
6018**-
6019** Execute the trigger program passed as P4 (type P4_SUBPROGRAM). -
6020**-
6021** P1 contains the address of the memory cell that contains the first memory -
6022** cell in an array of values used as arguments to the sub-program. P2 -
6023** contains the address to jump to if the sub-program throws an IGNORE -
6024** exception using the RAISE() function. Register P3 contains the address -
6025** of a memory cell in this (the parent) VM that is used to allocate the -
6026** memory required by the sub-vdbe at runtime.-
6027**-
6028** P4 is a pointer to the VM containing the trigger program.-
6029**-
6030** If P5 is non-zero, then recursive program invocation is enabled.-
6031*/-
6032case
executed 141751 times by 1 test: case 45:
Executed by:
  • Self test (438)
OP_Program: { /* jump */
executed 141751 times by 1 test: case 45:
Executed by:
  • Self test (438)
141751
6033 int nMem; /* Number of memory registers for sub-program */-
6034 int nByte; /* Bytes of runtime space required for sub-program */-
6035 Mem *pRt; /* Register to allocate runtime space */-
6036 Mem *pMem; /* Used to iterate through memory cells */-
6037 Mem *pEnd; /* Last memory cell in new array */-
6038 VdbeFrame *pFrame; /* New vdbe frame to execute in */-
6039 SubProgram *pProgram; /* Sub-program to execute */-
6040 void *t; /* Token identifying trigger */-
6041-
6042 pProgram = pOp->p4.pProgram;-
6043 pRt = &aMem[pOp->p3];-
6044 assert( pProgram->nOp>0 );-
6045 -
6046 /* If the p5 flag is clear, then recursive invocation of triggers is -
6047 ** disabled for backwards compatibility (p5 is set if this sub-program-
6048 ** is really a trigger, not a foreign key action, and the flag set-
6049 ** and cleared by the "PRAGMA recursive_triggers" command is clear).-
6050 ** -
6051 ** It is recursive invocation of triggers, at the SQL level, that is -
6052 ** disabled. In some cases a single trigger may generate more than one -
6053 ** SubProgram (if the trigger may be executed with more than one different -
6054 ** ON CONFLICT algorithm). SubProgram structures associated with a-
6055 ** single trigger all have the same value for the SubProgram.token -
6056 ** variable. */-
6057 if( pOp->p5 ){
pOp->p5Description
TRUEevaluated 6467 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 135284 times by 1 test
Evaluated by:
  • Self test (438)
6467-135284
6058 t = pProgram->token;-
6059 for(pFrame=p->pFrame; pFrame && pFrame->token!=t; pFrame=pFrame->pParent);
executed 39 times by 1 test: ;
Executed by:
  • Self test (438)
pFrameDescription
TRUEevaluated 119 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6387 times by 1 test
Evaluated by:
  • Self test (438)
pFrame->token!=tDescription
TRUEevaluated 39 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 80 times by 1 test
Evaluated by:
  • Self test (438)
39-6387
6060 if( pFrame ) break;
executed 80 times by 1 test: break;
Executed by:
  • Self test (438)
pFrameDescription
TRUEevaluated 80 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6387 times by 1 test
Evaluated by:
  • Self test (438)
80-6387
6061 }
executed 6387 times by 1 test: end of block
Executed by:
  • Self test (438)
6387
6062-
6063 if( p->nFrame>=db->aLimit[SQLITE_LIMIT_TRIGGER_DEPTH] ){
p->nFrame>=db->aLimit[10]Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 141662 times by 1 test
Evaluated by:
  • Self test (438)
9-141662
6064 rc = SQLITE_ERROR;-
6065 sqlite3VdbeError(p, "too many levels of trigger recursion");-
6066 goto abort_due_to_error;
executed 9 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
9
6067 }-
6068-
6069 /* Register pRt is used to store the memory required to save the state-
6070 ** of the current program, and the memory required at runtime to execute-
6071 ** the trigger program. If this trigger has been fired before, then pRt -
6072 ** is already allocated. Otherwise, it must be initialized. */-
6073 if( (pRt->flags&MEM_Blob)==0 ){
(pRt->flags&0x0010)==0Description
TRUEevaluated 16141 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 125521 times by 1 test
Evaluated by:
  • Self test (438)
16141-125521
6074 /* SubProgram.nMem is set to the number of memory cells used by the -
6075 ** program stored in SubProgram.aOp. As well as these, one memory-
6076 ** cell is required for each cursor used by the program. Set local-
6077 ** variable nMem (and later, VdbeFrame.nChildMem) to this value.-
6078 */-
6079 nMem = pProgram->nMem + pProgram->nCsr;-
6080 assert( nMem>0 );-
6081 if( pProgram->nCsr==0 ) nMem++;
executed 718 times by 1 test: nMem++;
Executed by:
  • Self test (438)
pProgram->nCsr==0Description
TRUEevaluated 718 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 15423 times by 1 test
Evaluated by:
  • Self test (438)
718-15423
6082 nByte = ROUND8(sizeof(VdbeFrame))-
6083 + nMem * sizeof(Mem)-
6084 + pProgram->nCsr * sizeof(VdbeCursor*)-
6085 + (pProgram->nOp + 7)/8;-
6086 pFrame = sqlite3DbMallocZero(db, nByte);-
6087 if( !pFrame ){
!pFrameDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 16137 times by 1 test
Evaluated by:
  • Self test (438)
4-16137
6088 goto no_mem;
executed 4 times by 1 test: goto no_mem;
Executed by:
  • Self test (438)
4
6089 }-
6090 sqlite3VdbeMemRelease(pRt);-
6091 pRt->flags = MEM_Blob|MEM_Dyn;-
6092 pRt->z = (char*)pFrame;-
6093 pRt->n = nByte;-
6094 pRt->xDel = sqlite3VdbeFrameMemDel;-
6095-
6096 pFrame->v = p;-
6097 pFrame->nChildMem = nMem;-
6098 pFrame->nChildCsr = pProgram->nCsr;-
6099 pFrame->pc = (int)(pOp - aOp);-
6100 pFrame->aMem = p->aMem;-
6101 pFrame->nMem = p->nMem;-
6102 pFrame->apCsr = p->apCsr;-
6103 pFrame->nCursor = p->nCursor;-
6104 pFrame->aOp = p->aOp;-
6105 pFrame->nOp = p->nOp;-
6106 pFrame->token = pProgram->token;-
6107#ifdef SQLITE_ENABLE_STMT_SCANSTATUS-
6108 pFrame->anExec = p->anExec;-
6109#endif-
6110#ifdef SQLITE_DEBUG-
6111 pFrame->iFrameMagic = SQLITE_FRAME_MAGIC;-
6112#endif-
6113-
6114 pEnd = &VdbeFrameMem(pFrame)[pFrame->nChildMem];-
6115 for(pMem=VdbeFrameMem(pFrame); pMem!=pEnd; pMem++){
pMem!=pEndDescription
TRUEevaluated 152884 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 16137 times by 1 test
Evaluated by:
  • Self test (438)
16137-152884
6116 pMem->flags = MEM_Undefined;-
6117 pMem->db = db;-
6118 }
executed 152884 times by 1 test: end of block
Executed by:
  • Self test (438)
152884
6119 }else{
executed 16137 times by 1 test: end of block
Executed by:
  • Self test (438)
16137
6120 pFrame = (VdbeFrame*)pRt->z;-
6121 assert( pRt->xDel==sqlite3VdbeFrameMemDel );-
6122 assert( pProgram->nMem+pProgram->nCsr==pFrame->nChildMem -
6123 || (pProgram->nCsr==0 && pProgram->nMem+1==pFrame->nChildMem) );-
6124 assert( pProgram->nCsr==pFrame->nChildCsr );-
6125 assert( (int)(pOp - aOp)==pFrame->pc );-
6126 }
executed 125521 times by 1 test: end of block
Executed by:
  • Self test (438)
125521
6127-
6128 p->nFrame++;-
6129 pFrame->pParent = p->pFrame;-
6130 pFrame->lastRowid = db->lastRowid;-
6131 pFrame->nChange = p->nChange;-
6132 pFrame->nDbChange = p->db->nChange;-
6133 assert( pFrame->pAuxData==0 );-
6134 pFrame->pAuxData = p->pAuxData;-
6135 p->pAuxData = 0;-
6136 p->nChange = 0;-
6137 p->pFrame = pFrame;-
6138 p->aMem = aMem = VdbeFrameMem(pFrame);-
6139 p->nMem = pFrame->nChildMem;-
6140 p->nCursor = (u16)pFrame->nChildCsr;-
6141 p->apCsr = (VdbeCursor **)&aMem[p->nMem];-
6142 pFrame->aOnce = (u8*)&p->apCsr[pProgram->nCsr];-
6143 memset(pFrame->aOnce, 0, (pProgram->nOp + 7)/8);-
6144 p->aOp = aOp = pProgram->aOp;-
6145 p->nOp = pProgram->nOp;-
6146#ifdef SQLITE_ENABLE_STMT_SCANSTATUS-
6147 p->anExec = 0;-
6148#endif-
6149 pOp = &aOp[-1];-
6150-
6151 break;
executed 141658 times by 1 test: break;
Executed by:
  • Self test (438)
141658
6152}-
6153-
6154/* Opcode: Param P1 P2 * * *-
6155**-
6156** This opcode is only ever present in sub-programs called via the -
6157** OP_Program instruction. Copy a value currently stored in a memory -
6158** cell of the calling (parent) frame to cell P2 in the current frames -
6159** address space. This is used by trigger programs to access the new.* -
6160** and old.* values.-
6161**-
6162** The address of the cell in the parent frame is determined by adding-
6163** the value of the P1 argument to the value of the P1 argument to the-
6164** calling OP_Program instruction.-
6165*/-
6166case
executed 29279 times by 1 test: case 150:
Executed by:
  • Self test (438)
OP_Param: { /* out2 */
executed 29279 times by 1 test: case 150:
Executed by:
  • Self test (438)
29279
6167 VdbeFrame *pFrame;-
6168 Mem *pIn;-
6169 pOut = out2Prerelease(p, pOp);-
6170 pFrame = p->pFrame;-
6171 pIn = &pFrame->aMem[pOp->p1 + pFrame->aOp[pFrame->pc].p1]; -
6172 sqlite3VdbeMemShallowCopy(pOut, pIn, MEM_Ephem);-
6173 break;
executed 29279 times by 1 test: break;
Executed by:
  • Self test (438)
29279
6174}-
6175-
6176#endif /* #ifndef SQLITE_OMIT_TRIGGER */-
6177-
6178#ifndef SQLITE_OMIT_FOREIGN_KEY-
6179/* Opcode: FkCounter P1 P2 * * *-
6180** Synopsis: fkctr[P1]+=P2-
6181**-
6182** Increment a "constraint counter" by P2 (P2 may be negative or positive).-
6183** If P1 is non-zero, the database constraint counter is incremented -
6184** (deferred foreign key constraints). Otherwise, if P1 is zero, the -
6185** statement counter is incremented (immediate foreign key constraints).-
6186*/-
6187case
executed 608 times by 1 test: case 151:
Executed by:
  • Self test (438)
OP_FkCounter: {
executed 608 times by 1 test: case 151:
Executed by:
  • Self test (438)
608
6188 if( db->flags & SQLITE_DeferFKs ){
db->flags & 0x00080000Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 592 times by 1 test
Evaluated by:
  • Self test (438)
16-592
6189 db->nDeferredImmCons += pOp->p2;-
6190 }else if( pOp->p1 ){
executed 16 times by 1 test: end of block
Executed by:
  • Self test (438)
pOp->p1Description
TRUEevaluated 160 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 432 times by 1 test
Evaluated by:
  • Self test (438)
16-432
6191 db->nDeferredCons += pOp->p2;-
6192 }else{
executed 160 times by 1 test: end of block
Executed by:
  • Self test (438)
160
6193 p->nFkConstraint += pOp->p2;-
6194 }
executed 432 times by 1 test: end of block
Executed by:
  • Self test (438)
432
6195 break;
executed 608 times by 1 test: break;
Executed by:
  • Self test (438)
608
6196}-
6197-
6198/* Opcode: FkIfZero P1 P2 * * *-
6199** Synopsis: if fkctr[P1]==0 goto P2-
6200**-
6201** This opcode tests if a foreign key constraint-counter is currently zero.-
6202** If so, jump to instruction P2. Otherwise, fall through to the next -
6203** instruction.-
6204**-
6205** If P1 is non-zero, then the jump is taken if the database constraint-counter-
6206** is zero (the one that counts deferred constraint violations). If P1 is-
6207** zero, the jump is taken if the statement constraint-counter is zero-
6208** (immediate foreign key constraint violations).-
6209*/-
6210case
executed 720 times by 1 test: case 46:
Executed by:
  • Self test (438)
OP_FkIfZero: { /* jump */
executed 720 times by 1 test: case 46:
Executed by:
  • Self test (438)
720
6211 if( pOp->p1 ){
pOp->p1Description
TRUEevaluated 181 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 539 times by 1 test
Evaluated by:
  • Self test (438)
181-539
6212 VdbeBranchTaken(db->nDeferredCons==0 && db->nDeferredImmCons==0, 2);-
6213 if( db->nDeferredCons==0 && db->nDeferredImmCons==0 ) goto jump_to_p2;
executed 96 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
db->nDeferredCons==0Description
TRUEevaluated 98 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 83 times by 1 test
Evaluated by:
  • Self test (438)
db->nDeferredImmCons==0Description
TRUEevaluated 96 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
2-98
6214 }else{
executed 85 times by 1 test: end of block
Executed by:
  • Self test (438)
85
6215 VdbeBranchTaken(p->nFkConstraint==0 && db->nDeferredImmCons==0, 2);-
6216 if( p->nFkConstraint==0 && db->nDeferredImmCons==0 ) goto jump_to_p2;
executed 275 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
p->nFkConstraint==0Description
TRUEevaluated 284 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 255 times by 1 test
Evaluated by:
  • Self test (438)
db->nDeferredImmCons==0Description
TRUEevaluated 275 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 9 times by 1 test
Evaluated by:
  • Self test (438)
9-284
6217 }
executed 264 times by 1 test: end of block
Executed by:
  • Self test (438)
264
6218 break;
executed 349 times by 1 test: break;
Executed by:
  • Self test (438)
349
6219}-
6220#endif /* #ifndef SQLITE_OMIT_FOREIGN_KEY */-
6221-
6222#ifndef SQLITE_OMIT_AUTOINCREMENT-
6223/* Opcode: MemMax P1 P2 * * *-
6224** Synopsis: r[P1]=max(r[P1],r[P2])-
6225**-
6226** P1 is a register in the root frame of this VM (the root frame is-
6227** different from the current frame if this instruction is being executed-
6228** within a sub-program). Set the value of register P1 to the maximum of -
6229** its current value and the value in register P2.-
6230**-
6231** This instruction throws an error if the memory cell is not initially-
6232** an integer.-
6233*/-
6234case
executed 138 times by 1 test: case 152:
Executed by:
  • Self test (438)
OP_MemMax: { /* in2 */
executed 138 times by 1 test: case 152:
Executed by:
  • Self test (438)
138
6235 VdbeFrame *pFrame;-
6236 if( p->pFrame ){
p->pFrameDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 108 times by 1 test
Evaluated by:
  • Self test (438)
30-108
6237 for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
executed 8 times by 1 test: ;
Executed by:
  • Self test (438)
pFrame->pParentDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 30 times by 1 test
Evaluated by:
  • Self test (438)
8-30
6238 pIn1 = &pFrame->aMem[pOp->p1];-
6239 }else{
executed 30 times by 1 test: end of block
Executed by:
  • Self test (438)
30
6240 pIn1 = &aMem[pOp->p1];-
6241 }
executed 108 times by 1 test: end of block
Executed by:
  • Self test (438)
108
6242 assert( memIsValid(pIn1) );-
6243 sqlite3VdbeMemIntegerify(pIn1);-
6244 pIn2 = &aMem[pOp->p2];-
6245 sqlite3VdbeMemIntegerify(pIn2);-
6246 if( pIn1->u.i<pIn2->u.i){
pIn1->u.i<pIn2->u.iDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 96 times by 1 test
Evaluated by:
  • Self test (438)
42-96
6247 pIn1->u.i = pIn2->u.i;-
6248 }
executed 42 times by 1 test: end of block
Executed by:
  • Self test (438)
42
6249 break;
executed 138 times by 1 test: break;
Executed by:
  • Self test (438)
138
6250}-
6251#endif /* SQLITE_OMIT_AUTOINCREMENT */-
6252-
6253/* Opcode: IfPos P1 P2 P3 * *-
6254** Synopsis: if r[P1]>0 then r[P1]-=P3, goto P2-
6255**-
6256** Register P1 must contain an integer.-
6257** If the value of register P1 is 1 or greater, subtract P3 from the-
6258** value in P1 and jump to P2.-
6259**-
6260** If the initial value of register P1 is less than 1, then the-
6261** value is unchanged and control passes through to the next instruction.-
6262*/-
6263case
executed 386494 times by 1 test: case 47:
Executed by:
  • Self test (438)
OP_IfPos: { /* jump, in1 */
executed 386494 times by 1 test: case 47:
Executed by:
  • Self test (438)
386494
6264 pIn1 = &aMem[pOp->p1];-
6265 assert( pIn1->flags&MEM_Int );-
6266 VdbeBranchTaken( pIn1->u.i>0, 2);-
6267 if( pIn1->u.i>0 ){
pIn1->u.i>0Description
TRUEevaluated 199820 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 186674 times by 1 test
Evaluated by:
  • Self test (438)
186674-199820
6268 pIn1->u.i -= pOp->p3;-
6269 goto jump_to_p2;
executed 199820 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
199820
6270 }-
6271 break;
executed 186674 times by 1 test: break;
Executed by:
  • Self test (438)
186674
6272}-
6273-
6274/* Opcode: OffsetLimit P1 P2 P3 * *-
6275** Synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)-
6276**-
6277** This opcode performs a commonly used computation associated with-
6278** LIMIT and OFFSET process. r[P1] holds the limit counter. r[P3]-
6279** holds the offset counter. The opcode computes the combined value-
6280** of the LIMIT and OFFSET and stores that value in r[P2]. The r[P2]-
6281** value computed is the total number of rows that will need to be-
6282** visited in order to complete the query.-
6283**-
6284** If r[P3] is zero or negative, that means there is no OFFSET-
6285** and r[P2] is set to be the value of the LIMIT, r[P1].-
6286**-
6287** if r[P1] is zero or negative, that means there is no LIMIT-
6288** and r[P2] is set to -1. -
6289**-
6290** Otherwise, r[P2] is set to the sum of r[P1] and r[P3].-
6291*/-
6292case
executed 473 times by 1 test: case 153:
Executed by:
  • Self test (438)
OP_OffsetLimit: { /* in1, out2, in3 */
executed 473 times by 1 test: case 153:
Executed by:
  • Self test (438)
473
6293 i64 x;-
6294 pIn1 = &aMem[pOp->p1];-
6295 pIn3 = &aMem[pOp->p3];-
6296 pOut = out2Prerelease(p, pOp);-
6297 assert( pIn1->flags & MEM_Int );-
6298 assert( pIn3->flags & MEM_Int );-
6299 x = pIn1->u.i;-
6300 if( x<=0 || sqlite3AddInt64(&x, pIn3->u.i>0?pIn3->u.i:0) ){
x<=0Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 458 times by 1 test
Evaluated by:
  • Self test (438)
sqlite3AddInt6...0?pIn3->u.i:0)Description
TRUEnever evaluated
FALSEevaluated 458 times by 1 test
Evaluated by:
  • Self test (438)
0-458
6301 /* If the LIMIT is less than or equal to zero, loop forever. This-
6302 ** is documented. But also, if the LIMIT+OFFSET exceeds 2^63 then-
6303 ** also loop forever. This is undocumented. In fact, one could argue-
6304 ** that the loop should terminate. But assuming 1 billion iterations-
6305 ** per second (far exceeding the capabilities of any current hardware)-
6306 ** it would take nearly 300 years to actually reach the limit. So-
6307 ** looping forever is a reasonable approximation. */-
6308 pOut->u.i = -1;-
6309 }else{
executed 15 times by 1 test: end of block
Executed by:
  • Self test (438)
15
6310 pOut->u.i = x;-
6311 }
executed 458 times by 1 test: end of block
Executed by:
  • Self test (438)
458
6312 break;
executed 473 times by 1 test: break;
Executed by:
  • Self test (438)
473
6313}-
6314-
6315/* Opcode: IfNotZero P1 P2 * * *-
6316** Synopsis: if r[P1]!=0 then r[P1]--, goto P2-
6317**-
6318** Register P1 must contain an integer. If the content of register P1 is-
6319** initially greater than zero, then decrement the value in register P1.-
6320** If it is non-zero (negative or positive) and then also jump to P2. -
6321** If register P1 is initially zero, leave it unchanged and fall through.-
6322*/-
6323case
executed 158371 times by 12 tests: case 48:
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)
OP_IfNotZero: { /* jump, in1 */
executed 158371 times by 12 tests: case 48:
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)
158371
6324 pIn1 = &aMem[pOp->p1];-
6325 assert( pIn1->flags&MEM_Int );-
6326 VdbeBranchTaken(pIn1->u.i<0, 2);-
6327 if( pIn1->u.i ){
pIn1->u.iDescription
TRUEevaluated 15254 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 143117 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)
15254-143117
6328 if( pIn1->u.i>0 ) pIn1->u.i--;
executed 13175 times by 1 test: pIn1->u.i--;
Executed by:
  • Self test (438)
pIn1->u.i>0Description
TRUEevaluated 13175 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2079 times by 1 test
Evaluated by:
  • Self test (438)
2079-13175
6329 goto jump_to_p2;
executed 15254 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
15254
6330 }-
6331 break;
executed 143117 times by 12 tests: break;
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)
143117
6332}-
6333-
6334/* Opcode: DecrJumpZero P1 P2 * * *-
6335** Synopsis: if (--r[P1])==0 goto P2-
6336**-
6337** Register P1 must hold an integer. Decrement the value in P1-
6338** and jump to P2 if the new value is exactly zero.-
6339*/-
6340case
executed 540414 times by 1 test: case 49:
Executed by:
  • Self test (438)
OP_DecrJumpZero: { /* jump, in1 */
executed 540414 times by 1 test: case 49:
Executed by:
  • Self test (438)
540414
6341 pIn1 = &aMem[pOp->p1];-
6342 assert( pIn1->flags&MEM_Int );-
6343 if( pIn1->u.i>SMALLEST_INT64 ) pIn1->u.i--;
executed 540414 times by 1 test: pIn1->u.i--;
Executed by:
  • Self test (438)
pIn1->u.i>(((i...ffffff)<<32)))Description
TRUEevaluated 540414 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-540414
6344 VdbeBranchTaken(pIn1->u.i==0, 2);-
6345 if( pIn1->u.i==0 ) goto jump_to_p2;
executed 176467 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
pIn1->u.i==0Description
TRUEevaluated 176467 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 363947 times by 1 test
Evaluated by:
  • Self test (438)
176467-363947
6346 break;
executed 363947 times by 1 test: break;
Executed by:
  • Self test (438)
363947
6347}-
6348-
6349-
6350/* Opcode: AggStep * P2 P3 P4 P5-
6351** Synopsis: accum=r[P3] step(r[P2@P5])-
6352**-
6353** Execute the xStep function for an aggregate.-
6354** The function has P5 arguments. P4 is a pointer to the -
6355** FuncDef structure that specifies the function. Register P3 is the-
6356** accumulator.-
6357**-
6358** The P5 arguments are taken from register P2 and its-
6359** successors.-
6360*/-
6361/* Opcode: AggInverse * P2 P3 P4 P5-
6362** Synopsis: accum=r[P3] inverse(r[P2@P5])-
6363**-
6364** Execute the xInverse function for an aggregate.-
6365** The function has P5 arguments. P4 is a pointer to the -
6366** FuncDef structure that specifies the function. Register P3 is the-
6367** accumulator.-
6368**-
6369** The P5 arguments are taken from register P2 and its-
6370** successors.-
6371*/-
6372/* Opcode: AggStep1 P1 P2 P3 P4 P5-
6373** Synopsis: accum=r[P3] step(r[P2@P5])-
6374**-
6375** Execute the xStep (if P1==0) or xInverse (if P1!=0) function for an-
6376** aggregate. The function has P5 arguments. P4 is a pointer to the -
6377** FuncDef structure that specifies the function. Register P3 is the-
6378** accumulator.-
6379**-
6380** The P5 arguments are taken from register P2 and its-
6381** successors.-
6382**-
6383** This opcode is initially coded as OP_AggStep0. On first evaluation,-
6384** the FuncDef stored in P4 is converted into an sqlite3_context and-
6385** the opcode is changed. In this way, the initialization of the-
6386** sqlite3_context only happens once, instead of on each call to the-
6387** step function.-
6388*/-
6389case
executed 232 times by 1 test: case 154:
Executed by:
  • Self test (438)
OP_AggInverse:
executed 232 times by 1 test: case 154:
Executed by:
  • Self test (438)
232
6390case
executed 26252 times by 1 test: case 155:
Executed by:
  • Self test (438)
OP_AggStep: {
executed 26252 times by 1 test: case 155:
Executed by:
  • Self test (438)
26252
6391 int n;-
6392 sqlite3_context *pCtx;-
6393-
6394 assert( pOp->p4type==P4_FUNCDEF );-
6395 n = pOp->p5;-
6396 assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );-
6397 assert( n==0 || (pOp->p2>0 && pOp->p2+n<=(p->nMem+1 - p->nCursor)+1) );-
6398 assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+n );-
6399 pCtx = sqlite3DbMallocRawNN(db, n*sizeof(sqlite3_value*) +-
6400 (sizeof(pCtx[0]) + sizeof(Mem) - sizeof(sqlite3_value*)));-
6401 if( pCtx==0 ) goto no_mem;
never executed: goto no_mem;
pCtx==0Description
TRUEnever evaluated
FALSEevaluated 26484 times by 1 test
Evaluated by:
  • Self test (438)
0-26484
6402 pCtx->pMem = 0;-
6403 pCtx->pOut = (Mem*)&(pCtx->argv[n]);-
6404 sqlite3VdbeMemInit(pCtx->pOut, db, MEM_Null);-
6405 pCtx->pFunc = pOp->p4.pFunc;-
6406 pCtx->iOp = (int)(pOp - aOp);-
6407 pCtx->pVdbe = p;-
6408 pCtx->skipFlag = 0;-
6409 pCtx->isError = 0;-
6410 pCtx->argc = n;-
6411 pOp->p4type = P4_FUNCCTX;-
6412 pOp->p4.pCtx = pCtx;-
6413-
6414 /* OP_AggInverse must have P1==1 and OP_AggStep must have P1==0 */-
6415 assert( pOp->p1==(pOp->opcode==OP_AggInverse) );-
6416-
6417 pOp->opcode = OP_AggStep1;-
6418 /* Fall through into OP_AggStep */-
6419}-
6420case
code before this statement executed 26484 times by 1 test: case 156:
Executed by:
  • Self test (438)
executed 6797614 times by 1 test: case 156:
Executed by:
  • Self test (438)
OP_AggStep1: {
code before this statement executed 26484 times by 1 test: case 156:
Executed by:
  • Self test (438)
executed 6797614 times by 1 test: case 156:
Executed by:
  • Self test (438)
26484-6797614
6421 int i;-
6422 sqlite3_context *pCtx;-
6423 Mem *pMem;-
6424-
6425 assert( pOp->p4type==P4_FUNCCTX );-
6426 pCtx = pOp->p4.pCtx;-
6427 pMem = &aMem[pOp->p3];-
6428-
6429#ifdef SQLITE_DEBUG-
6430 if( pOp->p1 ){-
6431 /* This is an OP_AggInverse call. Verify that xStep has always-
6432 ** been called at least once prior to any xInverse call. */-
6433 assert( pMem->uTemp==0x1122e0e3 );-
6434 }else{-
6435 /* This is an OP_AggStep call. Mark it as such. */-
6436 pMem->uTemp = 0x1122e0e3;-
6437 }-
6438#endif-
6439-
6440 /* If this function is inside of a trigger, the register array in aMem[]-
6441 ** might change from one evaluation to the next. The next block of code-
6442 ** checks to see if the register array has changed, and if so it-
6443 ** reinitializes the relavant parts of the sqlite3_context object */-
6444 if( pCtx->pMem != pMem ){
pCtx->pMem != pMemDescription
TRUEevaluated 26983 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6797115 times by 1 test
Evaluated by:
  • Self test (438)
26983-6797115
6445 pCtx->pMem = pMem;-
6446 for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
executed 33697 times by 1 test: pCtx->argv[i] = &aMem[pOp->p2+i];
Executed by:
  • Self test (438)
i>=0Description
TRUEevaluated 33697 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 26983 times by 1 test
Evaluated by:
  • Self test (438)
26983-33697
6447 }
executed 26983 times by 1 test: end of block
Executed by:
  • Self test (438)
26983
6448-
6449#ifdef SQLITE_DEBUG-
6450 for(i=0; i<pCtx->argc; i++){-
6451 assert( memIsValid(pCtx->argv[i]) );-
6452 REGISTER_TRACE(pOp->p2+i, pCtx->argv[i]);-
6453 }-
6454#endif-
6455-
6456 pMem->n++;-
6457 assert( pCtx->pOut->flags==MEM_Null );-
6458 assert( pCtx->isError==0 );-
6459 assert( pCtx->skipFlag==0 );-
6460#ifndef SQLITE_OMIT_WINDOWFUNC-
6461 if( pOp->p1 ){
pOp->p1Description
TRUEevaluated 31080 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6793018 times by 1 test
Evaluated by:
  • Self test (438)
31080-6793018
6462 (pCtx->pFunc->xInverse)(pCtx,pCtx->argc,pCtx->argv);-
6463 }else
executed 31080 times by 1 test: end of block
Executed by:
  • Self test (438)
31080
6464#endif-
6465 (pCtx->pFunc->xSFunc)(pCtx,pCtx->argc,pCtx->argv); /* IMP: R-24505-23230 */
executed 6793018 times by 1 test: (pCtx->pFunc->xSFunc)(pCtx,pCtx->argc,pCtx->argv);
Executed by:
  • Self test (438)
6793018
6466-
6467 if( pCtx->isError ){
pCtx->isErrorDescription
TRUEevaluated 69328 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6754770 times by 1 test
Evaluated by:
  • Self test (438)
69328-6754770
6468 if( pCtx->isError>0 ){
pCtx->isError>0Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 69306 times by 1 test
Evaluated by:
  • Self test (438)
22-69306
6469 sqlite3VdbeError(p, "%s", sqlite3_value_text(pCtx->pOut));-
6470 rc = pCtx->isError;-
6471 }
executed 22 times by 1 test: end of block
Executed by:
  • Self test (438)
22
6472 if( pCtx->skipFlag ){
pCtx->skipFlagDescription
TRUEevaluated 69306 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 22 times by 1 test
Evaluated by:
  • Self test (438)
22-69306
6473 assert( pOp[-1].opcode==OP_CollSeq );-
6474 i = pOp[-1].p1;-
6475 if( i ) sqlite3VdbeMemSetInt64(&aMem[i], 1);
executed 60268 times by 1 test: sqlite3VdbeMemSetInt64(&aMem[i], 1);
Executed by:
  • Self test (438)
iDescription
TRUEevaluated 60268 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 9038 times by 1 test
Evaluated by:
  • Self test (438)
9038-60268
6476 pCtx->skipFlag = 0;-
6477 }
executed 69306 times by 1 test: end of block
Executed by:
  • Self test (438)
69306
6478 sqlite3VdbeMemRelease(pCtx->pOut);-
6479 pCtx->pOut->flags = MEM_Null;-
6480 pCtx->isError = 0;-
6481 if( rc ) goto abort_due_to_error;
executed 22 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 69306 times by 1 test
Evaluated by:
  • Self test (438)
22-69306
6482 }
executed 69306 times by 1 test: end of block
Executed by:
  • Self test (438)
69306
6483 assert( pCtx->pOut->flags==MEM_Null );-
6484 assert( pCtx->skipFlag==0 );-
6485 break;
executed 6824076 times by 1 test: break;
Executed by:
  • Self test (438)
6824076
6486}-
6487-
6488/* Opcode: AggFinal P1 P2 * P4 *-
6489** Synopsis: accum=r[P1] N=P2-
6490**-
6491** P1 is the memory location that is the accumulator for an aggregate-
6492** or window function. Execute the finalizer function -
6493** for an aggregate and store the result in P1.-
6494**-
6495** P2 is the number of arguments that the step function takes and-
6496** P4 is a pointer to the FuncDef for this function. The P2-
6497** argument is not used by this opcode. It is only there to disambiguate-
6498** functions that can take varying numbers of arguments. The-
6499** P4 argument is only needed for the case where-
6500** the step function was not previously called.-
6501*/-
6502/* Opcode: AggValue * P2 P3 P4 *-
6503** Synopsis: r[P3]=value N=P2-
6504**-
6505** Invoke the xValue() function and store the result in register P3.-
6506**-
6507** P2 is the number of arguments that the step function takes and-
6508** P4 is a pointer to the FuncDef for this function. The P2-
6509** argument is not used by this opcode. It is only there to disambiguate-
6510** functions that can take varying numbers of arguments. The-
6511** P4 argument is only needed for the case where-
6512** the step function was not previously called.-
6513*/-
6514case
executed 191503 times by 1 test: case 157:
Executed by:
  • Self test (438)
OP_AggValue:
executed 191503 times by 1 test: case 157:
Executed by:
  • Self test (438)
191503
6515case
executed 44992 times by 1 test: case 158:
Executed by:
  • Self test (438)
OP_AggFinal: {
executed 44992 times by 1 test: case 158:
Executed by:
  • Self test (438)
44992
6516 Mem *pMem;-
6517 assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) );-
6518 assert( pOp->p3==0 || pOp->opcode==OP_AggValue );-
6519 pMem = &aMem[pOp->p1];-
6520 assert( (pMem->flags & ~(MEM_Null|MEM_Agg))==0 );-
6521#ifndef SQLITE_OMIT_WINDOWFUNC-
6522 if( pOp->p3 ){
pOp->p3Description
TRUEevaluated 191503 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 44992 times by 1 test
Evaluated by:
  • Self test (438)
44992-191503
6523 rc = sqlite3VdbeMemAggValue(pMem, &aMem[pOp->p3], pOp->p4.pFunc);-
6524 pMem = &aMem[pOp->p3];-
6525 }else
executed 191503 times by 1 test: end of block
Executed by:
  • Self test (438)
191503
6526#endif-
6527 {-
6528 rc = sqlite3VdbeMemFinalize(pMem, pOp->p4.pFunc);-
6529 }
executed 44992 times by 1 test: end of block
Executed by:
  • Self test (438)
44992
6530 -
6531 if( rc ){
rcDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 236491 times by 1 test
Evaluated by:
  • Self test (438)
4-236491
6532 sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));-
6533 goto abort_due_to_error;
executed 4 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
4
6534 }-
6535 sqlite3VdbeChangeEncoding(pMem, encoding);-
6536 UPDATE_MAX_BLOBSIZE(pMem);-
6537 if( sqlite3VdbeMemTooBig(pMem) ){
sqlite3VdbeMemTooBig(pMem)Description
TRUEnever evaluated
FALSEevaluated 236491 times by 1 test
Evaluated by:
  • Self test (438)
0-236491
6538 goto too_big;
never executed: goto too_big;
0
6539 }-
6540 break;
executed 236491 times by 1 test: break;
Executed by:
  • Self test (438)
236491
6541}-
6542-
6543#ifndef SQLITE_OMIT_WAL-
6544/* Opcode: Checkpoint P1 P2 P3 * *-
6545**-
6546** Checkpoint database P1. This is a no-op if P1 is not currently in-
6547** WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL,-
6548** RESTART, or TRUNCATE. Write 1 or 0 into mem[P3] if the checkpoint returns-
6549** SQLITE_BUSY or not, respectively. Write the number of pages in the-
6550** WAL after the checkpoint into mem[P3+1] and the number of pages-
6551** in the WAL that have been checkpointed after the checkpoint-
6552** completes into mem[P3+2]. However on an error, mem[P3+1] and-
6553** mem[P3+2] are initialized to -1.-
6554*/-
6555case
executed 4423 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)
OP_Checkpoint: {
executed 4423 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)
4423
6556 int i; /* Loop counter */-
6557 int aRes[3]; /* Results */-
6558 Mem *pMem; /* Write results here */-
6559-
6560 assert( p->readOnly==0 );-
6561 aRes[0] = 0;-
6562 aRes[1] = aRes[2] = -1;-
6563 assert( pOp->p2==SQLITE_CHECKPOINT_PASSIVE-
6564 || pOp->p2==SQLITE_CHECKPOINT_FULL-
6565 || pOp->p2==SQLITE_CHECKPOINT_RESTART-
6566 || pOp->p2==SQLITE_CHECKPOINT_TRUNCATE-
6567 );-
6568 rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]);-
6569 if( rc ){
rcDescription
TRUEevaluated 47 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4376 times by 8 tests
Evaluated 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)
47-4376
6570 if( rc!=SQLITE_BUSY ) goto abort_due_to_error;
executed 7 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rc!=5Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 40 times by 1 test
Evaluated by:
  • Self test (438)
7-40
6571 rc = SQLITE_OK;-
6572 aRes[0] = 1;-
6573 }
executed 40 times by 1 test: end of block
Executed by:
  • Self test (438)
40
6574 for(i=0, pMem = &aMem[pOp->p3]; i<3; i++, pMem++){
i<3Description
TRUEevaluated 13248 times by 8 tests
Evaluated 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)
FALSEevaluated 4416 times by 8 tests
Evaluated 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)
4416-13248
6575 sqlite3VdbeMemSetInt64(pMem, (i64)aRes[i]);-
6576 }
executed 13248 times by 8 tests: end of block
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)
13248
6577 break;
executed 4416 times by 8 tests: break;
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)
4416
6578}; -
6579#endif-
6580-
6581#ifndef SQLITE_OMIT_PRAGMA-
6582/* Opcode: JournalMode P1 P2 P3 * *-
6583**-
6584** Change the journal mode of database P1 to P3. P3 must be one of the-
6585** PAGER_JOURNALMODE_XXX values. If changing between the various rollback-
6586** modes (delete, truncate, persist, off and memory), this is a simple-
6587** operation. No IO is required.-
6588**-
6589** If changing into or out of WAL mode the procedure is more complicated.-
6590**-
6591** Write a string containing the final journal-mode to register P2.-
6592*/-
6593case
executed 5364 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)
OP_JournalMode: { /* out2 */
executed 5364 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)
5364
6594 Btree *pBt; /* Btree to change journal mode of */-
6595 Pager *pPager; /* Pager associated with pBt */-
6596 int eNew; /* New journal mode */-
6597 int eOld; /* The old journal mode */-
6598#ifndef SQLITE_OMIT_WAL-
6599 const char *zFilename; /* Name of database file for pPager */-
6600#endif-
6601-
6602 pOut = out2Prerelease(p, pOp);-
6603 eNew = pOp->p3;-
6604 assert( eNew==PAGER_JOURNALMODE_DELETE -
6605 || eNew==PAGER_JOURNALMODE_TRUNCATE -
6606 || eNew==PAGER_JOURNALMODE_PERSIST -
6607 || eNew==PAGER_JOURNALMODE_OFF-
6608 || eNew==PAGER_JOURNALMODE_MEMORY-
6609 || eNew==PAGER_JOURNALMODE_WAL-
6610 || eNew==PAGER_JOURNALMODE_QUERY-
6611 );-
6612 assert( pOp->p1>=0 && pOp->p1<db->nDb );-
6613 assert( p->readOnly==0 );-
6614-
6615 pBt = db->aDb[pOp->p1].pBt;-
6616 pPager = sqlite3BtreePager(pBt);-
6617 eOld = sqlite3PagerGetJournalMode(pPager);-
6618 if( eNew==PAGER_JOURNALMODE_QUERY ) eNew = eOld;
executed 179 times by 5 tests: eNew = eOld;
Executed by:
  • Self test (438)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
eNew==(-1)Description
TRUEevaluated 179 times by 5 tests
Evaluated by:
  • Self test (438)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
FALSEevaluated 5185 times by 6 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
179-5185
6619 if( !sqlite3PagerOkToChangeJournalMode(pPager) ) eNew = eOld;
executed 22 times by 1 test: eNew = eOld;
Executed by:
  • Self test (438)
!sqlite3PagerO...alMode(pPager)Description
TRUEevaluated 22 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5342 times by 10 tests
Evaluated 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)
22-5342
6620-
6621#ifndef SQLITE_OMIT_WAL-
6622 zFilename = sqlite3PagerFilename(pPager, 1);-
6623-
6624 /* Do not allow a transition to journal_mode=WAL for a database-
6625 ** in temporary storage or if the VFS does not support shared memory -
6626 */-
6627 if( eNew==PAGER_JOURNALMODE_WAL
eNew==5Description
TRUEevaluated 4800 times by 8 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
FALSEevaluated 564 times by 3 tests
Evaluated by:
  • Self test (3)
  • Self test (438)
  • Self test (58)
564-4800
6628 && (sqlite3Strlen30(zFilename)==0 /* Temp file */
sqlite3Strlen30(zFilename)==0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4790 times by 8 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
10-4790
6629 || !sqlite3PagerWalSupported(pPager)) /* No shared-memory support */
!sqlite3PagerW...ported(pPager)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4786 times by 8 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
4-4786
6630 ){-
6631 eNew = eOld;-
6632 }
executed 14 times by 1 test: end of block
Executed by:
  • Self test (438)
14
6633-
6634 if( (eNew!=eOld)
(eNew!=eOld)Description
TRUEevaluated 825 times by 6 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
FALSEevaluated 4539 times by 5 tests
Evaluated by:
  • Self test (438)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
825-4539
6635 && (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL)
eOld==5Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 802 times by 6 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
eNew==5Description
TRUEevaluated 521 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
FALSEevaluated 281 times by 3 tests
Evaluated by:
  • Self test (3)
  • Self test (438)
  • Self test (58)
23-802
6636 ){-
6637 if( !db->autoCommit || db->nVdbeRead>1 ){
!db->autoCommitDescription
TRUEnever evaluated
FALSEevaluated 544 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
db->nVdbeRead>1Description
TRUEnever evaluated
FALSEevaluated 544 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
0-544
6638 rc = SQLITE_ERROR;-
6639 sqlite3VdbeError(p,-
6640 "cannot change %s wal mode from within a transaction",-
6641 (eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of")-
6642 );-
6643 goto abort_due_to_error;
never executed: goto abort_due_to_error;
0
6644 }else{-
6645 -
6646 if( eOld==PAGER_JOURNALMODE_WAL ){
eOld==5Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 521 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
23-521
6647 /* If leaving WAL mode, close the log file. If successful, the call-
6648 ** to PagerCloseWal() checkpoints and deletes the write-ahead-log -
6649 ** file. An EXCLUSIVE lock may still be held on the database file -
6650 ** after a successful return. -
6651 */-
6652 rc = sqlite3PagerCloseWal(pPager, db);-
6653 if( rc==SQLITE_OK ){
rc==0Description
TRUEevaluated 23 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-23
6654 sqlite3PagerSetJournalMode(pPager, eNew);-
6655 }
executed 23 times by 1 test: end of block
Executed by:
  • Self test (438)
23
6656 }else if( eOld==PAGER_JOURNALMODE_MEMORY ){
executed 23 times by 1 test: end of block
Executed by:
  • Self test (438)
eOld==4Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 519 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
2-519
6657 /* Cannot transition directly from MEMORY to WAL. Use mode OFF-
6658 ** as an intermediate */-
6659 sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF);-
6660 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
6661 -
6662 /* Open a transaction on the database file. Regardless of the journal-
6663 ** mode, this transaction always uses a rollback journal.-
6664 */-
6665 assert( sqlite3BtreeIsInTrans(pBt)==0 );-
6666 if( rc==SQLITE_OK ){
rc==0Description
TRUEevaluated 544 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
FALSEnever evaluated
0-544
6667 rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1));-
6668 }
executed 544 times by 4 tests: end of block
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
544
6669 }
executed 544 times by 4 tests: end of block
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (438)
544
6670 }-
6671#endif /* ifndef SQLITE_OMIT_WAL */-
6672-
6673 if( rc ) eNew = eOld;
executed 2 times by 1 test: eNew = eOld;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5362 times by 10 tests
Evaluated 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)
2-5362
6674 eNew = sqlite3PagerSetJournalMode(pPager, eNew);-
6675-
6676 pOut->flags = MEM_Str|MEM_Static|MEM_Term;-
6677 pOut->z = (char *)sqlite3JournalModename(eNew);-
6678 pOut->n = sqlite3Strlen30(pOut->z);-
6679 pOut->enc = SQLITE_UTF8;-
6680 sqlite3VdbeChangeEncoding(pOut, encoding);-
6681 if( rc ) goto abort_due_to_error;
executed 2 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5362 times by 10 tests
Evaluated 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)
2-5362
6682 break;
executed 5362 times by 10 tests: break;
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)
5362
6683};-
6684#endif /* SQLITE_OMIT_PRAGMA */-
6685-
6686#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)-
6687/* Opcode: Vacuum P1 * * * *-
6688**-
6689** Vacuum the entire database P1. P1 is 0 for "main", and 2 or more-
6690** for an attached database. The "temp" database may not be vacuumed.-
6691*/-
6692case
executed 875 times by 2 tests: case 8:
Executed by:
  • Self test (34)
  • Self test (438)
OP_Vacuum: {
executed 875 times by 2 tests: case 8:
Executed by:
  • Self test (34)
  • Self test (438)
875
6693 assert( p->readOnly==0 );-
6694 rc = sqlite3RunVacuum(&p->zErrMsg, db, pOp->p1);-
6695 if( rc ) goto abort_due_to_error;
executed 745 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 745 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 130 times by 2 tests
Evaluated by:
  • Self test (34)
  • Self test (438)
130-745
6696 break;
executed 130 times by 2 tests: break;
Executed by:
  • Self test (34)
  • Self test (438)
130
6697}-
6698#endif-
6699-
6700#if !defined(SQLITE_OMIT_AUTOVACUUM)-
6701/* Opcode: IncrVacuum P1 P2 * * *-
6702**-
6703** Perform a single step of the incremental vacuum procedure on-
6704** the P1 database. If the vacuum has finished, jump to instruction-
6705** P2. Otherwise, fall through to the next instruction.-
6706*/-
6707case
executed 7887 times by 1 test: case 59:
Executed by:
  • Self test (438)
OP_IncrVacuum: { /* jump */
executed 7887 times by 1 test: case 59:
Executed by:
  • Self test (438)
7887
6708 Btree *pBt;-
6709-
6710 assert( pOp->p1>=0 && pOp->p1<db->nDb );-
6711 assert( DbMaskTest(p->btreeMask, pOp->p1) );-
6712 assert( p->readOnly==0 );-
6713 pBt = db->aDb[pOp->p1].pBt;-
6714 rc = sqlite3BtreeIncrVacuum(pBt);-
6715 VdbeBranchTaken(rc==SQLITE_DONE,2);-
6716 if( rc ){
rcDescription
TRUEevaluated 107 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 7780 times by 1 test
Evaluated by:
  • Self test (438)
107-7780
6717 if( rc!=SQLITE_DONE ) goto abort_due_to_error;
executed 8 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rc!=101Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 99 times by 1 test
Evaluated by:
  • Self test (438)
8-99
6718 rc = SQLITE_OK;-
6719 goto jump_to_p2;
executed 99 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
99
6720 }-
6721 break;
executed 7780 times by 1 test: break;
Executed by:
  • Self test (438)
7780
6722}-
6723#endif-
6724-
6725/* Opcode: Expire P1 P2 * * *-
6726**-
6727** Cause precompiled statements to expire. When an expired statement-
6728** is executed using sqlite3_step() it will either automatically-
6729** reprepare itself (if it was originally created using sqlite3_prepare_v2())-
6730** or it will fail with SQLITE_SCHEMA.-
6731** -
6732** If P1 is 0, then all SQL statements become expired. If P1 is non-zero,-
6733** then only the currently executing statement is expired.-
6734**-
6735** If P2 is 0, then SQL statements are expired immediately. If P2 is 1,-
6736** then running SQL statements are allowed to continue to run to completion.-
6737** The P2==1 case occurs when a CREATE INDEX or similar schema change happens-
6738** that might help the statement run faster but which does not affect the-
6739** correctness of operation.-
6740*/-
6741case
executed 6297 times by 20 tests: case 159:
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (34)
  • Self test (4)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (5)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
OP_Expire: {
executed 6297 times by 20 tests: case 159:
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (34)
  • Self test (4)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (5)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
6297
6742 assert( pOp->p2==0 || pOp->p2==1 );-
6743 if( !pOp->p1 ){
!pOp->p1Description
TRUEevaluated 4673 times by 10 tests
Evaluated 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)
FALSEevaluated 1624 times by 12 tests
Evaluated by:
  • Self test (27)
  • Self test (34)
  • Self test (4)
  • Self test (438)
  • Self test (5)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
1624-4673
6744 sqlite3ExpirePreparedStatements(db, pOp->p2);-
6745 }else{
executed 4673 times by 10 tests: end of block
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)
4673
6746 p->expired = pOp->p2+1;-
6747 }
executed 1624 times by 12 tests: end of block
Executed by:
  • Self test (27)
  • Self test (34)
  • Self test (4)
  • Self test (438)
  • Self test (5)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
1624
6748 break;
executed 6297 times by 20 tests: break;
Executed by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (34)
  • Self test (4)
  • Self test (42)
  • Self test (438)
  • Self test (44)
  • Self test (46)
  • Self test (47)
  • Self test (5)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
6297
6749}-
6750-
6751#ifndef SQLITE_OMIT_SHARED_CACHE-
6752/* Opcode: TableLock P1 P2 P3 P4 *-
6753** Synopsis: iDb=P1 root=P2 write=P3-
6754**-
6755** Obtain a lock on a particular table. This instruction is only used when-
6756** the shared-cache feature is enabled. -
6757**-
6758** P1 is the index of the database in sqlite3.aDb[] of the database-
6759** on which the lock is acquired. A readlock is obtained if P3==0 or-
6760** a write lock if P3==1.-
6761**-
6762** P2 contains the root-page of the table to lock.-
6763**-
6764** P4 contains a pointer to the name of the table being locked. This is only-
6765** used to generate an error message if the lock cannot be obtained.-
6766*/-
6767case
executed 2211 times by 1 test: case 160:
Executed by:
  • Self test (438)
OP_TableLock: {
executed 2211 times by 1 test: case 160:
Executed by:
  • Self test (438)
2211
6768 u8 isWriteLock = (u8)pOp->p3;-
6769 if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommit) ){
isWriteLockDescription
TRUEevaluated 949 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1262 times by 1 test
Evaluated by:
  • Self test (438)
0==(db->flags&0x00000400)Description
TRUEevaluated 1248 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
14-1262
6770 int p1 = pOp->p1; -
6771 assert( p1>=0 && p1<db->nDb );-
6772 assert( DbMaskTest(p->btreeMask, p1) );-
6773 assert( isWriteLock==0 || isWriteLock==1 );-
6774 rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock);-
6775 if( rc ){
rcDescription
TRUEevaluated 46 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2151 times by 1 test
Evaluated by:
  • Self test (438)
46-2151
6776 if( (rc&0xFF)==SQLITE_LOCKED ){
(rc&0xFF)==6Description
TRUEevaluated 46 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-46
6777 const char *z = pOp->p4.z;-
6778 sqlite3VdbeError(p, "database table is locked: %s", z);-
6779 }
executed 46 times by 1 test: end of block
Executed by:
  • Self test (438)
46
6780 goto abort_due_to_error;
executed 46 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
46
6781 }-
6782 }
executed 2151 times by 1 test: end of block
Executed by:
  • Self test (438)
2151
6783 break;
executed 2165 times by 1 test: break;
Executed by:
  • Self test (438)
2165
6784}-
6785#endif /* SQLITE_OMIT_SHARED_CACHE */-
6786-
6787#ifndef SQLITE_OMIT_VIRTUALTABLE-
6788/* Opcode: VBegin * * * P4 *-
6789**-
6790** P4 may be a pointer to an sqlite3_vtab structure. If so, call the -
6791** xBegin method for that table.-
6792**-
6793** Also, whether or not P4 is set, check that this is not being called from-
6794** within a callback to a virtual table xSync() method. If it is, the error-
6795** code will be set to SQLITE_LOCKED.-
6796*/-
6797case
executed 2333 times by 1 test: case 161:
Executed by:
  • Self test (438)
OP_VBegin: {
executed 2333 times by 1 test: case 161:
Executed by:
  • Self test (438)
2333
6798 VTable *pVTab;-
6799 pVTab = pOp->p4.pVtab;-
6800 rc = sqlite3VtabBegin(db, pVTab);-
6801 if( pVTab ) sqlite3VtabImportErrmsg(p, pVTab->pVtab);
executed 1266 times by 1 test: sqlite3VtabImportErrmsg(p, pVTab->pVtab);
Executed by:
  • Self test (438)
pVTabDescription
TRUEevaluated 1266 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1067 times by 1 test
Evaluated by:
  • Self test (438)
1067-1266
6802 if( rc ) goto abort_due_to_error;
executed 6 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2327 times by 1 test
Evaluated by:
  • Self test (438)
6-2327
6803 break;
executed 2327 times by 1 test: break;
Executed by:
  • Self test (438)
2327
6804}-
6805#endif /* SQLITE_OMIT_VIRTUALTABLE */-
6806-
6807#ifndef SQLITE_OMIT_VIRTUALTABLE-
6808/* Opcode: VCreate P1 P2 * * *-
6809**-
6810** P2 is a register that holds the name of a virtual table in database -
6811** P1. Call the xCreate method for that table.-
6812*/-
6813case
executed 1005 times by 1 test: case 162:
Executed by:
  • Self test (438)
OP_VCreate: {
executed 1005 times by 1 test: case 162:
Executed by:
  • Self test (438)
1005
6814 Mem sMem; /* For storing the record being decoded */-
6815 const char *zTab; /* Name of the virtual table */-
6816-
6817 memset(&sMem, 0, sizeof(sMem));-
6818 sMem.db = db;-
6819 /* Because P2 is always a static string, it is impossible for the-
6820 ** sqlite3VdbeMemCopy() to fail */-
6821 assert( (aMem[pOp->p2].flags & MEM_Str)!=0 );-
6822 assert( (aMem[pOp->p2].flags & MEM_Static)!=0 );-
6823 rc = sqlite3VdbeMemCopy(&sMem, &aMem[pOp->p2]);-
6824 assert( rc==SQLITE_OK );-
6825 zTab = (const char*)sqlite3_value_text(&sMem);-
6826 assert( zTab || db->mallocFailed );-
6827 if( zTab ){
zTabDescription
TRUEevaluated 1005 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-1005
6828 rc = sqlite3VtabCallCreate(db, pOp->p1, zTab, &p->zErrMsg);-
6829 }
executed 1005 times by 1 test: end of block
Executed by:
  • Self test (438)
1005
6830 sqlite3VdbeMemRelease(&sMem);-
6831 if( rc ) goto abort_due_to_error;
executed 53 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 53 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 952 times by 1 test
Evaluated by:
  • Self test (438)
53-952
6832 break;
executed 952 times by 1 test: break;
Executed by:
  • Self test (438)
952
6833}-
6834#endif /* SQLITE_OMIT_VIRTUALTABLE */-
6835-
6836#ifndef SQLITE_OMIT_VIRTUALTABLE-
6837/* Opcode: VDestroy P1 * * P4 *-
6838**-
6839** P4 is the name of a virtual table in database P1. Call the xDestroy method-
6840** of that table.-
6841*/-
6842case
executed 60 times by 1 test: case 163:
Executed by:
  • Self test (438)
OP_VDestroy: {
executed 60 times by 1 test: case 163:
Executed by:
  • Self test (438)
60
6843 db->nVDestroy++;-
6844 rc = sqlite3VtabCallDestroy(db, pOp->p1, pOp->p4.z);-
6845 db->nVDestroy--;-
6846 if( rc ) goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 59 times by 1 test
Evaluated by:
  • Self test (438)
1-59
6847 break;
executed 59 times by 1 test: break;
Executed by:
  • Self test (438)
59
6848}-
6849#endif /* SQLITE_OMIT_VIRTUALTABLE */-
6850-
6851#ifndef SQLITE_OMIT_VIRTUALTABLE-
6852/* Opcode: VOpen P1 * * P4 *-
6853**-
6854** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.-
6855** P1 is a cursor number. This opcode opens a cursor to the virtual-
6856** table and stores that cursor in P1.-
6857*/-
6858case
executed 11227 times by 1 test: case 164:
Executed by:
  • Self test (438)
OP_VOpen: {
executed 11227 times by 1 test: case 164:
Executed by:
  • Self test (438)
11227
6859 VdbeCursor *pCur;-
6860 sqlite3_vtab_cursor *pVCur;-
6861 sqlite3_vtab *pVtab;-
6862 const sqlite3_module *pModule;-
6863-
6864 assert( p->bIsReader );-
6865 pCur = 0;-
6866 pVCur = 0;-
6867 pVtab = pOp->p4.pVtab->pVtab;-
6868 if( pVtab==0 || NEVER(pVtab->pModule==0) ){
pVtab==0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 11226 times by 1 test
Evaluated by:
  • Self test (438)
(pVtab->pModule==0)Description
TRUEnever evaluated
FALSEevaluated 11226 times by 1 test
Evaluated by:
  • Self test (438)
0-11226
6869 rc = SQLITE_LOCKED;-
6870 goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
1
6871 }-
6872 pModule = pVtab->pModule;-
6873 rc = pModule->xOpen(pVtab, &pVCur);-
6874 sqlite3VtabImportErrmsg(p, pVtab);-
6875 if( rc ) goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 11225 times by 1 test
Evaluated by:
  • Self test (438)
1-11225
6876-
6877 /* Initialize sqlite3_vtab_cursor base class */-
6878 pVCur->pVtab = pVtab;-
6879-
6880 /* Initialize vdbe cursor object */-
6881 pCur = allocateCursor(p, pOp->p1, 0, -1, CURTYPE_VTAB);-
6882 if( pCur ){
pCurDescription
TRUEevaluated 11225 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-11225
6883 pCur->uc.pVCur = pVCur;-
6884 pVtab->nRef++;-
6885 }else{
executed 11225 times by 1 test: end of block
Executed by:
  • Self test (438)
11225
6886 assert( db->mallocFailed );-
6887 pModule->xClose(pVCur);-
6888 goto no_mem;
never executed: goto no_mem;
0
6889 }-
6890 break;
executed 11225 times by 1 test: break;
Executed by:
  • Self test (438)
11225
6891}-
6892#endif /* SQLITE_OMIT_VIRTUALTABLE */-
6893-
6894#ifndef SQLITE_OMIT_VIRTUALTABLE-
6895/* Opcode: VFilter P1 P2 P3 P4 *-
6896** Synopsis: iplan=r[P3] zplan='P4'-
6897**-
6898** P1 is a cursor opened using VOpen. P2 is an address to jump to if-
6899** the filtered result set is empty.-
6900**-
6901** P4 is either NULL or a string that was generated by the xBestIndex-
6902** method of the module. The interpretation of the P4 string is left-
6903** to the module implementation.-
6904**-
6905** This opcode invokes the xFilter method on the virtual table specified-
6906** by P1. The integer query plan parameter to xFilter is stored in register-
6907** P3. Register P3+1 stores the argc parameter to be passed to the-
6908** xFilter method. Registers P3+2..P3+1+argc are the argc-
6909** additional parameters which are passed to-
6910** xFilter as argv. Register P3+2 becomes argv[0] when passed to xFilter.-
6911**-
6912** A jump is made to P2 if the result set after filtering would be empty.-
6913*/-
6914case
executed 13227 times by 1 test: case 9:
Executed by:
  • Self test (438)
OP_VFilter: { /* jump */
executed 13227 times by 1 test: case 9:
Executed by:
  • Self test (438)
13227
6915 int nArg;-
6916 int iQuery;-
6917 const sqlite3_module *pModule;-
6918 Mem *pQuery;-
6919 Mem *pArgc;-
6920 sqlite3_vtab_cursor *pVCur;-
6921 sqlite3_vtab *pVtab;-
6922 VdbeCursor *pCur;-
6923 int res;-
6924 int i;-
6925 Mem **apArg;-
6926-
6927 pQuery = &aMem[pOp->p3];-
6928 pArgc = &pQuery[1];-
6929 pCur = p->apCsr[pOp->p1];-
6930 assert( memIsValid(pQuery) );-
6931 REGISTER_TRACE(pOp->p3, pQuery);-
6932 assert( pCur->eCurType==CURTYPE_VTAB );-
6933 pVCur = pCur->uc.pVCur;-
6934 pVtab = pVCur->pVtab;-
6935 pModule = pVtab->pModule;-
6936-
6937 /* Grab the index number and argc parameters */-
6938 assert( (pQuery->flags&MEM_Int)!=0 && pArgc->flags==MEM_Int );-
6939 nArg = (int)pArgc->u.i;-
6940 iQuery = (int)pQuery->u.i;-
6941-
6942 /* Invoke the xFilter method */-
6943 res = 0;-
6944 apArg = p->apArg;-
6945 for(i = 0; i<nArg; i++){
i<nArgDescription
TRUEevaluated 19422 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 13227 times by 1 test
Evaluated by:
  • Self test (438)
13227-19422
6946 apArg[i] = &pArgc[i+1];-
6947 }
executed 19422 times by 1 test: end of block
Executed by:
  • Self test (438)
19422
6948 rc = pModule->xFilter(pVCur, iQuery, pOp->p4.z, nArg, apArg);-
6949 sqlite3VtabImportErrmsg(p, pVtab);-
6950 if( rc ) goto abort_due_to_error;
executed 19 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 19 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 13208 times by 1 test
Evaluated by:
  • Self test (438)
19-13208
6951 res = pModule->xEof(pVCur);-
6952 pCur->nullRow = 0;-
6953 VdbeBranchTaken(res!=0,2);-
6954 if( res ) goto jump_to_p2;
executed 1829 times by 1 test: goto jump_to_p2;
Executed by:
  • Self test (438)
resDescription
TRUEevaluated 1829 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 11379 times by 1 test
Evaluated by:
  • Self test (438)
1829-11379
6955 break;
executed 11379 times by 1 test: break;
Executed by:
  • Self test (438)
11379
6956}-
6957#endif /* SQLITE_OMIT_VIRTUALTABLE */-
6958-
6959#ifndef SQLITE_OMIT_VIRTUALTABLE-
6960/* Opcode: VColumn P1 P2 P3 * P5-
6961** Synopsis: r[P3]=vcolumn(P2)-
6962**-
6963** Store in register P3 the value of the P2-th column of-
6964** the current row of the virtual-table of cursor P1.-
6965**-
6966** If the VColumn opcode is being used to fetch the value of-
6967** an unchanging column during an UPDATE operation, then the P5-
6968** value is 1. Otherwise, P5 is 0. The P5 value is returned-
6969** by sqlite3_vtab_nochange() routine and can be used-
6970** by virtual table implementations to return special "no-change"-
6971** marks which can be more efficient, depending on the virtual table.-
6972*/-
6973case
executed 1478253 times by 1 test: case 165:
Executed by:
  • Self test (438)
OP_VColumn: {
executed 1478253 times by 1 test: case 165:
Executed by:
  • Self test (438)
1478253
6974 sqlite3_vtab *pVtab;-
6975 const sqlite3_module *pModule;-
6976 Mem *pDest;-
6977 sqlite3_context sContext;-
6978-
6979 VdbeCursor *pCur = p->apCsr[pOp->p1];-
6980 assert( pCur->eCurType==CURTYPE_VTAB );-
6981 assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );-
6982 pDest = &aMem[pOp->p3];-
6983 memAboutToChange(p, pDest);-
6984 if( pCur->nullRow ){
pCur->nullRowDescription
TRUEevaluated 56 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1478197 times by 1 test
Evaluated by:
  • Self test (438)
56-1478197
6985 sqlite3VdbeMemSetNull(pDest);-
6986 break;
executed 56 times by 1 test: break;
Executed by:
  • Self test (438)
56
6987 }-
6988 pVtab = pCur->uc.pVCur->pVtab;-
6989 pModule = pVtab->pModule;-
6990 assert( pModule->xColumn );-
6991 memset(&sContext, 0, sizeof(sContext));-
6992 sContext.pOut = pDest;-
6993 if( pOp->p5 ){
pOp->p5Description
TRUEevaluated 493 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1477704 times by 1 test
Evaluated by:
  • Self test (438)
493-1477704
6994 sqlite3VdbeMemSetNull(pDest);-
6995 pDest->flags = MEM_Null|MEM_Zero;-
6996 pDest->u.nZero = 0;-
6997 }else{
executed 493 times by 1 test: end of block
Executed by:
  • Self test (438)
493
6998 MemSetTypeFlag(pDest, MEM_Null);-
6999 }
executed 1477704 times by 1 test: end of block
Executed by:
  • Self test (438)
1477704
7000 rc = pModule->xColumn(pCur->uc.pVCur, &sContext, pOp->p2);-
7001 sqlite3VtabImportErrmsg(p, pVtab);-
7002 if( sContext.isError>0 ){
sContext.isError>0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1478196 times by 1 test
Evaluated by:
  • Self test (438)
1-1478196
7003 sqlite3VdbeError(p, "%s", sqlite3_value_text(pDest));-
7004 rc = sContext.isError;-
7005 }
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
1
7006 sqlite3VdbeChangeEncoding(pDest, encoding);-
7007 REGISTER_TRACE(pOp->p3, pDest);-
7008 UPDATE_MAX_BLOBSIZE(pDest);-
7009-
7010 if( sqlite3VdbeMemTooBig(pDest) ){
sqlite3VdbeMemTooBig(pDest)Description
TRUEnever evaluated
FALSEevaluated 1478197 times by 1 test
Evaluated by:
  • Self test (438)
0-1478197
7011 goto too_big;
never executed: goto too_big;
0
7012 }-
7013 if( rc ) goto abort_due_to_error;
executed 2 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1478195 times by 1 test
Evaluated by:
  • Self test (438)
2-1478195
7014 break;
executed 1478195 times by 1 test: break;
Executed by:
  • Self test (438)
1478195
7015}-
7016#endif /* SQLITE_OMIT_VIRTUALTABLE */-
7017-
7018#ifndef SQLITE_OMIT_VIRTUALTABLE-
7019/* Opcode: VNext P1 P2 * * *-
7020**-
7021** Advance virtual table P1 to the next row in its result set and-
7022** jump to instruction P2. Or, if the virtual table has reached-
7023** the end of its result set, then fall through to the next instruction.-
7024*/-
7025case
executed 1403372 times by 1 test: case 60:
Executed by:
  • Self test (438)
OP_VNext: { /* jump */
executed 1403372 times by 1 test: case 60:
Executed by:
  • Self test (438)
1403372
7026 sqlite3_vtab *pVtab;-
7027 const sqlite3_module *pModule;-
7028 int res;-
7029 VdbeCursor *pCur;-
7030-
7031 res = 0;-
7032 pCur = p->apCsr[pOp->p1];-
7033 assert( pCur->eCurType==CURTYPE_VTAB );-
7034 if( pCur->nullRow ){
pCur->nullRowDescription
TRUEevaluated 21 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1403351 times by 1 test
Evaluated by:
  • Self test (438)
21-1403351
7035 break;
executed 21 times by 1 test: break;
Executed by:
  • Self test (438)
21
7036 }-
7037 pVtab = pCur->uc.pVCur->pVtab;-
7038 pModule = pVtab->pModule;-
7039 assert( pModule->xNext );-
7040-
7041 /* Invoke the xNext() method of the module. There is no way for the-
7042 ** underlying implementation to return an error if one occurs during-
7043 ** xNext(). Instead, if an error occurs, true is returned (indicating that -
7044 ** data is available) and the error code returned when xColumn or-
7045 ** some other method is next invoked on the save virtual table cursor.-
7046 */-
7047 rc = pModule->xNext(pCur->uc.pVCur);-
7048 sqlite3VtabImportErrmsg(p, pVtab);-
7049 if( rc ) goto abort_due_to_error;
executed 5 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1403346 times by 1 test
Evaluated by:
  • Self test (438)
5-1403346
7050 res = pModule->xEof(pCur->uc.pVCur);-
7051 VdbeBranchTaken(!res,2);-
7052 if( !res ){
!resDescription
TRUEevaluated 1392002 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 11344 times by 1 test
Evaluated by:
  • Self test (438)
11344-1392002
7053 /* If there is data, jump to P2 */-
7054 goto jump_to_p2_and_check_for_interrupt;
executed 1392002 times by 1 test: goto jump_to_p2_and_check_for_interrupt;
Executed by:
  • Self test (438)
1392002
7055 }-
7056 goto check_for_interrupt;
executed 11344 times by 1 test: goto check_for_interrupt;
Executed by:
  • Self test (438)
11344
7057}-
7058#endif /* SQLITE_OMIT_VIRTUALTABLE */-
7059-
7060#ifndef SQLITE_OMIT_VIRTUALTABLE-
7061/* Opcode: VRename P1 * * P4 *-
7062**-
7063** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.-
7064** This opcode invokes the corresponding xRename method. The value-
7065** in register P1 is passed as the zName argument to the xRename method.-
7066*/-
7067case
executed 8 times by 1 test: case 166:
Executed by:
  • Self test (438)
OP_VRename: {
executed 8 times by 1 test: case 166:
Executed by:
  • Self test (438)
8
7068 sqlite3_vtab *pVtab;-
7069 Mem *pName;-
7070 int isLegacy;-
7071 -
7072 isLegacy = (db->flags & SQLITE_LegacyAlter);-
7073 db->flags |= SQLITE_LegacyAlter;-
7074 pVtab = pOp->p4.pVtab->pVtab;-
7075 pName = &aMem[pOp->p1];-
7076 assert( pVtab->pModule->xRename );-
7077 assert( memIsValid(pName) );-
7078 assert( p->readOnly==0 );-
7079 REGISTER_TRACE(pOp->p1, pName);-
7080 assert( pName->flags & MEM_Str );-
7081 testcase( pName->enc==SQLITE_UTF8 );-
7082 testcase( pName->enc==SQLITE_UTF16BE );-
7083 testcase( pName->enc==SQLITE_UTF16LE );-
7084 rc = sqlite3VdbeChangeEncoding(pName, SQLITE_UTF8);-
7085 if( rc ) goto abort_due_to_error;
never executed: goto abort_due_to_error;
rcDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
0-8
7086 rc = pVtab->pModule->xRename(pVtab, pName->z);-
7087 if( isLegacy==0 ) db->flags &= ~SQLITE_LegacyAlter;
executed 7 times by 1 test: db->flags &= ~0x04000000;
Executed by:
  • Self test (438)
isLegacy==0Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-7
7088 sqlite3VtabImportErrmsg(p, pVtab);-
7089 p->expired = 0;-
7090 if( rc ) goto abort_due_to_error;
executed 2 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
2-6
7091 break;
executed 6 times by 1 test: break;
Executed by:
  • Self test (438)
6
7092}-
7093#endif-
7094-
7095#ifndef SQLITE_OMIT_VIRTUALTABLE-
7096/* Opcode: VUpdate P1 P2 P3 P4 P5-
7097** Synopsis: data=r[P3@P2]-
7098**-
7099** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.-
7100** This opcode invokes the corresponding xUpdate method. P2 values-
7101** are contiguous memory cells starting at P3 to pass to the xUpdate -
7102** invocation. The value in register (P3+P2-1) corresponds to the -
7103** p2th element of the argv array passed to xUpdate.-
7104**-
7105** The xUpdate method will do a DELETE or an INSERT or both.-
7106** The argv[0] element (which corresponds to memory cell P3)-
7107** is the rowid of a row to delete. If argv[0] is NULL then no -
7108** deletion occurs. The argv[1] element is the rowid of the new -
7109** row. This can be NULL to have the virtual table select the new -
7110** rowid for itself. The subsequent elements in the array are -
7111** the values of columns in the new row.-
7112**-
7113** If P2==1 then no insert is performed. argv[0] is the rowid of-
7114** a row to delete.-
7115**-
7116** P1 is a boolean flag. If it is set to true and the xUpdate call-
7117** is successful, then the value returned by sqlite3_last_insert_rowid() -
7118** is set to the value of the rowid for the row just inserted.-
7119**-
7120** P5 is the error actions (OE_Replace, OE_Fail, OE_Ignore, etc) to-
7121** apply in the case of a constraint failure on an insert or update.-
7122*/-
7123case
executed 2118 times by 1 test: case 10:
Executed by:
  • Self test (438)
OP_VUpdate: {
executed 2118 times by 1 test: case 10:
Executed by:
  • Self test (438)
2118
7124 sqlite3_vtab *pVtab;-
7125 const sqlite3_module *pModule;-
7126 int nArg;-
7127 int i;-
7128 sqlite_int64 rowid;-
7129 Mem **apArg;-
7130 Mem *pX;-
7131-
7132 assert( pOp->p2==1 || pOp->p5==OE_Fail || pOp->p5==OE_Rollback -
7133 || pOp->p5==OE_Abort || pOp->p5==OE_Ignore || pOp->p5==OE_Replace-
7134 );-
7135 assert( p->readOnly==0 );-
7136 if( db->mallocFailed ) goto no_mem;
never executed: goto no_mem;
db->mallocFailedDescription
TRUEnever evaluated
FALSEevaluated 2118 times by 1 test
Evaluated by:
  • Self test (438)
0-2118
7137 sqlite3VdbeIncrWriteCounter(p, 0);-
7138 pVtab = pOp->p4.pVtab->pVtab;-
7139 if( pVtab==0 || NEVER(pVtab->pModule==0) ){
pVtab==0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2117 times by 1 test
Evaluated by:
  • Self test (438)
(pVtab->pModule==0)Description
TRUEnever evaluated
FALSEevaluated 2117 times by 1 test
Evaluated by:
  • Self test (438)
0-2117
7140 rc = SQLITE_LOCKED;-
7141 goto abort_due_to_error;
executed 1 time by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
1
7142 }-
7143 pModule = pVtab->pModule;-
7144 nArg = pOp->p2;-
7145 assert( pOp->p4type==P4_VTAB );-
7146 if( ALWAYS(pModule->xUpdate) ){
(pModule->xUpdate)Description
TRUEevaluated 2117 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-2117
7147 u8 vtabOnConflict = db->vtabOnConflict;-
7148 apArg = p->apArg;-
7149 pX = &aMem[pOp->p3];-
7150 for(i=0; i<nArg; i++){
i<nArgDescription
TRUEevaluated 14099 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2117 times by 1 test
Evaluated by:
  • Self test (438)
2117-14099
7151 assert( memIsValid(pX) );-
7152 memAboutToChange(p, pX);-
7153 apArg[i] = pX;-
7154 pX++;-
7155 }
executed 14099 times by 1 test: end of block
Executed by:
  • Self test (438)
14099
7156 db->vtabOnConflict = pOp->p5;-
7157 rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid);-
7158 db->vtabOnConflict = vtabOnConflict;-
7159 sqlite3VtabImportErrmsg(p, pVtab);-
7160 if( rc==SQLITE_OK && pOp->p1 ){
rc==0Description
TRUEevaluated 2080 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 37 times by 1 test
Evaluated by:
  • Self test (438)
pOp->p1Description
TRUEevaluated 1726 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 354 times by 1 test
Evaluated by:
  • Self test (438)
37-2080
7161 assert( nArg>1 && apArg[0] && (apArg[0]->flags&MEM_Null) );-
7162 db->lastRowid = rowid;-
7163 }
executed 1726 times by 1 test: end of block
Executed by:
  • Self test (438)
1726
7164 if( (rc&0xff)==SQLITE_CONSTRAINT && pOp->p4.pVtab->bConstraint ){
(rc&0xff)==19Description
TRUEevaluated 35 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2082 times by 1 test
Evaluated by:
  • Self test (438)
pOp->p4.pVtab->bConstraintDescription
TRUEnever evaluated
FALSEevaluated 35 times by 1 test
Evaluated by:
  • Self test (438)
0-2082
7165 if( pOp->p5==OE_Ignore ){
pOp->p5==4Description
TRUEnever evaluated
FALSEnever evaluated
0
7166 rc = SQLITE_OK;-
7167 }else{
never executed: end of block
0
7168 p->errorAction = ((pOp->p5==OE_Replace) ? OE_Abort : pOp->p5);
(pOp->p5==5)Description
TRUEnever evaluated
FALSEnever evaluated
0
7169 }
never executed: end of block
0
7170 }else{-
7171 p->nChange++;-
7172 }
executed 2117 times by 1 test: end of block
Executed by:
  • Self test (438)
2117
7173 if( rc ) goto abort_due_to_error;
executed 37 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 37 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2080 times by 1 test
Evaluated by:
  • Self test (438)
37-2080
7174 }
executed 2080 times by 1 test: end of block
Executed by:
  • Self test (438)
2080
7175 break;
executed 2080 times by 1 test: break;
Executed by:
  • Self test (438)
2080
7176}-
7177#endif /* SQLITE_OMIT_VIRTUALTABLE */-
7178-
7179#ifndef SQLITE_OMIT_PAGER_PRAGMAS-
7180/* Opcode: Pagecount P1 P2 * * *-
7181**-
7182** Write the current number of pages in database P1 to memory cell P2.-
7183*/-
7184case
executed 102 times by 1 test: case 167:
Executed by:
  • Self test (438)
OP_Pagecount: { /* out2 */
executed 102 times by 1 test: case 167:
Executed by:
  • Self test (438)
102
7185 pOut = out2Prerelease(p, pOp);-
7186 pOut->u.i = sqlite3BtreeLastPage(db->aDb[pOp->p1].pBt);-
7187 break;
executed 102 times by 1 test: break;
Executed by:
  • Self test (438)
102
7188}-
7189#endif-
7190-
7191-
7192#ifndef SQLITE_OMIT_PAGER_PRAGMAS-
7193/* Opcode: MaxPgcnt P1 P2 P3 * *-
7194**-
7195** Try to set the maximum page count for database P1 to the value in P3.-
7196** Do not let the maximum page count fall below the current page count and-
7197** do not change the maximum page count value if P3==0.-
7198**-
7199** Store the maximum page count after the change in register P2.-
7200*/-
7201case
executed 12 times by 2 tests: case 168:
Executed by:
  • Self test (39)
  • Self test (438)
OP_MaxPgcnt: { /* out2 */
executed 12 times by 2 tests: case 168:
Executed by:
  • Self test (39)
  • Self test (438)
12
7202 unsigned int newMax;-
7203 Btree *pBt;-
7204-
7205 pOut = out2Prerelease(p, pOp);-
7206 pBt = db->aDb[pOp->p1].pBt;-
7207 newMax = 0;-
7208 if( pOp->p3 ){
pOp->p3Description
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • Self test (39)
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
2-10
7209 newMax = sqlite3BtreeLastPage(pBt);-
7210 if( newMax < (unsigned)pOp->p3 ) newMax = (unsigned)pOp->p3;
executed 6 times by 1 test: newMax = (unsigned)pOp->p3;
Executed by:
  • Self test (438)
newMax < (unsigned)pOp->p3Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • Self test (39)
  • Self test (438)
4-6
7211 }
executed 10 times by 2 tests: end of block
Executed by:
  • Self test (39)
  • Self test (438)
10
7212 pOut->u.i = sqlite3BtreeMaxPageCount(pBt, newMax);-
7213 break;
executed 12 times by 2 tests: break;
Executed by:
  • Self test (39)
  • Self test (438)
12
7214}-
7215#endif-
7216-
7217/* Opcode: Function0 P1 P2 P3 P4 P5-
7218** Synopsis: r[P3]=func(r[P2@P5])-
7219**-
7220** Invoke a user function (P4 is a pointer to a FuncDef object that-
7221** defines the function) with P5 arguments taken from register P2 and-
7222** successors. The result of the function is stored in register P3.-
7223** Register P3 must not be one of the function inputs.-
7224**-
7225** P1 is a 32-bit bitmask indicating whether or not each argument to the -
7226** function was determined to be constant at compile time. If the first-
7227** argument was constant then bit 0 of P1 is set. This is used to determine-
7228** whether meta data associated with a user function argument using the-
7229** sqlite3_set_auxdata() API may be safely retained until the next-
7230** invocation of this opcode.-
7231**-
7232** See also: Function, AggStep, AggFinal-
7233*/-
7234/* Opcode: Function P1 P2 P3 P4 P5-
7235** Synopsis: r[P3]=func(r[P2@P5])-
7236**-
7237** Invoke a user function (P4 is a pointer to an sqlite3_context object that-
7238** contains a pointer to the function to be run) with P5 arguments taken-
7239** from register P2 and successors. The result of the function is stored-
7240** in register P3. Register P3 must not be one of the function inputs.-
7241**-
7242** P1 is a 32-bit bitmask indicating whether or not each argument to the -
7243** function was determined to be constant at compile time. If the first-
7244** argument was constant then bit 0 of P1 is set. This is used to determine-
7245** whether meta data associated with a user function argument using the-
7246** sqlite3_set_auxdata() API may be safely retained until the next-
7247** invocation of this opcode.-
7248**-
7249** SQL functions are initially coded as OP_Function0 with P4 pointing-
7250** to a FuncDef object. But on first evaluation, the P4 operand is-
7251** automatically converted into an sqlite3_context object and the operation-
7252** changed to this OP_Function opcode. In this way, the initialization of-
7253** the sqlite3_context object occurs only once, rather than once for each-
7254** evaluation of the function.-
7255**-
7256** See also: Function0, AggStep, AggFinal-
7257*/-
7258case
executed 129 times by 1 test: case 62:
Executed by:
  • Self test (438)
OP_PureFunc0: /* group */
executed 129 times by 1 test: case 62:
Executed by:
  • Self test (438)
129
7259case
executed 55775 times by 378 tests: case 63:
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)
  • ...
OP_Function0: { /* group */
executed 55775 times by 378 tests: case 63:
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)
  • ...
55775
7260 int n;-
7261 sqlite3_context *pCtx;-
7262-
7263 assert( pOp->p4type==P4_FUNCDEF );-
7264 n = pOp->p5;-
7265 assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );-
7266 assert( n==0 || (pOp->p2>0 && pOp->p2+n<=(p->nMem+1 - p->nCursor)+1) );-
7267 assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+n );-
7268 pCtx = sqlite3DbMallocRawNN(db, sizeof(*pCtx) + (n-1)*sizeof(sqlite3_value*));-
7269 if( pCtx==0 ) goto no_mem;
never executed: goto no_mem;
pCtx==0Description
TRUEnever evaluated
FALSEevaluated 55904 times by 378 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)
  • ...
0-55904
7270 pCtx->pOut = 0;-
7271 pCtx->pFunc = pOp->p4.pFunc;-
7272 pCtx->iOp = (int)(pOp - aOp);-
7273 pCtx->pVdbe = p;-
7274 pCtx->isError = 0;-
7275 pCtx->argc = n;-
7276 pOp->p4type = P4_FUNCCTX;-
7277 pOp->p4.pCtx = pCtx;-
7278 assert( OP_PureFunc == OP_PureFunc0+2 );-
7279 assert( OP_Function == OP_Function0+2 );-
7280 pOp->opcode += 2;-
7281 /* Fall through into OP_Function */-
7282}-
7283case
code before this statement executed 55904 times by 378 tests: case 64:
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)
  • ...
executed 4361 times by 1 test: case 64:
Executed by:
  • Self test (438)
OP_PureFunc: /* group */
code before this statement executed 55904 times by 378 tests: case 64:
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)
  • ...
executed 4361 times by 1 test: case 64:
Executed by:
  • Self test (438)
4361-55904
7284case
executed 3320941 times by 332 tests: case 65:
Executed by:
  • Self test (10)
  • Self test (12)
  • 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)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • Self test (139)
  • Self test (14)
  • Self test (140)
  • Self test (141)
  • Self test (142)
  • Self test (143)
  • ...
OP_Function: { /* group */
executed 3320941 times by 332 tests: case 65:
Executed by:
  • Self test (10)
  • Self test (12)
  • 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)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • Self test (139)
  • Self test (14)
  • Self test (140)
  • Self test (141)
  • Self test (142)
  • Self test (143)
  • ...
3320941
7285 int i;-
7286 sqlite3_context *pCtx;-
7287-
7288 assert( pOp->p4type==P4_FUNCCTX );-
7289 pCtx = pOp->p4.pCtx;-
7290-
7291 /* If this function is inside of a trigger, the register array in aMem[]-
7292 ** might change from one evaluation to the next. The next block of code-
7293 ** checks to see if the register array has changed, and if so it-
7294 ** reinitializes the relavant parts of the sqlite3_context object */-
7295 pOut = &aMem[pOp->p3];-
7296 if( pCtx->pOut != pOut ){
pCtx->pOut != pOutDescription
TRUEevaluated 55932 times by 378 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 3325274 times by 332 tests
Evaluated by:
  • Self test (10)
  • Self test (12)
  • 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)
  • Self test (131)
  • Self test (132)
  • Self test (133)
  • Self test (134)
  • Self test (135)
  • Self test (136)
  • Self test (137)
  • Self test (138)
  • Self test (139)
  • Self test (14)
  • Self test (140)
  • Self test (141)
  • Self test (142)
  • Self test (143)
  • ...
55932-3325274
7297 pCtx->pOut = pOut;-
7298 for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
executed 84311 times by 378 tests: pCtx->argv[i] = &aMem[pOp->p2+i];
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)
  • ...
i>=0Description
TRUEevaluated 84311 times by 378 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 55932 times by 378 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)
  • ...
55932-84311
7299 }
executed 55932 times by 378 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)
  • ...
55932
7300-
7301 memAboutToChange(p, pOut);-
7302#ifdef SQLITE_DEBUG-
7303 for(i=0; i<pCtx->argc; i++){-
7304 assert( memIsValid(pCtx->argv[i]) );-
7305 REGISTER_TRACE(pOp->p2+i, pCtx->argv[i]);-
7306 }-
7307#endif-
7308 MemSetTypeFlag(pOut, MEM_Null);-
7309 assert( pCtx->isError==0 );-
7310 (*pCtx->pFunc->xSFunc)(pCtx, pCtx->argc, pCtx->argv);/* IMP: R-24505-23230 */-
7311-
7312 /* If the function returned an error, throw an exception */-
7313 if( pCtx->isError ){
pCtx->isErrorDescription
TRUEevaluated 223 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3380983 times by 378 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)
  • ...
223-3380983
7314 if( pCtx->isError>0 ){
pCtx->isError>0Description
TRUEevaluated 100 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 123 times by 1 test
Evaluated by:
  • Self test (438)
100-123
7315 sqlite3VdbeError(p, "%s", sqlite3_value_text(pOut));-
7316 rc = pCtx->isError;-
7317 }
executed 100 times by 1 test: end of block
Executed by:
  • Self test (438)
100
7318 sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);-
7319 pCtx->isError = 0;-
7320 if( rc ) goto abort_due_to_error;
executed 100 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
rcDescription
TRUEevaluated 100 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 123 times by 1 test
Evaluated by:
  • Self test (438)
100-123
7321 }
executed 123 times by 1 test: end of block
Executed by:
  • Self test (438)
123
7322-
7323 /* Copy the result of the function into register P3 */-
7324 if( pOut->flags & (MEM_Str|MEM_Blob) ){
pOut->flags & (0x0002|0x0010)Description
TRUEevaluated 2150853 times by 368 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
FALSEevaluated 1230253 times by 12 tests
Evaluated by:
  • Self test (27)
  • Self test (34)
  • Self test (4)
  • Self test (438)
  • Self test (5)
  • Self test (77)
  • Self test (78)
  • Self test (79)
  • Self test (80)
  • Self test (81)
  • Self test (82)
  • Self test (83)
1230253-2150853
7325 sqlite3VdbeChangeEncoding(pOut, encoding);-
7326 if( sqlite3VdbeMemTooBig(pOut) ) goto too_big;
never executed: goto too_big;
sqlite3VdbeMemTooBig(pOut)Description
TRUEnever evaluated
FALSEevaluated 2150853 times by 368 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
0-2150853
7327 }
executed 2150853 times by 368 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • Self test (122)
  • Self test (123)
  • Self test (124)
  • Self test (125)
  • Self test (126)
  • ...
2150853
7328-
7329 REGISTER_TRACE(pOp->p3, pOut);-
7330 UPDATE_MAX_BLOBSIZE(pOut);-
7331 break;
executed 3381106 times by 378 tests: break;
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)
  • ...
3381106
7332}-
7333-
7334/* Opcode: Trace P1 P2 * P4 *-
7335**-
7336** Write P4 on the statement trace output if statement tracing is-
7337** enabled.-
7338**-
7339** Operand P1 must be 0x7fffffff and P2 must positive.-
7340*/-
7341/* Opcode: Init P1 P2 P3 P4 *-
7342** Synopsis: Start at P2-
7343**-
7344** Programs contain a single instance of this opcode as the very first-
7345** opcode.-
7346**-
7347** If tracing is enabled (by the sqlite3_trace()) interface, then-
7348** the UTF-8 string contained in P4 is emitted on the trace callback.-
7349** Or if P4 is blank, use the string returned by sqlite3_sql().-
7350**-
7351** If P2 is not zero, jump to instruction P2.-
7352**-
7353** Increment the value of P1 so that OP_Once opcodes will jump the-
7354** first time they are evaluated for this run.-
7355**-
7356** If P3 is not zero, then it is an address to jump to if an SQLITE_CORRUPT-
7357** error is encountered.-
7358*/-
7359case
executed 138233 times by 1 test: case 169:
Executed by:
  • Self test (438)
OP_Trace:
executed 138233 times by 1 test: case 169:
Executed by:
  • Self test (438)
138233
7360case
executed 1244433 times by 435 tests: case 61:
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)
  • ...
OP_Init: { /* jump */
executed 1244433 times by 435 tests: case 61:
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)
  • ...
1244433
7361 int i;-
7362#ifndef SQLITE_OMIT_TRACE-
7363 char *zTrace;-
7364#endif-
7365-
7366 /* If the P4 argument is not NULL, then it must be an SQL comment string.-
7367 ** The "--" string is broken up to prevent false-positives with srcck1.c.-
7368 **-
7369 ** This assert() provides evidence for:-
7370 ** EVIDENCE-OF: R-50676-09860 The callback can compute the same text that-
7371 ** would have been returned by the legacy sqlite3_trace() interface by-
7372 ** using the X argument when X begins with "--" and invoking-
7373 ** sqlite3_expanded_sql(P) otherwise.-
7374 */-
7375 assert( pOp->p4.z==0 || strncmp(pOp->p4.z, "-" "- ", 3)==0 );-
7376-
7377 /* OP_Init is always instruction 0 */-
7378 assert( pOp==p->aOp || pOp->opcode==OP_Trace );-
7379-
7380#ifndef SQLITE_OMIT_TRACE-
7381 if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0
(db->mTrace & (0x01|0x80))!=0Description
TRUEevaluated 154 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1382512 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)
  • ...
154-1382512
7382 && !p->doingRerun
!p->doingRerunDescription
TRUEevaluated 154 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-154
7383 && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
pOp->p4.zDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 142 times by 1 test
Evaluated by:
  • Self test (438)
(zTrace = (pOp...: p->zSql))!=0Description
TRUEevaluated 140 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
12-142
7384 ){-
7385#ifndef SQLITE_OMIT_DEPRECATED-
7386 if( db->mTrace & SQLITE_TRACE_LEGACY ){
db->mTrace & 0x80Description
TRUEevaluated 134 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
6-134
7387 void (*x)(void*,const char*) = (void(*)(void*,const char*))db->xTrace;-
7388 char *z = sqlite3VdbeExpandSql(p, zTrace);-
7389 x(db->pTraceArg, z);-
7390 sqlite3_free(z);-
7391 }else
executed 134 times by 1 test: end of block
Executed by:
  • Self test (438)
134
7392#endif-
7393 if( db->nVdbeExec>1 ){
db->nVdbeExec>1Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
0-6
7394 char *z = sqlite3MPrintf(db, "-- %s", zTrace);-
7395 (void)db->xTrace(SQLITE_TRACE_STMT, db->pTraceArg, p, z);-
7396 sqlite3DbFree(db, z);-
7397 }else{
never executed: end of block
0
7398 (void)db->xTrace(SQLITE_TRACE_STMT, db->pTraceArg, p, zTrace);-
7399 }
executed 6 times by 1 test: end of block
Executed by:
  • Self test (438)
6
7400 }-
7401#ifdef SQLITE_USE_FCNTL_TRACE-
7402 zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql);-
7403 if( zTrace ){-
7404 int j;-
7405 for(j=0; j<db->nDb; j++){-
7406 if( DbMaskTest(p->btreeMask, j)==0 ) continue;-
7407 sqlite3_file_control(db, db->aDb[j].zDbSName, SQLITE_FCNTL_TRACE, zTrace);-
7408 }-
7409 }-
7410#endif /* SQLITE_USE_FCNTL_TRACE */-
7411#ifdef SQLITE_DEBUG-
7412 if( (db->flags & SQLITE_SqlTrace)!=0-
7413 && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0-
7414 ){-
7415 sqlite3DebugPrintf("SQL-trace: %s\n", zTrace);-
7416 }-
7417#endif /* SQLITE_DEBUG */-
7418#endif /* SQLITE_OMIT_TRACE */-
7419 assert( pOp->p2>0 );-
7420 if( pOp->p1>=sqlite3GlobalConfig.iOnceResetThreshold ){
pOp->p1>=sqlit...ResetThresholdDescription
TRUEevaluated 138233 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1244433 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)
  • ...
138233-1244433
7421 if( pOp->opcode==OP_Trace ) break;
executed 138233 times by 1 test: break;
Executed by:
  • Self test (438)
pOp->opcode==169Description
TRUEevaluated 138233 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-138233
7422 for(i=1; i<p->nOp; i++){
i<p->nOpDescription
TRUEnever evaluated
FALSEnever evaluated
0
7423 if( p->aOp[i].opcode==OP_Once ) p->aOp[i].p1 = 0;
never executed: p->aOp[i].p1 = 0;
p->aOp[i].opcode==17Description
TRUEnever evaluated
FALSEnever evaluated
0
7424 }
never executed: end of block
0
7425 pOp->p1 = 0;-
7426 }
never executed: end of block
0
7427 pOp->p1++;-
7428 p->aCounter[SQLITE_STMTSTATUS_RUN]++;-
7429 goto jump_to_p2;
executed 1244433 times by 435 tests: goto jump_to_p2;
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)
  • ...
1244433
7430}-
7431-
7432#ifdef SQLITE_ENABLE_CURSOR_HINTS-
7433/* Opcode: CursorHint P1 * * P4 *-
7434**-
7435** Provide a hint to cursor P1 that it only needs to return rows that-
7436** satisfy the Expr in P4. TK_REGISTER terms in the P4 expression refer-
7437** to values currently held in registers. TK_COLUMN terms in the P4-
7438** expression refer to columns in the b-tree to which cursor P1 is pointing.-
7439*/-
7440case OP_CursorHint: {-
7441 VdbeCursor *pC;-
7442-
7443 assert( pOp->p1>=0 && pOp->p1<p->nCursor );-
7444 assert( pOp->p4type==P4_EXPR );-
7445 pC = p->apCsr[pOp->p1];-
7446 if( pC ){-
7447 assert( pC->eCurType==CURTYPE_BTREE );-
7448 sqlite3BtreeCursorHint(pC->uc.pCursor, BTREE_HINT_RANGE,-
7449 pOp->p4.pExpr, aMem);-
7450 }-
7451 break;-
7452}-
7453#endif /* SQLITE_ENABLE_CURSOR_HINTS */-
7454-
7455#ifdef SQLITE_DEBUG-
7456/* Opcode: Abortable * * * * *-
7457**-
7458** Verify that an Abort can happen. Assert if an Abort at this point-
7459** might cause database corruption. This opcode only appears in debugging-
7460** builds.-
7461**-
7462** An Abort is safe if either there have been no writes, or if there is-
7463** an active statement journal.-
7464*/-
7465case OP_Abortable: {-
7466 sqlite3VdbeAssertAbortable(p);-
7467 break;-
7468}-
7469#endif-
7470-
7471/* Opcode: Noop * * * * *-
7472**-
7473** Do nothing. This instruction is often useful as a jump-
7474** destination.-
7475*/-
7476/*-
7477** The magic Explain opcode are only inserted when explain==2 (which-
7478** is to say when the EXPLAIN QUERY PLAN syntax is used.)-
7479** This opcode records information from the optimizer. It is the-
7480** the same as a no-op. This opcodesnever appears in a real VM program.-
7481*/-
7482default
executed 52069 times by 435 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)
  • ...
: { /* This is really OP_Noop, OP_Explain */
executed 52069 times by 435 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)
  • ...
52069
7483 assert( pOp->opcode==OP_Noop || pOp->opcode==OP_Explain );-
7484-
7485 break;
executed 52069 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)
  • ...
52069
7486}-
7487-
7488/*****************************************************************************-
7489** The cases of the switch statement above this line should all be indented-
7490** by 6 spaces. But the left-most 6 spaces have been removed to improve the-
7491** readability. From this point on down, the normal indentation rules are-
7492** restored.-
7493*****************************************************************************/-
7494 }-
7495-
7496#ifdef VDBE_PROFILE-
7497 {-
7498 u64 endTime = sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();-
7499 if( endTime>start ) pOrigOp->cycles += endTime - start;-
7500 pOrigOp->cnt++;-
7501 }-
7502#endif-
7503-
7504 /* The following code adds nothing to the actual functionality-
7505 ** of the program. It is only here for testing and debugging.-
7506 ** On the other hand, it does burn CPU cycles every time through-
7507 ** the evaluator loop. So we can leave it out when NDEBUG is defined.-
7508 */-
7509#ifndef NDEBUG-
7510 assert( pOp>=&aOp[-1] && pOp<&aOp[p->nOp-1] );-
7511-
7512#ifdef SQLITE_DEBUG-
7513 if( db->flags & SQLITE_VdbeTrace ){-
7514 u8 opProperty = sqlite3OpcodeProperty[pOrigOp->opcode];-
7515 if( rc!=0 ) printf("rc=%d\n",rc);-
7516 if( opProperty & (OPFLG_OUT2) ){-
7517 registerTrace(pOrigOp->p2, &aMem[pOrigOp->p2]);-
7518 }-
7519 if( opProperty & OPFLG_OUT3 ){-
7520 registerTrace(pOrigOp->p3, &aMem[pOrigOp->p3]);-
7521 }-
7522 }-
7523#endif /* SQLITE_DEBUG */-
7524#endif /* NDEBUG */-
7525 } /* The end of the for(;;) loop the loops through opcodes */-
7526-
7527 /* If we reach this point, it means that execution is finished with-
7528 ** an error of some kind.-
7529 */-
7530abort_due_to_error:
code before this statement never executed: abort_due_to_error:
0
7531 if( db->mallocFailed ) rc = SQLITE_NOMEM_BKPT;
executed 82 times by 1 test: rc = 7;
Executed by:
  • Self test (438)
db->mallocFailedDescription
TRUEevaluated 82 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6536 times by 12 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (30)
  • Self test (34)
  • Self test (35)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (53)
82-6536
7532 assert( rc );-
7533 if( p->zErrMsg==0 && rc!=SQLITE_IOERR_NOMEM ){
p->zErrMsg==0Description
TRUEevaluated 1269 times by 2 tests
Evaluated by:
  • Self test (39)
  • Self test (438)
FALSEevaluated 5349 times by 11 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (30)
  • Self test (34)
  • Self test (35)
  • Self test (438)
  • Self test (47)
  • Self test (53)
rc!=(10 | (12<<8))Description
TRUEevaluated 1051 times by 2 tests
Evaluated by:
  • Self test (39)
  • Self test (438)
FALSEevaluated 218 times by 1 test
Evaluated by:
  • Self test (438)
218-5349
7534 sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));-
7535 }
executed 1051 times by 2 tests: end of block
Executed by:
  • Self test (39)
  • Self test (438)
1051
7536 p->rc = rc;-
7537 sqlite3SystemError(db, rc);-
7538 testcase( sqlite3GlobalConfig.xLog!=0 );-
7539 sqlite3_log(rc, "statement aborts at %d: [%s] %s", -
7540 (int)(pOp - aOp), p->zSql, p->zErrMsg);-
7541 sqlite3VdbeHalt(p);-
7542 if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db);
executed 218 times by 1 test: sqlite3OomFault(db);
Executed by:
  • Self test (438)
rc==(10 | (12<<8))Description
TRUEevaluated 218 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6400 times by 12 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (30)
  • Self test (34)
  • Self test (35)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (53)
218-6400
7543 rc = SQLITE_ERROR;-
7544 if( resetSchemaOnFault>0 ){
resetSchemaOnFault>0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6617 times by 12 tests
Evaluated by:
  • Self test (24)
  • Self test (26)
  • Self test (27)
  • Self test (28)
  • Self test (29)
  • Self test (30)
  • Self test (34)
  • Self test (35)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (53)
1-6617
7545 sqlite3ResetOneSchema(db, resetSchemaOnFault-1);-
7546 }
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
1
7547-
7548 /* This is the only way out of this procedure. We have to-
7549 ** release the mutexes on btrees that were acquired at the-
7550 ** top. */-
7551vdbe_return:
code before this statement executed 6618 times by 12 tests: vdbe_return:
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 (35)
  • Self test (39)
  • Self test (438)
  • Self test (47)
  • Self test (53)
6618
7552 testcase( nVmStep>0 );-
7553 p->aCounter[SQLITE_STMTSTATUS_VM_STEP] += (int)nVmStep;-
7554 sqlite3VdbeLeave(p);-
7555 assert( rc!=SQLITE_OK || nExtraDelete==0 -
7556 || sqlite3_strlike("DELETE%",p->zSql,0)!=0 -
7557 );-
7558 return rc;
executed 3753813 times by 435 tests: return rc;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (103)
  • Self test (104)
  • Self test (105)
  • Self test (106)
  • Self test (107)
  • Self test (108)
  • Self test (109)
  • Self test (11)
  • Self test (110)
  • Self test (111)
  • Self test (112)
  • Self test (113)
  • Self test (114)
  • Self test (115)
  • Self test (116)
  • Self test (117)
  • Self test (118)
  • Self test (119)
  • Self test (12)
  • Self test (120)
  • Self test (121)
  • ...
3753813
7559-
7560 /* Jump to here if a string or blob larger than SQLITE_MAX_LENGTH-
7561 ** is encountered.-
7562 */-
7563too_big:-
7564 sqlite3VdbeError(p, "string or blob too big");-
7565 rc = SQLITE_TOOBIG;-
7566 goto abort_due_to_error;
executed 2 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
2
7567-
7568 /* Jump to here if a malloc() fails.-
7569 */-
7570no_mem:-
7571 sqlite3OomFault(db);-
7572 sqlite3VdbeError(p, "out of memory");-
7573 rc = SQLITE_NOMEM_BKPT;-
7574 goto abort_due_to_error;
executed 80 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
80
7575-
7576 /* Jump to here if the sqlite3_interrupt() API sets the interrupt-
7577 ** flag.-
7578 */-
7579abort_due_to_interrupt:-
7580 assert( db->u1.isInterrupted );-
7581 rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT;
db->mallocFailedDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2108 times by 1 test
Evaluated by:
  • Self test (438)
2-2108
7582 p->rc = rc;-
7583 sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc));-
7584 goto abort_due_to_error;
executed 2110 times by 1 test: goto abort_due_to_error;
Executed by:
  • Self test (438)
2110
7585}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2