OpenCoverage

pragma.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/sqlite/src/src/pragma.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2** 2003 April 6-
3**-
4** The author disclaims copyright to this source code. In place of-
5** a legal notice, here is a blessing:-
6**-
7** May you do good and not evil.-
8** May you find forgiveness for yourself and forgive others.-
9** May you share freely, never taking more than you give.-
10**-
11*************************************************************************-
12** This file contains code used to implement the PRAGMA command.-
13*/-
14#include "sqliteInt.h"-
15-
16#if !defined(SQLITE_ENABLE_LOCKING_STYLE)-
17# if defined(__APPLE__)-
18# define SQLITE_ENABLE_LOCKING_STYLE 1-
19# else-
20# define SQLITE_ENABLE_LOCKING_STYLE 0-
21# endif-
22#endif-
23-
24/***************************************************************************-
25** The "pragma.h" include file is an automatically generated file that-
26** that includes the PragType_XXXX macro definitions and the aPragmaName[]-
27** object. This ensures that the aPragmaName[] table is arranged in-
28** lexicographical order to facility a binary search of the pragma name.-
29** Do not edit pragma.h directly. Edit and rerun the script in at -
30** ../tool/mkpragmatab.tcl. */-
31#include "pragma.h"-
32-
33/*-
34** Interpret the given string as a safety level. Return 0 for OFF,-
35** 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or -
36** unrecognized string argument. The FULL and EXTRA option is disallowed-
37** if the omitFull parameter it 1.-
38**-
39** Note that the values returned are one less that the values that-
40** should be passed into sqlite3BtreeSetSafetyLevel(). The is done-
41** to support legacy SQL code. The safety level used to be boolean-
42** and older scripts may have used numbers 0 for OFF and 1 for ON.-
43*/-
44static u8 getSafetyLevel(const char *z, int omitFull, u8 dflt){-
45 /* 123456789 123456789 123 */-
46 static const char zText[] = "onoffalseyestruextrafull";-
47 static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 15, 20};-
48 static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 5, 4};-
49 static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 3, 2};-
50 /* on no off false yes true extra full */-
51 int i, n;-
52 if( sqlite3Isdigit(*z) ){
(sqlite3CtypeM...ar)(*z)]&0x04)Description
TRUEevaluated 475 times by 4 tests
Evaluated by:
  • Self test (103)
  • Self test (104)
  • Self test (438)
  • Self test (61)
FALSEevaluated 773 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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)
475-773
53 return (u8)sqlite3Atoi(z);
executed 475 times by 4 tests: return (u8)sqlite3Atoi(z);
Executed by:
  • Self test (103)
  • Self test (104)
  • Self test (438)
  • Self test (61)
475
54 }-
55 n = sqlite3Strlen30(z);-
56 for(i=0; i<ArraySize(iLength); i++){
i<((int)(sizeo...(iLength[0])))Description
TRUEevaluated 2788 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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 111 times by 1 test
Evaluated by:
  • Self test (438)
111-2788
57 if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0
iLength[i]==nDescription
TRUEevaluated 727 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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 2061 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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)
sqlite3_strnic...et[i]],z,n)==0Description
TRUEevaluated 662 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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 65 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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)
65-2061
58 && (!omitFull || iValue[i]<=1)
!omitFullDescription
TRUEevaluated 88 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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 574 times by 1 test
Evaluated by:
  • Self test (438)
iValue[i]<=1Description
TRUEevaluated 574 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-574
59 ){-
60 return iValue[i];
executed 662 times by 11 tests: return iValue[i];
Executed by:
  • Self test (100)
  • 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)
662
61 }-
62 }
executed 2126 times by 11 tests: end of block
Executed by:
  • Self test (100)
  • 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)
2126
63 return dflt;
executed 111 times by 1 test: return dflt;
Executed by:
  • Self test (438)
111
64}-
65-
66/*-
67** Interpret the given string as a boolean value.-
68*/-
69u8 sqlite3GetBoolean(const char *z, u8 dflt){-
70 return getSafetyLevel(z,1,dflt)!=0;
executed 1045 times by 4 tests: return getSafetyLevel(z,1,dflt)!=0;
Executed by:
  • Self test (103)
  • Self test (104)
  • Self test (438)
  • Self test (61)
1045
71}-
72-
73/* The sqlite3GetBoolean() function is used by other modules but the-
74** remainder of this file is specific to PRAGMA processing. So omit-
75** the rest of the file if PRAGMAs are omitted from the build.-
76*/-
77#if !defined(SQLITE_OMIT_PRAGMA)-
78-
79/*-
80** Interpret the given string as a locking mode value.-
81*/-
82static int getLockingMode(const char *z){-
83 if( z ){
zDescription
TRUEevaluated 96 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 37 times by 1 test
Evaluated by:
  • Self test (438)
37-96
84 if( 0==sqlite3StrICmp(z, "exclusive") ) return PAGER_LOCKINGMODE_EXCLUSIVE;
executed 64 times by 1 test: return 1;
Executed by:
  • Self test (438)
0==sqlite3StrI..., "exclusive")Description
TRUEevaluated 64 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 32 times by 1 test
Evaluated by:
  • Self test (438)
32-64
85 if( 0==sqlite3StrICmp(z, "normal") ) return PAGER_LOCKINGMODE_NORMAL;
executed 31 times by 1 test: return 0;
Executed by:
  • Self test (438)
0==sqlite3StrICmp(z, "normal")Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-31
86 }
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
1
87 return PAGER_LOCKINGMODE_QUERY;
executed 38 times by 1 test: return -1;
Executed by:
  • Self test (438)
38
88}-
89-
90#ifndef SQLITE_OMIT_AUTOVACUUM-
91/*-
92** Interpret the given string as an auto-vacuum mode value.-
93**-
94** The following strings, "none", "full" and "incremental" are -
95** acceptable, as are their numeric equivalents: 0, 1 and 2 respectively.-
96*/-
97static int getAutoVacuum(const char *z){-
98 int i;-
99 if( 0==sqlite3StrICmp(z, "none") ) return BTREE_AUTOVACUUM_NONE;
executed 15 times by 1 test: return 0;
Executed by:
  • Self test (438)
0==sqlite3StrICmp(z, "none")Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 589 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
15-589
100 if( 0==sqlite3StrICmp(z, "full") ) return BTREE_AUTOVACUUM_FULL;
executed 19 times by 1 test: return 1;
Executed by:
  • Self test (438)
0==sqlite3StrICmp(z, "full")Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 570 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
19-570
101 if( 0==sqlite3StrICmp(z, "incremental") ) return BTREE_AUTOVACUUM_INCR;
executed 29 times by 1 test: return 2;
Executed by:
  • Self test (438)
0==sqlite3StrI..."incremental")Description
TRUEevaluated 29 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 541 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
29-541
102 i = sqlite3Atoi(z);-
103 return (u8)((i>=0&&i<=2)?i:0);
executed 541 times by 4 tests: return (u8)((i>=0&&i<=2)?i:0);
Executed by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
i>=0Description
TRUEevaluated 539 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
i<=2Description
TRUEevaluated 536 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
2-541
104}-
105#endif /* ifndef SQLITE_OMIT_AUTOVACUUM */-
106-
107#ifndef SQLITE_OMIT_PAGER_PRAGMAS-
108/*-
109** Interpret the given string as a temp db location. Return 1 for file-
110** backed temporary databases, 2 for the Red-Black tree in memory database-
111** and 0 to use the compile-time default.-
112*/-
113static int getTempStore(const char *z){-
114 if( z[0]>='0' && z[0]<='2' ){
z[0]>='0'Description
TRUEevaluated 84 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
z[0]<='2'Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 70 times by 1 test
Evaluated by:
  • Self test (438)
2-84
115 return z[0] - '0';
executed 14 times by 1 test: return z[0] - '0';
Executed by:
  • Self test (438)
14
116 }else if( sqlite3StrICmp(z, "file")==0 ){
sqlite3StrICmp(z, "file")==0Description
TRUEevaluated 49 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 23 times by 1 test
Evaluated by:
  • Self test (438)
23-49
117 return 1;
executed 49 times by 1 test: return 1;
Executed by:
  • Self test (438)
49
118 }else if( sqlite3StrICmp(z, "memory")==0 ){
sqlite3StrICmp(z, "memory")==0Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
5-18
119 return 2;
executed 18 times by 1 test: return 2;
Executed by:
  • Self test (438)
18
120 }else{-
121 return 0;
executed 5 times by 1 test: return 0;
Executed by:
  • Self test (438)
5
122 }-
123}-
124#endif /* SQLITE_PAGER_PRAGMAS */-
125-
126#ifndef SQLITE_OMIT_PAGER_PRAGMAS-
127/*-
128** Invalidate temp storage, either when the temp storage is changed-
129** from default, or when 'file' and the temp_store_directory has changed-
130*/-
131static int invalidateTempStorage(Parse *pParse){-
132 sqlite3 *db = pParse->db;-
133 if( db->aDb[1].pBt!=0 ){
db->aDb[1].pBt!=0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 69 times by 1 test
Evaluated by:
  • Self test (438)
4-69
134 if( !db->autoCommit || sqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){
!db->autoCommitDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
sqlite3BtreeIs...b->aDb[1].pBt)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
1-3
135 sqlite3ErrorMsg(pParse, "temporary storage cannot be changed "-
136 "from within a transaction");-
137 return SQLITE_ERROR;
executed 2 times by 1 test: return 1;
Executed by:
  • Self test (438)
2
138 }-
139 sqlite3BtreeClose(db->aDb[1].pBt);-
140 db->aDb[1].pBt = 0;-
141 sqlite3ResetAllSchemasOfConnection(db);-
142 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
143 return SQLITE_OK;
executed 71 times by 1 test: return 0;
Executed by:
  • Self test (438)
71
144}-
145#endif /* SQLITE_PAGER_PRAGMAS */-
146-
147#ifndef SQLITE_OMIT_PAGER_PRAGMAS-
148/*-
149** If the TEMP database is open, close it and mark the database schema-
150** as needing reloading. This must be done when using the SQLITE_TEMP_STORE-
151** or DEFAULT_TEMP_STORE pragmas.-
152*/-
153static int changeTempStorage(Parse *pParse, const char *zStorageType){-
154 int ts = getTempStore(zStorageType);-
155 sqlite3 *db = pParse->db;-
156 if( db->temp_store==ts ) return SQLITE_OK;
executed 15 times by 1 test: return 0;
Executed by:
  • Self test (438)
db->temp_store==tsDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 71 times by 1 test
Evaluated by:
  • Self test (438)
15-71
157 if( invalidateTempStorage( pParse ) != SQLITE_OK ){
invalidateTemp... pParse ) != 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 69 times by 1 test
Evaluated by:
  • Self test (438)
2-69
158 return SQLITE_ERROR;
executed 2 times by 1 test: return 1;
Executed by:
  • Self test (438)
2
159 }-
160 db->temp_store = (u8)ts;-
161 return SQLITE_OK;
executed 69 times by 1 test: return 0;
Executed by:
  • Self test (438)
69
162}-
163#endif /* SQLITE_PAGER_PRAGMAS */-
164-
165/*-
166** Set result column names for a pragma.-
167*/-
168static void setPragmaResultColumnNames(-
169 Vdbe *v, /* The query under construction */-
170 const PragmaName *pPragma /* The pragma */-
171){-
172 u8 n = pPragma->nPragCName;-
173 sqlite3VdbeSetNumCols(v, n==0 ? 1 : n);-
174 if( n==0 ){
n==0Description
TRUEevaluated 12720 times by 25 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (58)
  • Self test (64)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
FALSEevaluated 15804 times by 9 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (35)
  • Self test (438)
  • Self test (72)
  • Self test (73)
  • Self test (84)
  • Self test (85)
12720-15804
175 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, pPragma->zName, SQLITE_STATIC);-
176 }else{
executed 12720 times by 25 tests: end of block
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (58)
  • Self test (64)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (74)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
12720
177 int i, j;-
178 for(i=0, j=pPragma->iPragCName; i<n; i++, j++){
i<nDescription
TRUEevaluated 74863 times by 9 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (35)
  • Self test (438)
  • Self test (72)
  • Self test (73)
  • Self test (84)
  • Self test (85)
FALSEevaluated 15804 times by 9 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (35)
  • Self test (438)
  • Self test (72)
  • Self test (73)
  • Self test (84)
  • Self test (85)
15804-74863
179 sqlite3VdbeSetColName(v, i, COLNAME_NAME, pragCName[j], SQLITE_STATIC);-
180 }
executed 74863 times by 9 tests: end of block
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (35)
  • Self test (438)
  • Self test (72)
  • Self test (73)
  • Self test (84)
  • Self test (85)
74863
181 }
executed 15804 times by 9 tests: end of block
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (35)
  • Self test (438)
  • Self test (72)
  • Self test (73)
  • Self test (84)
  • Self test (85)
15804
182}-
183-
184/*-
185** Generate code to return a single integer value.-
186*/-
187static void returnSingleInt(Vdbe *v, i64 value){-
188 sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, 1, 0, (const u8*)&value, P4_INT64);-
189 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);-
190}
executed 1066 times by 4 tests: end of block
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (64)
1066
191-
192/*-
193** Generate code to return a single text value.-
194*/-
195static void returnSingleText(-
196 Vdbe *v, /* Prepared statement under construction */-
197 const char *zValue /* Value to be returned */-
198){-
199 if( zValue ){
zValueDescription
TRUEevaluated 201 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
2-201
200 sqlite3VdbeLoadString(v, 1, (const char*)zValue);-
201 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);-
202 }
executed 201 times by 1 test: end of block
Executed by:
  • Self test (438)
201
203}
executed 203 times by 1 test: end of block
Executed by:
  • Self test (438)
203
204-
205-
206/*-
207** Set the safety_level and pager flags for pager iDb. Or if iDb<0-
208** set these values for all pagers.-
209*/-
210#ifndef SQLITE_OMIT_PAGER_PRAGMAS-
211static void setAllPagerFlags(sqlite3 *db){-
212 if( db->autoCommit ){
db->autoCommitDescription
TRUEevaluated 1155 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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 16 times by 1 test
Evaluated by:
  • Self test (438)
16-1155
213 Db *pDb = db->aDb;-
214 int n = db->nDb;-
215 assert( SQLITE_FullFSync==PAGER_FULLFSYNC );-
216 assert( SQLITE_CkptFullFSync==PAGER_CKPT_FULLFSYNC );-
217 assert( SQLITE_CacheSpill==PAGER_CACHESPILL );-
218 assert( (PAGER_FULLFSYNC | PAGER_CKPT_FULLFSYNC | PAGER_CACHESPILL)-
219 == PAGER_FLAGS_MASK );-
220 assert( (pDb->safety_level & PAGER_SYNCHRONOUS_MASK)==pDb->safety_level );-
221 while( (n--) > 0 ){
(n--) > 0Description
TRUEevaluated 2548 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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 1155 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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)
1155-2548
222 if( pDb->pBt ){
pDb->pBtDescription
TRUEevaluated 1642 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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 906 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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)
906-1642
223 sqlite3BtreeSetPagerFlags(pDb->pBt,-
224 pDb->safety_level | (db->flags & PAGER_FLAGS_MASK) );-
225 }
executed 1642 times by 11 tests: end of block
Executed by:
  • Self test (100)
  • 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)
1642
226 pDb++;-
227 }
executed 2548 times by 11 tests: end of block
Executed by:
  • Self test (100)
  • 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)
2548
228 }
executed 1155 times by 11 tests: end of block
Executed by:
  • Self test (100)
  • 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)
1155
229}
executed 1171 times by 11 tests: end of block
Executed by:
  • Self test (100)
  • 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)
1171
230#else-
231# define setAllPagerFlags(X) /* no-op */-
232#endif-
233-
234-
235/*-
236** Return a human-readable name for a constraint resolution action.-
237*/-
238#ifndef SQLITE_OMIT_FOREIGN_KEY-
239static const char *actionName(u8 action){-
240 const char *zName;-
241 switch( action ){-
242 case OE_SetNull: zName = "SET NULL"; break;
executed 4 times by 1 test: break;
Executed by:
  • Self test (438)
executed 4 times by 1 test: case 8:
Executed by:
  • Self test (438)
4
243 case OE_SetDflt: zName = "SET DEFAULT"; break;
executed 4 times by 1 test: break;
Executed by:
  • Self test (438)
executed 4 times by 1 test: case 9:
Executed by:
  • Self test (438)
4
244 case OE_Cascade: zName = "CASCADE"; break;
executed 10 times by 1 test: break;
Executed by:
  • Self test (438)
executed 10 times by 1 test: case 10:
Executed by:
  • Self test (438)
10
245 case OE_Restrict: zName = "RESTRICT"; break;
executed 2 times by 1 test: break;
Executed by:
  • Self test (438)
executed 2 times by 1 test: case 7:
Executed by:
  • Self test (438)
2
246 default: zName = "NO ACTION";
executed 24 times by 1 test: default:
Executed by:
  • Self test (438)
24
247 assert( action==OE_None ); break;
executed 24 times by 1 test: break;
Executed by:
  • Self test (438)
24
248 }-
249 return zName;
executed 44 times by 1 test: return zName;
Executed by:
  • Self test (438)
44
250}-
251#endif-
252-
253-
254/*-
255** Parameter eMode must be one of the PAGER_JOURNALMODE_XXX constants-
256** defined in pager.h. This function returns the associated lowercase-
257** journal-mode name.-
258*/-
259const char *sqlite3JournalModename(int eMode){-
260 static char * const azModeName[] = {-
261 "delete", "persist", "off", "truncate", "memory"-
262#ifndef SQLITE_OMIT_WAL-
263 , "wal"-
264#endif-
265 };-
266 assert( PAGER_JOURNALMODE_DELETE==0 );-
267 assert( PAGER_JOURNALMODE_PERSIST==1 );-
268 assert( PAGER_JOURNALMODE_OFF==2 );-
269 assert( PAGER_JOURNALMODE_TRUNCATE==3 );-
270 assert( PAGER_JOURNALMODE_MEMORY==4 );-
271 assert( PAGER_JOURNALMODE_WAL==5 );-
272 assert( eMode>=0 && eMode<=ArraySize(azModeName) );-
273-
274 if( eMode==ArraySize(azModeName) ) return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • Self test (438)
eMode==((int)(...ModeName[0])))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 34623 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)
1-34623
275 return azModeName[eMode];
executed 34623 times by 10 tests: return azModeName[eMode];
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)
34623
276}-
277-
278/*-
279** Locate a pragma in the aPragmaName[] array.-
280*/-
281static const PragmaName *pragmaLocate(const char *zName){-
282 int upr, lwr, mid = 0, rc;-
283 lwr = 0;-
284 upr = ArraySize(aPragmaName)-1;-
285 while( lwr<=upr ){
lwr<=uprDescription
TRUEevaluated 162644 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
FALSEevaluated 426 times by 1 test
Evaluated by:
  • Self test (438)
426-162644
286 mid = (lwr+upr)/2;-
287 rc = sqlite3_stricmp(zName, aPragmaName[mid].zName);-
288 if( rc==0 ) break;
executed 43992 times by 52 tests: break;
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
rc==0Description
TRUEevaluated 43992 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
FALSEevaluated 118652 times by 41 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (64)
  • ...
43992-118652
289 if( rc<0 ){
rc<0Description
TRUEevaluated 37252 times by 38 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (64)
  • Self test (8)
  • ...
FALSEevaluated 81400 times by 39 tests
Evaluated by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (438)
  • Self test (54)
  • Self test (58)
  • Self test (6)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • ...
37252-81400
290 upr = mid - 1;-
291 }else{
executed 37252 times by 38 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (64)
  • Self test (8)
  • ...
37252
292 lwr = mid + 1;-
293 }
executed 81400 times by 39 tests: end of block
Executed by:
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (438)
  • Self test (54)
  • Self test (58)
  • Self test (6)
  • Self test (64)
  • Self test (72)
  • Self test (73)
  • ...
81400
294 }-
295 return lwr>upr ? 0 : &aPragmaName[mid];
executed 44418 times by 52 tests: return lwr>upr ? 0 : &aPragmaName[mid];
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
lwr>uprDescription
TRUEevaluated 426 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 43992 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
426-44418
296}-
297-
298/*-
299** Helper subroutine for PRAGMA integrity_check:-
300**-
301** Generate code to output a single-column result row with a value of the-
302** string held in register 3. Decrement the result count in register 1-
303** and halt if the maximum number of result rows have been issued.-
304*/-
305static int integrityCheckResultRow(Vdbe *v){-
306 int addr;-
307 sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1);-
308 addr = sqlite3VdbeAddOp3(v, OP_IfPos, 1, sqlite3VdbeCurrentAddr(v)+2, 1);-
309 VdbeCoverage(v);-
310 sqlite3VdbeAddOp0(v, OP_Halt);-
311 return addr;
executed 18516 times by 12 tests: return addr;
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)
18516
312}-
313-
314/*-
315** Process a pragma statement. -
316**-
317** Pragmas are of this form:-
318**-
319** PRAGMA [schema.]id [= value]-
320**-
321** The identifier might also be a string. The value is a string, and-
322** identifier, or a number. If minusFlag is true, then the value is-
323** a number that was preceded by a minus sign.-
324**-
325** If the left side is "database.id" then pId1 is the database name-
326** and pId2 is the id. If the left side is just "id" then pId1 is the-
327** id and pId2 is any empty string.-
328*/-
329void sqlite3Pragma(-
330 Parse *pParse, -
331 Token *pId1, /* First part of [schema.]id field */-
332 Token *pId2, /* Second part of [schema.]id field, or NULL */-
333 Token *pValue, /* Token for <value>, or NULL */-
334 int minusFlag /* True if a '-' sign preceded <value> */-
335){-
336 char *zLeft = 0; /* Nul-terminated UTF-8 string <id> */-
337 char *zRight = 0; /* Nul-terminated UTF-8 string <value>, or NULL */-
338 const char *zDb = 0; /* The database name */-
339 Token *pId; /* Pointer to <id> token */-
340 char *aFcntl[4]; /* Argument to SQLITE_FCNTL_PRAGMA */-
341 int iDb; /* Database index for <database> */-
342 int rc; /* return value form SQLITE_FCNTL_PRAGMA */-
343 sqlite3 *db = pParse->db; /* The database connection */-
344 Db *pDb; /* The specific database being pragmaed */-
345 Vdbe *v = sqlite3GetVdbe(pParse); /* Prepared statement */-
346 const PragmaName *pPragma; /* The pragma */-
347-
348 if( v==0 ) return;
executed 2 times by 1 test: return;
Executed by:
  • Self test (438)
v==0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 35849 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
2-35849
349 sqlite3VdbeRunOnlyOnce(v);-
350 pParse->nMem = 2;-
351-
352 /* Interpret the [schema.] part of the pragma statement. iDb is the-
353 ** index of the database this pragma is being applied to in db.aDb[]. */-
354 iDb = sqlite3TwoPartName(pParse, pId1, pId2, &pId);-
355 if( iDb<0 ) return;
executed 5 times by 1 test: return;
Executed by:
  • Self test (438)
iDb<0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 35844 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
5-35844
356 pDb = &db->aDb[iDb];-
357-
358 /* If the temp database has been explicitly named as part of the -
359 ** pragma, make sure it is open. -
360 */-
361 if( iDb==1 && sqlite3OpenTempDatabase(pParse) ){
iDb==1Description
TRUEevaluated 67 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 35777 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
sqlite3OpenTem...tabase(pParse)Description
TRUEnever evaluated
FALSEevaluated 67 times by 1 test
Evaluated by:
  • Self test (438)
0-35777
362 return;
never executed: return;
0
363 }-
364-
365 zLeft = sqlite3NameFromToken(db, pId);-
366 if( !zLeft ) return;
executed 2 times by 1 test: return;
Executed by:
  • Self test (438)
!zLeftDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 35842 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
2-35842
367 if( minusFlag ){
minusFlagDescription
TRUEevaluated 27 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 35815 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
27-35815
368 zRight = sqlite3MPrintf(db, "-%T", pValue);-
369 }else{
executed 27 times by 1 test: end of block
Executed by:
  • Self test (438)
27
370 zRight = sqlite3NameFromToken(db, pValue);-
371 }
executed 35815 times by 52 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
35815
372-
373 assert( pId2 );-
374 zDb = pId2->n>0 ? pDb->zDbSName : 0;
pId2->n>0Description
TRUEevaluated 1154 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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 34688 times by 42 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • ...
1154-34688
375 if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){
sqlite3AuthChe..., zRight, zDb)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 35840 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
2-35840
376 goto pragma_out;
executed 2 times by 1 test: goto pragma_out;
Executed by:
  • Self test (438)
2
377 }-
378-
379 /* Send an SQLITE_FCNTL_PRAGMA file-control to the underlying VFS-
380 ** connection. If it returns SQLITE_OK, then assume that the VFS-
381 ** handled the pragma and generate a no-op prepared statement.-
382 **-
383 ** IMPLEMENTATION-OF: R-12238-55120 Whenever a PRAGMA statement is parsed,-
384 ** an SQLITE_FCNTL_PRAGMA file control is sent to the open sqlite3_file-
385 ** object corresponding to the database file to which the pragma-
386 ** statement refers.-
387 **-
388 ** IMPLEMENTATION-OF: R-29875-31678 The argument to the SQLITE_FCNTL_PRAGMA-
389 ** file control is an array of pointers to strings (char**) in which the-
390 ** second element of the array is the name of the pragma and the third-
391 ** element is the argument to the pragma or NULL if the pragma has no-
392 ** argument.-
393 */-
394 aFcntl[0] = 0;-
395 aFcntl[1] = zLeft;-
396 aFcntl[2] = zRight;-
397 aFcntl[3] = 0;-
398 db->busyHandler.nBusy = 0;-
399 rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl);-
400 if( rc==SQLITE_OK ){
rc==0Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 35829 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
11-35829
401 sqlite3VdbeSetNumCols(v, 1);-
402 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, aFcntl[0], SQLITE_TRANSIENT);-
403 returnSingleText(v, aFcntl[0]);-
404 sqlite3_free(aFcntl[0]);-
405 goto pragma_out;
executed 11 times by 1 test: goto pragma_out;
Executed by:
  • Self test (438)
11
406 }-
407 if( rc!=SQLITE_NOTFOUND ){
rc!=12Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 35823 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
6-35823
408 if( aFcntl[0] ){
aFcntl[0]Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
2-4
409 sqlite3ErrorMsg(pParse, "%s", aFcntl[0]);-
410 sqlite3_free(aFcntl[0]);-
411 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
412 pParse->nErr++;-
413 pParse->rc = rc;-
414 goto pragma_out;
executed 6 times by 1 test: goto pragma_out;
Executed by:
  • Self test (438)
6
415 }-
416-
417 /* Locate the pragma in the lookup table */-
418 pPragma = pragmaLocate(zLeft);-
419 if( pPragma==0 ) goto pragma_out;
executed 425 times by 1 test: goto pragma_out;
Executed by:
  • Self test (438)
pPragma==0Description
TRUEevaluated 425 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 35398 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
425-35398
420-
421 /* Make sure the database schema is loaded if the pragma requires that */-
422 if( (pPragma->mPragFlg & PragFlg_NeedSchema)!=0 ){
(pPragma->mPragFlg & 0x01)!=0Description
TRUEevaluated 32423 times by 50 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • ...
FALSEevaluated 2975 times by 5 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (438)
  • Self test (64)
2975-32423
423 if( sqlite3ReadSchema(pParse) ) goto pragma_out;
executed 13 times by 1 test: goto pragma_out;
Executed by:
  • Self test (438)
sqlite3ReadSchema(pParse)Description
TRUEevaluated 13 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 32410 times by 50 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • ...
13-32410
424 }
executed 32410 times by 50 tests: end of block
Executed by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • ...
32410
425-
426 /* Register the result column names for pragmas that return results */-
427 if( (pPragma->mPragFlg & PragFlg_NoColumns)==0
(pPragma->mPragFlg & 0x02)==0Description
TRUEevaluated 31050 times by 52 tests
Evaluated by:
  • Self test
  • Self test (10)
  • Self test (100)
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (54)
  • Self test (57)
  • ...
FALSEevaluated 4335 times by 1 test
Evaluated by:
  • Self test (438)
4335-31050
428 && ((pPragma->mPragFlg & PragFlg_NoColumns1)==0 || zRight==0)
(pPragma->mPragFlg & 0x04)==0Description
TRUEevaluated 26989 times by 29 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (58)
  • Self test (64)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (72)
  • Self test (73)
  • Self test (74)
  • ...
FALSEevaluated 4061 times by 29 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 (2)
  • Self test (20)
  • Self test (22)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (8)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • ...
zRight==0Description
TRUEevaluated 1218 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2843 times by 29 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 (2)
  • Self test (20)
  • Self test (22)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (54)
  • Self test (57)
  • Self test (58)
  • Self test (6)
  • Self test (8)
  • Self test (91)
  • Self test (92)
  • Self test (93)
  • Self test (94)
  • Self test (95)
  • ...
1218-26989
429 ){-
430 setPragmaResultColumnNames(v, pPragma);-
431 }
executed 28207 times by 29 tests: end of block
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (105)
  • Self test (28)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (35)
  • Self test (39)
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (58)
  • Self test (64)
  • Self test (65)
  • Self test (66)
  • Self test (67)
  • Self test (68)
  • Self test (69)
  • Self test (70)
  • Self test (71)
  • Self test (72)
  • Self test (73)
  • Self test (74)
  • ...
28207
432-
433 /* Jump to the appropriate pragma handler */-
434 switch( pPragma->ePragTyp ){-
435 -
436#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)-
437 /*-
438 ** PRAGMA [schema.]default_cache_size-
439 ** PRAGMA [schema.]default_cache_size=N-
440 **-
441 ** The first form reports the current persistent setting for the-
442 ** page cache size. The value returned is the maximum number of-
443 ** pages in the page cache. The second form sets both the current-
444 ** page cache size value and the persistent page cache size value-
445 ** stored in the database file.-
446 **-
447 ** Older versions of SQLite would set the default cache size to a-
448 ** negative number to indicate synchronous=OFF. These days, synchronous-
449 ** is always on by default regardless of the sign of the default cache-
450 ** size. But continue to take the absolute value of the default cache-
451 ** size of historical compatibility.-
452 */-
453 case PragTyp_DEFAULT_CACHE_SIZE: {
executed 444 times by 4 tests: case 11:
Executed by:
  • Self test
  • Self test (438)
  • Self test (57)
  • Self test (58)
444
454 static const int iLn = VDBE_OFFSET_LINENO(2);-
455 static const VdbeOpList getCacheSize[] = {-
456 { OP_Transaction, 0, 0, 0}, /* 0 */-
457 { OP_ReadCookie, 0, 1, BTREE_DEFAULT_CACHE_SIZE}, /* 1 */-
458 { OP_IfPos, 1, 8, 0},-
459 { OP_Integer, 0, 2, 0},-
460 { OP_Subtract, 1, 2, 1},-
461 { OP_IfPos, 1, 8, 0},-
462 { OP_Integer, 0, 1, 0}, /* 6 */-
463 { OP_Noop, 0, 0, 0},-
464 { OP_ResultRow, 1, 1, 0},-
465 };-
466 VdbeOp *aOp;-
467 sqlite3VdbeUsesBtree(v, iDb);-
468 if( !zRight ){
!zRightDescription
TRUEevaluated 433 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 11 times by 4 tests
Evaluated by:
  • Self test
  • Self test (438)
  • Self test (57)
  • Self test (58)
11-433
469 pParse->nMem += 2;-
470 sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(getCacheSize));-
471 aOp = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize, iLn);-
472 if( ONLY_IF_REALLOC_STRESS(aOp==0) ) break;
(0)Description
TRUEnever evaluated
FALSEevaluated 433 times by 1 test
Evaluated by:
  • Self test (438)
dead code: break;
-
473 aOp[0].p1 = iDb;-
474 aOp[1].p1 = iDb;-
475 aOp[6].p1 = SQLITE_DEFAULT_CACHE_SIZE;-
476 }else{
executed 433 times by 1 test: end of block
Executed by:
  • Self test (438)
433
477 int size = sqlite3AbsInt32(sqlite3Atoi(zRight));-
478 sqlite3BeginWriteOperation(pParse, 0, iDb);-
479 sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_DEFAULT_CACHE_SIZE, size);-
480 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );-
481 pDb->pSchema->cache_size = size;-
482 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);-
483 }
executed 11 times by 4 tests: end of block
Executed by:
  • Self test
  • Self test (438)
  • Self test (57)
  • Self test (58)
11
484 break;
executed 444 times by 4 tests: break;
Executed by:
  • Self test
  • Self test (438)
  • Self test (57)
  • Self test (58)
444
485 }-
486#endif /* !SQLITE_OMIT_PAGER_PRAGMAS && !SQLITE_OMIT_DEPRECATED */-
487-
488#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)-
489 /*-
490 ** PRAGMA [schema.]page_size-
491 ** PRAGMA [schema.]page_size=N-
492 **-
493 ** The first form reports the current setting for the-
494 ** database page size in bytes. The second form sets the-
495 ** database page size value. The value can only be set if-
496 ** the database has not yet been created.-
497 */-
498 case PragTyp_PAGE_SIZE: {
executed 723 times by 3 tests: case 28:
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
723
499 Btree *pBt = pDb->pBt;-
500 assert( pBt!=0 );-
501 if( !zRight ){
!zRightDescription
TRUEevaluated 131 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 592 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
131-592
502 int size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0;
(pBt)Description
TRUEevaluated 131 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-131
503 returnSingleInt(v, size);-
504 }else{
executed 131 times by 1 test: end of block
Executed by:
  • Self test (438)
131
505 /* Malloc may fail when setting the page-size, as there is an internal-
506 ** buffer that the pager module resizes using sqlite3_realloc().-
507 */-
508 db->nextPagesize = sqlite3Atoi(zRight);-
509 if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize,-1,0) ){
7==sqlite3Btre...Pagesize,-1,0)Description
TRUEnever evaluated
FALSEevaluated 592 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
0-592
510 sqlite3OomFault(db);-
511 }
never executed: end of block
0
512 }
executed 592 times by 3 tests: end of block
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
592
513 break;
executed 723 times by 3 tests: break;
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
723
514 }-
515-
516 /*-
517 ** PRAGMA [schema.]secure_delete-
518 ** PRAGMA [schema.]secure_delete=ON/OFF/FAST-
519 **-
520 ** The first form reports the current setting for the-
521 ** secure_delete flag. The second form changes the secure_delete-
522 ** flag setting and reports the new value.-
523 */-
524 case PragTyp_SECURE_DELETE: {
executed 22 times by 1 test: case 30:
Executed by:
  • Self test (438)
22
525 Btree *pBt = pDb->pBt;-
526 int b = -1;-
527 assert( pBt!=0 );-
528 if( zRight ){
zRightDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 11 times by 1 test
Evaluated by:
  • Self test (438)
11
529 if( sqlite3_stricmp(zRight, "fast")==0 ){
sqlite3_stricm...ht, "fast")==0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 9 times by 1 test
Evaluated by:
  • Self test (438)
2-9
530 b = 2;-
531 }else{
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
532 b = sqlite3GetBoolean(zRight, 0);-
533 }
executed 9 times by 1 test: end of block
Executed by:
  • Self test (438)
9
534 }-
535 if( pId2->n==0 && b>=0 ){
pId2->n==0Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 15 times by 1 test
Evaluated by:
  • Self test (438)
b>=0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-15
536 int ii;-
537 for(ii=0; ii<db->nDb; ii++){
ii<db->nDbDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 6 times by 1 test
Evaluated by:
  • Self test (438)
6-16
538 sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);-
539 }
executed 16 times by 1 test: end of block
Executed by:
  • Self test (438)
16
540 }
executed 6 times by 1 test: end of block
Executed by:
  • Self test (438)
6
541 b = sqlite3BtreeSecureDelete(pBt, b);-
542 returnSingleInt(v, b);-
543 break;
executed 22 times by 1 test: break;
Executed by:
  • Self test (438)
22
544 }-
545-
546 /*-
547 ** PRAGMA [schema.]max_page_count-
548 ** PRAGMA [schema.]max_page_count=N-
549 **-
550 ** The first form reports the current setting for the-
551 ** maximum number of pages in the database file. The -
552 ** second form attempts to change this setting. Both-
553 ** forms return the current setting.-
554 **-
555 ** The absolute value of N is used. This is undocumented and might-
556 ** change. The only purpose is to provide an easy way to test-
557 ** the sqlite3AbsInt32() function.-
558 **-
559 ** PRAGMA [schema.]page_count-
560 **-
561 ** Return the number of pages in the specified database.-
562 */-
563 case PragTyp_PAGE_COUNT: {
executed 115 times by 2 tests: case 24:
Executed by:
  • Self test (39)
  • Self test (438)
115
564 int iReg;-
565 sqlite3CodeVerifySchema(pParse, iDb);-
566 iReg = ++pParse->nMem;-
567 if( sqlite3Tolower(zLeft[0])=='p' ){
(sqlite3UpperT...eft[0])])=='p'Description
TRUEevaluated 103 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • Self test (39)
  • Self test (438)
12-103
568 sqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg);-
569 }else{
executed 103 times by 1 test: end of block
Executed by:
  • Self test (438)
103
570 sqlite3VdbeAddOp3(v, OP_MaxPgcnt, iDb, iReg, -
571 sqlite3AbsInt32(sqlite3Atoi(zRight)));-
572 }
executed 12 times by 2 tests: end of block
Executed by:
  • Self test (39)
  • Self test (438)
12
573 sqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1);-
574 break;
executed 115 times by 2 tests: break;
Executed by:
  • Self test (39)
  • Self test (438)
115
575 }-
576-
577 /*-
578 ** PRAGMA [schema.]locking_mode-
579 ** PRAGMA [schema.]locking_mode = (normal|exclusive)-
580 */-
581 case PragTyp_LOCKING_MODE: {
executed 133 times by 1 test: case 23:
Executed by:
  • Self test (438)
133
582 const char *zRet = "normal";-
583 int eMode = getLockingMode(zRight);-
584-
585 if( pId2->n==0 && eMode==PAGER_LOCKINGMODE_QUERY ){
pId2->n==0Description
TRUEevaluated 101 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 32 times by 1 test
Evaluated by:
  • Self test (438)
eMode==-1Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 93 times by 1 test
Evaluated by:
  • Self test (438)
8-101
586 /* Simple "PRAGMA locking_mode;" statement. This is a query for-
587 ** the current default locking mode (which may be different to-
588 ** the locking-mode of the main database).-
589 */-
590 eMode = db->dfltLockMode;-
591 }else{
executed 8 times by 1 test: end of block
Executed by:
  • Self test (438)
8
592 Pager *pPager;-
593 if( pId2->n==0 ){
pId2->n==0Description
TRUEevaluated 93 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 32 times by 1 test
Evaluated by:
  • Self test (438)
32-93
594 /* This indicates that no database name was specified as part-
595 ** of the PRAGMA command. In this case the locking-mode must be-
596 ** set on all attached databases, as well as the main db file.-
597 **-
598 ** Also, the sqlite3.dfltLockMode variable is set so that-
599 ** any subsequently attached databases also use the specified-
600 ** locking mode.-
601 */-
602 int ii;-
603 assert(pDb==&db->aDb[0]);-
604 for(ii=2; ii<db->nDb; ii++){
ii<db->nDbDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 93 times by 1 test
Evaluated by:
  • Self test (438)
2-93
605 pPager = sqlite3BtreePager(db->aDb[ii].pBt);-
606 sqlite3PagerLockingMode(pPager, eMode);-
607 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
608 db->dfltLockMode = (u8)eMode;-
609 }
executed 93 times by 1 test: end of block
Executed by:
  • Self test (438)
93
610 pPager = sqlite3BtreePager(pDb->pBt);-
611 eMode = sqlite3PagerLockingMode(pPager, eMode);-
612 }
executed 125 times by 1 test: end of block
Executed by:
  • Self test (438)
125
613-
614 assert( eMode==PAGER_LOCKINGMODE_NORMAL-
615 || eMode==PAGER_LOCKINGMODE_EXCLUSIVE );-
616 if( eMode==PAGER_LOCKINGMODE_EXCLUSIVE ){
eMode==1Description
TRUEevaluated 88 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 45 times by 1 test
Evaluated by:
  • Self test (438)
45-88
617 zRet = "exclusive";-
618 }
executed 88 times by 1 test: end of block
Executed by:
  • Self test (438)
88
619 returnSingleText(v, zRet);-
620 break;
executed 133 times by 1 test: break;
Executed by:
  • Self test (438)
133
621 }-
622-
623 /*-
624 ** PRAGMA [schema.]journal_mode-
625 ** PRAGMA [schema.]journal_mode =-
626 ** (delete|persist|off|truncate|memory|wal|off)-
627 */-
628 case PragTyp_JOURNAL_MODE: {
executed 5311 times by 10 tests: case 20:
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)
5311
629 int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */-
630 int ii; /* Loop counter */-
631-
632 if( zRight==0 ){
zRight==0Description
TRUEevaluated 178 times by 5 tests
Evaluated by:
  • Self test (438)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
FALSEevaluated 5133 times by 6 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
178-5133
633 /* If there is no "=MODE" part of the pragma, do a query for the-
634 ** current mode */-
635 eMode = PAGER_JOURNALMODE_QUERY;-
636 }else{
executed 178 times by 5 tests: end of block
Executed by:
  • Self test (438)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
178
637 const char *zMode;-
638 int n = sqlite3Strlen30(zRight);-
639 for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){
(zMode = sqlit...ame(eMode))!=0Description
TRUEevaluated 29259 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 1 time by 1 test
Evaluated by:
  • Self test (438)
1-29259
640 if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break;
executed 5132 times by 6 tests: break;
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
sqlite3_strnic..., zMode, n)==0Description
TRUEevaluated 5132 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 24127 times by 6 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
5132-24127
641 }
executed 24127 times by 6 tests: end of block
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
24127
642 if( !zMode ){
!zModeDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5132 times by 6 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
1-5132
643 /* If the "=MODE" part does not match any known journal mode,-
644 ** then do a query */-
645 eMode = PAGER_JOURNALMODE_QUERY;-
646 }
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
1
647 }
executed 5133 times by 6 tests: end of block
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
5133
648 if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){
eMode==(-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 5132 times by 6 tests
Evaluated by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
pId2->n==0Description
TRUEevaluated 61 times by 5 tests
Evaluated by:
  • Self test (438)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
FALSEevaluated 118 times by 1 test
Evaluated by:
  • Self test (438)
61-5132
649 /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */-
650 iDb = 0;-
651 pId2->n = 1;-
652 }
executed 61 times by 5 tests: end of block
Executed by:
  • Self test (438)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
61
653 for(ii=db->nDb-1; ii>=0; ii--){
ii>=0Description
TRUEevaluated 11152 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)
FALSEevaluated 5311 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)
5311-11152
654 if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
db->aDb[ii].pBtDescription
TRUEevaluated 5909 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)
FALSEevaluated 5243 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)
ii==iDbDescription
TRUEevaluated 5311 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)
FALSEevaluated 598 times by 1 test
Evaluated by:
  • Self test (438)
pId2->n==0Description
TRUEevaluated 54 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 544 times by 1 test
Evaluated by:
  • Self test (438)
54-5909
655 sqlite3VdbeUsesBtree(v, ii);-
656 sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode);-
657 }
executed 5365 times by 10 tests: end of block
Executed by:
  • Self test (101)
  • Self test (104)
  • Self test (28)
  • Self test (3)
  • Self test (438)
  • Self test (58)
  • Self test (84)
  • Self test (85)
  • Self test (89)
  • Self test (90)
5365
658 }
executed 11152 times by 10 tests: end of block
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)
11152
659 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);-
660 break;
executed 5311 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)
5311
661 }-
662-
663 /*-
664 ** PRAGMA [schema.]journal_size_limit-
665 ** PRAGMA [schema.]journal_size_limit=N-
666 **-
667 ** Get or set the size limit on rollback journal files.-
668 */-
669 case PragTyp_JOURNAL_SIZE_LIMIT: {
executed 15 times by 1 test: case 21:
Executed by:
  • Self test (438)
15
670 Pager *pPager = sqlite3BtreePager(pDb->pBt);-
671 i64 iLimit = -2;-
672 if( zRight ){
zRightDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
5-10
673 sqlite3DecOrHexToI64(zRight, &iLimit);-
674 if( iLimit<-1 ) iLimit = -1;
executed 1 time by 1 test: iLimit = -1;
Executed by:
  • Self test (438)
iLimit<-1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 9 times by 1 test
Evaluated by:
  • Self test (438)
1-9
675 }
executed 10 times by 1 test: end of block
Executed by:
  • Self test (438)
10
676 iLimit = sqlite3PagerJournalSizeLimit(pPager, iLimit);-
677 returnSingleInt(v, iLimit);-
678 break;
executed 15 times by 1 test: break;
Executed by:
  • Self test (438)
15
679 }-
680-
681#endif /* SQLITE_OMIT_PAGER_PRAGMAS */-
682-
683 /*-
684 ** PRAGMA [schema.]auto_vacuum-
685 ** PRAGMA [schema.]auto_vacuum=N-
686 **-
687 ** Get or set the value of the database 'auto-vacuum' parameter.-
688 ** The value is one of: 0 NONE 1 FULL 2 INCREMENTAL-
689 */-
690#ifndef SQLITE_OMIT_AUTOVACUUM-
691 case PragTyp_AUTO_VACUUM: {
executed 681 times by 4 tests: case 1:
Executed by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
681
692 Btree *pBt = pDb->pBt;-
693 assert( pBt!=0 );-
694 if( !zRight ){
!zRightDescription
TRUEevaluated 77 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 604 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
77-604
695 returnSingleInt(v, sqlite3BtreeGetAutoVacuum(pBt));-
696 }else{
executed 77 times by 1 test: end of block
Executed by:
  • Self test (438)
77
697 int eAuto = getAutoVacuum(zRight);-
698 assert( eAuto>=0 && eAuto<=2 );-
699 db->nextAutovac = (u8)eAuto;-
700 /* Call SetAutoVacuum() to set initialize the internal auto and-
701 ** incr-vacuum flags. This is required in case this connection-
702 ** creates the database file. It is important that it is created-
703 ** as an auto-vacuum capable db.-
704 */-
705 rc = sqlite3BtreeSetAutoVacuum(pBt, eAuto);-
706 if( rc==SQLITE_OK && (eAuto==1 || eAuto==2) ){
rc==0Description
TRUEevaluated 590 times by 4 tests
Evaluated by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
eAuto==1Description
TRUEevaluated 64 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
FALSEevaluated 526 times by 2 tests
Evaluated by:
  • Self test (101)
  • Self test (438)
eAuto==2Description
TRUEevaluated 71 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 455 times by 2 tests
Evaluated by:
  • Self test (101)
  • Self test (438)
14-590
707 /* When setting the auto_vacuum mode to either "full" or -
708 ** "incremental", write the value of meta[6] in the database-
709 ** file. Before writing to meta[6], check that meta[3] indicates-
710 ** that this really is an auto-vacuum capable database.-
711 */-
712 static const int iLn = VDBE_OFFSET_LINENO(2);-
713 static const VdbeOpList setMeta6[] = {-
714 { OP_Transaction, 0, 1, 0}, /* 0 */-
715 { OP_ReadCookie, 0, 1, BTREE_LARGEST_ROOT_PAGE},-
716 { OP_If, 1, 0, 0}, /* 2 */-
717 { OP_Halt, SQLITE_OK, OE_Abort, 0}, /* 3 */-
718 { OP_SetCookie, 0, BTREE_INCR_VACUUM, 0}, /* 4 */-
719 };-
720 VdbeOp *aOp;-
721 int iAddr = sqlite3VdbeCurrentAddr(v);-
722 sqlite3VdbeVerifyNoMallocRequired(v, ArraySize(setMeta6));-
723 aOp = sqlite3VdbeAddOpList(v, ArraySize(setMeta6), setMeta6, iLn);-
724 if( ONLY_IF_REALLOC_STRESS(aOp==0) ) break;
(0)Description
TRUEnever evaluated
FALSEevaluated 135 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
dead code: break;
-
725 aOp[0].p1 = iDb;-
726 aOp[1].p1 = iDb;-
727 aOp[2].p2 = iAddr+4;-
728 aOp[4].p1 = iDb;-
729 aOp[4].p3 = eAuto - 1;-
730 sqlite3VdbeUsesBtree(v, iDb);-
731 }
executed 135 times by 3 tests: end of block
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
135
732 }
executed 604 times by 4 tests: end of block
Executed by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
604
733 break;
executed 681 times by 4 tests: break;
Executed by:
  • Self test (101)
  • Self test (32)
  • Self test (33)
  • Self test (438)
681
734 }-
735#endif-
736-
737 /*-
738 ** PRAGMA [schema.]incremental_vacuum(N)-
739 **-
740 ** Do N steps of incremental vacuuming on a database.-
741 */-
742#ifndef SQLITE_OMIT_AUTOVACUUM-
743 case PragTyp_INCREMENTAL_VACUUM: {
executed 4299 times by 1 test: case 16:
Executed by:
  • Self test (438)
4299
744 int iLimit, addr;-
745 if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){
zRight==0Description
TRUEevaluated 91 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4208 times by 1 test
Evaluated by:
  • Self test (438)
!sqlite3GetInt...ight, &iLimit)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4207 times by 1 test
Evaluated by:
  • Self test (438)
iLimit<=0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4205 times by 1 test
Evaluated by:
  • Self test (438)
1-4208
746 iLimit = 0x7fffffff;-
747 }
executed 94 times by 1 test: end of block
Executed by:
  • Self test (438)
94
748 sqlite3BeginWriteOperation(pParse, 0, iDb);-
749 sqlite3VdbeAddOp2(v, OP_Integer, iLimit, 1);-
750 addr = sqlite3VdbeAddOp1(v, OP_IncrVacuum, iDb); VdbeCoverage(v);-
751 sqlite3VdbeAddOp1(v, OP_ResultRow, 1);-
752 sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1);-
753 sqlite3VdbeAddOp2(v, OP_IfPos, 1, addr); VdbeCoverage(v);-
754 sqlite3VdbeJumpHere(v, addr);-
755 break;
executed 4299 times by 1 test: break;
Executed by:
  • Self test (438)
4299
756 }-
757#endif-
758-
759#ifndef SQLITE_OMIT_PAGER_PRAGMAS-
760 /*-
761 ** PRAGMA [schema.]cache_size-
762 ** PRAGMA [schema.]cache_size=N-
763 **-
764 ** The first form reports the current local setting for the-
765 ** page cache size. The second form sets the local-
766 ** page cache size value. If N is positive then that is the-
767 ** number of pages in the cache. If N is negative, then the-
768 ** number of pages is adjusted so that the cache uses -N kibibytes-
769 ** of memory.-
770 */-
771 case PragTyp_CACHE_SIZE: {
executed 393 times by 16 tests: case 4:
Executed by:
  • Self test (10)
  • Self test (101)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (54)
  • Self test (6)
  • Self test (8)
393
772 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );-
773 if( !zRight ){
!zRightDescription
TRUEevaluated 112 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 281 times by 16 tests
Evaluated by:
  • Self test (10)
  • Self test (101)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (54)
  • Self test (6)
  • Self test (8)
112-281
774 returnSingleInt(v, pDb->pSchema->cache_size);-
775 }else{
executed 112 times by 1 test: end of block
Executed by:
  • Self test (438)
112
776 int size = sqlite3Atoi(zRight);-
777 pDb->pSchema->cache_size = size;-
778 sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);-
779 }
executed 281 times by 16 tests: end of block
Executed by:
  • Self test (10)
  • Self test (101)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (54)
  • Self test (6)
  • Self test (8)
281
780 break;
executed 393 times by 16 tests: break;
Executed by:
  • Self test (10)
  • Self test (101)
  • Self test (12)
  • Self test (14)
  • Self test (16)
  • Self test (18)
  • Self test (2)
  • Self test (20)
  • Self test (22)
  • Self test (3)
  • Self test (32)
  • Self test (33)
  • Self test (438)
  • Self test (54)
  • Self test (6)
  • Self test (8)
393
781 }-
782-
783 /*-
784 ** PRAGMA [schema.]cache_spill-
785 ** PRAGMA cache_spill=BOOLEAN-
786 ** PRAGMA [schema.]cache_spill=N-
787 **-
788 ** The first form reports the current local setting for the-
789 ** page cache spill size. The second form turns cache spill on-
790 ** or off. When turnning cache spill on, the size is set to the-
791 ** current cache_size. The third form sets a spill size that-
792 ** may be different form the cache size.-
793 ** If N is positive then that is the-
794 ** number of pages in the cache. If N is negative, then the-
795 ** number of pages is adjusted so that the cache uses -N kibibytes-
796 ** of memory.-
797 **-
798 ** If the number of cache_spill pages is less then the number of-
799 ** cache_size pages, no spilling occurs until the page count exceeds-
800 ** the number of cache_size pages.-
801 **-
802 ** The cache_spill=BOOLEAN setting applies to all attached schemas,-
803 ** not just the schema specified.-
804 */-
805 case PragTyp_CACHE_SPILL: {
executed 28 times by 1 test: case 5:
Executed by:
  • Self test (438)
28
806 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );-
807 if( !zRight ){
!zRightDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
14
808 returnSingleInt(v,-
809 (db->flags & SQLITE_CacheSpill)==0 ? 0 : -
810 sqlite3BtreeSetSpillSize(pDb->pBt,0));-
811 }else{
executed 14 times by 1 test: end of block
Executed by:
  • Self test (438)
14
812 int size = 1;-
813 if( sqlite3GetInt32(zRight, &size) ){
sqlite3GetInt32(zRight, &size)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
7
814 sqlite3BtreeSetSpillSize(pDb->pBt, size);-
815 }
executed 7 times by 1 test: end of block
Executed by:
  • Self test (438)
7
816 if( sqlite3GetBoolean(zRight, size!=0) ){
sqlite3GetBool...ight, size!=0)Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
5-9
817 db->flags |= SQLITE_CacheSpill;-
818 }else{
executed 9 times by 1 test: end of block
Executed by:
  • Self test (438)
9
819 db->flags &= ~SQLITE_CacheSpill;-
820 }
executed 5 times by 1 test: end of block
Executed by:
  • Self test (438)
5
821 setAllPagerFlags(db);-
822 }
executed 14 times by 1 test: end of block
Executed by:
  • Self test (438)
14
823 break;
executed 28 times by 1 test: break;
Executed by:
  • Self test (438)
28
824 }-
825-
826 /*-
827 ** PRAGMA [schema.]mmap_size(N)-
828 **-
829 ** Used to set mapping size limit. The mapping size limit is-
830 ** used to limit the aggregate size of all memory mapped regions of the-
831 ** database file. If this parameter is set to zero, then memory mapping-
832 ** is not used at all. If N is negative, then the default memory map-
833 ** limit determined by sqlite3_config(SQLITE_CONFIG_MMAP_SIZE) is set.-
834 ** The parameter N is measured in bytes.-
835 **-
836 ** This value is advisory. The underlying VFS is free to memory map-
837 ** as little or as much as it wants. Except, if N is set to 0 then the-
838 ** upper layers will never invoke the xFetch interfaces to the VFS.-
839 */-
840 case PragTyp_MMAP_SIZE: {
executed 262 times by 3 tests: case 25:
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
262
841 sqlite3_int64 sz;-
842#if SQLITE_MAX_MMAP_SIZE>0-
843 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );-
844 if( zRight ){
zRightDescription
TRUEevaluated 248 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
FALSEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
14-248
845 int ii;-
846 sqlite3DecOrHexToI64(zRight, &sz);-
847 if( sz<0 ) sz = sqlite3GlobalConfig.szMmap;
never executed: sz = sqlite3Config.szMmap;
sz<0Description
TRUEnever evaluated
FALSEevaluated 248 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
0-248
848 if( pId2->n==0 ) db->szMmap = sz;
executed 248 times by 3 tests: db->szMmap = sz;
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
pId2->n==0Description
TRUEevaluated 248 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
FALSEnever evaluated
0-248
849 for(ii=db->nDb-1; ii>=0; ii--){
ii>=0Description
TRUEevaluated 496 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
FALSEevaluated 248 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
248-496
850 if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){
db->aDb[ii].pBtDescription
TRUEevaluated 268 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
FALSEevaluated 228 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
ii==iDbDescription
TRUEevaluated 248 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
FALSEevaluated 20 times by 1 test
Evaluated by:
  • Self test (438)
pId2->n==0Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-268
851 sqlite3BtreeSetMmapLimit(db->aDb[ii].pBt, sz);-
852 }
executed 268 times by 3 tests: end of block
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
268
853 }
executed 496 times by 3 tests: end of block
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
496
854 }
executed 248 times by 3 tests: end of block
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
248
855 sz = -1;-
856 rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_MMAP_SIZE, &sz);-
857#else-
858 sz = 0;-
859 rc = SQLITE_OK;-
860#endif-
861 if( rc==SQLITE_OK ){
rc==0Description
TRUEevaluated 262 times by 3 tests
Evaluated by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
FALSEnever evaluated
0-262
862 returnSingleInt(v, sz);-
863 }else if( rc!=SQLITE_NOTFOUND ){
executed 262 times by 3 tests: end of block
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
rc!=12Description
TRUEnever evaluated
FALSEnever evaluated
0-262
864 pParse->nErr++;-
865 pParse->rc = rc;-
866 }
never executed: end of block
0
867 break;
executed 262 times by 3 tests: break;
Executed by:
  • Self test (32)
  • Self test (33)
  • Self test (438)
262
868 }-
869-
870 /*-
871 ** PRAGMA temp_store-
872 ** PRAGMA temp_store = "default"|"memory"|"file"-
873 **-
874 ** Return or set the local value of the temp_store flag. Changing-
875 ** the local value does not make changes to the disk file and the default-
876 ** value will be restored the next time the database is opened.-
877 **-
878 ** Note that it is possible for the library compile-time options to-
879 ** override this setting-
880 */-
881 case PragTyp_TEMP_STORE: {
executed 105 times by 1 test: case 35:
Executed by:
  • Self test (438)
105
882 if( !zRight ){
!zRightDescription
TRUEevaluated 19 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 86 times by 1 test
Evaluated by:
  • Self test (438)
19-86
883 returnSingleInt(v, db->temp_store);-
884 }else{
executed 19 times by 1 test: end of block
Executed by:
  • Self test (438)
19
885 changeTempStorage(pParse, zRight);-
886 }
executed 86 times by 1 test: end of block
Executed by:
  • Self test (438)
86
887 break;
executed 105 times by 1 test: break;
Executed by:
  • Self test (438)
105
888 }-
889-
890 /*-
891 ** PRAGMA temp_store_directory-
892 ** PRAGMA temp_store_directory = ""|"directory_name"-
893 **-
894 ** Return or set the local value of the temp_store_directory flag. Changing-
895 ** the value sets a specific directory to be used for temporary files.-
896 ** Setting to a null string reverts to the default temporary directory search.-
897 ** If temporary directory is changed, then invalidateTempStorage.-
898 **-
899 */-
900 case PragTyp_TEMP_STORE_DIRECTORY: {
executed 8 times by 1 test: case 36:
Executed by:
  • Self test (438)
8
901 if( !zRight ){
!zRightDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5 times by 1 test
Evaluated by:
  • Self test (438)
3-5
902 returnSingleText(v, sqlite3_temp_directory);-
903 }else{
executed 3 times by 1 test: end of block
Executed by:
  • Self test (438)
3
904#ifndef SQLITE_OMIT_WSD-
905 if( zRight[0] ){
zRight[0]Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
2-3
906 int res;-
907 rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);-
908 if( rc!=SQLITE_OK || res==0 ){
rc!=0Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
res==0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
0-3
909 sqlite3ErrorMsg(pParse, "not a writable directory");-
910 goto pragma_out;
executed 1 time by 1 test: goto pragma_out;
Executed by:
  • Self test (438)
1
911 }-
912 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
913 if( SQLITE_TEMP_STORE==0
1==0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
0-4
914 || (SQLITE_TEMP_STORE==1 && db->temp_store<=1)
1==1Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
db->temp_store<=1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
0-4
915 || (SQLITE_TEMP_STORE==2 && db->temp_store==1)
1==2Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
db->temp_store==1Description
TRUEnever evaluated
FALSEnever evaluated
0-2
916 ){-
917 invalidateTempStorage(pParse);-
918 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
919 sqlite3_free(sqlite3_temp_directory);-
920 if( zRight[0] ){
zRight[0]Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
2
921 sqlite3_temp_directory = sqlite3_mprintf("%s", zRight);-
922 }else{
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
923 sqlite3_temp_directory = 0;-
924 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
925#endif /* SQLITE_OMIT_WSD */-
926 }-
927 break;
executed 7 times by 1 test: break;
Executed by:
  • Self test (438)
7
928 }-
929-
930#if SQLITE_OS_WIN-
931 /*-
932 ** PRAGMA data_store_directory-
933 ** PRAGMA data_store_directory = ""|"directory_name"-
934 **-
935 ** Return or set the local value of the data_store_directory flag. Changing-
936 ** the value sets a specific directory to be used for database files that-
937 ** were specified with a relative pathname. Setting to a null string reverts-
938 ** to the default database directory, which for database files specified with-
939 ** a relative path will probably be based on the current directory for the-
940 ** process. Database file specified with an absolute path are not impacted-
941 ** by this setting, regardless of its value.-
942 **-
943 */-
944 case PragTyp_DATA_STORE_DIRECTORY: {-
945 if( !zRight ){-
946 returnSingleText(v, sqlite3_data_directory);-
947 }else{-
948#ifndef SQLITE_OMIT_WSD-
949 if( zRight[0] ){-
950 int res;-
951 rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);-
952 if( rc!=SQLITE_OK || res==0 ){-
953 sqlite3ErrorMsg(pParse, "not a writable directory");-
954 goto pragma_out;-
955 }-
956 }-
957 sqlite3_free(sqlite3_data_directory);-
958 if( zRight[0] ){-
959 sqlite3_data_directory = sqlite3_mprintf("%s", zRight);-
960 }else{-
961 sqlite3_data_directory = 0;-
962 }-
963#endif /* SQLITE_OMIT_WSD */-
964 }-
965 break;-
966 }-
967#endif-
968-
969#if SQLITE_ENABLE_LOCKING_STYLE-
970 /*-
971 ** PRAGMA [schema.]lock_proxy_file-
972 ** PRAGMA [schema.]lock_proxy_file = ":auto:"|"lock_file_path"-
973 **-
974 ** Return or set the value of the lock_proxy_file flag. Changing-
975 ** the value sets a specific file to be used for database access locks.-
976 **-
977 */-
978 case PragTyp_LOCK_PROXY_FILE: {-
979 if( !zRight ){-
980 Pager *pPager = sqlite3BtreePager(pDb->pBt);-
981 char *proxy_file_path = NULL;-
982 sqlite3_file *pFile = sqlite3PagerFile(pPager);-
983 sqlite3OsFileControlHint(pFile, SQLITE_GET_LOCKPROXYFILE, -
984 &proxy_file_path);-
985 returnSingleText(v, proxy_file_path);-
986 }else{-
987 Pager *pPager = sqlite3BtreePager(pDb->pBt);-
988 sqlite3_file *pFile = sqlite3PagerFile(pPager);-
989 int res;-
990 if( zRight[0] ){-
991 res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, -
992 zRight);-
993 } else {-
994 res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, -
995 NULL);-
996 }-
997 if( res!=SQLITE_OK ){-
998 sqlite3ErrorMsg(pParse, "failed to set lock proxy file");-
999 goto pragma_out;-
1000 }-
1001 }-
1002 break;-
1003 }-
1004#endif /* SQLITE_ENABLE_LOCKING_STYLE */ -
1005 -
1006 /*-
1007 ** PRAGMA [schema.]synchronous-
1008 ** PRAGMA [schema.]synchronous=OFF|ON|NORMAL|FULL|EXTRA-
1009 **-
1010 ** Return or set the local value of the synchronous flag. Changing-
1011 ** the local value does not make changes to the disk file and the-
1012 ** default value will be restored the next time the database is-
1013 ** opened.-
1014 */-
1015 case PragTyp_SYNCHRONOUS: {
executed 238 times by 11 tests: case 33:
Executed by:
  • Self test (100)
  • 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)
238
1016 if( !zRight ){
!zRightDescription
TRUEevaluated 34 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 204 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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)
34-204
1017 returnSingleInt(v, pDb->safety_level-1);-
1018 }else{
executed 34 times by 1 test: end of block
Executed by:
  • Self test (438)
34
1019 if( !db->autoCommit ){
!db->autoCommitDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 203 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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)
1-203
1020 sqlite3ErrorMsg(pParse, -
1021 "Safety level may not be changed inside a transaction");-
1022 }else if( iDb!=1 ){
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
iDb!=1Description
TRUEevaluated 203 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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)
FALSEnever evaluated
0-203
1023 int iLevel = (getSafetyLevel(zRight,0,1)+1) & PAGER_SYNCHRONOUS_MASK;-
1024 if( iLevel==0 ) iLevel = 1;
never executed: iLevel = 1;
iLevel==0Description
TRUEnever evaluated
FALSEevaluated 203 times by 11 tests
Evaluated by:
  • Self test (100)
  • 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)
0-203
1025 pDb->safety_level = iLevel;-
1026 pDb->bSyncSet = 1;-
1027 setAllPagerFlags(db);-
1028 }
executed 203 times by 11 tests: end of block
Executed by:
  • Self test (100)
  • 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)
203
1029 }
executed 204 times by 11 tests: end of block
Executed by:
  • Self test (100)
  • 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)
204
1030 break;
executed 238 times by 11 tests: break;
Executed by:
  • Self test (100)
  • 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)
238
1031 }-
1032#endif /* SQLITE_OMIT_PAGER_PRAGMAS */-
1033-
1034#ifndef SQLITE_OMIT_FLAG_PRAGMAS-
1035 case PragTyp_FLAG: {
executed 1271 times by 1 test: case 2:
Executed by:
  • Self test (438)
1271
1036 if( zRight==0 ){
zRight==0Description
TRUEevaluated 317 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 954 times by 1 test
Evaluated by:
  • Self test (438)
317-954
1037 setPragmaResultColumnNames(v, pPragma);-
1038 returnSingleInt(v, (db->flags & pPragma->iArg)!=0 );-
1039 }else{
executed 317 times by 1 test: end of block
Executed by:
  • Self test (438)
317
1040 int mask = pPragma->iArg; /* Mask of bits to set or clear. */-
1041 if( db->autoCommit==0 ){
db->autoCommit==0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 938 times by 1 test
Evaluated by:
  • Self test (438)
16-938
1042 /* Foreign key support may not be enabled or disabled while not-
1043 ** in auto-commit mode. */-
1044 mask &= ~(SQLITE_ForeignKeys);-
1045 }
executed 16 times by 1 test: end of block
Executed by:
  • Self test (438)
16
1046#if SQLITE_USER_AUTHENTICATION-
1047 if( db->auth.authLevel==UAUTH_User ){-
1048 /* Do not allow non-admin users to modify the schema arbitrarily */-
1049 mask &= ~(SQLITE_WriteSchema);-
1050 }-
1051#endif-
1052-
1053 if( sqlite3GetBoolean(zRight, 0) ){
sqlite3GetBoolean(zRight, 0)Description
TRUEevaluated 406 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 548 times by 1 test
Evaluated by:
  • Self test (438)
406-548
1054 db->flags |= mask;-
1055 }else{
executed 406 times by 1 test: end of block
Executed by:
  • Self test (438)
406
1056 db->flags &= ~mask;-
1057 if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0;
never executed: db->nDeferredImmCons = 0;
mask==0x00080000Description
TRUEnever evaluated
FALSEevaluated 548 times by 1 test
Evaluated by:
  • Self test (438)
0-548
1058 }
executed 548 times by 1 test: end of block
Executed by:
  • Self test (438)
548
1059-
1060 /* Many of the flag-pragmas modify the code generated by the SQL -
1061 ** compiler (eg. count_changes). So add an opcode to expire all-
1062 ** compiled SQL statements after modifying a pragma value.-
1063 */-
1064 sqlite3VdbeAddOp0(v, OP_Expire);-
1065 setAllPagerFlags(db);-
1066 }
executed 954 times by 1 test: end of block
Executed by:
  • Self test (438)
954
1067 break;
executed 1271 times by 1 test: break;
Executed by:
  • Self test (438)
1271
1068 }-
1069#endif /* SQLITE_OMIT_FLAG_PRAGMAS */-
1070-
1071#ifndef SQLITE_OMIT_SCHEMA_PRAGMAS-
1072 /*-
1073 ** PRAGMA table_info(<table>)-
1074 **-
1075 ** Return a single row for each column of the named table. The columns of-
1076 ** the returned data set are:-
1077 **-
1078 ** cid: Column id (numbered from left to right, starting at 0)-
1079 ** name: Column name-
1080 ** type: Column declaration type.-
1081 ** notnull: True if 'NOT NULL' is part of column declaration-
1082 ** dflt_value: The default value for the column, if any.-
1083 ** pk: Non-zero for PK fields.-
1084 */-
1085 case PragTyp_TABLE_INFO: if( zRight ){
zRightDescription
TRUEevaluated 8704 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
executed 8705 times by 1 test: case 34:
Executed by:
  • Self test (438)
1-8705
1086 Table *pTab;-
1087 pTab = sqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb);-
1088 if( pTab ){
pTabDescription
TRUEevaluated 8702 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
2-8702
1089 int i, k;-
1090 int nHidden = 0;-
1091 Column *pCol;-
1092 Index *pPk = sqlite3PrimaryKeyIndex(pTab);-
1093 pParse->nMem = 6;-
1094 sqlite3CodeVerifySchema(pParse, iDb);-
1095 sqlite3ViewGetColumnNames(pParse, pTab);-
1096 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
i<pTab->nColDescription
TRUEevaluated 17574 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 8702 times by 1 test
Evaluated by:
  • Self test (438)
8702-17574
1097 if( IsHiddenColumn(pCol) ){
(((pCol)->colF... & 0x0002)!=0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 17555 times by 1 test
Evaluated by:
  • Self test (438)
19-17555
1098 nHidden++;-
1099 continue;
executed 19 times by 1 test: continue;
Executed by:
  • Self test (438)
19
1100 }-
1101 if( (pCol->colFlags & COLFLAG_PRIMKEY)==0 ){
(pCol->colFlags & 0x0001)==0Description
TRUEevaluated 8964 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 8591 times by 1 test
Evaluated by:
  • Self test (438)
8591-8964
1102 k = 0;-
1103 }else if( pPk==0 ){
executed 8964 times by 1 test: end of block
Executed by:
  • Self test (438)
pPk==0Description
TRUEevaluated 8571 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 20 times by 1 test
Evaluated by:
  • Self test (438)
20-8964
1104 k = 1;-
1105 }else{
executed 8571 times by 1 test: end of block
Executed by:
  • Self test (438)
8571
1106 for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){}
executed 10 times by 1 test: end of block
Executed by:
  • Self test (438)
k<=pTab->nColDescription
TRUEevaluated 29 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
pPk->aiColumn[k-1]!=iDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 19 times by 1 test
Evaluated by:
  • Self test (438)
1-29
1107 }
executed 20 times by 1 test: end of block
Executed by:
  • Self test (438)
20
1108 assert( pCol->pDflt==0 || pCol->pDflt->op==TK_SPAN );-
1109 sqlite3VdbeMultiLoad(v, 1, "issisi",-
1110 i-nHidden,-
1111 pCol->zName,-
1112 sqlite3ColumnType(pCol,""),-
1113 pCol->notNull ? 1 : 0,-
1114 pCol->pDflt ? pCol->pDflt->u.zToken : 0,-
1115 k);-
1116 }
executed 17555 times by 1 test: end of block
Executed by:
  • Self test (438)
17555
1117 }
executed 8702 times by 1 test: end of block
Executed by:
  • Self test (438)
8702
1118 }
executed 8704 times by 1 test: end of block
Executed by:
  • Self test (438)
8704
1119 break;
executed 8705 times by 1 test: break;
Executed by:
  • Self test (438)
8705
1120-
1121#ifdef SQLITE_DEBUG-
1122 case PragTyp_STATS: {-
1123 Index *pIdx;-
1124 HashElem *i;-
1125 pParse->nMem = 5;-
1126 sqlite3CodeVerifySchema(pParse, iDb);-
1127 for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){-
1128 Table *pTab = sqliteHashData(i);-
1129 sqlite3VdbeMultiLoad(v, 1, "ssiii",-
1130 pTab->zName,-
1131 0,-
1132 pTab->szTabRow,-
1133 pTab->nRowLogEst,-
1134 pTab->tabFlags);-
1135 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){-
1136 sqlite3VdbeMultiLoad(v, 2, "siiiX",-
1137 pIdx->zName,-
1138 pIdx->szIdxRow,-
1139 pIdx->aiRowLogEst[0],-
1140 pIdx->hasStat1);-
1141 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);-
1142 }-
1143 }-
1144 }-
1145 break;-
1146#endif-
1147-
1148 case PragTyp_INDEX_INFO: if( zRight ){
zRightDescription
TRUEevaluated 101 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
executed 101 times by 1 test: case 17:
Executed by:
  • Self test (438)
0-101
1149 Index *pIdx;-
1150 Table *pTab;-
1151 pIdx = sqlite3FindIndex(db, zRight, zDb);-
1152 if( pIdx ){
pIdxDescription
TRUEevaluated 100 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-100
1153 int i;-
1154 int mx;-
1155 if( pPragma->iArg ){
pPragma->iArgDescription
TRUEevaluated 39 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 61 times by 1 test
Evaluated by:
  • Self test (438)
39-61
1156 /* PRAGMA index_xinfo (newer version with more rows and columns) */-
1157 mx = pIdx->nColumn;-
1158 pParse->nMem = 6;-
1159 }else{
executed 39 times by 1 test: end of block
Executed by:
  • Self test (438)
39
1160 /* PRAGMA index_info (legacy version) */-
1161 mx = pIdx->nKeyCol;-
1162 pParse->nMem = 3;-
1163 }
executed 61 times by 1 test: end of block
Executed by:
  • Self test (438)
61
1164 pTab = pIdx->pTable;-
1165 sqlite3CodeVerifySchema(pParse, iDb);-
1166 assert( pParse->nMem<=pPragma->nPragCName );-
1167 for(i=0; i<mx; i++){
i<mxDescription
TRUEevaluated 169 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 100 times by 1 test
Evaluated by:
  • Self test (438)
100-169
1168 i16 cnum = pIdx->aiColumn[i];-
1169 sqlite3VdbeMultiLoad(v, 1, "iisX", i, cnum,-
1170 cnum<0 ? 0 : pTab->aCol[cnum].zName);-
1171 if( pPragma->iArg ){
pPragma->iArgDescription
TRUEevaluated 92 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 77 times by 1 test
Evaluated by:
  • Self test (438)
77-92
1172 sqlite3VdbeMultiLoad(v, 4, "isiX",-
1173 pIdx->aSortOrder[i],-
1174 pIdx->azColl[i],-
1175 i<pIdx->nKeyCol);-
1176 }
executed 92 times by 1 test: end of block
Executed by:
  • Self test (438)
92
1177 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, pParse->nMem);-
1178 }
executed 169 times by 1 test: end of block
Executed by:
  • Self test (438)
169
1179 }
executed 100 times by 1 test: end of block
Executed by:
  • Self test (438)
100
1180 }
executed 101 times by 1 test: end of block
Executed by:
  • Self test (438)
101
1181 break;
executed 101 times by 1 test: break;
Executed by:
  • Self test (438)
101
1182-
1183 case PragTyp_INDEX_LIST: if( zRight ){
zRightDescription
TRUEevaluated 449 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
executed 449 times by 1 test: case 18:
Executed by:
  • Self test (438)
0-449
1184 Index *pIdx;-
1185 Table *pTab;-
1186 int i;-
1187 pTab = sqlite3FindTable(db, zRight, zDb);-
1188 if( pTab ){
pTabDescription
TRUEevaluated 448 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-448
1189 pParse->nMem = 5;-
1190 sqlite3CodeVerifySchema(pParse, iDb);-
1191 for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){
pIdxDescription
TRUEevaluated 116 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 448 times by 1 test
Evaluated by:
  • Self test (438)
116-448
1192 const char *azOrigin[] = { "c", "u", "pk" };-
1193 sqlite3VdbeMultiLoad(v, 1, "isisi",-
1194 i,-
1195 pIdx->zName,-
1196 IsUniqueIndex(pIdx),-
1197 azOrigin[pIdx->idxType],-
1198 pIdx->pPartIdxWhere!=0);-
1199 }
executed 116 times by 1 test: end of block
Executed by:
  • Self test (438)
116
1200 }
executed 448 times by 1 test: end of block
Executed by:
  • Self test (438)
448
1201 }
executed 449 times by 1 test: end of block
Executed by:
  • Self test (438)
449
1202 break;
executed 449 times by 1 test: break;
Executed by:
  • Self test (438)
449
1203-
1204 case PragTyp_DATABASE_LIST: {
executed 343 times by 1 test: case 10:
Executed by:
  • Self test (438)
343
1205 int i;-
1206 pParse->nMem = 3;-
1207 for(i=0; i<db->nDb; i++){
i<db->nDbDescription
TRUEevaluated 883 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 343 times by 1 test
Evaluated by:
  • Self test (438)
343-883
1208 if( db->aDb[i].pBt==0 ) continue;
executed 159 times by 1 test: continue;
Executed by:
  • Self test (438)
db->aDb[i].pBt==0Description
TRUEevaluated 159 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 724 times by 1 test
Evaluated by:
  • Self test (438)
159-724
1209 assert( db->aDb[i].zDbSName!=0 );-
1210 sqlite3VdbeMultiLoad(v, 1, "iss",-
1211 i,-
1212 db->aDb[i].zDbSName,-
1213 sqlite3BtreeGetFilename(db->aDb[i].pBt));-
1214 }
executed 724 times by 1 test: end of block
Executed by:
  • Self test (438)
724
1215 }-
1216 break;
executed 343 times by 1 test: break;
Executed by:
  • Self test (438)
343
1217-
1218 case PragTyp_COLLATION_LIST: {
executed 2 times by 1 test: case 7:
Executed by:
  • Self test (438)
2
1219 int i = 0;-
1220 HashElem *p;-
1221 pParse->nMem = 2;-
1222 for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){
pDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
2-7
1223 CollSeq *pColl = (CollSeq *)sqliteHashData(p);-
1224 sqlite3VdbeMultiLoad(v, 1, "is", i++, pColl->zName);-
1225 }
executed 7 times by 1 test: end of block
Executed by:
  • Self test (438)
7
1226 }-
1227 break;
executed 2 times by 1 test: break;
Executed by:
  • Self test (438)
2
1228-
1229#ifdef SQLITE_INTROSPECTION_PRAGMAS-
1230 case PragTyp_FUNCTION_LIST: {-
1231 int i;-
1232 HashElem *j;-
1233 FuncDef *p;-
1234 pParse->nMem = 2;-
1235 for(i=0; i<SQLITE_FUNC_HASH_SZ; i++){-
1236 for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash ){-
1237 sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 1);-
1238 }-
1239 }-
1240 for(j=sqliteHashFirst(&db->aFunc); j; j=sqliteHashNext(j)){-
1241 p = (FuncDef*)sqliteHashData(j);-
1242 sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 0);-
1243 }-
1244 }-
1245 break;-
1246-
1247#ifndef SQLITE_OMIT_VIRTUALTABLE-
1248 case PragTyp_MODULE_LIST: {-
1249 HashElem *j;-
1250 pParse->nMem = 1;-
1251 for(j=sqliteHashFirst(&db->aModule); j; j=sqliteHashNext(j)){-
1252 Module *pMod = (Module*)sqliteHashData(j);-
1253 sqlite3VdbeMultiLoad(v, 1, "s", pMod->zName);-
1254 }-
1255 }-
1256 break;-
1257#endif /* SQLITE_OMIT_VIRTUALTABLE */-
1258-
1259 case PragTyp_PRAGMA_LIST: {-
1260 int i;-
1261 for(i=0; i<ArraySize(aPragmaName); i++){-
1262 sqlite3VdbeMultiLoad(v, 1, "s", aPragmaName[i].zName);-
1263 }-
1264 }-
1265 break;-
1266#endif /* SQLITE_INTROSPECTION_PRAGMAS */-
1267-
1268#endif /* SQLITE_OMIT_SCHEMA_PRAGMAS */-
1269-
1270#ifndef SQLITE_OMIT_FOREIGN_KEY-
1271 case PragTyp_FOREIGN_KEY_LIST: if( zRight ){
zRightDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
executed 16 times by 1 test: case 14:
Executed by:
  • Self test (438)
1-16
1272 FKey *pFK;-
1273 Table *pTab;-
1274 pTab = sqlite3FindTable(db, zRight, zDb);-
1275 if( pTab ){
pTabDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-14
1276 pFK = pTab->pFKey;-
1277 if( pFK ){
pFKDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-13
1278 int i = 0; -
1279 pParse->nMem = 8;-
1280 sqlite3CodeVerifySchema(pParse, iDb);-
1281 while(pFK){
pFKDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 13 times by 1 test
Evaluated by:
  • Self test (438)
13-16
1282 int j;-
1283 for(j=0; j<pFK->nCol; j++){
j<pFK->nColDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
16-22
1284 sqlite3VdbeMultiLoad(v, 1, "iissssss",-
1285 i,-
1286 j,-
1287 pFK->zTo,-
1288 pTab->aCol[pFK->aCol[j].iFrom].zName,-
1289 pFK->aCol[j].zCol,-
1290 actionName(pFK->aAction[1]), /* ON UPDATE */-
1291 actionName(pFK->aAction[0]), /* ON DELETE */-
1292 "NONE");-
1293 }
executed 22 times by 1 test: end of block
Executed by:
  • Self test (438)
22
1294 ++i;-
1295 pFK = pFK->pNextFrom;-
1296 }
executed 16 times by 1 test: end of block
Executed by:
  • Self test (438)
16
1297 }
executed 13 times by 1 test: end of block
Executed by:
  • Self test (438)
13
1298 }
executed 14 times by 1 test: end of block
Executed by:
  • Self test (438)
14
1299 }
executed 15 times by 1 test: end of block
Executed by:
  • Self test (438)
15
1300 break;
executed 16 times by 1 test: break;
Executed by:
  • Self test (438)
16
1301#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */-
1302-
1303#ifndef SQLITE_OMIT_FOREIGN_KEY-
1304#ifndef SQLITE_OMIT_TRIGGER-
1305 case PragTyp_FOREIGN_KEY_CHECK: {
executed 1223 times by 1 test: case 13:
Executed by:
  • Self test (438)
1223
1306 FKey *pFK; /* A foreign key constraint */-
1307 Table *pTab; /* Child table contain "REFERENCES" keyword */-
1308 Table *pParent; /* Parent table that child points to */-
1309 Index *pIdx; /* Index in the parent table */-
1310 int i; /* Loop counter: Foreign key number for pTab */-
1311 int j; /* Loop counter: Field of the foreign key */-
1312 HashElem *k; /* Loop counter: Next table in schema */-
1313 int x; /* result variable */-
1314 int regResult; /* 3 registers to hold a result row */-
1315 int regKey; /* Register to hold key for checking the FK */-
1316 int regRow; /* Registers to hold a row from pTab */-
1317 int addrTop; /* Top of a loop checking foreign keys */-
1318 int addrOk; /* Jump here if the key is OK */-
1319 int *aiCols; /* child to parent column mapping */-
1320-
1321 regResult = pParse->nMem+1;-
1322 pParse->nMem += 4;-
1323 regKey = ++pParse->nMem;-
1324 regRow = ++pParse->nMem;-
1325 sqlite3CodeVerifySchema(pParse, iDb);-
1326 k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash);-
1327 while( k ){
kDescription
TRUEevaluated 1647 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1222 times by 1 test
Evaluated by:
  • Self test (438)
1222-1647
1328 if( zRight ){
zRightDescription
TRUEevaluated 1204 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 443 times by 1 test
Evaluated by:
  • Self test (438)
443-1204
1329 pTab = sqlite3LocateTable(pParse, 0, zRight, zDb);-
1330 k = 0;-
1331 }else{
executed 1204 times by 1 test: end of block
Executed by:
  • Self test (438)
1204
1332 pTab = (Table*)sqliteHashData(k);-
1333 k = sqliteHashNext(k);-
1334 }
executed 443 times by 1 test: end of block
Executed by:
  • Self test (438)
443
1335 if( pTab==0 || pTab->pFKey==0 ) continue;
executed 696 times by 1 test: continue;
Executed by:
  • Self test (438)
pTab==0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1646 times by 1 test
Evaluated by:
  • Self test (438)
pTab->pFKey==0Description
TRUEevaluated 695 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 951 times by 1 test
Evaluated by:
  • Self test (438)
1-1646
1336 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);-
1337 if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
executed 636 times by 1 test: pParse->nMem = pTab->nCol + regRow;
Executed by:
  • Self test (438)
pTab->nCol+regRow>pParse->nMemDescription
TRUEevaluated 636 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 315 times by 1 test
Evaluated by:
  • Self test (438)
315-636
1338 sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);-
1339 sqlite3VdbeLoadString(v, regResult, pTab->zName);-
1340 for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
pFKDescription
TRUEevaluated 951 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 950 times by 1 test
Evaluated by:
  • Self test (438)
950-951
1341 pParent = sqlite3FindTable(db, pFK->zTo, zDb);-
1342 if( pParent==0 ) continue;
executed 7 times by 1 test: continue;
Executed by:
  • Self test (438)
pParent==0Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 944 times by 1 test
Evaluated by:
  • Self test (438)
7-944
1343 pIdx = 0;-
1344 sqlite3TableLock(pParse, iDb, pParent->tnum, 0, pParent->zName);-
1345 x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, 0);-
1346 if( x==0 ){
x==0Description
TRUEevaluated 943 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
1-943
1347 if( pIdx==0 ){
pIdx==0Description
TRUEevaluated 151 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 792 times by 1 test
Evaluated by:
  • Self test (438)
151-792
1348 sqlite3OpenTable(pParse, i, iDb, pParent, OP_OpenRead);-
1349 }else{
executed 151 times by 1 test: end of block
Executed by:
  • Self test (438)
151
1350 sqlite3VdbeAddOp3(v, OP_OpenRead, i, pIdx->tnum, iDb);-
1351 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);-
1352 }
executed 792 times by 1 test: end of block
Executed by:
  • Self test (438)
792
1353 }else{-
1354 k = 0;-
1355 break;
executed 1 time by 1 test: break;
Executed by:
  • Self test (438)
1
1356 }-
1357 }-
1358 assert( pParse->nErr>0 || pFK==0 );-
1359 if( pFK ) break;
executed 1 time by 1 test: break;
Executed by:
  • Self test (438)
pFKDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 950 times by 1 test
Evaluated by:
  • Self test (438)
1-950
1360 if( pParse->nTab<i ) pParse->nTab = i;
executed 635 times by 1 test: pParse->nTab = i;
Executed by:
  • Self test (438)
pParse->nTab<iDescription
TRUEevaluated 635 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 315 times by 1 test
Evaluated by:
  • Self test (438)
315-635
1361 addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, 0); VdbeCoverage(v);-
1362 for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){
pFKDescription
TRUEevaluated 950 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 950 times by 1 test
Evaluated by:
  • Self test (438)
950
1363 pParent = sqlite3FindTable(db, pFK->zTo, zDb);-
1364 pIdx = 0;-
1365 aiCols = 0;-
1366 if( pParent ){
pParentDescription
TRUEevaluated 943 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
7-943
1367 x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols);-
1368 assert( x==0 );-
1369 }
executed 943 times by 1 test: end of block
Executed by:
  • Self test (438)
943
1370 addrOk = sqlite3VdbeMakeLabel(v);-
1371-
1372 /* Generate code to read the child key values into registers-
1373 ** regRow..regRow+n. If any of the child key values are NULL, this -
1374 ** row cannot cause an FK violation. Jump directly to addrOk in -
1375 ** this case. */-
1376 for(j=0; j<pFK->nCol; j++){
j<pFK->nColDescription
TRUEevaluated 1082 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 950 times by 1 test
Evaluated by:
  • Self test (438)
950-1082
1377 int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
aiColsDescription
TRUEevaluated 256 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 826 times by 1 test
Evaluated by:
  • Self test (438)
256-826
1378 sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j);-
1379 sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v);-
1380 }
executed 1082 times by 1 test: end of block
Executed by:
  • Self test (438)
1082
1381-
1382 /* Generate code to query the parent index for a matching parent-
1383 ** key. If a match is found, jump to addrOk. */-
1384 if( pIdx ){
pIdxDescription
TRUEevaluated 792 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 158 times by 1 test
Evaluated by:
  • Self test (438)
158-792
1385 sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, pFK->nCol, regKey,-
1386 sqlite3IndexAffinityStr(db,pIdx), pFK->nCol);-
1387 sqlite3VdbeAddOp4Int(v, OP_Found, i, addrOk, regKey, 0);-
1388 VdbeCoverage(v);-
1389 }else if( pParent ){
executed 792 times by 1 test: end of block
Executed by:
  • Self test (438)
pParentDescription
TRUEevaluated 151 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 7 times by 1 test
Evaluated by:
  • Self test (438)
7-792
1390 int jmp = sqlite3VdbeCurrentAddr(v)+2;-
1391 sqlite3VdbeAddOp3(v, OP_SeekRowid, i, jmp, regRow); VdbeCoverage(v);-
1392 sqlite3VdbeGoto(v, addrOk);-
1393 assert( pFK->nCol==1 );-
1394 }
executed 151 times by 1 test: end of block
Executed by:
  • Self test (438)
151
1395-
1396 /* Generate code to report an FK violation to the caller. */-
1397 if( HasRowid(pTab) ){
(((pTab)->tabF... & 0x0020)==0)Description
TRUEevaluated 948 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 2 times by 1 test
Evaluated by:
  • Self test (438)
2-948
1398 sqlite3VdbeAddOp2(v, OP_Rowid, 0, regResult+1);-
1399 }else{
executed 948 times by 1 test: end of block
Executed by:
  • Self test (438)
948
1400 sqlite3VdbeAddOp2(v, OP_Null, 0, regResult+1);-
1401 }
executed 2 times by 1 test: end of block
Executed by:
  • Self test (438)
2
1402 sqlite3VdbeMultiLoad(v, regResult+2, "siX", pFK->zTo, i-1);-
1403 sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 4);-
1404 sqlite3VdbeResolveLabel(v, addrOk);-
1405 sqlite3DbFree(db, aiCols);-
1406 }
executed 950 times by 1 test: end of block
Executed by:
  • Self test (438)
950
1407 sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1); VdbeCoverage(v);-
1408 sqlite3VdbeJumpHere(v, addrTop);-
1409 }
executed 950 times by 1 test: end of block
Executed by:
  • Self test (438)
950
1410 }-
1411 break;
executed 1223 times by 1 test: break;
Executed by:
  • Self test (438)
1223
1412#endif /* !defined(SQLITE_OMIT_TRIGGER) */-
1413#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */-
1414-
1415#ifndef NDEBUG-
1416 case PragTyp_PARSER_TRACE: {-
1417 if( zRight ){-
1418 if( sqlite3GetBoolean(zRight, 0) ){-
1419 sqlite3ParserTrace(stdout, "parser: ");-
1420 }else{-
1421 sqlite3ParserTrace(0, 0);-
1422 }-
1423 }-
1424 }-
1425 break;-
1426#endif-
1427-
1428 /* Reinstall the LIKE and GLOB functions. The variant of LIKE-
1429 ** used will be case sensitive or not depending on the RHS.-
1430 */-
1431 case PragTyp_CASE_SENSITIVE_LIKE: {
executed 32 times by 1 test: case 6:
Executed by:
  • Self test (438)
32
1432 if( zRight ){
zRightDescription
TRUEevaluated 29 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
3-29
1433 sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0));-
1434 }
executed 29 times by 1 test: end of block
Executed by:
  • Self test (438)
29
1435 }-
1436 break;
executed 32 times by 1 test: break;
Executed by:
  • Self test (438)
32
1437-
1438#ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX-
1439# define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100-
1440#endif-
1441-
1442#ifndef SQLITE_OMIT_INTEGRITY_CHECK-
1443 /* PRAGMA integrity_check-
1444 ** PRAGMA integrity_check(N)-
1445 ** PRAGMA quick_check-
1446 ** PRAGMA quick_check(N)-
1447 **-
1448 ** Verify the integrity of the database.-
1449 **-
1450 ** The "quick_check" is reduced version of -
1451 ** integrity_check designed to detect most database corruption-
1452 ** without the overhead of cross-checking indexes. Quick_check-
1453 ** is linear time wherease integrity_check is O(NlogN).-
1454 */-
1455 case PragTyp_INTEGRITY_CHECK: {
executed 5663 times by 12 tests: case 19:
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)
5663
1456 int i, j, addr, mxErr;-
1457-
1458 int isQuick = (sqlite3Tolower(zLeft[0])=='q');-
1459-
1460 /* If the PRAGMA command was of the form "PRAGMA <db>.integrity_check",-
1461 ** then iDb is set to the index of the database identified by <db>.-
1462 ** In this case, the integrity of database iDb only is verified by-
1463 ** the VDBE created below.-
1464 **-
1465 ** Otherwise, if the command was simply "PRAGMA integrity_check" (or-
1466 ** "PRAGMA quick_check"), then iDb is set to 0. In this case, set iDb-
1467 ** to -1 here, to indicate that the VDBE should verify the integrity-
1468 ** of all attached databases. */-
1469 assert( iDb>=0 );-
1470 assert( iDb==0 || pId2->z );-
1471 if( pId2->z==0 ) iDb = -1;
executed 5647 times by 12 tests: iDb = -1;
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)
pId2->z==0Description
TRUEevaluated 5647 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 16 times by 1 test
Evaluated by:
  • Self test (438)
16-5647
1472-
1473 /* Initialize the VDBE program */-
1474 pParse->nMem = 6;-
1475-
1476 /* Set the maximum error count */-
1477 mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;-
1478 if( zRight ){
zRightDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 5646 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)
17-5646
1479 sqlite3GetInt32(zRight, &mxErr);-
1480 if( mxErr<=0 ){
mxErr<=0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
1-16
1481 mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;-
1482 }
executed 1 time by 1 test: end of block
Executed by:
  • Self test (438)
1
1483 }
executed 17 times by 1 test: end of block
Executed by:
  • Self test (438)
17
1484 sqlite3VdbeAddOp2(v, OP_Integer, mxErr-1, 1); /* reg[1] holds errors left */-
1485-
1486 /* Do an integrity check on each database file */-
1487 for(i=0; i<db->nDb; i++){
i<db->nDbDescription
TRUEevaluated 11377 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 5663 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)
5663-11377
1488 HashElem *x; /* For looping over tables in the schema */-
1489 Hash *pTbls; /* Set of all tables in the schema */-
1490 int *aRoot; /* Array of root page numbers of all btrees */-
1491 int cnt = 0; /* Number of entries in aRoot[] */-
1492 int mxIdx = 0; /* Maximum number of indexes for any table */-
1493-
1494 if( OMIT_TEMPDB && i==1 ) continue;
dead code: i==1
dead code: continue;
-
1495 if( iDb>=0 && i!=iDb ) continue;
executed 32 times by 1 test: continue;
Executed by:
  • Self test (438)
iDb>=0Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 11329 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)
i!=iDbDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 16 times by 1 test
Evaluated by:
  • Self test (438)
16-11329
1496-
1497 sqlite3CodeVerifySchema(pParse, i);-
1498-
1499 /* Do an integrity check of the B-Tree-
1500 **-
1501 ** Begin by finding the root pages numbers-
1502 ** for all tables and indices in the database.-
1503 */-
1504 assert( sqlite3SchemaMutexHeld(db, i, 0) );-
1505 pTbls = &db->aDb[i].pSchema->tblHash;-
1506 for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
xDescription
TRUEevaluated 19936 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 11345 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)
11345-19936
1507 Table *pTab = sqliteHashData(x); /* Current table */-
1508 Index *pIdx; /* An index on pTab */-
1509 int nIdx; /* Number of indexes on pTab */-
1510 if( HasRowid(pTab) ) cnt++;
executed 19841 times by 12 tests: cnt++;
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)
(((pTab)->tabF... & 0x0020)==0)Description
TRUEevaluated 19841 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 95 times by 1 test
Evaluated by:
  • Self test (438)
95-19841
1511 for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; }
executed 3626 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)
pIdxDescription
TRUEevaluated 3626 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 19936 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)
3626-19936
1512 if( nIdx>mxIdx ) mxIdx = nIdx;
executed 2339 times by 12 tests: mxIdx = nIdx;
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)
nIdx>mxIdxDescription
TRUEevaluated 2339 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 17597 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)
2339-17597
1513 }
executed 19936 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)
19936
1514 aRoot = sqlite3DbMallocRawNN(db, sizeof(int)*(cnt+1));-
1515 if( aRoot==0 ) break;
never executed: break;
aRoot==0Description
TRUEnever evaluated
FALSEevaluated 11345 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)
0-11345
1516 for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
xDescription
TRUEevaluated 19936 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 11345 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)
11345-19936
1517 Table *pTab = sqliteHashData(x);-
1518 Index *pIdx;-
1519 if( HasRowid(pTab) ) aRoot[++cnt] = pTab->tnum;
executed 19841 times by 12 tests: aRoot[++cnt] = pTab->tnum;
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)
(((pTab)->tabF... & 0x0020)==0)Description
TRUEevaluated 19841 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 95 times by 1 test
Evaluated by:
  • Self test (438)
95-19841
1520 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
pIdxDescription
TRUEevaluated 3626 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 19936 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)
3626-19936
1521 aRoot[++cnt] = pIdx->tnum;-
1522 }
executed 3626 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)
3626
1523 }
executed 19936 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)
19936
1524 aRoot[0] = cnt;-
1525-
1526 /* Make sure sufficient number of registers have been allocated */-
1527 pParse->nMem = MAX( pParse->nMem, 8+mxIdx );
(pParse->nMem)>(8+mxIdx)Description
TRUEevaluated 2296 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 9049 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)
2296-9049
1528 sqlite3ClearTempRegCache(pParse);-
1529-
1530 /* Do the b-tree integrity checks */-
1531 sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);-
1532 sqlite3VdbeChangeP5(v, (u8)i);-
1533 addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v);-
1534 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,-
1535 sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName),-
1536 P4_DYNAMIC);-
1537 sqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 3);-
1538 integrityCheckResultRow(v);-
1539 sqlite3VdbeJumpHere(v, addr);-
1540-
1541 /* Make sure all the indices are constructed correctly.-
1542 */-
1543 for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
xDescription
TRUEevaluated 19936 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 11345 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)
11345-19936
1544 Table *pTab = sqliteHashData(x);-
1545 Index *pIdx, *pPk;-
1546 Index *pPrior = 0;-
1547 int loopTop;-
1548 int iDataCur, iIdxCur;-
1549 int r1 = -1;-
1550-
1551 if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */
executed 47 times by 1 test: continue;
Executed by:
  • Self test (438)
pTab->tnum<1Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 19889 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)
47-19889
1552 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
(((pTab)->tabF... & 0x0020)==0)Description
TRUEevaluated 19794 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 95 times by 1 test
Evaluated by:
  • Self test (438)
95-19794
1553 sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,-
1554 1, 0, &iDataCur, &iIdxCur);-
1555 /* reg[7] counts the number of entries in the table.-
1556 ** reg[8+i] counts the number of entries in the i-th index -
1557 */-
1558 sqlite3VdbeAddOp2(v, OP_Integer, 0, 7);-
1559 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
pIdxDescription
TRUEevaluated 3626 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 19889 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)
3626-19889
1560 sqlite3VdbeAddOp2(v, OP_Integer, 0, 8+j); /* index entries counter */-
1561 }
executed 3626 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)
3626
1562 assert( pParse->nMem>=8+j );-
1563 assert( sqlite3NoTempsInRange(pParse,1,7+j) );-
1564 sqlite3VdbeAddOp2(v, OP_Rewind, iDataCur, 0); VdbeCoverage(v);-
1565 loopTop = sqlite3VdbeAddOp2(v, OP_AddImm, 7, 1);-
1566 if( !isQuick ){
!isQuickDescription
TRUEevaluated 19841 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 48 times by 1 test
Evaluated by:
  • Self test (438)
48-19841
1567 /* Sanity check on record header decoding */-
1568 sqlite3VdbeAddOp3(v, OP_Column, iDataCur, pTab->nCol-1, 3);-
1569 sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);-
1570 }
executed 19841 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)
19841
1571 /* Verify that all NOT NULL columns really are NOT NULL */-
1572 for(j=0; j<pTab->nCol; j++){
j<pTab->nColDescription
TRUEevaluated 71532 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 19889 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)
19889-71532
1573 char *zErr;-
1574 int jmp2;-
1575 if( j==pTab->iPKey ) continue;
executed 3392 times by 1 test: continue;
Executed by:
  • Self test (438)
j==pTab->iPKeyDescription
TRUEevaluated 3392 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 68140 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)
3392-68140
1576 if( pTab->aCol[j].notNull==0 ) continue;
executed 68021 times by 12 tests: continue;
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)
pTab->aCol[j].notNull==0Description
TRUEevaluated 68021 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 119 times by 1 test
Evaluated by:
  • Self test (438)
119-68021
1577 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3);-
1578 sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);-
1579 jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v);-
1580 zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,-
1581 pTab->aCol[j].zName);-
1582 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);-
1583 integrityCheckResultRow(v);-
1584 sqlite3VdbeJumpHere(v, jmp2);-
1585 }
executed 119 times by 1 test: end of block
Executed by:
  • Self test (438)
119
1586 /* Verify CHECK constraints */-
1587 if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
pTab->pCheckDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 19875 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)
(db->flags & 0x00000200)==0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 4 times by 1 test
Evaluated by:
  • Self test (438)
4-19875
1588 ExprList *pCheck = sqlite3ExprListDup(db, pTab->pCheck, 0);-
1589 if( db->mallocFailed==0 ){
db->mallocFailed==0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
FALSEnever evaluated
0-10
1590 int addrCkFault = sqlite3VdbeMakeLabel(v);-
1591 int addrCkOk = sqlite3VdbeMakeLabel(v);-
1592 char *zErr;-
1593 int k;-
1594 pParse->iSelfTab = iDataCur + 1;-
1595 for(k=pCheck->nExpr-1; k>0; k--){
k>0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 10 times by 1 test
Evaluated by:
  • Self test (438)
3-10
1596 sqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0);-
1597 }
executed 3 times by 1 test: end of block
Executed by:
  • Self test (438)
3
1598 sqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk, -
1599 SQLITE_JUMPIFNULL);-
1600 sqlite3VdbeResolveLabel(v, addrCkFault);-
1601 pParse->iSelfTab = 0;-
1602 zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s",-
1603 pTab->zName);-
1604 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);-
1605 integrityCheckResultRow(v);-
1606 sqlite3VdbeResolveLabel(v, addrCkOk);-
1607 }
executed 10 times by 1 test: end of block
Executed by:
  • Self test (438)
10
1608 sqlite3ExprListDelete(db, pCheck);-
1609 }
executed 10 times by 1 test: end of block
Executed by:
  • Self test (438)
10
1610 if( !isQuick ){ /* Omit the remaining tests for quick_check */
!isQuickDescription
TRUEevaluated 19841 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 48 times by 1 test
Evaluated by:
  • Self test (438)
48-19841
1611 /* Validate index entries for the current row */-
1612 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
pIdxDescription
TRUEevaluated 3616 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 19841 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)
3616-19841
1613 int jmp2, jmp3, jmp4, jmp5;-
1614 int ckUniq = sqlite3VdbeMakeLabel(v);-
1615 if( pPk==pIdx ) continue;
executed 95 times by 1 test: continue;
Executed by:
  • Self test (438)
pPk==pIdxDescription
TRUEevaluated 95 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3521 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)
95-3521
1616 r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3,-
1617 pPrior, r1);-
1618 pPrior = pIdx;-
1619 sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1);/* increment entry count */-
1620 /* Verify that an index entry exists for the current table row */-
1621 jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1,-
1622 pIdx->nColumn); VdbeCoverage(v);-
1623 sqlite3VdbeLoadString(v, 3, "row ");-
1624 sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);-
1625 sqlite3VdbeLoadString(v, 4, " missing from index ");-
1626 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);-
1627 jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);-
1628 sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);-
1629 jmp4 = integrityCheckResultRow(v);-
1630 sqlite3VdbeJumpHere(v, jmp2);-
1631 /* For UNIQUE indexes, verify that only one entry exists with the-
1632 ** current key. The entry is unique if (1) any column is NULL-
1633 ** or (2) the next entry has a different key */-
1634 if( IsUniqueIndex(pIdx) ){
((pIdx)->onError!=0)Description
TRUEevaluated 1692 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 1829 times by 5 tests
Evaluated by:
  • Self test (43)
  • Self test (438)
  • Self test (45)
  • Self test (53)
  • Self test (74)
1692-1829
1635 int uniqOk = sqlite3VdbeMakeLabel(v);-
1636 int jmp6;-
1637 int kk;-
1638 for(kk=0; kk<pIdx->nKeyCol; kk++){
kk<pIdx->nKeyColDescription
TRUEevaluated 1874 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 1692 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)
1692-1874
1639 int iCol = pIdx->aiColumn[kk];-
1640 assert( iCol!=XN_ROWID && iCol<pTab->nCol );-
1641 if( iCol>=0 && pTab->aCol[iCol].notNull ) continue;
executed 15 times by 1 test: continue;
Executed by:
  • Self test (438)
iCol>=0Description
TRUEevaluated 1864 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 10 times by 1 test
Evaluated by:
  • Self test (438)
pTab->aCol[iCol].notNullDescription
TRUEevaluated 15 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 1849 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)
10-1864
1642 sqlite3VdbeAddOp2(v, OP_IsNull, r1+kk, uniqOk);-
1643 VdbeCoverage(v);-
1644 }
executed 1859 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)
1859
1645 jmp6 = sqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v);-
1646 sqlite3VdbeGoto(v, uniqOk);-
1647 sqlite3VdbeJumpHere(v, jmp6);-
1648 sqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1,-
1649 pIdx->nKeyCol); VdbeCoverage(v);-
1650 sqlite3VdbeLoadString(v, 3, "non-unique entry in index ");-
1651 sqlite3VdbeGoto(v, jmp5);-
1652 sqlite3VdbeResolveLabel(v, uniqOk);-
1653 }
executed 1692 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)
1692
1654 sqlite3VdbeJumpHere(v, jmp4);-
1655 sqlite3ResolvePartIdxLabel(pParse, jmp3);-
1656 }
executed 3521 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)
3521
1657 }
executed 19841 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)
19841
1658 sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v);-
1659 sqlite3VdbeJumpHere(v, loopTop-1);-
1660#ifndef SQLITE_OMIT_BTREECOUNT-
1661 if( !isQuick ){
!isQuickDescription
TRUEevaluated 19841 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 48 times by 1 test
Evaluated by:
  • Self test (438)
48-19841
1662 sqlite3VdbeLoadString(v, 2, "wrong # of entries in index ");-
1663 for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
pIdxDescription
TRUEevaluated 3616 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 19841 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)
3616-19841
1664 if( pPk==pIdx ) continue;
executed 95 times by 1 test: continue;
Executed by:
  • Self test (438)
pPk==pIdxDescription
TRUEevaluated 95 times by 1 test
Evaluated by:
  • Self test (438)
FALSEevaluated 3521 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)
95-3521
1665 sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3);-
1666 addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+j, 0, 3); VdbeCoverage(v);-
1667 sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);-
1668 sqlite3VdbeLoadString(v, 4, pIdx->zName);-
1669 sqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3);-
1670 integrityCheckResultRow(v);-
1671 sqlite3VdbeJumpHere(v, addr);-
1672 }
executed 3521 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)
3521
1673 }
executed 19841 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)
19841
1674#endif /* SQLITE_OMIT_BTREECOUNT */-
1675 }
executed 19889 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)
19889
1676 }
executed 11345 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)
11345
1677 {-
1678 static const int iLn = VDBE_OFFSET_LINENO(2);-
1679 static const VdbeOpList endCode[] = {-
1680 { OP_AddImm, 1, 0, 0}, /* 0 */-
1681 { OP_IfNotZero, 1, 4, 0}, /* 1 */-
1682 { OP_String8, 0, 3, 0}, /* 2 */-
1683 { OP_ResultRow, 3, 1, 0}, /* 3 */-
1684 { OP_Halt, 0, 0, 0}, /* 4 */-
1685 { OP_String8, 0, 3, 0}, /* 5 */-
1686 { OP_Goto, 0, 3, 0}, /* 6 */-
1687 };-
1688 VdbeOp *aOp;-
1689-
1690 aOp = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode, iLn);-
1691 if( aOp ){
aOpDescription
TRUEevaluated 5663 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)
FALSEnever evaluated
0-5663
1692 aOp[0].p2 = 1-mxErr;-
1693 aOp[2].p4type = P4_STATIC;-
1694 aOp[2].p4.z = "ok";-
1695 aOp[5].p4type = P4_STATIC;-
1696 aOp[5].p4.z = (char*)sqlite3ErrStr(SQLITE_CORRUPT);-
1697 }
executed 5663 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)
5663
1698