| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/sqlite/src/src/pragma.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | static u8 getSafetyLevel(const char *z, int omitFull, u8 dflt){ | - | ||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | static const char zText[] = "onoffalseyestruextrafull"; | - | ||||||||||||||||||
| 4 | static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 15, 20}; | - | ||||||||||||||||||
| 5 | static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 5, 4}; | - | ||||||||||||||||||
| 6 | static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 3, 2}; | - | ||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | int i, n; | - | ||||||||||||||||||
| 9 | if( (
| 475-773 | ||||||||||||||||||
| 10 | return executed 475 times by 4 tests: (u8)sqlite3Atoi(z);return (u8)sqlite3Atoi(z);Executed by:
executed 475 times by 4 tests: return (u8)sqlite3Atoi(z);Executed by:
| 475 | ||||||||||||||||||
| 11 | } | - | ||||||||||||||||||
| 12 | n = sqlite3Strlen30(z); | - | ||||||||||||||||||
| 13 | for(i=0; i<((int)(sizeof(iLength)/sizeof(iLength[0])))
| 111-2788 | ||||||||||||||||||
| 14 | if( iLength[i]==n
| 65-2061 | ||||||||||||||||||
| 15 | && (!omitFull
| 0-574 | ||||||||||||||||||
| 16 | ){ | - | ||||||||||||||||||
| 17 | return executed 662 times by 11 tests: iValue[i];return iValue[i];Executed by:
executed 662 times by 11 tests: return iValue[i];Executed by:
| 662 | ||||||||||||||||||
| 18 | } | - | ||||||||||||||||||
| 19 | } executed 2126 times by 11 tests: end of blockExecuted by:
| 2126 | ||||||||||||||||||
| 20 | return executed 111 times by 1 test: dflt;return dflt;Executed by:
executed 111 times by 1 test: return dflt;Executed by:
| 111 | ||||||||||||||||||
| 21 | } | - | ||||||||||||||||||
| 22 | - | |||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | - | |||||||||||||||||||
| 25 | - | |||||||||||||||||||
| 26 | u8 sqlite3GetBoolean(const char *z, u8 dflt){ | - | ||||||||||||||||||
| 27 | return executed 1045 times by 4 tests: getSafetyLevel(z,1,dflt)!=0;return getSafetyLevel(z,1,dflt)!=0;Executed by:
executed 1045 times by 4 tests: return getSafetyLevel(z,1,dflt)!=0;Executed by:
| 1045 | ||||||||||||||||||
| 28 | } | - | ||||||||||||||||||
| 29 | static int getLockingMode(const char *z){ | - | ||||||||||||||||||
| 30 | if( z
| 37-96 | ||||||||||||||||||
| 31 | if( 0==sqlite3StrICmp(z, "exclusive")
executed 64 times by 1 test: 1;return 1;Executed by:
executed 64 times by 1 test: return 1;Executed by:
| 32-64 | ||||||||||||||||||
| 32 | if( 0==sqlite3StrICmp(z, "normal")
executed 31 times by 1 test: 0;return 0;Executed by:
executed 31 times by 1 test: return 0;Executed by:
| 1-31 | ||||||||||||||||||
| 33 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 34 | return executed 38 times by 1 test: -1;return -1;Executed by:
executed 38 times by 1 test: return -1;Executed by:
| 38 | ||||||||||||||||||
| 35 | } | - | ||||||||||||||||||
| 36 | static int getAutoVacuum(const char *z){ | - | ||||||||||||||||||
| 37 | int i; | - | ||||||||||||||||||
| 38 | if( 0==sqlite3StrICmp(z, "none")
executed 15 times by 1 test: 0;return 0;Executed by:
executed 15 times by 1 test: return 0;Executed by:
| 15-589 | ||||||||||||||||||
| 39 | if( 0==sqlite3StrICmp(z, "full")
executed 19 times by 1 test: 1;return 1;Executed by:
executed 19 times by 1 test: return 1;Executed by:
| 19-570 | ||||||||||||||||||
| 40 | if( 0==sqlite3StrICmp(z, "incremental")
executed 29 times by 1 test: 2;return 2;Executed by:
executed 29 times by 1 test: return 2;Executed by:
| 29-541 | ||||||||||||||||||
| 41 | i = sqlite3Atoi(z); | - | ||||||||||||||||||
| 42 | return executed 541 times by 4 tests: (u8)((i>=0return (u8)((i>=0&&i<=2)?i:0);Executed by:
executed 541 times by 4 tests: return (u8)((i>=0&&i<=2)?i:0);Executed by:
| 2-541 | ||||||||||||||||||
| 43 | } | - | ||||||||||||||||||
| 44 | static int getTempStore(const char *z){ | - | ||||||||||||||||||
| 45 | if( z[0]>='0'
| 2-84 | ||||||||||||||||||
| 46 | return executed 14 times by 1 test: z[0] - '0';return z[0] - '0';Executed by:
executed 14 times by 1 test: return z[0] - '0';Executed by:
| 14 | ||||||||||||||||||
| 47 | }else if( sqlite3StrICmp(z, "file")==0
| 23-49 | ||||||||||||||||||
| 48 | return executed 49 times by 1 test: 1;return 1;Executed by:
executed 49 times by 1 test: return 1;Executed by:
| 49 | ||||||||||||||||||
| 49 | }else if( sqlite3StrICmp(z, "memory")==0
| 5-18 | ||||||||||||||||||
| 50 | return executed 18 times by 1 test: 2;return 2;Executed by:
executed 18 times by 1 test: return 2;Executed by:
| 18 | ||||||||||||||||||
| 51 | }else{ | - | ||||||||||||||||||
| 52 | return executed 5 times by 1 test: 0;return 0;Executed by:
executed 5 times by 1 test: return 0;Executed by:
| 5 | ||||||||||||||||||
| 53 | } | - | ||||||||||||||||||
| 54 | } | - | ||||||||||||||||||
| 55 | - | |||||||||||||||||||
| 56 | - | |||||||||||||||||||
| 57 | - | |||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | - | |||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | static int invalidateTempStorage(Parse *pParse){ | - | ||||||||||||||||||
| 63 | sqlite3 *db = pParse->db; | - | ||||||||||||||||||
| 64 | if( db->aDb[1].pBt!=0
| 4-69 | ||||||||||||||||||
| 65 | if( !db->autoCommit
| 1-3 | ||||||||||||||||||
| 66 | sqlite3ErrorMsg(pParse, "temporary storage cannot be changed " | - | ||||||||||||||||||
| 67 | "from within a transaction"); | - | ||||||||||||||||||
| 68 | return executed 2 times by 1 test: 1;return 1;Executed by:
executed 2 times by 1 test: return 1;Executed by:
| 2 | ||||||||||||||||||
| 69 | } | - | ||||||||||||||||||
| 70 | sqlite3BtreeClose(db->aDb[1].pBt); | - | ||||||||||||||||||
| 71 | db->aDb[1].pBt = 0; | - | ||||||||||||||||||
| 72 | sqlite3ResetAllSchemasOfConnection(db); | - | ||||||||||||||||||
| 73 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 74 | return executed 71 times by 1 test: 0;return 0;Executed by:
executed 71 times by 1 test: return 0;Executed by:
| 71 | ||||||||||||||||||
| 75 | } | - | ||||||||||||||||||
| 76 | static int changeTempStorage(Parse *pParse, const char *zStorageType){ | - | ||||||||||||||||||
| 77 | int ts = getTempStore(zStorageType); | - | ||||||||||||||||||
| 78 | sqlite3 *db = pParse->db; | - | ||||||||||||||||||
| 79 | if( db->temp_store==ts
executed 15 times by 1 test: 0;return 0;Executed by:
executed 15 times by 1 test: return 0;Executed by:
| 15-71 | ||||||||||||||||||
| 80 | if( invalidateTempStorage( pParse ) != 0
| 2-69 | ||||||||||||||||||
| 81 | return executed 2 times by 1 test: 1;return 1;Executed by:
executed 2 times by 1 test: return 1;Executed by:
| 2 | ||||||||||||||||||
| 82 | } | - | ||||||||||||||||||
| 83 | db->temp_store = (u8)ts; | - | ||||||||||||||||||
| 84 | return executed 69 times by 1 test: 0;return 0;Executed by:
executed 69 times by 1 test: return 0;Executed by:
| 69 | ||||||||||||||||||
| 85 | } | - | ||||||||||||||||||
| 86 | - | |||||||||||||||||||
| 87 | - | |||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | - | |||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | static void setPragmaResultColumnNames( | - | ||||||||||||||||||
| 92 | Vdbe *v, | - | ||||||||||||||||||
| 93 | const PragmaName *pPragma | - | ||||||||||||||||||
| 94 | ){ | - | ||||||||||||||||||
| 95 | u8 n = pPragma->nPragCName; | - | ||||||||||||||||||
| 96 | sqlite3VdbeSetNumCols(v, n==0 ? 1 : n); | - | ||||||||||||||||||
| 97 | if( n==0
| 12720-15804 | ||||||||||||||||||
| 98 | sqlite3VdbeSetColName(v, 0, 0, pPragma->zName, ((sqlite3_destructor_type)0)); | - | ||||||||||||||||||
| 99 | } executed 12720 times by 25 tests: else{end of blockExecuted by:
| 12720 | ||||||||||||||||||
| 100 | int i, j; | - | ||||||||||||||||||
| 101 | for(i=0, j=pPragma->iPragCName; i<n
| 15804-74863 | ||||||||||||||||||
| 102 | sqlite3VdbeSetColName(v, i, 0, pragCName[j], ((sqlite3_destructor_type)0)); | - | ||||||||||||||||||
| 103 | } executed 74863 times by 9 tests: end of blockExecuted by:
| 74863 | ||||||||||||||||||
| 104 | } executed 15804 times by 9 tests: end of blockExecuted by:
| 15804 | ||||||||||||||||||
| 105 | } | - | ||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | - | |||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | static void returnSingleInt(Vdbe *v, i64 value){ | - | ||||||||||||||||||
| 111 | sqlite3VdbeAddOp4Dup8(v, 71, 0, 1, 0, (const u8*)&value, (-14)); | - | ||||||||||||||||||
| 112 | sqlite3VdbeAddOp2(v, 81, 1, 1); | - | ||||||||||||||||||
| 113 | } executed 1066 times by 4 tests: end of blockExecuted by:
| 1066 | ||||||||||||||||||
| 114 | - | |||||||||||||||||||
| 115 | - | |||||||||||||||||||
| 116 | - | |||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | static void returnSingleText( | - | ||||||||||||||||||
| 119 | Vdbe *v, | - | ||||||||||||||||||
| 120 | const char *zValue | - | ||||||||||||||||||
| 121 | ){ | - | ||||||||||||||||||
| 122 | if( zValue
| 2-201 | ||||||||||||||||||
| 123 | sqlite3VdbeLoadString(v, 1, (const char*)zValue); | - | ||||||||||||||||||
| 124 | sqlite3VdbeAddOp2(v, 81, 1, 1); | - | ||||||||||||||||||
| 125 | } executed 201 times by 1 test: end of blockExecuted by:
| 201 | ||||||||||||||||||
| 126 | } executed 203 times by 1 test: end of blockExecuted by:
| 203 | ||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | - | |||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | - | |||||||||||||||||||
| 134 | static void setAllPagerFlags(sqlite3 *db){ | - | ||||||||||||||||||
| 135 | if( db->autoCommit
| 16-1155 | ||||||||||||||||||
| 136 | Db *pDb = db->aDb; | - | ||||||||||||||||||
| 137 | int n = db->nDb; | - | ||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | ((void) (0)) | - | ||||||||||||||||||
| 140 | ; | - | ||||||||||||||||||
| 141 | - | |||||||||||||||||||
| 142 | ((void) (0)) | - | ||||||||||||||||||
| 143 | ; | - | ||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | ((void) (0)) | - | ||||||||||||||||||
| 146 | ; | - | ||||||||||||||||||
| 147 | - | |||||||||||||||||||
| 148 | ((void) (0)) | - | ||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | ; | - | ||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | ((void) (0)) | - | ||||||||||||||||||
| 153 | ; | - | ||||||||||||||||||
| 154 | while( (
| 1155-2548 | ||||||||||||||||||
| 155 | if( pDb->pBt
| 906-1642 | ||||||||||||||||||
| 156 | sqlite3BtreeSetPagerFlags(pDb->pBt, | - | ||||||||||||||||||
| 157 | pDb->safety_level | (db->flags & 0x38) ); | - | ||||||||||||||||||
| 158 | } executed 1642 times by 11 tests: end of blockExecuted by:
| 1642 | ||||||||||||||||||
| 159 | pDb++; | - | ||||||||||||||||||
| 160 | } executed 2548 times by 11 tests: end of blockExecuted by:
| 2548 | ||||||||||||||||||
| 161 | } executed 1155 times by 11 tests: end of blockExecuted by:
| 1155 | ||||||||||||||||||
| 162 | } executed 1171 times by 11 tests: end of blockExecuted by:
| 1171 | ||||||||||||||||||
| 163 | static const char *actionName(u8 action){ | - | ||||||||||||||||||
| 164 | const char *zName; | - | ||||||||||||||||||
| 165 | switch( action ){ | - | ||||||||||||||||||
| 166 | case executed 4 times by 1 test: 8:case 8:Executed by:
executed 4 times by 1 test: zName = "SET NULL"; break;case 8:Executed by:
executed 4 times by 1 test: break;Executed by:
| 4 | ||||||||||||||||||
| 167 | case executed 4 times by 1 test: 9:case 9:Executed by:
executed 4 times by 1 test: zName = "SET DEFAULT"; break;case 9:Executed by:
executed 4 times by 1 test: break;Executed by:
| 4 | ||||||||||||||||||
| 168 | case executed 10 times by 1 test: 10:case 10:Executed by:
executed 10 times by 1 test: zName = "CASCADE"; break;case 10:Executed by:
executed 10 times by 1 test: break;Executed by:
| 10 | ||||||||||||||||||
| 169 | case executed 2 times by 1 test: 7:case 7:Executed by:
executed 2 times by 1 test: zName = "RESTRICT"; break;case 7:Executed by:
executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||
| 170 | default executed 24 times by 1 test: :default:Executed by:
executed 24 times by 1 test: zName = "NO ACTION";default:Executed by:
| 24 | ||||||||||||||||||
| 171 | - | |||||||||||||||||||
| 172 | ((void) (0)) | - | ||||||||||||||||||
| 173 | ; break; executed 24 times by 1 test: break;Executed by:
| 24 | ||||||||||||||||||
| 174 | } | - | ||||||||||||||||||
| 175 | return executed 44 times by 1 test: zName;return zName;Executed by:
executed 44 times by 1 test: return zName;Executed by:
| 44 | ||||||||||||||||||
| 176 | } | - | ||||||||||||||||||
| 177 | const char *sqlite3JournalModename(int eMode){ | - | ||||||||||||||||||
| 178 | static char * const azModeName[] = { | - | ||||||||||||||||||
| 179 | "delete", "persist", "off", "truncate", "memory" | - | ||||||||||||||||||
| 180 | - | |||||||||||||||||||
| 181 | , "wal" | - | ||||||||||||||||||
| 182 | - | |||||||||||||||||||
| 183 | }; | - | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | ((void) (0)) | - | ||||||||||||||||||
| 186 | ; | - | ||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | ((void) (0)) | - | ||||||||||||||||||
| 189 | ; | - | ||||||||||||||||||
| 190 | - | |||||||||||||||||||
| 191 | ((void) (0)) | - | ||||||||||||||||||
| 192 | ; | - | ||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | ((void) (0)) | - | ||||||||||||||||||
| 195 | ; | - | ||||||||||||||||||
| 196 | - | |||||||||||||||||||
| 197 | ((void) (0)) | - | ||||||||||||||||||
| 198 | ; | - | ||||||||||||||||||
| 199 | - | |||||||||||||||||||
| 200 | ((void) (0)) | - | ||||||||||||||||||
| 201 | ; | - | ||||||||||||||||||
| 202 | - | |||||||||||||||||||
| 203 | ((void) (0)) | - | ||||||||||||||||||
| 204 | ; | - | ||||||||||||||||||
| 205 | - | |||||||||||||||||||
| 206 | if( eMode==((int)(sizeof(azModeName)/sizeof(azModeName[0])))
executed 1 time by 1 test: 0;return 0;Executed by:
executed 1 time by 1 test: return 0;Executed by:
| 1-34623 | ||||||||||||||||||
| 207 | return executed 34623 times by 10 tests: azModeName[eMode];return azModeName[eMode];Executed by:
executed 34623 times by 10 tests: return azModeName[eMode];Executed by:
| 34623 | ||||||||||||||||||
| 208 | } | - | ||||||||||||||||||
| 209 | - | |||||||||||||||||||
| 210 | - | |||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | - | |||||||||||||||||||
| 213 | static const PragmaName *pragmaLocate(const char *zName){ | - | ||||||||||||||||||
| 214 | int upr, lwr, mid = 0, rc; | - | ||||||||||||||||||
| 215 | lwr = 0; | - | ||||||||||||||||||
| 216 | upr = ((int)(sizeof(aPragmaName)/sizeof(aPragmaName[0])))-1; | - | ||||||||||||||||||
| 217 | while( lwr<=upr
| 426-162644 | ||||||||||||||||||
| 218 | mid = (lwr+upr)/2; | - | ||||||||||||||||||
| 219 | rc = sqlite3_stricmp(zName, aPragmaName[mid].zName); | - | ||||||||||||||||||
| 220 | if( rc==0
executed 43992 times by 52 tests: break;Executed by:
| 43992-118652 | ||||||||||||||||||
| 221 | if( rc<0
| 37252-81400 | ||||||||||||||||||
| 222 | upr = mid - 1; | - | ||||||||||||||||||
| 223 | } executed 37252 times by 38 tests: else{end of blockExecuted by:
| 37252 | ||||||||||||||||||
| 224 | lwr = mid + 1; | - | ||||||||||||||||||
| 225 | } executed 81400 times by 39 tests: end of blockExecuted by:
| 81400 | ||||||||||||||||||
| 226 | } | - | ||||||||||||||||||
| 227 | return executed 44418 times by 52 tests: lwr>uprreturn lwr>upr ? 0 : &aPragmaName[mid];Executed by:
executed 44418 times by 52 tests: return lwr>upr ? 0 : &aPragmaName[mid];Executed by:
| 426-44418 | ||||||||||||||||||
| 228 | } | - | ||||||||||||||||||
| 229 | static int integrityCheckResultRow(Vdbe *v){ | - | ||||||||||||||||||
| 230 | int addr; | - | ||||||||||||||||||
| 231 | sqlite3VdbeAddOp2(v, 81, 3, 1); | - | ||||||||||||||||||
| 232 | addr = sqlite3VdbeAddOp3(v, 47, 1, sqlite3VdbeCurrentAddr(v)+2, 1); | - | ||||||||||||||||||
| 233 | ; | - | ||||||||||||||||||
| 234 | sqlite3VdbeAddOp0(v, 69); | - | ||||||||||||||||||
| 235 | return executed 18516 times by 12 tests: addr;return addr;Executed by:
executed 18516 times by 12 tests: return addr;Executed by:
| 18516 | ||||||||||||||||||
| 236 | } | - | ||||||||||||||||||
| 237 | void sqlite3Pragma( | - | ||||||||||||||||||
| 238 | Parse *pParse, | - | ||||||||||||||||||
| 239 | Token *pId1, | - | ||||||||||||||||||
| 240 | Token *pId2, | - | ||||||||||||||||||
| 241 | Token *pValue, | - | ||||||||||||||||||
| 242 | int minusFlag | - | ||||||||||||||||||
| 243 | ){ | - | ||||||||||||||||||
| 244 | char *zLeft = 0; | - | ||||||||||||||||||
| 245 | char *zRight = 0; | - | ||||||||||||||||||
| 246 | const char *zDb = 0; | - | ||||||||||||||||||
| 247 | Token *pId; | - | ||||||||||||||||||
| 248 | char *aFcntl[4]; | - | ||||||||||||||||||
| 249 | int iDb; | - | ||||||||||||||||||
| 250 | int rc; | - | ||||||||||||||||||
| 251 | sqlite3 *db = pParse->db; | - | ||||||||||||||||||
| 252 | Db *pDb; | - | ||||||||||||||||||
| 253 | Vdbe *v = sqlite3GetVdbe(pParse); | - | ||||||||||||||||||
| 254 | const PragmaName *pPragma; | - | ||||||||||||||||||
| 255 | - | |||||||||||||||||||
| 256 | if( v==0
executed 2 times by 1 test: return;Executed by:
| 2-35849 | ||||||||||||||||||
| 257 | sqlite3VdbeRunOnlyOnce(v); | - | ||||||||||||||||||
| 258 | pParse->nMem = 2; | - | ||||||||||||||||||
| 259 | - | |||||||||||||||||||
| 260 | - | |||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | iDb = sqlite3TwoPartName(pParse, pId1, pId2, &pId); | - | ||||||||||||||||||
| 263 | if( iDb<0
executed 5 times by 1 test: return;Executed by:
| 5-35844 | ||||||||||||||||||
| 264 | pDb = &db->aDb[iDb]; | - | ||||||||||||||||||
| 265 | - | |||||||||||||||||||
| 266 | - | |||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | - | |||||||||||||||||||
| 269 | if( iDb==1
| 0-35777 | ||||||||||||||||||
| 270 | return; never executed: return; | 0 | ||||||||||||||||||
| 271 | } | - | ||||||||||||||||||
| 272 | - | |||||||||||||||||||
| 273 | zLeft = sqlite3NameFromToken(db, pId); | - | ||||||||||||||||||
| 274 | if( !zLeft
executed 2 times by 1 test: return;Executed by:
| 2-35842 | ||||||||||||||||||
| 275 | if( minusFlag
| 27-35815 | ||||||||||||||||||
| 276 | zRight = sqlite3MPrintf(db, "-%T", pValue); | - | ||||||||||||||||||
| 277 | } executed 27 times by 1 test: else{end of blockExecuted by:
| 27 | ||||||||||||||||||
| 278 | zRight = sqlite3NameFromToken(db, pValue); | - | ||||||||||||||||||
| 279 | } executed 35815 times by 52 tests: end of blockExecuted by:
| 35815 | ||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | - | |||||||||||||||||||
| 282 | ((void) (0)) | - | ||||||||||||||||||
| 283 | ; | - | ||||||||||||||||||
| 284 | zDb = pId2->n>0
| 1154-34688 | ||||||||||||||||||
| 285 | if( sqlite3AuthCheck(pParse, 19, zLeft, zRight, zDb)
| 2-35840 | ||||||||||||||||||
| 286 | goto executed 2 times by 1 test: pragma_out;goto pragma_out;Executed by:
executed 2 times by 1 test: goto pragma_out;Executed by:
| 2 | ||||||||||||||||||
| 287 | } | - | ||||||||||||||||||
| 288 | aFcntl[0] = 0; | - | ||||||||||||||||||
| 289 | aFcntl[1] = zLeft; | - | ||||||||||||||||||
| 290 | aFcntl[2] = zRight; | - | ||||||||||||||||||
| 291 | aFcntl[3] = 0; | - | ||||||||||||||||||
| 292 | db->busyHandler.nBusy = 0; | - | ||||||||||||||||||
| 293 | rc = sqlite3_file_control(db, zDb, 14, (void*)aFcntl); | - | ||||||||||||||||||
| 294 | if( rc==0
| 11-35829 | ||||||||||||||||||
| 295 | sqlite3VdbeSetNumCols(v, 1); | - | ||||||||||||||||||
| 296 | sqlite3VdbeSetColName(v, 0, 0, aFcntl[0], ((sqlite3_destructor_type)-1)); | - | ||||||||||||||||||
| 297 | returnSingleText(v, aFcntl[0]); | - | ||||||||||||||||||
| 298 | sqlite3_free(aFcntl[0]); | - | ||||||||||||||||||
| 299 | goto executed 11 times by 1 test: pragma_out;goto pragma_out;Executed by:
executed 11 times by 1 test: goto pragma_out;Executed by:
| 11 | ||||||||||||||||||
| 300 | } | - | ||||||||||||||||||
| 301 | if( rc!=12
| 6-35823 | ||||||||||||||||||
| 302 | if( aFcntl[0]
| 2-4 | ||||||||||||||||||
| 303 | sqlite3ErrorMsg(pParse, "%s", aFcntl[0]); | - | ||||||||||||||||||
| 304 | sqlite3_free(aFcntl[0]); | - | ||||||||||||||||||
| 305 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 306 | pParse->nErr++; | - | ||||||||||||||||||
| 307 | pParse->rc = rc; | - | ||||||||||||||||||
| 308 | goto executed 6 times by 1 test: pragma_out;goto pragma_out;Executed by:
executed 6 times by 1 test: goto pragma_out;Executed by:
| 6 | ||||||||||||||||||
| 309 | } | - | ||||||||||||||||||
| 310 | - | |||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | pPragma = pragmaLocate(zLeft); | - | ||||||||||||||||||
| 313 | if( pPragma==0
executed 425 times by 1 test: pragma_out;goto pragma_out;Executed by:
executed 425 times by 1 test: goto pragma_out;Executed by:
| 425-35398 | ||||||||||||||||||
| 314 | - | |||||||||||||||||||
| 315 | - | |||||||||||||||||||
| 316 | if( (
| 2975-32423 | ||||||||||||||||||
| 317 | if( sqlite3ReadSchema(pParse)
executed 13 times by 1 test: pragma_out;goto pragma_out;Executed by:
executed 13 times by 1 test: goto pragma_out;Executed by:
| 13-32410 | ||||||||||||||||||
| 318 | } executed 32410 times by 50 tests: end of blockExecuted by:
| 32410 | ||||||||||||||||||
| 319 | - | |||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | if( (
| 4335-31050 | ||||||||||||||||||
| 322 | && ((
| 1218-26989 | ||||||||||||||||||
| 323 | ){ | - | ||||||||||||||||||
| 324 | setPragmaResultColumnNames(v, pPragma); | - | ||||||||||||||||||
| 325 | } executed 28207 times by 29 tests: end of blockExecuted by:
| 28207 | ||||||||||||||||||
| 326 | - | |||||||||||||||||||
| 327 | - | |||||||||||||||||||
| 328 | switch( pPragma->ePragTyp ){ | - | ||||||||||||||||||
| 329 | case executed 444 times by 4 tests: 11:case 11:Executed by:
executed 444 times by 4 tests: {case 11:Executed by:
| 444 | ||||||||||||||||||
| 330 | static const int iLn = 0; | - | ||||||||||||||||||
| 331 | static const VdbeOpList getCacheSize[] = { | - | ||||||||||||||||||
| 332 | { 2, 0, 0, 0}, | - | ||||||||||||||||||
| 333 | { 105, 0, 1, 3}, | - | ||||||||||||||||||
| 334 | { 47, 1, 8, 0}, | - | ||||||||||||||||||
| 335 | { 70, 0, 2, 0}, | - | ||||||||||||||||||
| 336 | { 97, 1, 2, 1}, | - | ||||||||||||||||||
| 337 | { 47, 1, 8, 0}, | - | ||||||||||||||||||
| 338 | { 70, 0, 1, 0}, | - | ||||||||||||||||||
| 339 | { 171, 0, 0, 0}, | - | ||||||||||||||||||
| 340 | { 81, 1, 1, 0}, | - | ||||||||||||||||||
| 341 | }; | - | ||||||||||||||||||
| 342 | VdbeOp *aOp; | - | ||||||||||||||||||
| 343 | sqlite3VdbeUsesBtree(v, iDb); | - | ||||||||||||||||||
| 344 | if( !zRight
| 11-433 | ||||||||||||||||||
| 345 | pParse->nMem += 2; | - | ||||||||||||||||||
| 346 | ; | - | ||||||||||||||||||
| 347 | aOp = sqlite3VdbeAddOpList(v, ((int)(sizeof(getCacheSize)/sizeof(getCacheSize[0]))), getCacheSize, iLn); | - | ||||||||||||||||||
| 348 | if( (
dead code: break; | - | ||||||||||||||||||
| 349 | aOp[0].p1 = iDb; | - | ||||||||||||||||||
| 350 | aOp[1].p1 = iDb; | - | ||||||||||||||||||
| 351 | aOp[6].p1 = -2000; | - | ||||||||||||||||||
| 352 | } executed 433 times by 1 test: else{end of blockExecuted by:
| 433 | ||||||||||||||||||
| 353 | int size = sqlite3AbsInt32(sqlite3Atoi(zRight)); | - | ||||||||||||||||||
| 354 | sqlite3BeginWriteOperation(pParse, 0, iDb); | - | ||||||||||||||||||
| 355 | sqlite3VdbeAddOp3(v, 107, iDb, 3, size); | - | ||||||||||||||||||
| 356 | - | |||||||||||||||||||
| 357 | ((void) (0)) | - | ||||||||||||||||||
| 358 | ; | - | ||||||||||||||||||
| 359 | pDb->pSchema->cache_size = size; | - | ||||||||||||||||||
| 360 | sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); | - | ||||||||||||||||||
| 361 | } executed 11 times by 4 tests: end of blockExecuted by:
| 11 | ||||||||||||||||||
| 362 | break; executed 444 times by 4 tests: break;Executed by:
| 444 | ||||||||||||||||||
| 363 | } | - | ||||||||||||||||||
| 364 | case executed 723 times by 3 tests: 28:case 28:Executed by:
executed 723 times by 3 tests: {case 28:Executed by:
| 723 | ||||||||||||||||||
| 365 | Btree *pBt = pDb->pBt; | - | ||||||||||||||||||
| 366 | - | |||||||||||||||||||
| 367 | ((void) (0)) | - | ||||||||||||||||||
| 368 | ; | - | ||||||||||||||||||
| 369 | if( !zRight
| 131-592 | ||||||||||||||||||
| 370 | int size = (
| 0-131 | ||||||||||||||||||
| 371 | returnSingleInt(v, size); | - | ||||||||||||||||||
| 372 | } executed 131 times by 1 test: else{end of blockExecuted by:
| 131 | ||||||||||||||||||
| 373 | - | |||||||||||||||||||
| 374 | - | |||||||||||||||||||
| 375 | - | |||||||||||||||||||
| 376 | db->nextPagesize = sqlite3Atoi(zRight); | - | ||||||||||||||||||
| 377 | if( 7==sqlite3BtreeSetPageSize(pBt, db->nextPagesize,-1,0)
| 0-592 | ||||||||||||||||||
| 378 | sqlite3OomFault(db); | - | ||||||||||||||||||
| 379 | } never executed: end of block | 0 | ||||||||||||||||||
| 380 | } executed 592 times by 3 tests: end of blockExecuted by:
| 592 | ||||||||||||||||||
| 381 | break; executed 723 times by 3 tests: break;Executed by:
| 723 | ||||||||||||||||||
| 382 | } | - | ||||||||||||||||||
| 383 | case executed 22 times by 1 test: 30:case 30:Executed by:
executed 22 times by 1 test: {case 30:Executed by:
| 22 | ||||||||||||||||||
| 384 | Btree *pBt = pDb->pBt; | - | ||||||||||||||||||
| 385 | int b = -1; | - | ||||||||||||||||||
| 386 | - | |||||||||||||||||||
| 387 | ((void) (0)) | - | ||||||||||||||||||
| 388 | ; | - | ||||||||||||||||||
| 389 | if( zRight
| 11 | ||||||||||||||||||
| 390 | if( sqlite3_stricmp(zRight, "fast")==0
| 2-9 | ||||||||||||||||||
| 391 | b = 2; | - | ||||||||||||||||||
| 392 | } executed 2 times by 1 test: else{end of blockExecuted by:
| 2 | ||||||||||||||||||
| 393 | b = sqlite3GetBoolean(zRight, 0); | - | ||||||||||||||||||
| 394 | } executed 9 times by 1 test: end of blockExecuted by:
| 9 | ||||||||||||||||||
| 395 | } | - | ||||||||||||||||||
| 396 | if( pId2->n==0
| 1-15 | ||||||||||||||||||
| 397 | int ii; | - | ||||||||||||||||||
| 398 | for(ii=0; ii<db->nDb
| 6-16 | ||||||||||||||||||
| 399 | sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b); | - | ||||||||||||||||||
| 400 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 401 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||
| 402 | b = sqlite3BtreeSecureDelete(pBt, b); | - | ||||||||||||||||||
| 403 | returnSingleInt(v, b); | - | ||||||||||||||||||
| 404 | break; executed 22 times by 1 test: break;Executed by:
| 22 | ||||||||||||||||||
| 405 | } | - | ||||||||||||||||||
| 406 | case executed 115 times by 2 tests: 24:case 24:Executed by:
executed 115 times by 2 tests: {case 24:Executed by:
| 115 | ||||||||||||||||||
| 407 | int iReg; | - | ||||||||||||||||||
| 408 | sqlite3CodeVerifySchema(pParse, iDb); | - | ||||||||||||||||||
| 409 | iReg = ++pParse->nMem; | - | ||||||||||||||||||
| 410 | if( (
| 12-103 | ||||||||||||||||||
| 411 | sqlite3VdbeAddOp2(v, 167, iDb, iReg); | - | ||||||||||||||||||
| 412 | } executed 103 times by 1 test: else{end of blockExecuted by:
| 103 | ||||||||||||||||||
| 413 | sqlite3VdbeAddOp3(v, 168, iDb, iReg, | - | ||||||||||||||||||
| 414 | sqlite3AbsInt32(sqlite3Atoi(zRight))); | - | ||||||||||||||||||
| 415 | } executed 12 times by 2 tests: end of blockExecuted by:
| 12 | ||||||||||||||||||
| 416 | sqlite3VdbeAddOp2(v, 81, iReg, 1); | - | ||||||||||||||||||
| 417 | break; executed 115 times by 2 tests: break;Executed by:
| 115 | ||||||||||||||||||
| 418 | } | - | ||||||||||||||||||
| 419 | - | |||||||||||||||||||
| 420 | - | |||||||||||||||||||
| 421 | - | |||||||||||||||||||
| 422 | - | |||||||||||||||||||
| 423 | - | |||||||||||||||||||
| 424 | case executed 133 times by 1 test: 23:case 23:Executed by:
executed 133 times by 1 test: {case 23:Executed by:
| 133 | ||||||||||||||||||
| 425 | const char *zRet = "normal"; | - | ||||||||||||||||||
| 426 | int eMode = getLockingMode(zRight); | - | ||||||||||||||||||
| 427 | - | |||||||||||||||||||
| 428 | if( pId2->n==0
| 8-101 | ||||||||||||||||||
| 429 | - | |||||||||||||||||||
| 430 | - | |||||||||||||||||||
| 431 | - | |||||||||||||||||||
| 432 | - | |||||||||||||||||||
| 433 | eMode = db->dfltLockMode; | - | ||||||||||||||||||
| 434 | } executed 8 times by 1 test: else{end of blockExecuted by:
| 8 | ||||||||||||||||||
| 435 | Pager *pPager; | - | ||||||||||||||||||
| 436 | if( pId2->n==0
| 32-93 | ||||||||||||||||||
| 437 | int ii; | - | ||||||||||||||||||
| 438 | - | |||||||||||||||||||
| 439 | ((void) (0)) | - | ||||||||||||||||||
| 440 | ; | - | ||||||||||||||||||
| 441 | for(ii=2; ii<db->nDb
| 2-93 | ||||||||||||||||||
| 442 | pPager = sqlite3BtreePager(db->aDb[ii].pBt); | - | ||||||||||||||||||
| 443 | sqlite3PagerLockingMode(pPager, eMode); | - | ||||||||||||||||||
| 444 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 445 | db->dfltLockMode = (u8)eMode; | - | ||||||||||||||||||
| 446 | } executed 93 times by 1 test: end of blockExecuted by:
| 93 | ||||||||||||||||||
| 447 | pPager = sqlite3BtreePager(pDb->pBt); | - | ||||||||||||||||||
| 448 | eMode = sqlite3PagerLockingMode(pPager, eMode); | - | ||||||||||||||||||
| 449 | } executed 125 times by 1 test: end of blockExecuted by:
| 125 | ||||||||||||||||||
| 450 | - | |||||||||||||||||||
| 451 | - | |||||||||||||||||||
| 452 | ((void) (0)) | - | ||||||||||||||||||
| 453 | - | |||||||||||||||||||
| 454 | ; | - | ||||||||||||||||||
| 455 | if( eMode==1
| 45-88 | ||||||||||||||||||
| 456 | zRet = "exclusive"; | - | ||||||||||||||||||
| 457 | } executed 88 times by 1 test: end of blockExecuted by:
| 88 | ||||||||||||||||||
| 458 | returnSingleText(v, zRet); | - | ||||||||||||||||||
| 459 | break; executed 133 times by 1 test: break;Executed by:
| 133 | ||||||||||||||||||
| 460 | } | - | ||||||||||||||||||
| 461 | - | |||||||||||||||||||
| 462 | - | |||||||||||||||||||
| 463 | - | |||||||||||||||||||
| 464 | - | |||||||||||||||||||
| 465 | - | |||||||||||||||||||
| 466 | - | |||||||||||||||||||
| 467 | case executed 5311 times by 10 tests: 20:case 20:Executed by:
executed 5311 times by 10 tests: {case 20:Executed by:
| 5311 | ||||||||||||||||||
| 468 | int eMode; | - | ||||||||||||||||||
| 469 | int ii; | - | ||||||||||||||||||
| 470 | - | |||||||||||||||||||
| 471 | if( zRight==0
| 178-5133 | ||||||||||||||||||
| 472 | - | |||||||||||||||||||
| 473 | - | |||||||||||||||||||
| 474 | eMode = (-1); | - | ||||||||||||||||||
| 475 | } executed 178 times by 5 tests: else{end of blockExecuted by:
| 178 | ||||||||||||||||||
| 476 | const char *zMode; | - | ||||||||||||||||||
| 477 | int n = sqlite3Strlen30(zRight); | - | ||||||||||||||||||
| 478 | for(eMode=0; (
| 1-29259 | ||||||||||||||||||
| 479 | if( sqlite3_strnicmp(zRight, zMode, n)==0
executed 5132 times by 6 tests: break;Executed by:
| 5132-24127 | ||||||||||||||||||
| 480 | } executed 24127 times by 6 tests: end of blockExecuted by:
| 24127 | ||||||||||||||||||
| 481 | if( !zMode
| 1-5132 | ||||||||||||||||||
| 482 | - | |||||||||||||||||||
| 483 | - | |||||||||||||||||||
| 484 | eMode = (-1); | - | ||||||||||||||||||
| 485 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 486 | } executed 5133 times by 6 tests: end of blockExecuted by:
| 5133 | ||||||||||||||||||
| 487 | if( eMode==(-1)
| 61-5132 | ||||||||||||||||||
| 488 | - | |||||||||||||||||||
| 489 | iDb = 0; | - | ||||||||||||||||||
| 490 | pId2->n = 1; | - | ||||||||||||||||||
| 491 | } executed 61 times by 5 tests: end of blockExecuted by:
| 61 | ||||||||||||||||||
| 492 | for(ii=db->nDb-1; ii>=0
| 5311-11152 | ||||||||||||||||||
| 493 | if( db->aDb[ii].pBt
| 54-5909 | ||||||||||||||||||
| 494 | sqlite3VdbeUsesBtree(v, ii); | - | ||||||||||||||||||
| 495 | sqlite3VdbeAddOp3(v, 7, ii, 1, eMode); | - | ||||||||||||||||||
| 496 | } executed 5365 times by 10 tests: end of blockExecuted by:
| 5365 | ||||||||||||||||||
| 497 | } executed 11152 times by 10 tests: end of blockExecuted by:
| 11152 | ||||||||||||||||||
| 498 | sqlite3VdbeAddOp2(v, 81, 1, 1); | - | ||||||||||||||||||
| 499 | break; executed 5311 times by 10 tests: break;Executed by:
| 5311 | ||||||||||||||||||
| 500 | } | - | ||||||||||||||||||
| 501 | - | |||||||||||||||||||
| 502 | - | |||||||||||||||||||
| 503 | - | |||||||||||||||||||
| 504 | - | |||||||||||||||||||
| 505 | - | |||||||||||||||||||
| 506 | - | |||||||||||||||||||
| 507 | - | |||||||||||||||||||
| 508 | case executed 15 times by 1 test: 21:case 21:Executed by:
executed 15 times by 1 test: {case 21:Executed by:
| 15 | ||||||||||||||||||
| 509 | Pager *pPager = sqlite3BtreePager(pDb->pBt); | - | ||||||||||||||||||
| 510 | i64 iLimit = -2; | - | ||||||||||||||||||
| 511 | if( zRight
| 5-10 | ||||||||||||||||||
| 512 | sqlite3DecOrHexToI64(zRight, &iLimit); | - | ||||||||||||||||||
| 513 | if( iLimit<-1
executed 1 time by 1 test: iLimit = -1;Executed by:
| 1-9 | ||||||||||||||||||
| 514 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 515 | iLimit = sqlite3PagerJournalSizeLimit(pPager, iLimit); | - | ||||||||||||||||||
| 516 | returnSingleInt(v, iLimit); | - | ||||||||||||||||||
| 517 | break; executed 15 times by 1 test: break;Executed by:
| 15 | ||||||||||||||||||
| 518 | } | - | ||||||||||||||||||
| 519 | case executed 681 times by 4 tests: 1:case 1:Executed by:
executed 681 times by 4 tests: {case 1:Executed by:
| 681 | ||||||||||||||||||
| 520 | Btree *pBt = pDb->pBt; | - | ||||||||||||||||||
| 521 | - | |||||||||||||||||||
| 522 | ((void) (0)) | - | ||||||||||||||||||
| 523 | ; | - | ||||||||||||||||||
| 524 | if( !zRight
| 77-604 | ||||||||||||||||||
| 525 | returnSingleInt(v, sqlite3BtreeGetAutoVacuum(pBt)); | - | ||||||||||||||||||
| 526 | } executed 77 times by 1 test: else{end of blockExecuted by:
| 77 | ||||||||||||||||||
| 527 | int eAuto = getAutoVacuum(zRight); | - | ||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | ((void) (0)) | - | ||||||||||||||||||
| 530 | ; | - | ||||||||||||||||||
| 531 | db->nextAutovac = (u8)eAuto; | - | ||||||||||||||||||
| 532 | - | |||||||||||||||||||
| 533 | - | |||||||||||||||||||
| 534 | - | |||||||||||||||||||
| 535 | - | |||||||||||||||||||
| 536 | - | |||||||||||||||||||
| 537 | rc = sqlite3BtreeSetAutoVacuum(pBt, eAuto); | - | ||||||||||||||||||
| 538 | if( rc==0
| 14-590 | ||||||||||||||||||
| 539 | - | |||||||||||||||||||
| 540 | - | |||||||||||||||||||
| 541 | - | |||||||||||||||||||
| 542 | - | |||||||||||||||||||
| 543 | - | |||||||||||||||||||
| 544 | static const int iLn = 0; | - | ||||||||||||||||||
| 545 | static const VdbeOpList setMeta6[] = { | - | ||||||||||||||||||
| 546 | { 2, 0, 1, 0}, | - | ||||||||||||||||||
| 547 | { 105, 0, 1, 4}, | - | ||||||||||||||||||
| 548 | { 18, 1, 0, 0}, | - | ||||||||||||||||||
| 549 | { 69, 0, 2, 0}, | - | ||||||||||||||||||
| 550 | { 107, 0, 7, 0}, | - | ||||||||||||||||||
| 551 | }; | - | ||||||||||||||||||
| 552 | VdbeOp *aOp; | - | ||||||||||||||||||
| 553 | int iAddr = sqlite3VdbeCurrentAddr(v); | - | ||||||||||||||||||
| 554 | ; | - | ||||||||||||||||||
| 555 | aOp = sqlite3VdbeAddOpList(v, ((int)(sizeof(setMeta6)/sizeof(setMeta6[0]))), setMeta6, iLn); | - | ||||||||||||||||||
| 556 | if( (
dead code: break; | - | ||||||||||||||||||
| 557 | aOp[0].p1 = iDb; | - | ||||||||||||||||||
| 558 | aOp[1].p1 = iDb; | - | ||||||||||||||||||
| 559 | aOp[2].p2 = iAddr+4; | - | ||||||||||||||||||
| 560 | aOp[4].p1 = iDb; | - | ||||||||||||||||||
| 561 | aOp[4].p3 = eAuto - 1; | - | ||||||||||||||||||
| 562 | sqlite3VdbeUsesBtree(v, iDb); | - | ||||||||||||||||||
| 563 | } executed 135 times by 3 tests: end of blockExecuted by:
| 135 | ||||||||||||||||||
| 564 | } executed 604 times by 4 tests: end of blockExecuted by:
| 604 | ||||||||||||||||||
| 565 | break; executed 681 times by 4 tests: break;Executed by:
| 681 | ||||||||||||||||||
| 566 | } | - | ||||||||||||||||||
| 567 | case executed 4299 times by 1 test: 16:case 16:Executed by:
executed 4299 times by 1 test: {case 16:Executed by:
| 4299 | ||||||||||||||||||
| 568 | int iLimit, addr; | - | ||||||||||||||||||
| 569 | if( zRight==0
| 1-4208 | ||||||||||||||||||
| 570 | iLimit = 0x7fffffff; | - | ||||||||||||||||||
| 571 | } executed 94 times by 1 test: end of blockExecuted by:
| 94 | ||||||||||||||||||
| 572 | sqlite3BeginWriteOperation(pParse, 0, iDb); | - | ||||||||||||||||||
| 573 | sqlite3VdbeAddOp2(v, 70, iLimit, 1); | - | ||||||||||||||||||
| 574 | addr = sqlite3VdbeAddOp1(v, 59, iDb); ; | - | ||||||||||||||||||
| 575 | sqlite3VdbeAddOp1(v, 81, 1); | - | ||||||||||||||||||
| 576 | sqlite3VdbeAddOp2(v, 83, 1, -1); | - | ||||||||||||||||||
| 577 | sqlite3VdbeAddOp2(v, 47, 1, addr); ; | - | ||||||||||||||||||
| 578 | sqlite3VdbeJumpHere(v, addr); | - | ||||||||||||||||||
| 579 | break; executed 4299 times by 1 test: break;Executed by:
| 4299 | ||||||||||||||||||
| 580 | } | - | ||||||||||||||||||
| 581 | case executed 393 times by 16 tests: 4:case 4:Executed by:
executed 393 times by 16 tests: {case 4:Executed by:
| 393 | ||||||||||||||||||
| 582 | - | |||||||||||||||||||
| 583 | ((void) (0)) | - | ||||||||||||||||||
| 584 | ; | - | ||||||||||||||||||
| 585 | if( !zRight
| 112-281 | ||||||||||||||||||
| 586 | returnSingleInt(v, pDb->pSchema->cache_size); | - | ||||||||||||||||||
| 587 | } executed 112 times by 1 test: else{end of blockExecuted by:
| 112 | ||||||||||||||||||
| 588 | int size = sqlite3Atoi(zRight); | - | ||||||||||||||||||
| 589 | pDb->pSchema->cache_size = size; | - | ||||||||||||||||||
| 590 | sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); | - | ||||||||||||||||||
| 591 | } executed 281 times by 16 tests: end of blockExecuted by:
| 281 | ||||||||||||||||||
| 592 | break; executed 393 times by 16 tests: break;Executed by:
| 393 | ||||||||||||||||||
| 593 | } | - | ||||||||||||||||||
| 594 | case executed 28 times by 1 test: 5:case 5:Executed by:
executed 28 times by 1 test: {case 5:Executed by:
| 28 | ||||||||||||||||||
| 595 | - | |||||||||||||||||||
| 596 | ((void) (0)) | - | ||||||||||||||||||
| 597 | ; | - | ||||||||||||||||||
| 598 | if( !zRight
| 14 | ||||||||||||||||||
| 599 | returnSingleInt(v, | - | ||||||||||||||||||
| 600 | (db->flags & 0x00000020)==0 ? 0 : | - | ||||||||||||||||||
| 601 | sqlite3BtreeSetSpillSize(pDb->pBt,0)); | - | ||||||||||||||||||
| 602 | } executed 14 times by 1 test: else{end of blockExecuted by:
| 14 | ||||||||||||||||||
| 603 | int size = 1; | - | ||||||||||||||||||
| 604 | if( sqlite3GetInt32(zRight, &size)
| 7 | ||||||||||||||||||
| 605 | sqlite3BtreeSetSpillSize(pDb->pBt, size); | - | ||||||||||||||||||
| 606 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||
| 607 | if( sqlite3GetBoolean(zRight, size!=0)
| 5-9 | ||||||||||||||||||
| 608 | db->flags |= 0x00000020; | - | ||||||||||||||||||
| 609 | } executed 9 times by 1 test: else{end of blockExecuted by:
| 9 | ||||||||||||||||||
| 610 | db->flags &= ~0x00000020; | - | ||||||||||||||||||
| 611 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||
| 612 | setAllPagerFlags(db); | - | ||||||||||||||||||
| 613 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||
| 614 | break; executed 28 times by 1 test: break;Executed by:
| 28 | ||||||||||||||||||
| 615 | } | - | ||||||||||||||||||
| 616 | case executed 262 times by 3 tests: 25:case 25:Executed by:
executed 262 times by 3 tests: {case 25:Executed by:
| 262 | ||||||||||||||||||
| 617 | sqlite3_int64 sz; | - | ||||||||||||||||||
| 618 | - | |||||||||||||||||||
| 619 | - | |||||||||||||||||||
| 620 | ((void) (0)) | - | ||||||||||||||||||
| 621 | ; | - | ||||||||||||||||||
| 622 | if( zRight
| 14-248 | ||||||||||||||||||
| 623 | int ii; | - | ||||||||||||||||||
| 624 | sqlite3DecOrHexToI64(zRight, &sz); | - | ||||||||||||||||||
| 625 | if( sz<0
never executed: sz = sqlite3Config.szMmap; | 0-248 | ||||||||||||||||||
| 626 | if( pId2->n==0
executed 248 times by 3 tests: db->szMmap = sz;Executed by:
| 0-248 | ||||||||||||||||||
| 627 | for(ii=db->nDb-1; ii>=0
| 248-496 | ||||||||||||||||||
| 628 | if( db->aDb[ii].pBt
| 0-268 | ||||||||||||||||||
| 629 | sqlite3BtreeSetMmapLimit(db->aDb[ii].pBt, sz); | - | ||||||||||||||||||
| 630 | } executed 268 times by 3 tests: end of blockExecuted by:
| 268 | ||||||||||||||||||
| 631 | } executed 496 times by 3 tests: end of blockExecuted by:
| 496 | ||||||||||||||||||
| 632 | } executed 248 times by 3 tests: end of blockExecuted by:
| 248 | ||||||||||||||||||
| 633 | sz = -1; | - | ||||||||||||||||||
| 634 | rc = sqlite3_file_control(db, zDb, 18, &sz); | - | ||||||||||||||||||
| 635 | - | |||||||||||||||||||
| 636 | - | |||||||||||||||||||
| 637 | - | |||||||||||||||||||
| 638 | - | |||||||||||||||||||
| 639 | if( rc==0
| 0-262 | ||||||||||||||||||
| 640 | returnSingleInt(v, sz); | - | ||||||||||||||||||
| 641 | } executed 262 times by 3 tests: else if( rc!=12end of blockExecuted by:
| 0-262 | ||||||||||||||||||
| 642 | pParse->nErr++; | - | ||||||||||||||||||
| 643 | pParse->rc = rc; | - | ||||||||||||||||||
| 644 | } never executed: end of block | 0 | ||||||||||||||||||
| 645 | break; executed 262 times by 3 tests: break;Executed by:
| 262 | ||||||||||||||||||
| 646 | } | - | ||||||||||||||||||
| 647 | case executed 105 times by 1 test: 35:case 35:Executed by:
executed 105 times by 1 test: {case 35:Executed by:
| 105 | ||||||||||||||||||
| 648 | if( !zRight
| 19-86 | ||||||||||||||||||
| 649 | returnSingleInt(v, db->temp_store); | - | ||||||||||||||||||
| 650 | } executed 19 times by 1 test: else{end of blockExecuted by:
| 19 | ||||||||||||||||||
| 651 | changeTempStorage(pParse, zRight); | - | ||||||||||||||||||
| 652 | } executed 86 times by 1 test: end of blockExecuted by:
| 86 | ||||||||||||||||||
| 653 | break; executed 105 times by 1 test: break;Executed by:
| 105 | ||||||||||||||||||
| 654 | } | - | ||||||||||||||||||
| 655 | case executed 8 times by 1 test: 36:case 36:Executed by:
executed 8 times by 1 test: {case 36:Executed by:
| 8 | ||||||||||||||||||
| 656 | if( !zRight
| 3-5 | ||||||||||||||||||
| 657 | returnSingleText(v, sqlite3_temp_directory); | - | ||||||||||||||||||
| 658 | } executed 3 times by 1 test: else{end of blockExecuted by:
| 3 | ||||||||||||||||||
| 659 | - | |||||||||||||||||||
| 660 | if( zRight[0]
| 2-3 | ||||||||||||||||||
| 661 | int res; | - | ||||||||||||||||||
| 662 | rc = sqlite3OsAccess(db->pVfs, zRight, 1, &res); | - | ||||||||||||||||||
| 663 | if( rc!=0
| 0-3 | ||||||||||||||||||
| 664 | sqlite3ErrorMsg(pParse, "not a writable directory"); | - | ||||||||||||||||||
| 665 | goto executed 1 time by 1 test: pragma_out;goto pragma_out;Executed by:
executed 1 time by 1 test: goto pragma_out;Executed by:
| 1 | ||||||||||||||||||
| 666 | } | - | ||||||||||||||||||
| 667 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 668 | if( 1==0
| 0-4 | ||||||||||||||||||
| 669 | || (1==1
| 0-4 | ||||||||||||||||||
| 670 | || (1==2
| 0-2 | ||||||||||||||||||
| 671 | ){ | - | ||||||||||||||||||
| 672 | invalidateTempStorage(pParse); | - | ||||||||||||||||||
| 673 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 674 | sqlite3_free(sqlite3_temp_directory); | - | ||||||||||||||||||
| 675 | if( zRight[0]
| 2 | ||||||||||||||||||
| 676 | sqlite3_temp_directory = sqlite3_mprintf("%s", zRight); | - | ||||||||||||||||||
| 677 | } executed 2 times by 1 test: else{end of blockExecuted by:
| 2 | ||||||||||||||||||
| 678 | sqlite3_temp_directory = 0; | - | ||||||||||||||||||
| 679 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 680 | - | |||||||||||||||||||
| 681 | } | - | ||||||||||||||||||
| 682 | break; executed 7 times by 1 test: break;Executed by:
| 7 | ||||||||||||||||||
| 683 | } | - | ||||||||||||||||||
| 684 | case executed 238 times by 11 tests: 33:case 33:Executed by:
executed 238 times by 11 tests: {case 33:Executed by:
| 238 | ||||||||||||||||||
| 685 | if( !zRight
| 34-204 | ||||||||||||||||||
| 686 | returnSingleInt(v, pDb->safety_level-1); | - | ||||||||||||||||||
| 687 | } executed 34 times by 1 test: else{end of blockExecuted by:
| 34 | ||||||||||||||||||
| 688 | if( !db->autoCommit
| 1-203 | ||||||||||||||||||
| 689 | sqlite3ErrorMsg(pParse, | - | ||||||||||||||||||
| 690 | "Safety level may not be changed inside a transaction"); | - | ||||||||||||||||||
| 691 | } executed 1 time by 1 test: else if( iDb!=1end of blockExecuted by:
| 0-203 | ||||||||||||||||||
| 692 | int iLevel = (getSafetyLevel(zRight,0,1)+1) & 0x07; | - | ||||||||||||||||||
| 693 | if( iLevel==0
never executed: iLevel = 1; | 0-203 | ||||||||||||||||||
| 694 | pDb->safety_level = iLevel; | - | ||||||||||||||||||
| 695 | pDb->bSyncSet = 1; | - | ||||||||||||||||||
| 696 | setAllPagerFlags(db); | - | ||||||||||||||||||
| 697 | } executed 203 times by 11 tests: end of blockExecuted by:
| 203 | ||||||||||||||||||
| 698 | } executed 204 times by 11 tests: end of blockExecuted by:
| 204 | ||||||||||||||||||
| 699 | break; executed 238 times by 11 tests: break;Executed by:
| 238 | ||||||||||||||||||
| 700 | } | - | ||||||||||||||||||
| 701 | - | |||||||||||||||||||
| 702 | - | |||||||||||||||||||
| 703 | - | |||||||||||||||||||
| 704 | case executed 1271 times by 1 test: 2:case 2:Executed by:
executed 1271 times by 1 test: {case 2:Executed by:
| 1271 | ||||||||||||||||||
| 705 | if( zRight==0
| 317-954 | ||||||||||||||||||
| 706 | setPragmaResultColumnNames(v, pPragma); | - | ||||||||||||||||||
| 707 | returnSingleInt(v, (db->flags & pPragma->iArg)!=0 ); | - | ||||||||||||||||||
| 708 | } executed 317 times by 1 test: else{end of blockExecuted by:
| 317 | ||||||||||||||||||
| 709 | int mask = pPragma->iArg; | - | ||||||||||||||||||
| 710 | if( db->autoCommit==0
| 16-938 | ||||||||||||||||||
| 711 | - | |||||||||||||||||||
| 712 | - | |||||||||||||||||||
| 713 | mask &= ~(0x00004000); | - | ||||||||||||||||||
| 714 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 715 | - | |||||||||||||||||||
| 716 | - | |||||||||||||||||||
| 717 | - | |||||||||||||||||||
| 718 | - | |||||||||||||||||||
| 719 | - | |||||||||||||||||||
| 720 | - | |||||||||||||||||||
| 721 | - | |||||||||||||||||||
| 722 | if( sqlite3GetBoolean(zRight, 0)
| 406-548 | ||||||||||||||||||
| 723 | db->flags |= mask; | - | ||||||||||||||||||
| 724 | } executed 406 times by 1 test: else{end of blockExecuted by:
| 406 | ||||||||||||||||||
| 725 | db->flags &= ~mask; | - | ||||||||||||||||||
| 726 | if( mask==0x00080000
never executed: db->nDeferredImmCons = 0; | 0-548 | ||||||||||||||||||
| 727 | } executed 548 times by 1 test: end of blockExecuted by:
| 548 | ||||||||||||||||||
| 728 | - | |||||||||||||||||||
| 729 | - | |||||||||||||||||||
| 730 | - | |||||||||||||||||||
| 731 | - | |||||||||||||||||||
| 732 | - | |||||||||||||||||||
| 733 | sqlite3VdbeAddOp0(v, 159); | - | ||||||||||||||||||
| 734 | setAllPagerFlags(db); | - | ||||||||||||||||||
| 735 | } executed 954 times by 1 test: end of blockExecuted by:
| 954 | ||||||||||||||||||
| 736 | break; executed 1271 times by 1 test: break;Executed by:
| 1271 | ||||||||||||||||||
| 737 | } | - | ||||||||||||||||||
| 738 | case executed 8705 times by 1 test: 34:case 34:Executed by:
executed 8705 times by 1 test: if( zRightcase 34:Executed by:
| 1-8705 | ||||||||||||||||||
| 739 | Table *pTab; | - | ||||||||||||||||||
| 740 | pTab = sqlite3LocateTable(pParse, 0x02, zRight, zDb); | - | ||||||||||||||||||
| 741 | if( pTab
| 2-8702 | ||||||||||||||||||
| 742 | int i, k; | - | ||||||||||||||||||
| 743 | int nHidden = 0; | - | ||||||||||||||||||
| 744 | Column *pCol; | - | ||||||||||||||||||
| 745 | Index *pPk = sqlite3PrimaryKeyIndex(pTab); | - | ||||||||||||||||||
| 746 | pParse->nMem = 6; | - | ||||||||||||||||||
| 747 | sqlite3CodeVerifySchema(pParse, iDb); | - | ||||||||||||||||||
| 748 | sqlite3ViewGetColumnNames(pParse, pTab); | - | ||||||||||||||||||
| 749 | for(i=0, pCol=pTab->aCol; i<pTab->nCol
| 8702-17574 | ||||||||||||||||||
| 750 | if( (((
| 19-17555 | ||||||||||||||||||
| 751 | nHidden++; | - | ||||||||||||||||||
| 752 | continue; executed 19 times by 1 test: continue;Executed by:
| 19 | ||||||||||||||||||
| 753 | } | - | ||||||||||||||||||
| 754 | if( (
| 8591-8964 | ||||||||||||||||||
| 755 | k = 0; | - | ||||||||||||||||||
| 756 | } executed 8964 times by 1 test: else if( pPk==0end of blockExecuted by:
| 20-8964 | ||||||||||||||||||
| 757 | k = 1; | - | ||||||||||||||||||
| 758 | } executed 8571 times by 1 test: else{end of blockExecuted by:
| 8571 | ||||||||||||||||||
| 759 | for(k=1; k<=pTab->nCol
executed 10 times by 1 test: end of blockExecuted by:
| 1-29 | ||||||||||||||||||
| 760 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||||||||||||||
| 761 | - | |||||||||||||||||||
| 762 | ((void) (0)) | - | ||||||||||||||||||
| 763 | ; | - | ||||||||||||||||||
| 764 | sqlite3VdbeMultiLoad(v, 1, "issisi", | - | ||||||||||||||||||
| 765 | i-nHidden, | - | ||||||||||||||||||
| 766 | pCol->zName, | - | ||||||||||||||||||
| 767 | sqlite3ColumnType(pCol,""), | - | ||||||||||||||||||
| 768 | pCol->notNull ? 1 : 0, | - | ||||||||||||||||||
| 769 | pCol->pDflt ? pCol->pDflt->u.zToken : 0, | - | ||||||||||||||||||
| 770 | k); | - | ||||||||||||||||||
| 771 | } executed 17555 times by 1 test: end of blockExecuted by:
| 17555 | ||||||||||||||||||
| 772 | } executed 8702 times by 1 test: end of blockExecuted by:
| 8702 | ||||||||||||||||||
| 773 | } executed 8704 times by 1 test: end of blockExecuted by:
| 8704 | ||||||||||||||||||
| 774 | break; executed 8705 times by 1 test: break;Executed by:
| 8705 | ||||||||||||||||||
| 775 | case executed 101 times by 1 test: 17:case 17:Executed by:
executed 101 times by 1 test: if( zRightcase 17:Executed by:
| 0-101 | ||||||||||||||||||
| 776 | Index *pIdx; | - | ||||||||||||||||||
| 777 | Table *pTab; | - | ||||||||||||||||||
| 778 | pIdx = sqlite3FindIndex(db, zRight, zDb); | - | ||||||||||||||||||
| 779 | if( pIdx
| 1-100 | ||||||||||||||||||
| 780 | int i; | - | ||||||||||||||||||
| 781 | int mx; | - | ||||||||||||||||||
| 782 | if( pPragma->iArg
| 39-61 | ||||||||||||||||||
| 783 | - | |||||||||||||||||||
| 784 | mx = pIdx->nColumn; | - | ||||||||||||||||||
| 785 | pParse->nMem = 6; | - | ||||||||||||||||||
| 786 | } executed 39 times by 1 test: else{end of blockExecuted by:
| 39 | ||||||||||||||||||
| 787 | - | |||||||||||||||||||
| 788 | mx = pIdx->nKeyCol; | - | ||||||||||||||||||
| 789 | pParse->nMem = 3; | - | ||||||||||||||||||
| 790 | } executed 61 times by 1 test: end of blockExecuted by:
| 61 | ||||||||||||||||||
| 791 | pTab = pIdx->pTable; | - | ||||||||||||||||||
| 792 | sqlite3CodeVerifySchema(pParse, iDb); | - | ||||||||||||||||||
| 793 | - | |||||||||||||||||||
| 794 | ((void) (0)) | - | ||||||||||||||||||
| 795 | ; | - | ||||||||||||||||||
| 796 | for(i=0; i<mx
| 100-169 | ||||||||||||||||||
| 797 | i16 cnum = pIdx->aiColumn[i]; | - | ||||||||||||||||||
| 798 | sqlite3VdbeMultiLoad(v, 1, "iisX", i, cnum, | - | ||||||||||||||||||
| 799 | cnum<0 ? 0 : pTab->aCol[cnum].zName); | - | ||||||||||||||||||
| 800 | if( pPragma->iArg
| 77-92 | ||||||||||||||||||
| 801 | sqlite3VdbeMultiLoad(v, 4, "isiX", | - | ||||||||||||||||||
| 802 | pIdx->aSortOrder[i], | - | ||||||||||||||||||
| 803 | pIdx->azColl[i], | - | ||||||||||||||||||
| 804 | i<pIdx->nKeyCol); | - | ||||||||||||||||||
| 805 | } executed 92 times by 1 test: end of blockExecuted by:
| 92 | ||||||||||||||||||
| 806 | sqlite3VdbeAddOp2(v, 81, 1, pParse->nMem); | - | ||||||||||||||||||
| 807 | } executed 169 times by 1 test: end of blockExecuted by:
| 169 | ||||||||||||||||||
| 808 | } executed 100 times by 1 test: end of blockExecuted by:
| 100 | ||||||||||||||||||
| 809 | } executed 101 times by 1 test: end of blockExecuted by:
| 101 | ||||||||||||||||||
| 810 | break; executed 101 times by 1 test: break;Executed by:
| 101 | ||||||||||||||||||
| 811 | - | |||||||||||||||||||
| 812 | case executed 449 times by 1 test: 18:case 18:Executed by:
executed 449 times by 1 test: if( zRightcase 18:Executed by:
| 0-449 | ||||||||||||||||||
| 813 | Index *pIdx; | - | ||||||||||||||||||
| 814 | Table *pTab; | - | ||||||||||||||||||
| 815 | int i; | - | ||||||||||||||||||
| 816 | pTab = sqlite3FindTable(db, zRight, zDb); | - | ||||||||||||||||||
| 817 | if( pTab
| 1-448 | ||||||||||||||||||
| 818 | pParse->nMem = 5; | - | ||||||||||||||||||
| 819 | sqlite3CodeVerifySchema(pParse, iDb); | - | ||||||||||||||||||
| 820 | for(pIdx=pTab->pIndex, i=0; pIdx
| 116-448 | ||||||||||||||||||
| 821 | const char *azOrigin[] = { "c", "u", "pk" }; | - | ||||||||||||||||||
| 822 | sqlite3VdbeMultiLoad(v, 1, "isisi", | - | ||||||||||||||||||
| 823 | i, | - | ||||||||||||||||||
| 824 | pIdx->zName, | - | ||||||||||||||||||
| 825 | ((pIdx)->onError!=0), | - | ||||||||||||||||||
| 826 | azOrigin[pIdx->idxType], | - | ||||||||||||||||||
| 827 | pIdx->pPartIdxWhere!=0); | - | ||||||||||||||||||
| 828 | } executed 116 times by 1 test: end of blockExecuted by:
| 116 | ||||||||||||||||||
| 829 | } executed 448 times by 1 test: end of blockExecuted by:
| 448 | ||||||||||||||||||
| 830 | } executed 449 times by 1 test: end of blockExecuted by:
| 449 | ||||||||||||||||||
| 831 | break; executed 449 times by 1 test: break;Executed by:
| 449 | ||||||||||||||||||
| 832 | - | |||||||||||||||||||
| 833 | case executed 343 times by 1 test: 10:case 10:Executed by:
executed 343 times by 1 test: {case 10:Executed by:
| 343 | ||||||||||||||||||
| 834 | int i; | - | ||||||||||||||||||
| 835 | pParse->nMem = 3; | - | ||||||||||||||||||
| 836 | for(i=0; i<db->nDb
| 343-883 | ||||||||||||||||||
| 837 | if( db->aDb[i].pBt==0
executed 159 times by 1 test: continue;Executed by:
| 159-724 | ||||||||||||||||||
| 838 | - | |||||||||||||||||||
| 839 | ((void) (0)) | - | ||||||||||||||||||
| 840 | ; | - | ||||||||||||||||||
| 841 | sqlite3VdbeMultiLoad(v, 1, "iss", | - | ||||||||||||||||||
| 842 | i, | - | ||||||||||||||||||
| 843 | db->aDb[i].zDbSName, | - | ||||||||||||||||||
| 844 | sqlite3BtreeGetFilename(db->aDb[i].pBt)); | - | ||||||||||||||||||
| 845 | } executed 724 times by 1 test: end of blockExecuted by:
| 724 | ||||||||||||||||||
| 846 | } | - | ||||||||||||||||||
| 847 | break; executed 343 times by 1 test: break;Executed by:
| 343 | ||||||||||||||||||
| 848 | - | |||||||||||||||||||
| 849 | case executed 2 times by 1 test: 7:case 7:Executed by:
executed 2 times by 1 test: {case 7:Executed by:
| 2 | ||||||||||||||||||
| 850 | int i = 0; | - | ||||||||||||||||||
| 851 | HashElem *p; | - | ||||||||||||||||||
| 852 | pParse->nMem = 2; | - | ||||||||||||||||||
| 853 | for(p=((&db->aCollSeq)->first); p
| 2-7 | ||||||||||||||||||
| 854 | CollSeq *pColl = (CollSeq *)((p)->data); | - | ||||||||||||||||||
| 855 | sqlite3VdbeMultiLoad(v, 1, "is", i++, pColl->zName); | - | ||||||||||||||||||
| 856 | } executed 7 times by 1 test: end of blockExecuted by:
| 7 | ||||||||||||||||||
| 857 | } | - | ||||||||||||||||||
| 858 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||||||||||||||
| 859 | case executed 16 times by 1 test: 14:case 14:Executed by:
executed 16 times by 1 test: if( zRightcase 14:Executed by:
| 1-16 | ||||||||||||||||||
| 860 | FKey *pFK; | - | ||||||||||||||||||
| 861 | Table *pTab; | - | ||||||||||||||||||
| 862 | pTab = sqlite3FindTable(db, zRight, zDb); | - | ||||||||||||||||||
| 863 | if( pTab
| 1-14 | ||||||||||||||||||
| 864 | pFK = pTab->pFKey; | - | ||||||||||||||||||
| 865 | if( pFK
| 1-13 | ||||||||||||||||||
| 866 | int i = 0; | - | ||||||||||||||||||
| 867 | pParse->nMem = 8; | - | ||||||||||||||||||
| 868 | sqlite3CodeVerifySchema(pParse, iDb); | - | ||||||||||||||||||
| 869 | while(pFK
| 13-16 | ||||||||||||||||||
| 870 | int j; | - | ||||||||||||||||||
| 871 | for(j=0; j<pFK->nCol
| 16-22 | ||||||||||||||||||
| 872 | sqlite3VdbeMultiLoad(v, 1, "iissssss", | - | ||||||||||||||||||
| 873 | i, | - | ||||||||||||||||||
| 874 | j, | - | ||||||||||||||||||
| 875 | pFK->zTo, | - | ||||||||||||||||||
| 876 | pTab->aCol[pFK->aCol[j].iFrom].zName, | - | ||||||||||||||||||
| 877 | pFK->aCol[j].zCol, | - | ||||||||||||||||||
| 878 | actionName(pFK->aAction[1]), | - | ||||||||||||||||||
| 879 | actionName(pFK->aAction[0]), | - | ||||||||||||||||||
| 880 | "NONE"); | - | ||||||||||||||||||
| 881 | } executed 22 times by 1 test: end of blockExecuted by:
| 22 | ||||||||||||||||||
| 882 | ++i; | - | ||||||||||||||||||
| 883 | pFK = pFK->pNextFrom; | - | ||||||||||||||||||
| 884 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 885 | } executed 13 times by 1 test: end of blockExecuted by:
| 13 | ||||||||||||||||||
| 886 | } executed 14 times by 1 test: end of blockExecuted by:
| 14 | ||||||||||||||||||
| 887 | } executed 15 times by 1 test: end of blockExecuted by:
| 15 | ||||||||||||||||||
| 888 | break; executed 16 times by 1 test: break;Executed by:
| 16 | ||||||||||||||||||
| 889 | - | |||||||||||||||||||
| 890 | - | |||||||||||||||||||
| 891 | - | |||||||||||||||||||
| 892 | - | |||||||||||||||||||
| 893 | case executed 1223 times by 1 test: 13:case 13:Executed by:
executed 1223 times by 1 test: {case 13:Executed by:
| 1223 | ||||||||||||||||||
| 894 | FKey *pFK; | - | ||||||||||||||||||
| 895 | Table *pTab; | - | ||||||||||||||||||
| 896 | Table *pParent; | - | ||||||||||||||||||
| 897 | Index *pIdx; | - | ||||||||||||||||||
| 898 | int i; | - | ||||||||||||||||||
| 899 | int j; | - | ||||||||||||||||||
| 900 | HashElem *k; | - | ||||||||||||||||||
| 901 | int x; | - | ||||||||||||||||||
| 902 | int regResult; | - | ||||||||||||||||||
| 903 | int regKey; | - | ||||||||||||||||||
| 904 | int regRow; | - | ||||||||||||||||||
| 905 | int addrTop; | - | ||||||||||||||||||
| 906 | int addrOk; | - | ||||||||||||||||||
| 907 | int *aiCols; | - | ||||||||||||||||||
| 908 | - | |||||||||||||||||||
| 909 | regResult = pParse->nMem+1; | - | ||||||||||||||||||
| 910 | pParse->nMem += 4; | - | ||||||||||||||||||
| 911 | regKey = ++pParse->nMem; | - | ||||||||||||||||||
| 912 | regRow = ++pParse->nMem; | - | ||||||||||||||||||
| 913 | sqlite3CodeVerifySchema(pParse, iDb); | - | ||||||||||||||||||
| 914 | k = ((&db->aDb[iDb].pSchema->tblHash)->first); | - | ||||||||||||||||||
| 915 | while( k
| 1222-1647 | ||||||||||||||||||
| 916 | if( zRight
| 443-1204 | ||||||||||||||||||
| 917 | pTab = sqlite3LocateTable(pParse, 0, zRight, zDb); | - | ||||||||||||||||||
| 918 | k = 0; | - | ||||||||||||||||||
| 919 | } executed 1204 times by 1 test: else{end of blockExecuted by:
| 1204 | ||||||||||||||||||
| 920 | pTab = (Table*)((k)->data); | - | ||||||||||||||||||
| 921 | k = ((k)->next); | - | ||||||||||||||||||
| 922 | } executed 443 times by 1 test: end of blockExecuted by:
| 443 | ||||||||||||||||||
| 923 | if( pTab==0
executed 696 times by 1 test: continue;Executed by:
| 1-1646 | ||||||||||||||||||
| 924 | sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); | - | ||||||||||||||||||
| 925 | if( pTab->nCol+regRow>pParse->nMem
executed 636 times by 1 test: pParse->nMem = pTab->nCol + regRow;Executed by:
| 315-636 | ||||||||||||||||||
| 926 | sqlite3OpenTable(pParse, 0, iDb, pTab, 109); | - | ||||||||||||||||||
| 927 | sqlite3VdbeLoadString(v, regResult, pTab->zName); | - | ||||||||||||||||||
| 928 | for(i=1, pFK=pTab->pFKey; pFK
| 950-951 | ||||||||||||||||||
| 929 | pParent = sqlite3FindTable(db, pFK->zTo, zDb); | - | ||||||||||||||||||
| 930 | if( pParent==0
executed 7 times by 1 test: continue;Executed by:
| 7-944 | ||||||||||||||||||
| 931 | pIdx = 0; | - | ||||||||||||||||||
| 932 | sqlite3TableLock(pParse, iDb, pParent->tnum, 0, pParent->zName); | - | ||||||||||||||||||
| 933 | x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, 0); | - | ||||||||||||||||||
| 934 | if( x==0
| 1-943 | ||||||||||||||||||
| 935 | if( pIdx==0
| 151-792 | ||||||||||||||||||
| 936 | sqlite3OpenTable(pParse, i, iDb, pParent, 109); | - | ||||||||||||||||||
| 937 | } executed 151 times by 1 test: else{end of blockExecuted by:
| 151 | ||||||||||||||||||
| 938 | sqlite3VdbeAddOp3(v, 109, i, pIdx->tnum, iDb); | - | ||||||||||||||||||
| 939 | sqlite3VdbeSetP4KeyInfo(pParse, pIdx); | - | ||||||||||||||||||
| 940 | } executed 792 times by 1 test: end of blockExecuted by:
| 792 | ||||||||||||||||||
| 941 | }else{ | - | ||||||||||||||||||
| 942 | k = 0; | - | ||||||||||||||||||
| 943 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||||||||||||||
| 944 | } | - | ||||||||||||||||||
| 945 | } | - | ||||||||||||||||||
| 946 | - | |||||||||||||||||||
| 947 | ((void) (0)) | - | ||||||||||||||||||
| 948 | ; | - | ||||||||||||||||||
| 949 | if( pFK
executed 1 time by 1 test: break;Executed by:
| 1-950 | ||||||||||||||||||
| 950 | if( pParse->nTab<i
executed 635 times by 1 test: pParse->nTab = i;Executed by:
| 315-635 | ||||||||||||||||||
| 951 | addrTop = sqlite3VdbeAddOp1(v, 36, 0); ; | - | ||||||||||||||||||
| 952 | for(i=1, pFK=pTab->pFKey; pFK
| 950 | ||||||||||||||||||
| 953 | pParent = sqlite3FindTable(db, pFK->zTo, zDb); | - | ||||||||||||||||||
| 954 | pIdx = 0; | - | ||||||||||||||||||
| 955 | aiCols = 0; | - | ||||||||||||||||||
| 956 | if( pParent
| 7-943 | ||||||||||||||||||
| 957 | x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols); | - | ||||||||||||||||||
| 958 | - | |||||||||||||||||||
| 959 | ((void) (0)) | - | ||||||||||||||||||
| 960 | ; | - | ||||||||||||||||||
| 961 | } executed 943 times by 1 test: end of blockExecuted by:
| 943 | ||||||||||||||||||
| 962 | addrOk = sqlite3VdbeMakeLabel(v); | - | ||||||||||||||||||
| 963 | - | |||||||||||||||||||
| 964 | - | |||||||||||||||||||
| 965 | - | |||||||||||||||||||
| 966 | - | |||||||||||||||||||
| 967 | - | |||||||||||||||||||
| 968 | for(j=0; j<pFK->nCol
| 950-1082 | ||||||||||||||||||
| 969 | int iCol = aiCols
| 256-826 | ||||||||||||||||||
| 970 | sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j); | - | ||||||||||||||||||
| 971 | sqlite3VdbeAddOp2(v, 50, regRow+j, addrOk); ; | - | ||||||||||||||||||
| 972 | } executed 1082 times by 1 test: end of blockExecuted by:
| 1082 | ||||||||||||||||||
| 973 | - | |||||||||||||||||||
| 974 | - | |||||||||||||||||||
| 975 | - | |||||||||||||||||||
| 976 | if( pIdx
| 158-792 | ||||||||||||||||||
| 977 | sqlite3VdbeAddOp4(v, 102, regRow, pFK->nCol, regKey, | - | ||||||||||||||||||
| 978 | sqlite3IndexAffinityStr(db,pIdx), pFK->nCol); | - | ||||||||||||||||||
| 979 | sqlite3VdbeAddOp4Int(v, 29, i, addrOk, regKey, 0); | - | ||||||||||||||||||
| 980 | ; | - | ||||||||||||||||||
| 981 | } executed 792 times by 1 test: else if( pParentend of blockExecuted by:
| 7-792 | ||||||||||||||||||
| 982 | int jmp = sqlite3VdbeCurrentAddr(v)+2; | - | ||||||||||||||||||
| 983 | sqlite3VdbeAddOp3(v, 30, i, jmp, regRow); ; | - | ||||||||||||||||||
| 984 | sqlite3VdbeGoto(v, addrOk); | - | ||||||||||||||||||
| 985 | - | |||||||||||||||||||
| 986 | ((void) (0)) | - | ||||||||||||||||||
| 987 | ; | - | ||||||||||||||||||
| 988 | } executed 151 times by 1 test: end of blockExecuted by:
| 151 | ||||||||||||||||||
| 989 | - | |||||||||||||||||||
| 990 | - | |||||||||||||||||||
| 991 | if( (((
| 2-948 | ||||||||||||||||||
| 992 | sqlite3VdbeAddOp2(v, 129, 0, regResult+1); | - | ||||||||||||||||||
| 993 | } executed 948 times by 1 test: else{end of blockExecuted by:
| 948 | ||||||||||||||||||
| 994 | sqlite3VdbeAddOp2(v, 73, 0, regResult+1); | - | ||||||||||||||||||
| 995 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 996 | sqlite3VdbeMultiLoad(v, regResult+2, "siX", pFK->zTo, i-1); | - | ||||||||||||||||||
| 997 | sqlite3VdbeAddOp2(v, 81, regResult, 4); | - | ||||||||||||||||||
| 998 | sqlite3VdbeResolveLabel(v, addrOk); | - | ||||||||||||||||||
| 999 | sqlite3DbFree(db, aiCols); | - | ||||||||||||||||||
| 1000 | } executed 950 times by 1 test: end of blockExecuted by:
| 950 | ||||||||||||||||||
| 1001 | sqlite3VdbeAddOp2(v, 5, 0, addrTop+1); ; | - | ||||||||||||||||||
| 1002 | sqlite3VdbeJumpHere(v, addrTop); | - | ||||||||||||||||||
| 1003 | } executed 950 times by 1 test: end of blockExecuted by:
| 950 | ||||||||||||||||||
| 1004 | } | - | ||||||||||||||||||
| 1005 | break; executed 1223 times by 1 test: break;Executed by:
| 1223 | ||||||||||||||||||
| 1006 | case executed 32 times by 1 test: 6:case 6:Executed by:
executed 32 times by 1 test: {case 6:Executed by:
| 32 | ||||||||||||||||||
| 1007 | if( zRight
| 3-29 | ||||||||||||||||||
| 1008 | sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0)); | - | ||||||||||||||||||
| 1009 | } executed 29 times by 1 test: end of blockExecuted by:
| 29 | ||||||||||||||||||
| 1010 | } | - | ||||||||||||||||||
| 1011 | break; executed 32 times by 1 test: break;Executed by:
| 32 | ||||||||||||||||||
| 1012 | case executed 5663 times by 12 tests: 19:case 19:Executed by:
executed 5663 times by 12 tests: {case 19:Executed by:
| 5663 | ||||||||||||||||||
| 1013 | int i, j, addr, mxErr; | - | ||||||||||||||||||
| 1014 | - | |||||||||||||||||||
| 1015 | int isQuick = ((sqlite3UpperToLower[(unsigned char)(zLeft[0])])=='q'); | - | ||||||||||||||||||
| 1016 | - | |||||||||||||||||||
| 1017 | ((void) (0)) | - | ||||||||||||||||||
| 1018 | ; | - | ||||||||||||||||||
| 1019 | - | |||||||||||||||||||
| 1020 | ((void) (0)) | - | ||||||||||||||||||
| 1021 | ; | - | ||||||||||||||||||
| 1022 | if( pId2->z==0
executed 5647 times by 12 tests: iDb = -1;Executed by:
| 16-5647 | ||||||||||||||||||
| 1023 | - | |||||||||||||||||||
| 1024 | - | |||||||||||||||||||
| 1025 | pParse->nMem = 6; | - | ||||||||||||||||||
| 1026 | - | |||||||||||||||||||
| 1027 | - | |||||||||||||||||||
| 1028 | mxErr = 100; | - | ||||||||||||||||||
| 1029 | if( zRight
| 17-5646 | ||||||||||||||||||
| 1030 | sqlite3GetInt32(zRight, &mxErr); | - | ||||||||||||||||||
| 1031 | if( mxErr<=0
| 1-16 | ||||||||||||||||||
| 1032 | mxErr = 100; | - | ||||||||||||||||||
| 1033 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 1034 | } executed 17 times by 1 test: end of blockExecuted by:
| 17 | ||||||||||||||||||
| 1035 | sqlite3VdbeAddOp2(v, 70, mxErr-1, 1); | - | ||||||||||||||||||
| 1036 | - | |||||||||||||||||||
| 1037 | - | |||||||||||||||||||
| 1038 | for(i=0; i<db->nDb
| 5663-11377 | ||||||||||||||||||
| 1039 | HashElem *x; | - | ||||||||||||||||||
| 1040 | Hash *pTbls; | - | ||||||||||||||||||
| 1041 | int *aRoot; | - | ||||||||||||||||||
| 1042 | int cnt = 0; | - | ||||||||||||||||||
| 1043 | int mxIdx = 0; | - | ||||||||||||||||||
| 1044 | - | |||||||||||||||||||
| 1045 | if( 0 && i==1 dead code: ) continue;i==1dead code: continue; | - | ||||||||||||||||||
| 1046 | if( iDb>=0
executed 32 times by 1 test: continue;Executed by:
| 16-11329 | ||||||||||||||||||
| 1047 | - | |||||||||||||||||||
| 1048 | sqlite3CodeVerifySchema(pParse, i); | - | ||||||||||||||||||
| 1049 | - | |||||||||||||||||||
| 1050 | - | |||||||||||||||||||
| 1051 | - | |||||||||||||||||||
| 1052 | - | |||||||||||||||||||
| 1053 | - | |||||||||||||||||||
| 1054 | - | |||||||||||||||||||
| 1055 | - | |||||||||||||||||||
| 1056 | ((void) (0)) | - | ||||||||||||||||||
| 1057 | ; | - | ||||||||||||||||||
| 1058 | pTbls = &db->aDb[i].pSchema->tblHash; | - | ||||||||||||||||||
| 1059 | for(cnt=0, x=((pTbls)->first); x
| 11345-19936 | ||||||||||||||||||
| 1060 | Table *pTab = ((x)->data); | - | ||||||||||||||||||
| 1061 | Index *pIdx; | - | ||||||||||||||||||
| 1062 | int nIdx; | - | ||||||||||||||||||
| 1063 | if( (((
executed 19841 times by 12 tests: cnt++;Executed by:
| 95-19841 | ||||||||||||||||||
| 1064 | for(nIdx=0, pIdx=pTab->pIndex; pIdx
executed 3626 times by 12 tests: end of blockExecuted by:
| 3626-19936 | ||||||||||||||||||
| 1065 | if( nIdx>mxIdx
executed 2339 times by 12 tests: mxIdx = nIdx;Executed by:
| 2339-17597 | ||||||||||||||||||
| 1066 | } executed 19936 times by 12 tests: end of blockExecuted by:
| 19936 | ||||||||||||||||||
| 1067 | aRoot = sqlite3DbMallocRawNN(db, sizeof(int)*(cnt+1)); | - | ||||||||||||||||||
| 1068 | if( aRoot==0
never executed: break; | 0-11345 | ||||||||||||||||||
| 1069 | for(cnt=0, x=((pTbls)->first); x
| 11345-19936 | ||||||||||||||||||
| 1070 | Table *pTab = ((x)->data); | - | ||||||||||||||||||
| 1071 | Index *pIdx; | - | ||||||||||||||||||
| 1072 | if( (((
executed 19841 times by 12 tests: aRoot[++cnt] = pTab->tnum;Executed by:
| 95-19841 | ||||||||||||||||||
| 1073 | for(pIdx=pTab->pIndex; pIdx
| 3626-19936 | ||||||||||||||||||
| 1074 | aRoot[++cnt] = pIdx->tnum; | - | ||||||||||||||||||
| 1075 | } executed 3626 times by 12 tests: end of blockExecuted by:
| 3626 | ||||||||||||||||||
| 1076 | } executed 19936 times by 12 tests: end of blockExecuted by:
| 19936 | ||||||||||||||||||
| 1077 | aRoot[0] = cnt; | - | ||||||||||||||||||
| 1078 | - | |||||||||||||||||||
| 1079 | - | |||||||||||||||||||
| 1080 | pParse->nMem = ((
| 2296-9049 | ||||||||||||||||||
| 1081 | sqlite3ClearTempRegCache(pParse); | - | ||||||||||||||||||
| 1082 | - | |||||||||||||||||||
| 1083 | - | |||||||||||||||||||
| 1084 | sqlite3VdbeAddOp4(v, 148, 2, cnt, 1, (char*)aRoot,(-15)); | - | ||||||||||||||||||
| 1085 | sqlite3VdbeChangeP5(v, (u8)i); | - | ||||||||||||||||||
| 1086 | addr = sqlite3VdbeAddOp1(v, 50, 2); ; | - | ||||||||||||||||||
| 1087 | sqlite3VdbeAddOp4(v, 106, 0, 3, 0, | - | ||||||||||||||||||
| 1088 | sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName), | - | ||||||||||||||||||
| 1089 | (-7)); | - | ||||||||||||||||||
| 1090 | sqlite3VdbeAddOp3(v, 101, 2, 3, 3); | - | ||||||||||||||||||
| 1091 | integrityCheckResultRow(v); | - | ||||||||||||||||||
| 1092 | sqlite3VdbeJumpHere(v, addr); | - | ||||||||||||||||||
| 1093 | - | |||||||||||||||||||
| 1094 | - | |||||||||||||||||||
| 1095 | - | |||||||||||||||||||
| 1096 | for(x=((pTbls)->first); x
| 11345-19936 | ||||||||||||||||||
| 1097 | Table *pTab = ((x)->data); | - | ||||||||||||||||||
| 1098 | Index *pIdx, *pPk; | - | ||||||||||||||||||
| 1099 | Index *pPrior = 0; | - | ||||||||||||||||||
| 1100 | int loopTop; | - | ||||||||||||||||||
| 1101 | int iDataCur, iIdxCur; | - | ||||||||||||||||||
| 1102 | int r1 = -1; | - | ||||||||||||||||||
| 1103 | - | |||||||||||||||||||
| 1104 | if( pTab->tnum<1
executed 47 times by 1 test: continue;Executed by:
| 47-19889 | ||||||||||||||||||
| 1105 | pPk = (((
| 95-19794 | ||||||||||||||||||
| 1106 | sqlite3OpenTableAndIndices(pParse, pTab, 109, 0, | - | ||||||||||||||||||
| 1107 | 1, 0, &iDataCur, &iIdxCur); | - | ||||||||||||||||||
| 1108 | - | |||||||||||||||||||
| 1109 | - | |||||||||||||||||||
| 1110 | - | |||||||||||||||||||
| 1111 | sqlite3VdbeAddOp2(v, 70, 0, 7); | - | ||||||||||||||||||
| 1112 | for(j=0, pIdx=pTab->pIndex; pIdx
| 3626-19889 | ||||||||||||||||||
| 1113 | sqlite3VdbeAddOp2(v, 70, 0, 8+j); | - | ||||||||||||||||||
| 1114 | } executed 3626 times by 12 tests: end of blockExecuted by:
| 3626 | ||||||||||||||||||
| 1115 | - | |||||||||||||||||||
| 1116 | ((void) (0)) | - | ||||||||||||||||||
| 1117 | ; | - | ||||||||||||||||||
| 1118 | - | |||||||||||||||||||
| 1119 | ((void) (0)) | - | ||||||||||||||||||
| 1120 | ; | - | ||||||||||||||||||
| 1121 | sqlite3VdbeAddOp2(v, 36, iDataCur, 0); ; | - | ||||||||||||||||||
| 1122 | loopTop = sqlite3VdbeAddOp2(v, 83, 7, 1); | - | ||||||||||||||||||
| 1123 | if( !isQuick
| 48-19841 | ||||||||||||||||||
| 1124 | - | |||||||||||||||||||
| 1125 | sqlite3VdbeAddOp3(v, 90, iDataCur, pTab->nCol-1, 3); | - | ||||||||||||||||||
| 1126 | sqlite3VdbeChangeP5(v, 0x80); | - | ||||||||||||||||||
| 1127 | } executed 19841 times by 12 tests: end of blockExecuted by:
| 19841 | ||||||||||||||||||
| 1128 | - | |||||||||||||||||||
| 1129 | for(j=0; j<pTab->nCol
| 19889-71532 | ||||||||||||||||||
| 1130 | char *zErr; | - | ||||||||||||||||||
| 1131 | int jmp2; | - | ||||||||||||||||||
| 1132 | if( j==pTab->iPKey
executed 3392 times by 1 test: continue;Executed by:
| 3392-68140 | ||||||||||||||||||
| 1133 | if( pTab->aCol[j].notNull==0
executed 68021 times by 12 tests: continue;Executed by:
| 119-68021 | ||||||||||||||||||
| 1134 | sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3); | - | ||||||||||||||||||
| 1135 | sqlite3VdbeChangeP5(v, 0x80); | - | ||||||||||||||||||
| 1136 | jmp2 = sqlite3VdbeAddOp1(v, 51, 3); ; | - | ||||||||||||||||||
| 1137 | zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName, | - | ||||||||||||||||||
| 1138 | pTab->aCol[j].zName); | - | ||||||||||||||||||
| 1139 | sqlite3VdbeAddOp4(v, 106, 0, 3, 0, zErr, (-7)); | - | ||||||||||||||||||
| 1140 | integrityCheckResultRow(v); | - | ||||||||||||||||||
| 1141 | sqlite3VdbeJumpHere(v, jmp2); | - | ||||||||||||||||||
| 1142 | } executed 119 times by 1 test: end of blockExecuted by:
| 119 | ||||||||||||||||||
| 1143 | - | |||||||||||||||||||
| 1144 | if( pTab->pCheck
| 4-19875 | ||||||||||||||||||
| 1145 | ExprList *pCheck = sqlite3ExprListDup(db, pTab->pCheck, 0); | - | ||||||||||||||||||
| 1146 | if( db->mallocFailed==0
| 0-10 | ||||||||||||||||||
| 1147 | int addrCkFault = sqlite3VdbeMakeLabel(v); | - | ||||||||||||||||||
| 1148 | int addrCkOk = sqlite3VdbeMakeLabel(v); | - | ||||||||||||||||||
| 1149 | char *zErr; | - | ||||||||||||||||||
| 1150 | int k; | - | ||||||||||||||||||
| 1151 | pParse->iSelfTab = iDataCur + 1; | - | ||||||||||||||||||
| 1152 | for(k=pCheck->nExpr-1; k>0
| 3-10 | ||||||||||||||||||
| 1153 | sqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0); | - | ||||||||||||||||||
| 1154 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||
| 1155 | sqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk, | - | ||||||||||||||||||
| 1156 | 0x10); | - | ||||||||||||||||||
| 1157 | sqlite3VdbeResolveLabel(v, addrCkFault); | - | ||||||||||||||||||
| 1158 | pParse->iSelfTab = 0; | - | ||||||||||||||||||
| 1159 | zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s", | - | ||||||||||||||||||
| 1160 | pTab->zName); | - | ||||||||||||||||||
| 1161 | sqlite3VdbeAddOp4(v, 106, 0, 3, 0, zErr, (-7)); | - | ||||||||||||||||||
| 1162 | integrityCheckResultRow(v); | - | ||||||||||||||||||
| 1163 | sqlite3VdbeResolveLabel(v, addrCkOk); | - | ||||||||||||||||||
| 1164 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 1165 | sqlite3ExprListDelete(db, pCheck); | - | ||||||||||||||||||
| 1166 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 1167 | if( !isQuick
| 48-19841 | ||||||||||||||||||
| 1168 | - | |||||||||||||||||||
| 1169 | for(j=0, pIdx=pTab->pIndex; pIdx
| 3616-19841 | ||||||||||||||||||
| 1170 | int jmp2, jmp3, jmp4, jmp5; | - | ||||||||||||||||||
| 1171 | int ckUniq = sqlite3VdbeMakeLabel(v); | - | ||||||||||||||||||
| 1172 | if( pPk==pIdx
executed 95 times by 1 test: continue;Executed by:
| 95-3521 | ||||||||||||||||||
| 1173 | r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3, | - | ||||||||||||||||||
| 1174 | pPrior, r1); | - | ||||||||||||||||||
| 1175 | pPrior = pIdx; | - | ||||||||||||||||||
| 1176 | sqlite3VdbeAddOp2(v, 83, 8+j, 1); | - | ||||||||||||||||||
| 1177 | - | |||||||||||||||||||
| 1178 | jmp2 = sqlite3VdbeAddOp4Int(v, 29, iIdxCur+j, ckUniq, r1, | - | ||||||||||||||||||
| 1179 | pIdx->nColumn); ; | - | ||||||||||||||||||
| 1180 | sqlite3VdbeLoadString(v, 3, "row "); | - | ||||||||||||||||||
| 1181 | sqlite3VdbeAddOp3(v, 101, 7, 3, 3); | - | ||||||||||||||||||
| 1182 | sqlite3VdbeLoadString(v, 4, " missing from index "); | - | ||||||||||||||||||
| 1183 | sqlite3VdbeAddOp3(v, 101, 4, 3, 3); | - | ||||||||||||||||||
| 1184 | jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName); | - | ||||||||||||||||||
| 1185 | sqlite3VdbeAddOp3(v, 101, 4, 3, 3); | - | ||||||||||||||||||
| 1186 | jmp4 = integrityCheckResultRow(v); | - | ||||||||||||||||||
| 1187 | sqlite3VdbeJumpHere(v, jmp2); | - | ||||||||||||||||||
| 1188 | - | |||||||||||||||||||
| 1189 | - | |||||||||||||||||||
| 1190 | - | |||||||||||||||||||
| 1191 | if( ((
| 1692-1829 | ||||||||||||||||||
| 1192 | int uniqOk = sqlite3VdbeMakeLabel(v); | - | ||||||||||||||||||
| 1193 | int jmp6; | - | ||||||||||||||||||
| 1194 | int kk; | - | ||||||||||||||||||
| 1195 | for(kk=0; kk<pIdx->nKeyCol
| 1692-1874 | ||||||||||||||||||
| 1196 | int iCol = pIdx->aiColumn[kk]; | - | ||||||||||||||||||
| 1197 | - | |||||||||||||||||||
| 1198 | ((void) (0)) | - | ||||||||||||||||||
| 1199 | ; | - | ||||||||||||||||||
| 1200 | if( iCol>=0
executed 15 times by 1 test: continue;Executed by:
| 10-1864 | ||||||||||||||||||
| 1201 | sqlite3VdbeAddOp2(v, 50, r1+kk, uniqOk); | - | ||||||||||||||||||
| 1202 | ; | - | ||||||||||||||||||
| 1203 | } executed 1859 times by 8 tests: end of blockExecuted by:
| 1859 | ||||||||||||||||||
| 1204 | jmp6 = sqlite3VdbeAddOp1(v, 5, iIdxCur+j); ; | - | ||||||||||||||||||
| 1205 | sqlite3VdbeGoto(v, uniqOk); | - | ||||||||||||||||||
| 1206 | sqlite3VdbeJumpHere(v, jmp6); | - | ||||||||||||||||||
| 1207 | sqlite3VdbeAddOp4Int(v, 38, iIdxCur+j, uniqOk, r1, | - | ||||||||||||||||||
| 1208 | pIdx->nKeyCol); ; | - | ||||||||||||||||||
| 1209 | sqlite3VdbeLoadString(v, 3, "non-unique entry in index "); | - | ||||||||||||||||||
| 1210 | sqlite3VdbeGoto(v, jmp5); | - | ||||||||||||||||||
| 1211 | sqlite3VdbeResolveLabel(v, uniqOk); | - | ||||||||||||||||||
| 1212 | } executed 1692 times by 8 tests: end of blockExecuted by:
| 1692 | ||||||||||||||||||
| 1213 | sqlite3VdbeJumpHere(v, jmp4); | - | ||||||||||||||||||
| 1214 | sqlite3ResolvePartIdxLabel(pParse, jmp3); | - | ||||||||||||||||||
| 1215 | } executed 3521 times by 12 tests: end of blockExecuted by:
| 3521 | ||||||||||||||||||
| 1216 | } executed 19841 times by 12 tests: end of blockExecuted by:
| 19841 | ||||||||||||||||||
| 1217 | sqlite3VdbeAddOp2(v, 5, iDataCur, loopTop); ; | - | ||||||||||||||||||
| 1218 | sqlite3VdbeJumpHere(v, loopTop-1); | - | ||||||||||||||||||
| 1219 | - | |||||||||||||||||||
| 1220 | if( !isQuick
| 48-19841 | ||||||||||||||||||
| 1221 | sqlite3VdbeLoadString(v, 2, "wrong # of entries in index "); | - | ||||||||||||||||||
| 1222 | for(j=0, pIdx=pTab->pIndex; pIdx
| 3616-19841 | ||||||||||||||||||
| 1223 | if( pPk==pIdx
executed 95 times by 1 test: continue;Executed by:
| 95-3521 | ||||||||||||||||||
| 1224 | sqlite3VdbeAddOp2(v, 104, iIdxCur+j, 3); | - | ||||||||||||||||||
| 1225 | addr = sqlite3VdbeAddOp3(v, 53, 8+j, 0, 3); ; | - | ||||||||||||||||||
| 1226 | sqlite3VdbeChangeP5(v, 0x90); | - | ||||||||||||||||||
| 1227 | sqlite3VdbeLoadString(v, 4, pIdx->zName); | - | ||||||||||||||||||
| 1228 | sqlite3VdbeAddOp3(v, 101, 4, 2, 3); | - | ||||||||||||||||||
| 1229 | integrityCheckResultRow(v); | - | ||||||||||||||||||
| 1230 | sqlite3VdbeJumpHere(v, addr); | - | ||||||||||||||||||
| 1231 | } executed 3521 times by 12 tests: end of blockExecuted by:
| 3521 | ||||||||||||||||||
| 1232 | } executed 19841 times by 12 tests: end of blockExecuted by:
| 19841 | ||||||||||||||||||
| 1233 | - | |||||||||||||||||||
| 1234 | } executed 19889 times by 12 tests: end of blockExecuted by:
| 19889 | ||||||||||||||||||
| 1235 | } executed 11345 times by 12 tests: end of blockExecuted by:
| 11345 | ||||||||||||||||||
| 1236 | { | - | ||||||||||||||||||
| 1237 | static const int iLn = 0; | - | ||||||||||||||||||
| 1238 | static const VdbeOpList endCode[] = { | - | ||||||||||||||||||
| 1239 | { 83, 1, 0, 0}, | - | ||||||||||||||||||
| 1240 | { 48, 1, 4, 0}, | - | ||||||||||||||||||
| 1241 | { 106, 0, 3, 0}, | - | ||||||||||||||||||
| 1242 | { 81, 3, 1, 0}, | - | ||||||||||||||||||
| 1243 | { 69, 0, 0, 0}, | - | ||||||||||||||||||
| 1244 | { 106, 0, 3, 0}, | - | ||||||||||||||||||
| 1245 | { 11, 0, 3, 0}, | - | ||||||||||||||||||
| 1246 | }; | - | ||||||||||||||||||
| 1247 | VdbeOp *aOp; | - | ||||||||||||||||||
| 1248 | - | |||||||||||||||||||
| 1249 | aOp = sqlite3VdbeAddOpList(v, ((int)(sizeof(endCode)/sizeof(endCode[0]))), endCode, iLn); | - | ||||||||||||||||||
| 1250 | if( aOp
| 0-5663 | ||||||||||||||||||
| 1251 | aOp[0].p2 = 1-mxErr; | - | ||||||||||||||||||
| 1252 | aOp[2].p4type = (-1); | - | ||||||||||||||||||
| 1253 | aOp[2].p4.z = "ok"; | - | ||||||||||||||||||
| 1254 | aOp[5].p4type = (-1); | - | ||||||||||||||||||
| 1255 | aOp[5].p4.z = (char*)sqlite3ErrStr(11); | - | ||||||||||||||||||
| 1256 | } executed 5663 times by 12 tests: end of blockExecuted by:
| 5663 | ||||||||||||||||||
| 1257 | sqlite3VdbeChangeP3(v, 0, sqlite3VdbeCurrentAddr(v)-2); | - | ||||||||||||||||||
| 1258 | } | - | ||||||||||||||||||
| 1259 | } | - | ||||||||||||||||||
| 1260 | break; executed 5663 times by 12 tests: break;Executed by:
| 5663 | ||||||||||||||||||
| 1261 | case executed 125 times by 1 test: 12:case 12:Executed by:
executed 125 times by 1 test: {case 12:Executed by:
| 125 | ||||||||||||||||||
| 1262 | static const struct EncName { | - | ||||||||||||||||||
| 1263 | char *zName; | - | ||||||||||||||||||
| 1264 | u8 enc; | - | ||||||||||||||||||
| 1265 | } encnames[] = { | - | ||||||||||||||||||
| 1266 | { "UTF8", 1 }, | - | ||||||||||||||||||
| 1267 | { "UTF-8", 1 }, | - | ||||||||||||||||||
| 1268 | { "UTF-16le", 2 }, | - | ||||||||||||||||||
| 1269 | { "UTF-16be", 3 }, | - | ||||||||||||||||||
| 1270 | { "UTF16le", 2 }, | - | ||||||||||||||||||
| 1271 | { "UTF16be", 3 }, | - | ||||||||||||||||||
| 1272 | { "UTF-16", 0 }, | - | ||||||||||||||||||
| 1273 | { "UTF16", 0 }, | - | ||||||||||||||||||
| 1274 | { 0, 0 } | - | ||||||||||||||||||
| 1275 | }; | - | ||||||||||||||||||
| 1276 | const struct EncName *pEnc; | - | ||||||||||||||||||
| 1277 | if( !zRight
| 56-69 | ||||||||||||||||||
| 1278 | if( sqlite3ReadSchema(pParse)
never executed: pragma_out;goto pragma_out;never executed: goto pragma_out; | 0-56 | ||||||||||||||||||
| 1279 | - | |||||||||||||||||||
| 1280 | ((void) (0)) | - | ||||||||||||||||||
| 1281 | ; | - | ||||||||||||||||||
| 1282 | - | |||||||||||||||||||
| 1283 | ((void) (0)) | - | ||||||||||||||||||
| 1284 | ; | - | ||||||||||||||||||
| 1285 | - | |||||||||||||||||||
| 1286 | ((void) (0)) | - | ||||||||||||||||||
| 1287 | ; | - | ||||||||||||||||||
| 1288 | returnSingleText(v, encnames[((pParse->db)->enc)].zName); | - | ||||||||||||||||||
| 1289 | } executed 56 times by 1 test: else{end of blockExecuted by:
| 56 | ||||||||||||||||||
| 1290 | - | |||||||||||||||||||
| 1291 | - | |||||||||||||||||||
| 1292 | - | |||||||||||||||||||
| 1293 | - | |||||||||||||||||||
| 1294 | - | |||||||||||||||||||
| 1295 | if( | - | ||||||||||||||||||
| 1296 | !((((db)->aDb[0].pSchema->schemaFlags&(0x0001))==(0x0001)))
| 16-53 | ||||||||||||||||||
| 1297 | (((
| 6-10 | ||||||||||||||||||
| 1298 | ){ | - | ||||||||||||||||||
| 1299 | for(pEnc=&encnames[0]; pEnc->zName
| 0-244 | ||||||||||||||||||
| 1300 | if( 0==sqlite3StrICmp(zRight, pEnc->zName)
| 59-185 | ||||||||||||||||||
| 1301 | ((db)->aDb[0].pSchema->enc) = ((db)->enc) = | - | ||||||||||||||||||
| 1302 | pEnc->enc
| 14-45 | ||||||||||||||||||
| 1303 | break; executed 59 times by 1 test: break;Executed by:
| 59 | ||||||||||||||||||
| 1304 | } | - | ||||||||||||||||||
| 1305 | } executed 185 times by 1 test: end of blockExecuted by:
| 185 | ||||||||||||||||||
| 1306 | if( !pEnc->zName
| 0-59 | ||||||||||||||||||
| 1307 | sqlite3ErrorMsg(pParse, "unsupported encoding: %s", zRight); | - | ||||||||||||||||||
| 1308 | } never executed: end of block | 0 | ||||||||||||||||||
| 1309 | } executed 59 times by 1 test: end of blockExecuted by:
| 59 | ||||||||||||||||||
| 1310 | } executed 69 times by 1 test: end of blockExecuted by:
| 69 | ||||||||||||||||||
| 1311 | } | - | ||||||||||||||||||
| 1312 | break; executed 125 times by 1 test: break;Executed by:
| 125 | ||||||||||||||||||
| 1313 | case executed 74 times by 1 test: 0:case 0:Executed by:
executed 74 times by 1 test: {case 0:Executed by:
| 74 | ||||||||||||||||||
| 1314 | int iCookie = pPragma->iArg; | - | ||||||||||||||||||
| 1315 | sqlite3VdbeUsesBtree(v, iDb); | - | ||||||||||||||||||
| 1316 | if( zRight
| 3-48 | ||||||||||||||||||
| 1317 | - | |||||||||||||||||||
| 1318 | static const VdbeOpList setCookie[] = { | - | ||||||||||||||||||
| 1319 | { 2, 0, 1, 0}, | - | ||||||||||||||||||
| 1320 | { 107, 0, 0, 0}, | - | ||||||||||||||||||
| 1321 | }; | - | ||||||||||||||||||
| 1322 | VdbeOp *aOp; | - | ||||||||||||||||||
| 1323 | ; | - | ||||||||||||||||||
| 1324 | aOp = sqlite3VdbeAddOpList(v, ((int)(sizeof(setCookie)/sizeof(setCookie[0]))), setCookie, 0); | - | ||||||||||||||||||
| 1325 | if( (
dead code: break; | - | ||||||||||||||||||
| 1326 | aOp[0].p1 = iDb; | - | ||||||||||||||||||
| 1327 | aOp[1].p1 = iDb; | - | ||||||||||||||||||
| 1328 | aOp[1].p2 = iCookie; | - | ||||||||||||||||||
| 1329 | aOp[1].p3 = sqlite3Atoi(zRight); | - | ||||||||||||||||||
| 1330 | } executed 23 times by 1 test: else{end of blockExecuted by:
| 23 | ||||||||||||||||||
| 1331 | - | |||||||||||||||||||
| 1332 | static const VdbeOpList readCookie[] = { | - | ||||||||||||||||||
| 1333 | { 2, 0, 0, 0}, | - | ||||||||||||||||||
| 1334 | { 105, 0, 1, 0}, | - | ||||||||||||||||||
| 1335 | { 81, 1, 1, 0} | - | ||||||||||||||||||
| 1336 | }; | - | ||||||||||||||||||
| 1337 | VdbeOp *aOp; | - | ||||||||||||||||||
| 1338 | ; | - | ||||||||||||||||||
| 1339 | aOp = sqlite3VdbeAddOpList(v, ((int)(sizeof(readCookie)/sizeof(readCookie[0]))),readCookie,0); | - | ||||||||||||||||||
| 1340 | if( (
dead code: break; | - | ||||||||||||||||||
| 1341 | aOp[0].p1 = iDb; | - | ||||||||||||||||||
| 1342 | aOp[1].p1 = iDb; | - | ||||||||||||||||||
| 1343 | aOp[1].p3 = iCookie; | - | ||||||||||||||||||
| 1344 | sqlite3VdbeReusable(v); | - | ||||||||||||||||||
| 1345 | } executed 51 times by 1 test: end of blockExecuted by:
| 51 | ||||||||||||||||||
| 1346 | } | - | ||||||||||||||||||
| 1347 | break; executed 74 times by 1 test: break;Executed by:
| 74 | ||||||||||||||||||
| 1348 | case executed 6 times by 1 test: 8:case 8:Executed by:
executed 6 times by 1 test: {case 8:Executed by:
| 6 | ||||||||||||||||||
| 1349 | int i = 0; | - | ||||||||||||||||||
| 1350 | const char *zOpt; | - | ||||||||||||||||||
| 1351 | pParse->nMem = 1; | - | ||||||||||||||||||
| 1352 | while( (
| 6-48 | ||||||||||||||||||
| 1353 | sqlite3VdbeLoadString(v, 1, zOpt); | - | ||||||||||||||||||
| 1354 | sqlite3VdbeAddOp2(v, 81, 1, 1); | - | ||||||||||||||||||
| 1355 | } executed 48 times by 1 test: end of blockExecuted by:
| 48 | ||||||||||||||||||
| 1356 | sqlite3VdbeReusable(v); | - | ||||||||||||||||||
| 1357 | } | - | ||||||||||||||||||
| 1358 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||
| 1359 | case executed 4424 times by 8 tests: 39:case 39:Executed by:
executed 4424 times by 8 tests: {case 39:Executed by:
| 4424 | ||||||||||||||||||
| 1360 | int iBt = (pId2->z
| 19-4405 | ||||||||||||||||||
| 1361 | int eMode = 0; | - | ||||||||||||||||||
| 1362 | if( zRight
| 87-4337 | ||||||||||||||||||
| 1363 | if( sqlite3StrICmp(zRight, "full")==0
| 18-69 | ||||||||||||||||||
| 1364 | eMode = 1; | - | ||||||||||||||||||
| 1365 | } executed 18 times by 1 test: else if( sqlite3StrICmp(zRight, "restart")==0end of blockExecuted by:
| 18-48 | ||||||||||||||||||
| 1366 | eMode = 2; | - | ||||||||||||||||||
| 1367 | } executed 21 times by 1 test: else if( sqlite3StrICmp(zRight, "truncate")==0end of blockExecuted by:
| 21-27 | ||||||||||||||||||
| 1368 | eMode = 3; | - | ||||||||||||||||||
| 1369 | } executed 27 times by 3 tests: end of blockExecuted by:
| 27 | ||||||||||||||||||
| 1370 | } executed 87 times by 3 tests: end of blockExecuted by:
| 87 | ||||||||||||||||||
| 1371 | pParse->nMem = 3; | - | ||||||||||||||||||
| 1372 | sqlite3VdbeAddOp3(v, 6, iBt, eMode, 1); | - | ||||||||||||||||||
| 1373 | sqlite3VdbeAddOp2(v, 81, 1, 3); | - | ||||||||||||||||||
| 1374 | } | - | ||||||||||||||||||
| 1375 | break; executed 4424 times by 8 tests: break;Executed by:
| 4424 | ||||||||||||||||||
| 1376 | case executed 41 times by 2 tests: 38:case 38:Executed by:
executed 41 times by 2 tests: {case 38:Executed by:
| 41 | ||||||||||||||||||
| 1377 | if( zRight
| 2-39 | ||||||||||||||||||
| 1378 | sqlite3_wal_autocheckpoint(db, sqlite3Atoi(zRight)); | - | ||||||||||||||||||
| 1379 | } executed 39 times by 2 tests: end of blockExecuted by:
| 39 | ||||||||||||||||||
| 1380 | returnSingleInt(v, | - | ||||||||||||||||||
| 1381 | db->xWalCallback==sqlite3WalDefaultHook ? | - | ||||||||||||||||||
| 1382 | ((int)(long int)(db->pWalArg)) : 0); | - | ||||||||||||||||||
| 1383 | } | - | ||||||||||||||||||
| 1384 | break; executed 41 times by 2 tests: break;Executed by:
| 41 | ||||||||||||||||||
| 1385 | case executed 4 times by 1 test: 31:case 31:Executed by:
executed 4 times by 1 test: {case 31:Executed by:
| 4 | ||||||||||||||||||
| 1386 | sqlite3_db_release_memory(db); | - | ||||||||||||||||||
| 1387 | break; executed 4 times by 1 test: break;Executed by:
| 4 | ||||||||||||||||||
| 1388 | } | - | ||||||||||||||||||
| 1389 | case executed 5 times by 1 test: 27:case 27:Executed by:
executed 5 times by 1 test: {case 27:Executed by:
| 5 | ||||||||||||||||||
| 1390 | int iDbLast; | - | ||||||||||||||||||
| 1391 | int iTabCur; | - | ||||||||||||||||||
| 1392 | HashElem *k; | - | ||||||||||||||||||
| 1393 | Schema *pSchema; | - | ||||||||||||||||||
| 1394 | Table *pTab; | - | ||||||||||||||||||
| 1395 | Index *pIdx; | - | ||||||||||||||||||
| 1396 | LogEst szThreshold; | - | ||||||||||||||||||
| 1397 | char *zSubSql; | - | ||||||||||||||||||
| 1398 | u32 opMask; | - | ||||||||||||||||||
| 1399 | - | |||||||||||||||||||
| 1400 | if( zRight
| 0-5 | ||||||||||||||||||
| 1401 | opMask = (u32)sqlite3Atoi(zRight); | - | ||||||||||||||||||
| 1402 | if( (
never executed: break; | 0 | ||||||||||||||||||
| 1403 | } never executed: else{end of block | 0 | ||||||||||||||||||
| 1404 | opMask = 0xfffe; | - | ||||||||||||||||||
| 1405 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||
| 1406 | iTabCur = pParse->nTab++; | - | ||||||||||||||||||
| 1407 | for(iDbLast = zDb?iDb:db->nDb-1; iDb<=iDbLast
| 5-10 | ||||||||||||||||||
| 1408 | if( iDb==1
executed 5 times by 1 test: continue;Executed by:
| 5 | ||||||||||||||||||
| 1409 | sqlite3CodeVerifySchema(pParse, iDb); | - | ||||||||||||||||||
| 1410 | pSchema = db->aDb[iDb].pSchema; | - | ||||||||||||||||||
| 1411 | for(k=((&pSchema->tblHash)->first); k
| 5-25 | ||||||||||||||||||
| 1412 | pTab = (Table*)((k)->data); | - | ||||||||||||||||||
| 1413 | - | |||||||||||||||||||
| 1414 | - | |||||||||||||||||||
| 1415 | - | |||||||||||||||||||
| 1416 | - | |||||||||||||||||||
| 1417 | if( (
executed 15 times by 1 test: continue;Executed by:
| 10-15 | ||||||||||||||||||
| 1418 | - | |||||||||||||||||||
| 1419 | - | |||||||||||||||||||
| 1420 | szThreshold = pTab->nRowLogEst + 46; | - | ||||||||||||||||||
| 1421 | ((void) (0)) | - | ||||||||||||||||||
| 1422 | ; | - | ||||||||||||||||||
| 1423 | for(pIdx=pTab->pIndex; pIdx
| 10 | ||||||||||||||||||
| 1424 | if( !pIdx->hasStat1
| 0-10 | ||||||||||||||||||
| 1425 | szThreshold = 0; | - | ||||||||||||||||||
| 1426 | break; never executed: break; | 0 | ||||||||||||||||||
| 1427 | } | - | ||||||||||||||||||
| 1428 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 1429 | if( szThreshold
| 0-10 | ||||||||||||||||||
| 1430 | sqlite3OpenTable(pParse, iTabCur, iDb, pTab, 109); | - | ||||||||||||||||||
| 1431 | sqlite3VdbeAddOp3(v, 33, iTabCur, | - | ||||||||||||||||||
| 1432 | sqlite3VdbeCurrentAddr(v)+2+(opMask&1), szThreshold); | - | ||||||||||||||||||
| 1433 | ; | - | ||||||||||||||||||
| 1434 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 1435 | zSubSql = sqlite3MPrintf(db, "ANALYZE \"%w\".\"%w\"", | - | ||||||||||||||||||
| 1436 | db->aDb[iDb].zDbSName, pTab->zName); | - | ||||||||||||||||||
| 1437 | if( opMask & 0x01
| 0-10 | ||||||||||||||||||
| 1438 | int r1 = sqlite3GetTempReg(pParse); | - | ||||||||||||||||||
| 1439 | sqlite3VdbeAddOp4(v, 106, 0, r1, 0, zSubSql, (-7)); | - | ||||||||||||||||||
| 1440 | sqlite3VdbeAddOp2(v, 81, r1, 1); | - | ||||||||||||||||||
| 1441 | } never executed: else{end of block | 0 | ||||||||||||||||||
| 1442 | sqlite3VdbeAddOp4(v, 142, 0, 0, 0, zSubSql, (-7)); | - | ||||||||||||||||||
| 1443 | } executed 10 times by 1 test: end of blockExecuted by:
| 10 | ||||||||||||||||||
| 1444 | } | - | ||||||||||||||||||
| 1445 | } executed 5 times by 1 test: end of blockExecuted by:
| 5 | ||||||||||||||||||
| 1446 | sqlite3VdbeAddOp0(v, 159); | - | ||||||||||||||||||
| 1447 | break; executed 5 times by 1 test: break;Executed by:
| 5 | ||||||||||||||||||
| 1448 | } | - | ||||||||||||||||||
| 1449 | default executed 6 times by 1 test: :default:Executed by:
executed 6 times by 1 test: {default:Executed by:
| 6 | ||||||||||||||||||
| 1450 | - | |||||||||||||||||||
| 1451 | ((void) (0)) | - | ||||||||||||||||||
| 1452 | ; | - | ||||||||||||||||||
| 1453 | if( zRight
| 2-4 | ||||||||||||||||||
| 1454 | sqlite3_busy_timeout(db, sqlite3Atoi(zRight)); | - | ||||||||||||||||||
| 1455 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 1456 | returnSingleInt(v, db->busyTimeout); | - | ||||||||||||||||||
| 1457 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||||||||||||||
| 1458 | } | - | ||||||||||||||||||
| 1459 | case executed 8 times by 1 test: 32:case 32:Executed by:
executed 8 times by 1 test: {case 32:Executed by:
| 8 | ||||||||||||||||||
| 1460 | sqlite3_int64 N; | - | ||||||||||||||||||
| 1461 | if( zRight
| 0-5 | ||||||||||||||||||
| 1462 | sqlite3_soft_heap_limit64(N); | - | ||||||||||||||||||
| 1463 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||
| 1464 | returnSingleInt(v, sqlite3_soft_heap_limit64(-1)); | - | ||||||||||||||||||
| 1465 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||||||||
| 1466 | } | - | ||||||||||||||||||
| 1467 | case executed 8 times by 1 test: 37:case 37:Executed by:
executed 8 times by 1 test: {case 37:Executed by:
| 8 | ||||||||||||||||||
| 1468 | sqlite3_int64 N; | - | ||||||||||||||||||
| 1469 | if( zRight
| 0-8 | ||||||||||||||||||
| 1470 | && sqlite3DecOrHexToI64(zRight, &N)==0
| 0-8 | ||||||||||||||||||
| 1471 | && N>=0
| 0-8 | ||||||||||||||||||
| 1472 | ){ | - | ||||||||||||||||||
| 1473 | sqlite3_limit(db, 11, (int)(N&0x7fffffff)); | - | ||||||||||||||||||
| 1474 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 1475 | returnSingleInt(v, sqlite3_limit(db, 11, -1)); | - | ||||||||||||||||||
| 1476 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||||||||||||||
| 1477 | } | - | ||||||||||||||||||
| 1478 | - | |||||||||||||||||||
| 1479 | - | |||||||||||||||||||
| 1480 | - | |||||||||||||||||||
| 1481 | - | |||||||||||||||||||
| 1482 | - | |||||||||||||||||||
| 1483 | case executed 102 times by 2 tests: 44:case 44:Executed by:
executed 102 times by 2 tests: {case 44:Executed by:
| 102 | ||||||||||||||||||
| 1484 | static const char *const azLockName[] = { | - | ||||||||||||||||||
| 1485 | "unlocked", "shared", "reserved", "pending", "exclusive" | - | ||||||||||||||||||
| 1486 | }; | - | ||||||||||||||||||
| 1487 | int i; | - | ||||||||||||||||||
| 1488 | pParse->nMem = 2; | - | ||||||||||||||||||
| 1489 | for(i=0; i<db->nDb
| 102-246 | ||||||||||||||||||
| 1490 | Btree *pBt; | - | ||||||||||||||||||
| 1491 | const char *zState = "unknown"; | - | ||||||||||||||||||
| 1492 | int j; | - | ||||||||||||||||||
| 1493 | if( db->aDb[i].zDbSName==0
never executed: continue; | 0-246 | ||||||||||||||||||
| 1494 | pBt = db->aDb[i].pBt; | - | ||||||||||||||||||
| 1495 | if( pBt==0
| 0-161 | ||||||||||||||||||
| 1496 | zState = "closed"; | - | ||||||||||||||||||
| 1497 | } executed 85 times by 2 tests: else if( sqlite3_file_control(db, i ? db->aDb[i].zDbSName : 0,end of blockExecuted by:
| 17-144 | ||||||||||||||||||
| 1498 | 1, &j)==0
| 17-144 | ||||||||||||||||||
| 1499 | zState = azLockName[j]; | - | ||||||||||||||||||
| 1500 | } executed 144 times by 2 tests: end of blockExecuted by:
| 144 | ||||||||||||||||||
| 1501 | sqlite3VdbeMultiLoad(v, 1, "ss", db->aDb[i].zDbSName, zState); | - | ||||||||||||||||||
| 1502 | } executed 246 times by 2 tests: end of blockExecuted by:
| 246 | ||||||||||||||||||
| 1503 | break; executed 102 times by 2 tests: break;Executed by:
| 102 | ||||||||||||||||||
| 1504 | } | - | ||||||||||||||||||
| 1505 | } | - | ||||||||||||||||||
| 1506 | - | |||||||||||||||||||
| 1507 | - | |||||||||||||||||||
| 1508 | - | |||||||||||||||||||
| 1509 | - | |||||||||||||||||||
| 1510 | - | |||||||||||||||||||
| 1511 | - | |||||||||||||||||||
| 1512 | if( (
| 1218-31324 | ||||||||||||||||||
| 1513 | ; | - | ||||||||||||||||||
| 1514 | } executed 2842 times by 29 tests: end of blockExecuted by:
| 2842 | ||||||||||||||||||
| 1515 | - | |||||||||||||||||||
| 1516 | pragma_out: code before this statement executed 35384 times by 52 tests: pragma_out:Executed by:
| 35384 | ||||||||||||||||||
| 1517 | sqlite3DbFree(db, zLeft); | - | ||||||||||||||||||
| 1518 | sqlite3DbFree(db, zRight); | - | ||||||||||||||||||
| 1519 | } executed 35842 times by 52 tests: end of blockExecuted by:
| 35842 | ||||||||||||||||||
| 1520 | - | |||||||||||||||||||
| 1521 | - | |||||||||||||||||||
| 1522 | - | |||||||||||||||||||
| 1523 | - | |||||||||||||||||||
| 1524 | - | |||||||||||||||||||
| 1525 | typedef struct PragmaVtab PragmaVtab; | - | ||||||||||||||||||
| 1526 | typedef struct PragmaVtabCursor PragmaVtabCursor; | - | ||||||||||||||||||
| 1527 | struct PragmaVtab { | - | ||||||||||||||||||
| 1528 | sqlite3_vtab base; | - | ||||||||||||||||||
| 1529 | sqlite3 *db; | - | ||||||||||||||||||
| 1530 | const PragmaName *pName; | - | ||||||||||||||||||
| 1531 | u8 nHidden; | - | ||||||||||||||||||
| 1532 | u8 iHidden; | - | ||||||||||||||||||
| 1533 | }; | - | ||||||||||||||||||
| 1534 | struct PragmaVtabCursor { | - | ||||||||||||||||||
| 1535 | sqlite3_vtab_cursor base; | - | ||||||||||||||||||
| 1536 | sqlite3_stmt *pPragma; | - | ||||||||||||||||||
| 1537 | sqlite_int64 iRowid; | - | ||||||||||||||||||
| 1538 | char *azArg[2]; | - | ||||||||||||||||||
| 1539 | }; | - | ||||||||||||||||||
| 1540 | - | |||||||||||||||||||
| 1541 | - | |||||||||||||||||||
| 1542 | - | |||||||||||||||||||
| 1543 | - | |||||||||||||||||||
| 1544 | static int pragmaVtabConnect( | - | ||||||||||||||||||
| 1545 | sqlite3 *db, | - | ||||||||||||||||||
| 1546 | void *pAux, | - | ||||||||||||||||||
| 1547 | int argc, const char *const*argv, | - | ||||||||||||||||||
| 1548 | sqlite3_vtab **ppVtab, | - | ||||||||||||||||||
| 1549 | char **pzErr | - | ||||||||||||||||||
| 1550 | ){ | - | ||||||||||||||||||
| 1551 | const PragmaName *pPragma = (const PragmaName*)pAux; | - | ||||||||||||||||||
| 1552 | PragmaVtab *pTab = 0; | - | ||||||||||||||||||
| 1553 | int rc; | - | ||||||||||||||||||
| 1554 | int i, j; | - | ||||||||||||||||||
| 1555 | char cSep = '('; | - | ||||||||||||||||||
| 1556 | StrAccum acc; | - | ||||||||||||||||||
| 1557 | char zBuf[200]; | - | ||||||||||||||||||
| 1558 | - | |||||||||||||||||||
| 1559 | (void)(argc); | - | ||||||||||||||||||
| 1560 | (void)(argv); | - | ||||||||||||||||||
| 1561 | sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); | - | ||||||||||||||||||
| 1562 | sqlite3_str_appendall(&acc, "CREATE TABLE x"); | - | ||||||||||||||||||
| 1563 | for(i=0, j=pPragma->iPragCName; i<pPragma->nPragCName
| 8594-51466 | ||||||||||||||||||
| 1564 | sqlite3_str_appendf(&acc, "%c\"%s\"", cSep, pragCName[j]); | - | ||||||||||||||||||
| 1565 | cSep = ','; | - | ||||||||||||||||||
| 1566 | } executed 51466 times by 1 test: end of blockExecuted by:
| 51466 | ||||||||||||||||||
| 1567 | if( i==0
| 1-8593 | ||||||||||||||||||
| 1568 | sqlite3_str_appendf(&acc, "(\"%s\"", pPragma->zName); | - | ||||||||||||||||||
| 1569 | i++; | - | ||||||||||||||||||
| 1570 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 1571 | j = 0; | - | ||||||||||||||||||
| 1572 | if( pPragma->mPragFlg & 0x20
| 1-8593 | ||||||||||||||||||
| 1573 | sqlite3_str_appendall(&acc, ",arg HIDDEN"); | - | ||||||||||||||||||
| 1574 | j++; | - | ||||||||||||||||||
| 1575 | } executed 8593 times by 1 test: end of blockExecuted by:
| 8593 | ||||||||||||||||||
| 1576 | if( pPragma->mPragFlg & (0x40|0x80)
| 1-8593 | ||||||||||||||||||
| 1577 | sqlite3_str_appendall(&acc, ",schema HIDDEN"); | - | ||||||||||||||||||
| 1578 | j++; | - | ||||||||||||||||||
| 1579 | } executed 8593 times by 1 test: end of blockExecuted by:
| 8593 | ||||||||||||||||||
| 1580 | sqlite3_str_append(&acc, ")", 1); | - | ||||||||||||||||||
| 1581 | sqlite3StrAccumFinish(&acc); | - | ||||||||||||||||||
| 1582 | - | |||||||||||||||||||
| 1583 | ((void) (0)) | - | ||||||||||||||||||
| 1584 | ; | - | ||||||||||||||||||
| 1585 | rc = sqlite3_declare_vtab(db, zBuf); | - | ||||||||||||||||||
| 1586 | if( rc==0
| 0-8594 | ||||||||||||||||||
| 1587 | pTab = (PragmaVtab*)sqlite3_malloc(sizeof(PragmaVtab)); | - | ||||||||||||||||||
| 1588 | if( pTab==0
| 0-8594 | ||||||||||||||||||
| 1589 | rc = 7; | - | ||||||||||||||||||
| 1590 | } never executed: else{end of block | 0 | ||||||||||||||||||
| 1591 | memset(pTab, 0, sizeof(PragmaVtab)); | - | ||||||||||||||||||
| 1592 | pTab->pName = pPragma; | - | ||||||||||||||||||
| 1593 | pTab->db = db; | - | ||||||||||||||||||
| 1594 | pTab->iHidden = i; | - | ||||||||||||||||||
| 1595 | pTab->nHidden = j; | - | ||||||||||||||||||
| 1596 | } executed 8594 times by 1 test: end of blockExecuted by:
| 8594 | ||||||||||||||||||
| 1597 | }else{ | - | ||||||||||||||||||
| 1598 | *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); | - | ||||||||||||||||||
| 1599 | } never executed: end of block | 0 | ||||||||||||||||||
| 1600 | - | |||||||||||||||||||
| 1601 | *ppVtab = (sqlite3_vtab*)pTab; | - | ||||||||||||||||||
| 1602 | return executed 8594 times by 1 test: rc;return rc;Executed by:
executed 8594 times by 1 test: return rc;Executed by:
| 8594 | ||||||||||||||||||
| 1603 | } | - | ||||||||||||||||||
| 1604 | - | |||||||||||||||||||
| 1605 | - | |||||||||||||||||||
| 1606 | - | |||||||||||||||||||
| 1607 | - | |||||||||||||||||||
| 1608 | static int pragmaVtabDisconnect(sqlite3_vtab *pVtab){ | - | ||||||||||||||||||
| 1609 | PragmaVtab *pTab = (PragmaVtab*)pVtab; | - | ||||||||||||||||||
| 1610 | sqlite3_free(pTab); | - | ||||||||||||||||||
| 1611 | return executed 8594 times by 1 test: 0;return 0;Executed by:
executed 8594 times by 1 test: return 0;Executed by:
| 8594 | ||||||||||||||||||
| 1612 | } | - | ||||||||||||||||||
| 1613 | static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ | - | ||||||||||||||||||
| 1614 | PragmaVtab *pTab = (PragmaVtab*)tab; | - | ||||||||||||||||||
| 1615 | const struct sqlite3_index_constraint *pConstraint; | - | ||||||||||||||||||
| 1616 | int i, j; | - | ||||||||||||||||||
| 1617 | int seen[2]; | - | ||||||||||||||||||
| 1618 | - | |||||||||||||||||||
| 1619 | pIdxInfo->estimatedCost = (double)1; | - | ||||||||||||||||||
| 1620 | if( pTab->nHidden==0
executed 1 time by 1 test: 0;return 0;Executed by:
executed 1 time by 1 test: }return 0;Executed by:
| 1-8738 | ||||||||||||||||||
| 1621 | pConstraint = pIdxInfo->aConstraint; | - | ||||||||||||||||||
| 1622 | seen[0] = 0; | - | ||||||||||||||||||
| 1623 | seen[1] = 0; | - | ||||||||||||||||||
| 1624 | for(i=0; i<pIdxInfo->nConstraint
| 8738-17357 | ||||||||||||||||||
| 1625 | if( pConstraint->usable==0
executed 69 times by 1 test: continue;Executed by:
| 69-17288 | ||||||||||||||||||
| 1626 | if( pConstraint->op!=2
never executed: continue; | 0-17288 | ||||||||||||||||||
| 1627 | if( pConstraint->iColumn < pTab->iHidden
executed 47 times by 1 test: continue;Executed by:
| 47-17241 | ||||||||||||||||||
| 1628 | j = pConstraint->iColumn - pTab->iHidden; | - | ||||||||||||||||||
| 1629 | - | |||||||||||||||||||
| 1630 | ((void) (0)) | - | ||||||||||||||||||
| 1631 | ; | - | ||||||||||||||||||
| 1632 | seen[j] = i+1; | - | ||||||||||||||||||
| 1633 | } executed 17241 times by 1 test: end of blockExecuted by:
| 17241 | ||||||||||||||||||
| 1634 | if( seen[0]==0
| 69-8669 | ||||||||||||||||||
| 1635 | pIdxInfo->estimatedCost = (double)2147483647; | - | ||||||||||||||||||
| 1636 | pIdxInfo->estimatedRows = 2147483647; | - | ||||||||||||||||||
| 1637 | return executed 69 times by 1 test: 0;return 0;Executed by:
executed 69 times by 1 test: return 0;Executed by:
| 69 | ||||||||||||||||||
| 1638 | } | - | ||||||||||||||||||
| 1639 | j = seen[0]-1; | - | ||||||||||||||||||
| 1640 | pIdxInfo->aConstraintUsage[j].argvIndex = 1; | - | ||||||||||||||||||
| 1641 | pIdxInfo->aConstraintUsage[j].omit = 1; | - | ||||||||||||||||||
| 1642 | if( seen[1]==0
executed 97 times by 1 test: 0;return 0;Executed by:
executed 97 times by 1 test: return 0;Executed by:
| 97-8572 | ||||||||||||||||||
| 1643 | pIdxInfo->estimatedCost = (double)20; | - | ||||||||||||||||||
| 1644 | pIdxInfo->estimatedRows = 20; | - | ||||||||||||||||||
| 1645 | j = seen[1]-1; | - | ||||||||||||||||||
| 1646 | pIdxInfo->aConstraintUsage[j].argvIndex = 2; | - | ||||||||||||||||||
| 1647 | pIdxInfo->aConstraintUsage[j].omit = 1; | - | ||||||||||||||||||
| 1648 | return executed 8572 times by 1 test: 0;return 0;Executed by:
executed 8572 times by 1 test: return 0;Executed by:
| 8572 | ||||||||||||||||||
| 1649 | } | - | ||||||||||||||||||
| 1650 | - | |||||||||||||||||||
| 1651 | - | |||||||||||||||||||
| 1652 | static int pragmaVtabOpen(sqlite3_vtab *pVtab, sqlite3_vtab_cursor **ppCursor){ | - | ||||||||||||||||||
| 1653 | PragmaVtabCursor *pCsr; | - | ||||||||||||||||||
| 1654 | pCsr = (PragmaVtabCursor*)sqlite3_malloc(sizeof(*pCsr)); | - | ||||||||||||||||||
| 1655 | if( pCsr==0
never executed: 7;return 7;never executed: return 7; | 0-8680 | ||||||||||||||||||
| 1656 | memset(pCsr, 0, sizeof(PragmaVtabCursor)); | - | ||||||||||||||||||
| 1657 | pCsr->base.pVtab = pVtab; | - | ||||||||||||||||||
| 1658 | *ppCursor = &pCsr->base; | - | ||||||||||||||||||
| 1659 | return executed 8680 times by 1 test: 0;return 0;Executed by:
executed 8680 times by 1 test: return 0;Executed by:
| 8680 | ||||||||||||||||||
| 1660 | } | - | ||||||||||||||||||
| 1661 | - | |||||||||||||||||||
| 1662 | - | |||||||||||||||||||
| 1663 | static void pragmaVtabCursorClear(PragmaVtabCursor *pCsr){ | - | ||||||||||||||||||
| 1664 | int i; | - | ||||||||||||||||||
| 1665 | sqlite3_finalize(pCsr->pPragma); | - | ||||||||||||||||||
| 1666 | pCsr->pPragma = 0; | - | ||||||||||||||||||
| 1667 | for(i=0; i<((int)(sizeof(pCsr->azArg)/sizeof(pCsr->azArg[0])))
| 26110-52220 | ||||||||||||||||||
| 1668 | sqlite3_free(pCsr->azArg[i]); | - | ||||||||||||||||||
| 1669 | pCsr->azArg[i] = 0; | - | ||||||||||||||||||
| 1670 | } executed 52220 times by 1 test: end of blockExecuted by:
| 52220 | ||||||||||||||||||
| 1671 | } executed 26110 times by 1 test: end of blockExecuted by:
| 26110 | ||||||||||||||||||
| 1672 | - | |||||||||||||||||||
| 1673 | - | |||||||||||||||||||
| 1674 | static int pragmaVtabClose(sqlite3_vtab_cursor *cur){ | - | ||||||||||||||||||
| 1675 | PragmaVtabCursor *pCsr = (PragmaVtabCursor*)cur; | - | ||||||||||||||||||
| 1676 | pragmaVtabCursorClear(pCsr); | - | ||||||||||||||||||
| 1677 | sqlite3_free(pCsr); | - | ||||||||||||||||||
| 1678 | return executed 8680 times by 1 test: 0;return 0;Executed by:
executed 8680 times by 1 test: return 0;Executed by:
| 8680 | ||||||||||||||||||
| 1679 | } | - | ||||||||||||||||||
| 1680 | - | |||||||||||||||||||
| 1681 | - | |||||||||||||||||||
| 1682 | static int pragmaVtabNext(sqlite3_vtab_cursor *pVtabCursor){ | - | ||||||||||||||||||
| 1683 | PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor; | - | ||||||||||||||||||
| 1684 | int rc = 0; | - | ||||||||||||||||||
| 1685 | - | |||||||||||||||||||
| 1686 | - | |||||||||||||||||||
| 1687 | pCsr->iRowid++; | - | ||||||||||||||||||
| 1688 | - | |||||||||||||||||||
| 1689 | ((void) (0)) | - | ||||||||||||||||||
| 1690 | ; | - | ||||||||||||||||||
| 1691 | if( 100!=sqlite3_step(pCsr->pPragma)
| 8712-17330 | ||||||||||||||||||
| 1692 | rc = sqlite3_finalize(pCsr->pPragma); | - | ||||||||||||||||||
| 1693 | pCsr->pPragma = 0; | - | ||||||||||||||||||
| 1694 | pragmaVtabCursorClear(pCsr); | - | ||||||||||||||||||
| 1695 | } executed 8712 times by 1 test: end of blockExecuted by:
| 8712 | ||||||||||||||||||
| 1696 | return executed 26042 times by 1 test: rc;return rc;Executed by:
executed 26042 times by 1 test: return rc;Executed by:
| 26042 | ||||||||||||||||||
| 1697 | } | - | ||||||||||||||||||
| 1698 | - | |||||||||||||||||||
| 1699 | - | |||||||||||||||||||
| 1700 | - | |||||||||||||||||||
| 1701 | - | |||||||||||||||||||
| 1702 | static int pragmaVtabFilter( | - | ||||||||||||||||||
| 1703 | sqlite3_vtab_cursor *pVtabCursor, | - | ||||||||||||||||||
| 1704 | int idxNum, const char *idxStr, | - | ||||||||||||||||||
| 1705 | int argc, sqlite3_value **argv | - | ||||||||||||||||||
| 1706 | ){ | - | ||||||||||||||||||
| 1707 | PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor; | - | ||||||||||||||||||
| 1708 | PragmaVtab *pTab = (PragmaVtab*)(pVtabCursor->pVtab); | - | ||||||||||||||||||
| 1709 | int rc; | - | ||||||||||||||||||
| 1710 | int i, j; | - | ||||||||||||||||||
| 1711 | StrAccum acc; | - | ||||||||||||||||||
| 1712 | char *zSql; | - | ||||||||||||||||||
| 1713 | - | |||||||||||||||||||
| 1714 | (void)(idxNum); | - | ||||||||||||||||||
| 1715 | (void)(idxStr); | - | ||||||||||||||||||
| 1716 | pragmaVtabCursorClear(pCsr); | - | ||||||||||||||||||
| 1717 | j = (
| 1-8717 | ||||||||||||||||||
| 1718 | for(i=0; i<argc
| 8718-17289 | ||||||||||||||||||
| 1719 | const char *zText = (const char*)sqlite3_value_text(argv[i]); | - | ||||||||||||||||||
| 1720 | - | |||||||||||||||||||
| 1721 | ((void) (0)) | - | ||||||||||||||||||
| 1722 | ; | - | ||||||||||||||||||
| 1723 | - | |||||||||||||||||||
| 1724 | ((void) (0)) | - | ||||||||||||||||||
| 1725 | ; | - | ||||||||||||||||||
| 1726 | if( zText
| 8556-8733 | ||||||||||||||||||
| 1727 | pCsr->azArg[j] = sqlite3_mprintf("%s", zText); | - | ||||||||||||||||||
| 1728 | if( pCsr->azArg[j]==0
| 0-8733 | ||||||||||||||||||
| 1729 | return never executed: 7;return 7;never executed: return 7; | 0 | ||||||||||||||||||
| 1730 | } | - | ||||||||||||||||||
| 1731 | } executed 8733 times by 1 test: end of blockExecuted by:
| 8733 | ||||||||||||||||||
| 1732 | } executed 17289 times by 1 test: end of blockExecuted by:
| 17289 | ||||||||||||||||||
| 1733 | sqlite3StrAccumInit(&acc, 0, 0, 0, pTab->db->aLimit[1]); | - | ||||||||||||||||||
| 1734 | sqlite3_str_appendall(&acc, "PRAGMA "); | - | ||||||||||||||||||
| 1735 | if( pCsr->azArg[1]
| 16-8702 | ||||||||||||||||||
| 1736 | sqlite3_str_appendf(&acc, "%Q.", pCsr->azArg[1]); | - | ||||||||||||||||||
| 1737 | } executed 16 times by 1 test: end of blockExecuted by:
| 16 | ||||||||||||||||||
| 1738 | sqlite3_str_appendall(&acc, pTab->pName->zName); | - | ||||||||||||||||||
| 1739 | if( pCsr->azArg[0]
| 1-8717 | ||||||||||||||||||
| 1740 | sqlite3_str_appendf(&acc, "=%Q", pCsr->azArg[0]); | - | ||||||||||||||||||
| 1741 | } executed 8717 times by 1 test: end of blockExecuted by:
| 8717 | ||||||||||||||||||
| 1742 | zSql = sqlite3StrAccumFinish(&acc); | - | ||||||||||||||||||
| 1743 | if( zSql==0
never executed: 7;return 7;never executed: return 7; | 0-8718 | ||||||||||||||||||
| 1744 | rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pPragma, 0); | - | ||||||||||||||||||
| 1745 | sqlite3_free(zSql); | - | ||||||||||||||||||
| 1746 | if( rc!=0
| 0-8718 | ||||||||||||||||||
| 1747 | pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db)); | - | ||||||||||||||||||
| 1748 | return never executed: rc;return rc;never executed: return rc; | 0 | ||||||||||||||||||
| 1749 | } | - | ||||||||||||||||||
| 1750 | return executed 8718 times by 1 test: pragmaVtabNext(pVtabCursor);return pragmaVtabNext(pVtabCursor);Executed by:
executed 8718 times by 1 test: return pragmaVtabNext(pVtabCursor);Executed by:
| 8718 | ||||||||||||||||||
| 1751 | } | - | ||||||||||||||||||
| 1752 | - | |||||||||||||||||||
| 1753 | - | |||||||||||||||||||
| 1754 | - | |||||||||||||||||||
| 1755 | - | |||||||||||||||||||
| 1756 | static int pragmaVtabEof(sqlite3_vtab_cursor *pVtabCursor){ | - | ||||||||||||||||||
| 1757 | PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor; | - | ||||||||||||||||||
| 1758 | return executed 26042 times by 1 test: (pCsr->pPragma==0);return (pCsr->pPragma==0);Executed by:
executed 26042 times by 1 test: return (pCsr->pPragma==0);Executed by:
| 26042 | ||||||||||||||||||
| 1759 | } | - | ||||||||||||||||||
| 1760 | - | |||||||||||||||||||
| 1761 | - | |||||||||||||||||||
| 1762 | - | |||||||||||||||||||
| 1763 | - | |||||||||||||||||||
| 1764 | static int pragmaVtabColumn( | - | ||||||||||||||||||
| 1765 | sqlite3_vtab_cursor *pVtabCursor, | - | ||||||||||||||||||
| 1766 | sqlite3_context *ctx, | - | ||||||||||||||||||
| 1767 | int i | - | ||||||||||||||||||
| 1768 | ){ | - | ||||||||||||||||||
| 1769 | PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor; | - | ||||||||||||||||||
| 1770 | PragmaVtab *pTab = (PragmaVtab*)(pVtabCursor->pVtab); | - | ||||||||||||||||||
| 1771 | if( i<pTab->iHidden
| 0-34671 | ||||||||||||||||||
| 1772 | sqlite3_result_value(ctx, sqlite3_column_value(pCsr->pPragma, i)); | - | ||||||||||||||||||
| 1773 | } executed 34671 times by 1 test: else{end of blockExecuted by:
| 34671 | ||||||||||||||||||
| 1774 | sqlite3_result_text(ctx, pCsr->azArg[i-pTab->iHidden],-1,((sqlite3_destructor_type)-1)); | - | ||||||||||||||||||
| 1775 | } never executed: end of block | 0 | ||||||||||||||||||
| 1776 | return executed 34671 times by 1 test: 0;return 0;Executed by:
executed 34671 times by 1 test: return 0;Executed by:
| 34671 | ||||||||||||||||||
| 1777 | } | - | ||||||||||||||||||
| 1778 | - | |||||||||||||||||||
| 1779 | - | |||||||||||||||||||
| 1780 | - | |||||||||||||||||||
| 1781 | - | |||||||||||||||||||
| 1782 | static int pragmaVtabRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *p){ | - | ||||||||||||||||||
| 1783 | PragmaVtabCursor *pCsr = (PragmaVtabCursor*)pVtabCursor; | - | ||||||||||||||||||
| 1784 | *p = pCsr->iRowid; | - | ||||||||||||||||||
| 1785 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 1786 | } | - | ||||||||||||||||||
| 1787 | - | |||||||||||||||||||
| 1788 | - | |||||||||||||||||||
| 1789 | static const sqlite3_module pragmaVtabModule = { | - | ||||||||||||||||||
| 1790 | 0, | - | ||||||||||||||||||
| 1791 | 0, | - | ||||||||||||||||||
| 1792 | pragmaVtabConnect, | - | ||||||||||||||||||
| 1793 | pragmaVtabBestIndex, | - | ||||||||||||||||||
| 1794 | pragmaVtabDisconnect, | - | ||||||||||||||||||
| 1795 | 0, | - | ||||||||||||||||||
| 1796 | pragmaVtabOpen, | - | ||||||||||||||||||
| 1797 | pragmaVtabClose, | - | ||||||||||||||||||
| 1798 | pragmaVtabFilter, | - | ||||||||||||||||||
| 1799 | pragmaVtabNext, | - | ||||||||||||||||||
| 1800 | pragmaVtabEof, | - | ||||||||||||||||||
| 1801 | pragmaVtabColumn, | - | ||||||||||||||||||
| 1802 | pragmaVtabRowid, | - | ||||||||||||||||||
| 1803 | 0, | - | ||||||||||||||||||
| 1804 | 0, | - | ||||||||||||||||||
| 1805 | 0, | - | ||||||||||||||||||
| 1806 | 0, | - | ||||||||||||||||||
| 1807 | 0, | - | ||||||||||||||||||
| 1808 | 0, | - | ||||||||||||||||||
| 1809 | 0, | - | ||||||||||||||||||
| 1810 | 0, | - | ||||||||||||||||||
| 1811 | 0, | - | ||||||||||||||||||
| 1812 | 0 | - | ||||||||||||||||||
| 1813 | }; | - | ||||||||||||||||||
| 1814 | - | |||||||||||||||||||
| 1815 | - | |||||||||||||||||||
| 1816 | - | |||||||||||||||||||
| 1817 | - | |||||||||||||||||||
| 1818 | - | |||||||||||||||||||
| 1819 | - | |||||||||||||||||||
| 1820 | Module *sqlite3PragmaVtabRegister(sqlite3 *db, const char *zName){ | - | ||||||||||||||||||
| 1821 | const PragmaName *pName; | - | ||||||||||||||||||
| 1822 | - | |||||||||||||||||||
| 1823 | ((void) (0)) | - | ||||||||||||||||||
| 1824 | ; | - | ||||||||||||||||||
| 1825 | pName = pragmaLocate(zName+7); | - | ||||||||||||||||||
| 1826 | if( pName==0
executed 1 time by 1 test: 0;return 0;Executed by:
executed 1 time by 1 test: return 0;Executed by:
| 1-8594 | ||||||||||||||||||
| 1827 | if( (
never executed: 0;return 0;never executed: return 0; | 0-8594 | ||||||||||||||||||
| 1828 | - | |||||||||||||||||||
| 1829 | ((void) (0)) | - | ||||||||||||||||||
| 1830 | ; | - | ||||||||||||||||||
| 1831 | return executed 8594 times by 1 test: sqlite3VtabCreateModule(db, zName, &pragmaVtabModule, (void*)pName, 0);return sqlite3VtabCreateModule(db, zName, &pragmaVtabModule, (void*)pName, 0);Executed by:
executed 8594 times by 1 test: return sqlite3VtabCreateModule(db, zName, &pragmaVtabModule, (void*)pName, 0);Executed by:
| 8594 | ||||||||||||||||||
| 1832 | } | - | ||||||||||||||||||
| Switch to Source code | Preprocessed file |