| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/sqlite/src/src/wherecode.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | static const char *explainIndexColumnName(Index *pIdx, int i){ | - | ||||||||||||||||||||||||
| 8 | i = pIdx->aiColumn[i]; | - | ||||||||||||||||||||||||
| 9 | if( i==(-2)
executed 15 times by 1 test: "<expr>";return "<expr>";Executed by:
executed 15 times by 1 test: return "<expr>";Executed by:
| 15-624 | ||||||||||||||||||||||||
| 10 | if( i==(-1)
executed 3 times by 1 test: "rowid";return "rowid";Executed by:
executed 3 times by 1 test: return "rowid";Executed by:
| 3-621 | ||||||||||||||||||||||||
| 11 | return executed 621 times by 1 test: pIdx->pTable->aCol[i].zName;return pIdx->pTable->aCol[i].zName;Executed by:
executed 621 times by 1 test: return pIdx->pTable->aCol[i].zName;Executed by:
| 621 | ||||||||||||||||||||||||
| 12 | } | - | ||||||||||||||||||||||||
| 13 | static void explainAppendTerm( | - | ||||||||||||||||||||||||
| 14 | StrAccum *pStr, | - | ||||||||||||||||||||||||
| 15 | Index *pIdx, | - | ||||||||||||||||||||||||
| 16 | int nTerm, | - | ||||||||||||||||||||||||
| 17 | int iTerm, | - | ||||||||||||||||||||||||
| 18 | int bAnd, | - | ||||||||||||||||||||||||
| 19 | const char *zOp | - | ||||||||||||||||||||||||
| 20 | ){ | - | ||||||||||||||||||||||||
| 21 | int i; | - | ||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||
| 24 | ((void) (0)) | - | ||||||||||||||||||||||||
| 25 | ; | - | ||||||||||||||||||||||||
| 26 | if( bAnd
executed 98 times by 1 test: sqlite3_str_append(pStr, " AND ", 5);Executed by:
| 81-98 | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | if( nTerm>1
executed 6 times by 1 test: sqlite3_str_append(pStr, "(", 1);Executed by:
| 6-173 | ||||||||||||||||||||||||
| 29 | for(i=0; i<nTerm
| 179-185 | ||||||||||||||||||||||||
| 30 | if( i
executed 6 times by 1 test: sqlite3_str_append(pStr, ",", 1);Executed by:
| 6-179 | ||||||||||||||||||||||||
| 31 | sqlite3_str_appendall(pStr, explainIndexColumnName(pIdx, iTerm+i)); | - | ||||||||||||||||||||||||
| 32 | } executed 185 times by 1 test: end of blockExecuted by:
| 185 | ||||||||||||||||||||||||
| 33 | if( nTerm>1
executed 6 times by 1 test: sqlite3_str_append(pStr, ")", 1);Executed by:
| 6-173 | ||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | sqlite3_str_append(pStr, zOp, 1); | - | ||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||
| 37 | if( nTerm>1
executed 6 times by 1 test: sqlite3_str_append(pStr, "(", 1);Executed by:
| 6-173 | ||||||||||||||||||||||||
| 38 | for(i=0; i<nTerm
| 179-185 | ||||||||||||||||||||||||
| 39 | if( i
executed 6 times by 1 test: sqlite3_str_append(pStr, ",", 1);Executed by:
| 6-179 | ||||||||||||||||||||||||
| 40 | sqlite3_str_append(pStr, "?", 1); | - | ||||||||||||||||||||||||
| 41 | } executed 185 times by 1 test: end of blockExecuted by:
| 185 | ||||||||||||||||||||||||
| 42 | if( nTerm>1
executed 6 times by 1 test: sqlite3_str_append(pStr, ")", 1);Executed by:
| 6-173 | ||||||||||||||||||||||||
| 43 | } executed 179 times by 1 test: end of blockExecuted by:
| 179 | ||||||||||||||||||||||||
| 44 | static void explainIndexRange(StrAccum *pStr, WhereLoop *pLoop){ | - | ||||||||||||||||||||||||
| 45 | Index *pIndex = pLoop->u.btree.pIndex; | - | ||||||||||||||||||||||||
| 46 | u16 nEq = pLoop->u.btree.nEq; | - | ||||||||||||||||||||||||
| 47 | u16 nSkip = pLoop->nSkip; | - | ||||||||||||||||||||||||
| 48 | int i, j; | - | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | if( nEq==0
executed 116 times by 1 test: return;Executed by:
| 81-323 | ||||||||||||||||||||||||
| 51 | sqlite3_str_append(pStr, " (", 2); | - | ||||||||||||||||||||||||
| 52 | for(i=0; i<nEq
| 404-454 | ||||||||||||||||||||||||
| 53 | const char *z = explainIndexColumnName(pIndex, i); | - | ||||||||||||||||||||||||
| 54 | if( i
executed 131 times by 1 test: sqlite3_str_append(pStr, " AND ", 5);Executed by:
| 131-323 | ||||||||||||||||||||||||
| 55 | sqlite3_str_appendf(pStr, i>=nSkip ? "%s=?" : "ANY(%s)", z); | - | ||||||||||||||||||||||||
| 56 | } executed 454 times by 1 test: end of blockExecuted by:
| 454 | ||||||||||||||||||||||||
| 57 | - | |||||||||||||||||||||||||
| 58 | j = i; | - | ||||||||||||||||||||||||
| 59 | if( pLoop->wsFlags&0x00000020
| 105-299 | ||||||||||||||||||||||||
| 60 | explainAppendTerm(pStr, pIndex, pLoop->u.btree.nBtm, j, i, ">"); | - | ||||||||||||||||||||||||
| 61 | i = 1; | - | ||||||||||||||||||||||||
| 62 | } executed 105 times by 1 test: end of blockExecuted by:
| 105 | ||||||||||||||||||||||||
| 63 | if( pLoop->wsFlags&0x00000010
| 74-330 | ||||||||||||||||||||||||
| 64 | explainAppendTerm(pStr, pIndex, pLoop->u.btree.nTop, j, i, "<"); | - | ||||||||||||||||||||||||
| 65 | } executed 74 times by 1 test: end of blockExecuted by:
| 74 | ||||||||||||||||||||||||
| 66 | sqlite3_str_append(pStr, ")", 1); | - | ||||||||||||||||||||||||
| 67 | } executed 404 times by 1 test: end of blockExecuted by:
| 404 | ||||||||||||||||||||||||
| 68 | int sqlite3WhereExplainOneScan( | - | ||||||||||||||||||||||||
| 69 | Parse *pParse, | - | ||||||||||||||||||||||||
| 70 | SrcList *pTabList, | - | ||||||||||||||||||||||||
| 71 | WhereLevel *pLevel, | - | ||||||||||||||||||||||||
| 72 | u16 wctrlFlags | - | ||||||||||||||||||||||||
| 73 | ){ | - | ||||||||||||||||||||||||
| 74 | int ret = 0; | - | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | if( ((
| 746-295537 | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | { | - | ||||||||||||||||||||||||
| 79 | struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom]; | - | ||||||||||||||||||||||||
| 80 | Vdbe *v = pParse->pVdbe; | - | ||||||||||||||||||||||||
| 81 | sqlite3 *db = pParse->db; | - | ||||||||||||||||||||||||
| 82 | int isSearch; | - | ||||||||||||||||||||||||
| 83 | WhereLoop *pLoop; | - | ||||||||||||||||||||||||
| 84 | u32 flags; | - | ||||||||||||||||||||||||
| 85 | char *zMsg; | - | ||||||||||||||||||||||||
| 86 | StrAccum str; | - | ||||||||||||||||||||||||
| 87 | char zBuf[100]; | - | ||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||
| 89 | pLoop = pLevel->pWLoop; | - | ||||||||||||||||||||||||
| 90 | flags = pLoop->wsFlags; | - | ||||||||||||||||||||||||
| 91 | if( (
executed 64 times by 1 test: 0;return 0;Executed by:
executed 64 times by 1 test: return 0;Executed by:
| 21-929 | ||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | isSearch = (
| 116-770 | ||||||||||||||||||||||||
| 94 | || ((
| 26-744 | ||||||||||||||||||||||||
| 95 | || (
| 5-380 | ||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), 1000000000); | - | ||||||||||||||||||||||||
| 98 | sqlite3_str_appendall(&str, isSearch ? "SEARCH" : "SCAN"); | - | ||||||||||||||||||||||||
| 99 | if( pItem->pSelect
| 21-865 | ||||||||||||||||||||||||
| 100 | sqlite3_str_appendf(&str, " SUBQUERY %u", pItem->pSelect->selId); | - | ||||||||||||||||||||||||
| 101 | } executed 21 times by 1 test: else{end of blockExecuted by:
| 21 | ||||||||||||||||||||||||
| 102 | sqlite3_str_appendf(&str, " TABLE %s", pItem->zName); | - | ||||||||||||||||||||||||
| 103 | } executed 865 times by 1 test: end of blockExecuted by:
| 865 | ||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | if( pItem->zAlias
| 42-844 | ||||||||||||||||||||||||
| 106 | sqlite3_str_appendf(&str, " AS %s", pItem->zAlias); | - | ||||||||||||||||||||||||
| 107 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||
| 108 | if( (
| 363-523 | ||||||||||||||||||||||||
| 109 | const char *zFmt = 0; | - | ||||||||||||||||||||||||
| 110 | Index *pIdx; | - | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||
| 113 | ((void) (0)) | - | ||||||||||||||||||||||||
| 114 | ; | - | ||||||||||||||||||||||||
| 115 | pIdx = pLoop->u.btree.pIndex; | - | ||||||||||||||||||||||||
| 116 | - | |||||||||||||||||||||||||
| 117 | ((void) (0)) | - | ||||||||||||||||||||||||
| 118 | ; | - | ||||||||||||||||||||||||
| 119 | if( !(((pItem->pTab)->tabFlags & 0x0020)==0)
| 12-487 | ||||||||||||||||||||||||
| 120 | if( isSearch
| 3-9 | ||||||||||||||||||||||||
| 121 | zFmt = "PRIMARY KEY"; | - | ||||||||||||||||||||||||
| 122 | } executed 9 times by 1 test: end of blockExecuted by:
| 9 | ||||||||||||||||||||||||
| 123 | } executed 12 times by 1 test: else if( flags & 0x00020000end of blockExecuted by:
| 0-511 | ||||||||||||||||||||||||
| 124 | zFmt = "AUTOMATIC PARTIAL COVERING INDEX"; | - | ||||||||||||||||||||||||
| 125 | } never executed: else if( flags & 0x00004000end of block
| 0-498 | ||||||||||||||||||||||||
| 126 | zFmt = "AUTOMATIC COVERING INDEX"; | - | ||||||||||||||||||||||||
| 127 | } executed 13 times by 1 test: else if( flags & 0x00000040end of blockExecuted by:
| 13-328 | ||||||||||||||||||||||||
| 128 | zFmt = "COVERING INDEX %s"; | - | ||||||||||||||||||||||||
| 129 | } executed 170 times by 1 test: else{end of blockExecuted by:
| 170 | ||||||||||||||||||||||||
| 130 | zFmt = "INDEX %s"; | - | ||||||||||||||||||||||||
| 131 | } executed 328 times by 1 test: end of blockExecuted by:
| 328 | ||||||||||||||||||||||||
| 132 | if( zFmt
| 3-520 | ||||||||||||||||||||||||
| 133 | sqlite3_str_append(&str, " USING ", 7); | - | ||||||||||||||||||||||||
| 134 | sqlite3_str_appendf(&str, zFmt, pIdx->zName); | - | ||||||||||||||||||||||||
| 135 | explainIndexRange(&str, pLoop); | - | ||||||||||||||||||||||||
| 136 | } executed 520 times by 1 test: end of blockExecuted by:
| 520 | ||||||||||||||||||||||||
| 137 | } executed 523 times by 1 test: else if( (end of blockExecuted by:
| 26-523 | ||||||||||||||||||||||||
| 138 | const char *zRangeOp; | - | ||||||||||||||||||||||||
| 139 | if( flags&(0x00000001|0x00000004)
| 3-94 | ||||||||||||||||||||||||
| 140 | zRangeOp = "="; | - | ||||||||||||||||||||||||
| 141 | } executed 94 times by 1 test: else if( (end of blockExecuted by:
| 0-94 | ||||||||||||||||||||||||
| 142 | zRangeOp = ">? AND rowid<"; | - | ||||||||||||||||||||||||
| 143 | } never executed: else if( flags&0x00000020end of block
| 0-2 | ||||||||||||||||||||||||
| 144 | zRangeOp = ">"; | - | ||||||||||||||||||||||||
| 145 | } executed 2 times by 1 test: else{end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | ((void) (0)) | - | ||||||||||||||||||||||||
| 148 | ; | - | ||||||||||||||||||||||||
| 149 | zRangeOp = "<"; | - | ||||||||||||||||||||||||
| 150 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||||||||
| 151 | sqlite3_str_appendf(&str, | - | ||||||||||||||||||||||||
| 152 | " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp); | - | ||||||||||||||||||||||||
| 153 | } executed 97 times by 1 test: end of blockExecuted by:
| 97 | ||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||
| 155 | else if( (
| 26-240 | ||||||||||||||||||||||||
| 156 | sqlite3_str_appendf(&str, " VIRTUAL TABLE INDEX %d:%s", | - | ||||||||||||||||||||||||
| 157 | pLoop->u.vtab.idxNum, pLoop->u.vtab.idxStr); | - | ||||||||||||||||||||||||
| 158 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 159 | zMsg = sqlite3StrAccumFinish(&str); | - | ||||||||||||||||||||||||
| 160 | ret = sqlite3VdbeAddOp4(v, 172, sqlite3VdbeCurrentAddr(v), | - | ||||||||||||||||||||||||
| 161 | pParse->addrExplain, 0, zMsg,(-7)); | - | ||||||||||||||||||||||||
| 162 | } executed 886 times by 1 test: end of blockExecuted by:
| 886 | ||||||||||||||||||||||||
| 163 | return executed 296219 times by 435 tests: ret;return ret;Executed by:
executed 296219 times by 435 tests: return ret;Executed by:
| 296219 | ||||||||||||||||||||||||
| 164 | } | - | ||||||||||||||||||||||||
| 165 | static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){ | - | ||||||||||||||||||||||||
| 166 | int nLoop = 0; | - | ||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||
| 168 | ((void) (0)) | - | ||||||||||||||||||||||||
| 169 | ; | - | ||||||||||||||||||||||||
| 170 | while( (
| 50-93044 | ||||||||||||||||||||||||
| 171 | && (pLevel->iLeftJoin==0
| 1-92424 | ||||||||||||||||||||||||
| 172 | && (
| 19-93024 | ||||||||||||||||||||||||
| 173 | ){ | - | ||||||||||||||||||||||||
| 174 | if( nLoop
| 225-87754 | ||||||||||||||||||||||||
| 175 | pTerm->wtFlags |= 0x200; | - | ||||||||||||||||||||||||
| 176 | } executed 225 times by 1 test: else{end of blockExecuted by:
| 225 | ||||||||||||||||||||||||
| 177 | pTerm->wtFlags |= 0x04; | - | ||||||||||||||||||||||||
| 178 | } executed 92799 times by 30 tests: end of blockExecuted by:
| 92799 | ||||||||||||||||||||||||
| 179 | if( pTerm->iParent<0
executed 83755 times by 30 tests: break;Executed by:
| 9269-83755 | ||||||||||||||||||||||||
| 180 | pTerm = &pTerm->pWC->a[pTerm->iParent]; | - | ||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||
| 182 | ((void) (0)) | - | ||||||||||||||||||||||||
| 183 | ; | - | ||||||||||||||||||||||||
| 184 | pTerm->nChild--; | - | ||||||||||||||||||||||||
| 185 | if( pTerm->nChild!=0
executed 3995 times by 1 test: break;Executed by:
| 3995-5274 | ||||||||||||||||||||||||
| 186 | nLoop++; | - | ||||||||||||||||||||||||
| 187 | } executed 5274 times by 1 test: end of blockExecuted by:
| 5274 | ||||||||||||||||||||||||
| 188 | } executed 87820 times by 30 tests: end of blockExecuted by:
| 87820 | ||||||||||||||||||||||||
| 189 | static void codeApplyAffinity(Parse *pParse, int base, int n, char *zAff){ | - | ||||||||||||||||||||||||
| 190 | Vdbe *v = pParse->pVdbe; | - | ||||||||||||||||||||||||
| 191 | if( zAff==0
| 8-37176 | ||||||||||||||||||||||||
| 192 | - | |||||||||||||||||||||||||
| 193 | ((void) (0)) | - | ||||||||||||||||||||||||
| 194 | ; | - | ||||||||||||||||||||||||
| 195 | return; executed 8 times by 1 test: return;Executed by:
| 8 | ||||||||||||||||||||||||
| 196 | } | - | ||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||
| 198 | ((void) (0)) | - | ||||||||||||||||||||||||
| 199 | ; | - | ||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||
| 204 | while( n>0
| 894-36383 | ||||||||||||||||||||||||
| 205 | n--; | - | ||||||||||||||||||||||||
| 206 | base++; | - | ||||||||||||||||||||||||
| 207 | zAff++; | - | ||||||||||||||||||||||||
| 208 | } executed 35489 times by 1 test: end of blockExecuted by:
| 35489 | ||||||||||||||||||||||||
| 209 | while( n>1
| 42-37100 | ||||||||||||||||||||||||
| 210 | n--; | - | ||||||||||||||||||||||||
| 211 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | if( n>0
| 894-36282 | ||||||||||||||||||||||||
| 215 | sqlite3VdbeAddOp4(v, 91, base, n, 0, zAff, n); | - | ||||||||||||||||||||||||
| 216 | } executed 894 times by 1 test: end of blockExecuted by:
| 894 | ||||||||||||||||||||||||
| 217 | } executed 37176 times by 2 tests: end of blockExecuted by:
| 37176 | ||||||||||||||||||||||||
| 218 | static void updateRangeAffinityStr( | - | ||||||||||||||||||||||||
| 219 | Expr *pRight, | - | ||||||||||||||||||||||||
| 220 | int n, | - | ||||||||||||||||||||||||
| 221 | char *zAff | - | ||||||||||||||||||||||||
| 222 | ){ | - | ||||||||||||||||||||||||
| 223 | int i; | - | ||||||||||||||||||||||||
| 224 | for(i=0; i<n
| 11895-13882 | ||||||||||||||||||||||||
| 225 | Expr *p = sqlite3VectorFieldSubexpr(pRight, i); | - | ||||||||||||||||||||||||
| 226 | if( sqlite3CompareAffinity(p, zAff[i])=='A'
| 5014-8868 | ||||||||||||||||||||||||
| 227 | || sqlite3ExprNeedsNoAffinityChange(p, zAff[i])
| 374-4640 | ||||||||||||||||||||||||
| 228 | ){ | - | ||||||||||||||||||||||||
| 229 | zAff[i] = 'A'; | - | ||||||||||||||||||||||||
| 230 | } executed 13508 times by 1 test: end of blockExecuted by:
| 13508 | ||||||||||||||||||||||||
| 231 | } executed 13882 times by 1 test: end of blockExecuted by:
| 13882 | ||||||||||||||||||||||||
| 232 | } executed 11895 times by 1 test: end of blockExecuted by:
| 11895 | ||||||||||||||||||||||||
| 233 | static Expr *removeUnindexableInClauseTerms( | - | ||||||||||||||||||||||||
| 234 | Parse *pParse, | - | ||||||||||||||||||||||||
| 235 | int iEq, | - | ||||||||||||||||||||||||
| 236 | WhereLoop *pLoop, | - | ||||||||||||||||||||||||
| 237 | Expr *pX | - | ||||||||||||||||||||||||
| 238 | ){ | - | ||||||||||||||||||||||||
| 239 | sqlite3 *db = pParse->db; | - | ||||||||||||||||||||||||
| 240 | Expr *pNew = sqlite3ExprDup(db, pX, 0); | - | ||||||||||||||||||||||||
| 241 | if( db->mallocFailed==0
| 0-50 | ||||||||||||||||||||||||
| 242 | ExprList *pOrigRhs = pNew->x.pSelect->pEList; | - | ||||||||||||||||||||||||
| 243 | ExprList *pOrigLhs = pNew->pLeft->x.pList; | - | ||||||||||||||||||||||||
| 244 | ExprList *pRhs = 0; | - | ||||||||||||||||||||||||
| 245 | ExprList *pLhs = 0; | - | ||||||||||||||||||||||||
| 246 | int i; | - | ||||||||||||||||||||||||
| 247 | Select *pSelect; | - | ||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||
| 249 | for(i=iEq; i<pLoop->nLTerm
| 50-82 | ||||||||||||||||||||||||
| 250 | if( pLoop->aLTerm[i]->pExpr==pX
| 3-79 | ||||||||||||||||||||||||
| 251 | int iField = pLoop->aLTerm[i]->iField - 1; | - | ||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||
| 253 | ((void) (0)) | - | ||||||||||||||||||||||||
| 254 | ; | - | ||||||||||||||||||||||||
| 255 | pRhs = sqlite3ExprListAppend(pParse, pRhs, pOrigRhs->a[iField].pExpr); | - | ||||||||||||||||||||||||
| 256 | pOrigRhs->a[iField].pExpr = 0; | - | ||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | ((void) (0)) | - | ||||||||||||||||||||||||
| 259 | ; | - | ||||||||||||||||||||||||
| 260 | pLhs = sqlite3ExprListAppend(pParse, pLhs, pOrigLhs->a[iField].pExpr); | - | ||||||||||||||||||||||||
| 261 | pOrigLhs->a[iField].pExpr = 0; | - | ||||||||||||||||||||||||
| 262 | } executed 79 times by 1 test: end of blockExecuted by:
| 79 | ||||||||||||||||||||||||
| 263 | } executed 82 times by 1 test: end of blockExecuted by:
| 82 | ||||||||||||||||||||||||
| 264 | sqlite3ExprListDelete(db, pOrigRhs); | - | ||||||||||||||||||||||||
| 265 | sqlite3ExprListDelete(db, pOrigLhs); | - | ||||||||||||||||||||||||
| 266 | pNew->pLeft->x.pList = pLhs; | - | ||||||||||||||||||||||||
| 267 | pNew->x.pSelect->pEList = pRhs; | - | ||||||||||||||||||||||||
| 268 | if( pLhs
| 0-50 | ||||||||||||||||||||||||
| 269 | - | |||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||
| 272 | Expr *p = pLhs->a[0].pExpr; | - | ||||||||||||||||||||||||
| 273 | pLhs->a[0].pExpr = 0; | - | ||||||||||||||||||||||||
| 274 | sqlite3ExprDelete(db, pNew->pLeft); | - | ||||||||||||||||||||||||
| 275 | pNew->pLeft = p; | - | ||||||||||||||||||||||||
| 276 | } executed 21 times by 1 test: end of blockExecuted by:
| 21 | ||||||||||||||||||||||||
| 277 | pSelect = pNew->x.pSelect; | - | ||||||||||||||||||||||||
| 278 | if( pSelect->pOrderBy
| 3-47 | ||||||||||||||||||||||||
| 279 | - | |||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||
| 286 | ExprList *pOrderBy = pSelect->pOrderBy; | - | ||||||||||||||||||||||||
| 287 | for(i=0; i<pOrderBy->nExpr
| 3-6 | ||||||||||||||||||||||||
| 288 | pOrderBy->a[i].u.x.iOrderByCol = 0; | - | ||||||||||||||||||||||||
| 289 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 290 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||
| 298 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||||||||||||||
| 299 | return executed 50 times by 1 test: pNew;return pNew;Executed by:
executed 50 times by 1 test: return pNew;Executed by:
| 50 | ||||||||||||||||||||||||
| 300 | } | - | ||||||||||||||||||||||||
| 301 | static int codeEqualityTerm( | - | ||||||||||||||||||||||||
| 302 | Parse *pParse, | - | ||||||||||||||||||||||||
| 303 | WhereTerm *pTerm, | - | ||||||||||||||||||||||||
| 304 | WhereLevel *pLevel, | - | ||||||||||||||||||||||||
| 305 | int iEq, | - | ||||||||||||||||||||||||
| 306 | int bRev, | - | ||||||||||||||||||||||||
| 307 | int iTarget | - | ||||||||||||||||||||||||
| 308 | ){ | - | ||||||||||||||||||||||||
| 309 | Expr *pX = pTerm->pExpr; | - | ||||||||||||||||||||||||
| 310 | Vdbe *v = pParse->pVdbe; | - | ||||||||||||||||||||||||
| 311 | int iReg; | - | ||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||
| 314 | ((void) (0)) | - | ||||||||||||||||||||||||
| 315 | ; | - | ||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||
| 317 | ((void) (0)) | - | ||||||||||||||||||||||||
| 318 | ; | - | ||||||||||||||||||||||||
| 319 | if( pX->op==53
| 985-50829 | ||||||||||||||||||||||||
| 320 | iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget); | - | ||||||||||||||||||||||||
| 321 | } executed 51858 times by 30 tests: else if( pX->op==50end of blockExecuted by:
| 172-51858 | ||||||||||||||||||||||||
| 322 | iReg = iTarget; | - | ||||||||||||||||||||||||
| 323 | sqlite3VdbeAddOp2(v, 73, 0, iReg); | - | ||||||||||||||||||||||||
| 324 | - | |||||||||||||||||||||||||
| 325 | } executed 172 times by 1 test: else{end of blockExecuted by:
| 172 | ||||||||||||||||||||||||
| 326 | int eType = 5; | - | ||||||||||||||||||||||||
| 327 | int iTab; | - | ||||||||||||||||||||||||
| 328 | struct InLoop *pIn; | - | ||||||||||||||||||||||||
| 329 | WhereLoop *pLoop = pLevel->pWLoop; | - | ||||||||||||||||||||||||
| 330 | int i; | - | ||||||||||||||||||||||||
| 331 | int nEq = 0; | - | ||||||||||||||||||||||||
| 332 | int *aiMap = 0; | - | ||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||
| 334 | if( (
| 21-792 | ||||||||||||||||||||||||
| 335 | && pLoop->u.btree.pIndex!=0
| 74-718 | ||||||||||||||||||||||||
| 336 | && pLoop->u.btree.pIndex->aSortOrder[iEq]
| 147-571 | ||||||||||||||||||||||||
| 337 | ){ | - | ||||||||||||||||||||||||
| 338 | ; | - | ||||||||||||||||||||||||
| 339 | ; | - | ||||||||||||||||||||||||
| 340 | bRev = !bRev; | - | ||||||||||||||||||||||||
| 341 | } executed 147 times by 1 test: end of blockExecuted by:
| 147 | ||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 | ((void) (0)) | - | ||||||||||||||||||||||||
| 344 | ; | - | ||||||||||||||||||||||||
| 345 | iReg = iTarget; | - | ||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | for(i=0; i<iEq
| 331-775 | ||||||||||||||||||||||||
| 348 | if( pLoop->aLTerm[i]
| 7-324 | ||||||||||||||||||||||||
| 349 | disableTerm(pLevel, pTerm); | - | ||||||||||||||||||||||||
| 350 | return executed 38 times by 1 test: iTarget;return iTarget;Executed by:
executed 38 times by 1 test: return iTarget;Executed by:
| 38 | ||||||||||||||||||||||||
| 351 | } | - | ||||||||||||||||||||||||
| 352 | } executed 293 times by 1 test: end of blockExecuted by:
| 293 | ||||||||||||||||||||||||
| 353 | for(i=iEq;i<pLoop->nLTerm
| 775-1142 | ||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||
| 355 | ((void) (0)) | - | ||||||||||||||||||||||||
| 356 | ; | - | ||||||||||||||||||||||||
| 357 | if( pLoop->aLTerm[i]->pExpr==pX
executed 813 times by 1 test: nEq++;Executed by:
| 329-813 | ||||||||||||||||||||||||
| 358 | } executed 1142 times by 1 test: end of blockExecuted by:
| 1142 | ||||||||||||||||||||||||
| 359 | - | |||||||||||||||||||||||||
| 360 | if( (
| 50-431 | ||||||||||||||||||||||||
| 361 | eType = sqlite3FindInIndex(pParse, pX, 0x0004, 0, 0); | - | ||||||||||||||||||||||||
| 362 | } executed 725 times by 1 test: else{end of blockExecuted by:
| 725 | ||||||||||||||||||||||||
| 363 | sqlite3 *db = pParse->db; | - | ||||||||||||||||||||||||
| 364 | pX = removeUnindexableInClauseTerms(pParse, iEq, pLoop, pX); | - | ||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | if( !db->mallocFailed
| 0-50 | ||||||||||||||||||||||||
| 367 | aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*nEq); | - | ||||||||||||||||||||||||
| 368 | eType = sqlite3FindInIndex(pParse, pX, 0x0004, 0, aiMap); | - | ||||||||||||||||||||||||
| 369 | pTerm->pExpr->iTable = pX->iTable; | - | ||||||||||||||||||||||||
| 370 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||||||||||||||
| 371 | sqlite3ExprDelete(db, pX); | - | ||||||||||||||||||||||||
| 372 | pX = pTerm->pExpr; | - | ||||||||||||||||||||||||
| 373 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | if( eType==4
| 97-678 | ||||||||||||||||||||||||
| 376 | ; | - | ||||||||||||||||||||||||
| 377 | bRev = !bRev; | - | ||||||||||||||||||||||||
| 378 | } executed 97 times by 1 test: end of blockExecuted by:
| 97 | ||||||||||||||||||||||||
| 379 | iTab = pX->iTable; | - | ||||||||||||||||||||||||
| 380 | sqlite3VdbeAddOp2(v, bRev ? 32 : 36, iTab, 0); | - | ||||||||||||||||||||||||
| 381 | ; | - | ||||||||||||||||||||||||
| 382 | ; | - | ||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | ((void) (0)) | - | ||||||||||||||||||||||||
| 385 | ; | - | ||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||
| 387 | pLoop->wsFlags |= 0x00000800; | - | ||||||||||||||||||||||||
| 388 | if( pLevel->u.in.nIn==0
| 96-679 | ||||||||||||||||||||||||
| 389 | pLevel->addrNxt = sqlite3VdbeMakeLabel(v); | - | ||||||||||||||||||||||||
| 390 | } executed 679 times by 1 test: end of blockExecuted by:
| 679 | ||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||
| 392 | i = pLevel->u.in.nIn; | - | ||||||||||||||||||||||||
| 393 | pLevel->u.in.nIn += nEq; | - | ||||||||||||||||||||||||
| 394 | pLevel->u.in.aInLoop = | - | ||||||||||||||||||||||||
| 395 | sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop, | - | ||||||||||||||||||||||||
| 396 | sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn); | - | ||||||||||||||||||||||||
| 397 | pIn = pLevel->u.in.aInLoop; | - | ||||||||||||||||||||||||
| 398 | if( pIn
| 0-775 | ||||||||||||||||||||||||
| 399 | int iMap = 0; | - | ||||||||||||||||||||||||
| 400 | pIn += i; | - | ||||||||||||||||||||||||
| 401 | for(i=iEq;i<pLoop->nLTerm
| 775-1142 | ||||||||||||||||||||||||
| 402 | if( pLoop->aLTerm[i]->pExpr==pX
| 329-813 | ||||||||||||||||||||||||
| 403 | int iOut = iReg + i - iEq; | - | ||||||||||||||||||||||||
| 404 | if( eType==1
| 74-739 | ||||||||||||||||||||||||
| 405 | ; | - | ||||||||||||||||||||||||
| 406 | pIn->addrInTop = sqlite3VdbeAddOp2(v, 129, iTab, iOut); | - | ||||||||||||||||||||||||
| 407 | } executed 74 times by 1 test: else{end of blockExecuted by:
| 74 | ||||||||||||||||||||||||
| 408 | int iCol = aiMap
| 79-660 | ||||||||||||||||||||||||
| 409 | pIn->addrInTop = sqlite3VdbeAddOp3(v,90,iTab, iCol, iOut); | - | ||||||||||||||||||||||||
| 410 | } executed 739 times by 1 test: end of blockExecuted by:
| 739 | ||||||||||||||||||||||||
| 411 | sqlite3VdbeAddOp1(v, 50, iOut); ; | - | ||||||||||||||||||||||||
| 412 | if( i==iEq
| 38-775 | ||||||||||||||||||||||||
| 413 | pIn->iCur = iTab; | - | ||||||||||||||||||||||||
| 414 | pIn->eEndLoopOp = bRev
| 162-613 | ||||||||||||||||||||||||
| 415 | if( iEq>0
| 1-519 | ||||||||||||||||||||||||
| 416 | pIn->iBase = iReg - i; | - | ||||||||||||||||||||||||
| 417 | pIn->nPrefix = i; | - | ||||||||||||||||||||||||
| 418 | pLoop->wsFlags |= 0x00040000; | - | ||||||||||||||||||||||||
| 419 | } executed 255 times by 1 test: else{end of blockExecuted by:
| 255 | ||||||||||||||||||||||||
| 420 | pIn->nPrefix = 0; | - | ||||||||||||||||||||||||
| 421 | } executed 520 times by 1 test: end of blockExecuted by:
| 520 | ||||||||||||||||||||||||
| 422 | }else{ | - | ||||||||||||||||||||||||
| 423 | pIn->eEndLoopOp = 171; | - | ||||||||||||||||||||||||
| 424 | } executed 38 times by 1 test: end of blockExecuted by:
| 38 | ||||||||||||||||||||||||
| 425 | pIn++; | - | ||||||||||||||||||||||||
| 426 | } executed 813 times by 1 test: end of blockExecuted by:
| 813 | ||||||||||||||||||||||||
| 427 | } executed 1142 times by 1 test: end of blockExecuted by:
| 1142 | ||||||||||||||||||||||||
| 428 | } executed 775 times by 1 test: else{end of blockExecuted by:
| 775 | ||||||||||||||||||||||||
| 429 | pLevel->u.in.nIn = 0; | - | ||||||||||||||||||||||||
| 430 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 431 | sqlite3DbFree(pParse->db, aiMap); | - | ||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | } executed 775 times by 1 test: end of blockExecuted by:
| 775 | ||||||||||||||||||||||||
| 434 | disableTerm(pLevel, pTerm); | - | ||||||||||||||||||||||||
| 435 | return executed 52805 times by 30 tests: iReg;return iReg;Executed by:
executed 52805 times by 30 tests: return iReg;Executed by:
| 52805 | ||||||||||||||||||||||||
| 436 | } | - | ||||||||||||||||||||||||
| 437 | static int codeAllEqualityTerms( | - | ||||||||||||||||||||||||
| 438 | Parse *pParse, | - | ||||||||||||||||||||||||
| 439 | WhereLevel *pLevel, | - | ||||||||||||||||||||||||
| 440 | int bRev, | - | ||||||||||||||||||||||||
| 441 | int nExtraReg, | - | ||||||||||||||||||||||||
| 442 | char **pzAff | - | ||||||||||||||||||||||||
| 443 | ){ | - | ||||||||||||||||||||||||
| 444 | u16 nEq; | - | ||||||||||||||||||||||||
| 445 | u16 nSkip; | - | ||||||||||||||||||||||||
| 446 | Vdbe *v = pParse->pVdbe; | - | ||||||||||||||||||||||||
| 447 | Index *pIdx; | - | ||||||||||||||||||||||||
| 448 | WhereTerm *pTerm; | - | ||||||||||||||||||||||||
| 449 | WhereLoop *pLoop; | - | ||||||||||||||||||||||||
| 450 | int j; | - | ||||||||||||||||||||||||
| 451 | int regBase; | - | ||||||||||||||||||||||||
| 452 | int nReg; | - | ||||||||||||||||||||||||
| 453 | char *zAff; | - | ||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||
| 456 | pLoop = pLevel->pWLoop; | - | ||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | ((void) (0)) | - | ||||||||||||||||||||||||
| 459 | ; | - | ||||||||||||||||||||||||
| 460 | nEq = pLoop->u.btree.nEq; | - | ||||||||||||||||||||||||
| 461 | nSkip = pLoop->nSkip; | - | ||||||||||||||||||||||||
| 462 | pIdx = pLoop->u.btree.pIndex; | - | ||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||
| 464 | ((void) (0)) | - | ||||||||||||||||||||||||
| 465 | ; | - | ||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||
| 469 | regBase = pParse->nMem + 1; | - | ||||||||||||||||||||||||
| 470 | nReg = pLoop->u.btree.nEq + nExtraReg; | - | ||||||||||||||||||||||||
| 471 | pParse->nMem += nReg; | - | ||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||
| 473 | zAff = sqlite3DbStrDup(pParse->db,sqlite3IndexAffinityStr(pParse->db,pIdx)); | - | ||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | ((void) (0)) | - | ||||||||||||||||||||||||
| 476 | ; | - | ||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | if( nSkip
| 44-31233 | ||||||||||||||||||||||||
| 479 | int iIdxCur = pLevel->iIdxCur; | - | ||||||||||||||||||||||||
| 480 | sqlite3VdbeAddOp1(v, (bRev?32:36), iIdxCur); | - | ||||||||||||||||||||||||
| 481 | ; | - | ||||||||||||||||||||||||
| 482 | ; | - | ||||||||||||||||||||||||
| 483 | ; | - | ||||||||||||||||||||||||
| 484 | j = sqlite3VdbeAddOp0(v, 11); | - | ||||||||||||||||||||||||
| 485 | pLevel->addrSkip = sqlite3VdbeAddOp4Int(v, (bRev?22:25), | - | ||||||||||||||||||||||||
| 486 | iIdxCur, 0, regBase, nSkip); | - | ||||||||||||||||||||||||
| 487 | ; | - | ||||||||||||||||||||||||
| 488 | ; | - | ||||||||||||||||||||||||
| 489 | sqlite3VdbeJumpHere(v, j); | - | ||||||||||||||||||||||||
| 490 | for(j=0; j<nSkip
| 44-64 | ||||||||||||||||||||||||
| 491 | sqlite3VdbeAddOp3(v, 90, iIdxCur, j, regBase+j); | - | ||||||||||||||||||||||||
| 492 | ; | - | ||||||||||||||||||||||||
| 493 | ; | - | ||||||||||||||||||||||||
| 494 | } executed 64 times by 1 test: end of blockExecuted by:
| 64 | ||||||||||||||||||||||||
| 495 | } executed 44 times by 1 test: end of blockExecuted by:
| 44 | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| 500 | ((void) (0)) | - | ||||||||||||||||||||||||
| 501 | ; | - | ||||||||||||||||||||||||
| 502 | for(j=nSkip; j<nEq
| 22589-31277 | ||||||||||||||||||||||||
| 503 | int r1; | - | ||||||||||||||||||||||||
| 504 | pTerm = pLoop->aLTerm[j]; | - | ||||||||||||||||||||||||
| 505 | - | |||||||||||||||||||||||||
| 506 | ((void) (0)) | - | ||||||||||||||||||||||||
| 507 | ; | - | ||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||
| 510 | ; | - | ||||||||||||||||||||||||
| 511 | ; | - | ||||||||||||||||||||||||
| 512 | r1 = codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, regBase+j); | - | ||||||||||||||||||||||||
| 513 | if( r1!=regBase+j
| 988-21601 | ||||||||||||||||||||||||
| 514 | if( nReg==1
| 195-793 | ||||||||||||||||||||||||
| 515 | sqlite3ReleaseTempReg(pParse, regBase); | - | ||||||||||||||||||||||||
| 516 | regBase = r1; | - | ||||||||||||||||||||||||
| 517 | } executed 195 times by 1 test: else{end of blockExecuted by:
| 195 | ||||||||||||||||||||||||
| 518 | sqlite3VdbeAddOp2(v, 79, r1, regBase+j); | - | ||||||||||||||||||||||||
| 519 | } executed 793 times by 1 test: end of blockExecuted by:
| 793 | ||||||||||||||||||||||||
| 520 | } | - | ||||||||||||||||||||||||
| 521 | if( pTerm->eOperator & 0x0001
| 718-21871 | ||||||||||||||||||||||||
| 522 | if( pTerm->pExpr->flags & 0x000800
| 286-432 | ||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||
| 525 | - | |||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||
| 527 | if( zAff
executed 432 times by 1 test: zAff[j] = 'A';Executed by:
| 0-432 | ||||||||||||||||||||||||
| 528 | } executed 432 times by 1 test: end of blockExecuted by:
| 432 | ||||||||||||||||||||||||
| 529 | } executed 718 times by 1 test: else if( (end of blockExecuted by:
| 172-21699 | ||||||||||||||||||||||||
| 530 | Expr *pRight = pTerm->pExpr->pRight; | - | ||||||||||||||||||||||||
| 531 | if( (
| 1022-20677 | ||||||||||||||||||||||||
| 532 | sqlite3VdbeAddOp2(v, 50, regBase+j, pLevel->addrBrk); | - | ||||||||||||||||||||||||
| 533 | ; | - | ||||||||||||||||||||||||
| 534 | } executed 6202 times by 1 test: end of blockExecuted by:
| 6202 | ||||||||||||||||||||||||
| 535 | if( zAff
| 24-21675 | ||||||||||||||||||||||||
| 536 | if( sqlite3CompareAffinity(pRight, zAff[j])=='A'
| 1896-19779 | ||||||||||||||||||||||||
| 537 | zAff[j] = 'A'; | - | ||||||||||||||||||||||||
| 538 | } executed 19779 times by 1 test: end of blockExecuted by:
| 19779 | ||||||||||||||||||||||||
| 539 | if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j])
| 405-21270 | ||||||||||||||||||||||||
| 540 | zAff[j] = 'A'; | - | ||||||||||||||||||||||||
| 541 | } executed 21270 times by 1 test: end of blockExecuted by:
| 21270 | ||||||||||||||||||||||||
| 542 | } executed 21675 times by 1 test: end of blockExecuted by:
| 21675 | ||||||||||||||||||||||||
| 543 | } executed 21699 times by 1 test: end of blockExecuted by:
| 21699 | ||||||||||||||||||||||||
| 544 | } executed 22589 times by 1 test: end of blockExecuted by:
| 22589 | ||||||||||||||||||||||||
| 545 | *pzAff = zAff; | - | ||||||||||||||||||||||||
| 546 | return executed 31277 times by 2 tests: regBase;return regBase;Executed by:
executed 31277 times by 2 tests: return regBase;Executed by:
| 31277 | ||||||||||||||||||||||||
| 547 | } | - | ||||||||||||||||||||||||
| 548 | static void whereLikeOptimizationStringFixup( | - | ||||||||||||||||||||||||
| 549 | Vdbe *v, | - | ||||||||||||||||||||||||
| 550 | WhereLevel *pLevel, | - | ||||||||||||||||||||||||
| 551 | WhereTerm *pTerm | - | ||||||||||||||||||||||||
| 552 | ){ | - | ||||||||||||||||||||||||
| 553 | if( pTerm->wtFlags & 0x100
| 3452-8453 | ||||||||||||||||||||||||
| 554 | VdbeOp *pOp; | - | ||||||||||||||||||||||||
| 555 | - | |||||||||||||||||||||||||
| 556 | ((void) (0)) | - | ||||||||||||||||||||||||
| 557 | ; | - | ||||||||||||||||||||||||
| 558 | pOp = sqlite3VdbeGetOp(v, -1); | - | ||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||
| 560 | ((void) (0)) | - | ||||||||||||||||||||||||
| 561 | ; | - | ||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||
| 563 | ((void) (0)) | - | ||||||||||||||||||||||||
| 564 | - | |||||||||||||||||||||||||
| 565 | ; | - | ||||||||||||||||||||||||
| 566 | pOp->p3 = (int)(pLevel->iLikeRepCntr>>1); | - | ||||||||||||||||||||||||
| 567 | pOp->p5 = (u8)(pLevel->iLikeRepCntr&1); | - | ||||||||||||||||||||||||
| 568 | } executed 3452 times by 1 test: end of blockExecuted by:
| 3452 | ||||||||||||||||||||||||
| 569 | } executed 11905 times by 1 test: end of blockExecuted by:
| 11905 | ||||||||||||||||||||||||
| 570 | static void codeDeferredSeek( | - | ||||||||||||||||||||||||
| 571 | WhereInfo *pWInfo, | - | ||||||||||||||||||||||||
| 572 | Index *pIdx, | - | ||||||||||||||||||||||||
| 573 | int iCur, | - | ||||||||||||||||||||||||
| 574 | int iIdxCur | - | ||||||||||||||||||||||||
| 575 | ){ | - | ||||||||||||||||||||||||
| 576 | Parse *pParse = pWInfo->pParse; | - | ||||||||||||||||||||||||
| 577 | Vdbe *v = pParse->pVdbe; | - | ||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||
| 579 | - | |||||||||||||||||||||||||
| 580 | ((void) (0)) | - | ||||||||||||||||||||||||
| 581 | ; | - | ||||||||||||||||||||||||
| 582 | - | |||||||||||||||||||||||||
| 583 | ((void) (0)) | - | ||||||||||||||||||||||||
| 584 | ; | - | ||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||
| 586 | sqlite3VdbeAddOp3(v, 135, iIdxCur, 0, iCur); | - | ||||||||||||||||||||||||
| 587 | if( (
| 7809-13263 | ||||||||||||||||||||||||
| 588 | && (((
| 4-13259 | ||||||||||||||||||||||||
| 589 | ){ | - | ||||||||||||||||||||||||
| 590 | int i; | - | ||||||||||||||||||||||||
| 591 | Table *pTab = pIdx->pTable; | - | ||||||||||||||||||||||||
| 592 | int *ai = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*(pTab->nCol+1)); | - | ||||||||||||||||||||||||
| 593 | if( ai
| 0-13243 | ||||||||||||||||||||||||
| 594 | ai[0] = pTab->nCol; | - | ||||||||||||||||||||||||
| 595 | for(i=0; i<pIdx->nColumn-1
| 13243-19594 | ||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||
| 597 | ((void) (0)) | - | ||||||||||||||||||||||||
| 598 | ; | - | ||||||||||||||||||||||||
| 599 | if( pIdx->aiColumn[i]>=0
executed 19594 times by 1 test: ai[pIdx->aiColumn[i]+1] = i+1;Executed by:
| 0-19594 | ||||||||||||||||||||||||
| 600 | } executed 19594 times by 1 test: end of blockExecuted by:
| 19594 | ||||||||||||||||||||||||
| 601 | sqlite3VdbeChangeP4(v, -1, (char*)ai, (-15)); | - | ||||||||||||||||||||||||
| 602 | } executed 13243 times by 1 test: end of blockExecuted by:
| 13243 | ||||||||||||||||||||||||
| 603 | } executed 13243 times by 1 test: end of blockExecuted by:
| 13243 | ||||||||||||||||||||||||
| 604 | } executed 21072 times by 2 tests: end of blockExecuted by:
| 21072 | ||||||||||||||||||||||||
| 605 | static void codeExprOrVector(Parse *pParse, Expr *p, int iReg, int nReg){ | - | ||||||||||||||||||||||||
| 606 | - | |||||||||||||||||||||||||
| 607 | ((void) (0)) | - | ||||||||||||||||||||||||
| 608 | ; | - | ||||||||||||||||||||||||
| 609 | if( p
| 3-32652 | ||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||
| 611 | if( (
| 907-1147 | ||||||||||||||||||||||||
| 612 | Vdbe *v = pParse->pVdbe; | - | ||||||||||||||||||||||||
| 613 | int iSelect = sqlite3CodeSubselect(pParse, p, 0, 0); | - | ||||||||||||||||||||||||
| 614 | sqlite3VdbeAddOp3(v, 78, iSelect, iReg, nReg-1); | - | ||||||||||||||||||||||||
| 615 | } executed 907 times by 1 test: elseend of blockExecuted by:
| 907 | ||||||||||||||||||||||||
| 616 | - | |||||||||||||||||||||||||
| 617 | { | - | ||||||||||||||||||||||||
| 618 | int i; | - | ||||||||||||||||||||||||
| 619 | ExprList *pList = p->x.pList; | - | ||||||||||||||||||||||||
| 620 | - | |||||||||||||||||||||||||
| 621 | ((void) (0)) | - | ||||||||||||||||||||||||
| 622 | ; | - | ||||||||||||||||||||||||
| 623 | for(i=0; i<nReg
| 1147-2227 | ||||||||||||||||||||||||
| 624 | sqlite3ExprCode(pParse, pList->a[i].pExpr, iReg+i); | - | ||||||||||||||||||||||||
| 625 | } executed 2227 times by 1 test: end of blockExecuted by:
| 2227 | ||||||||||||||||||||||||
| 626 | } executed 1147 times by 1 test: end of blockExecuted by:
| 1147 | ||||||||||||||||||||||||
| 627 | }else{ | - | ||||||||||||||||||||||||
| 628 | - | |||||||||||||||||||||||||
| 629 | ((void) (0)) | - | ||||||||||||||||||||||||
| 630 | ; | - | ||||||||||||||||||||||||
| 631 | sqlite3ExprCode(pParse, p, iReg); | - | ||||||||||||||||||||||||
| 632 | } executed 30601 times by 1 test: end of blockExecuted by:
| 30601 | ||||||||||||||||||||||||
| 633 | } | - | ||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||
| 637 | - | |||||||||||||||||||||||||
| 638 | - | |||||||||||||||||||||||||
| 639 | typedef struct IdxExprTrans { | - | ||||||||||||||||||||||||
| 640 | Expr *pIdxExpr; | - | ||||||||||||||||||||||||
| 641 | int iTabCur; | - | ||||||||||||||||||||||||
| 642 | int iIdxCur; | - | ||||||||||||||||||||||||
| 643 | int iIdxCol; | - | ||||||||||||||||||||||||
| 644 | } IdxExprTrans; | - | ||||||||||||||||||||||||
| 645 | - | |||||||||||||||||||||||||
| 646 | - | |||||||||||||||||||||||||
| 647 | - | |||||||||||||||||||||||||
| 648 | - | |||||||||||||||||||||||||
| 649 | - | |||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||
| 651 | - | |||||||||||||||||||||||||
| 652 | static int whereIndexExprTransNode(Walker *p, Expr *pExpr){ | - | ||||||||||||||||||||||||
| 653 | IdxExprTrans *pX = p->u.pIdxTrans; | - | ||||||||||||||||||||||||
| 654 | if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0
| 72-303 | ||||||||||||||||||||||||
| 655 | pExpr->op = 158; | - | ||||||||||||||||||||||||
| 656 | pExpr->iTable = pX->iIdxCur; | - | ||||||||||||||||||||||||
| 657 | pExpr->iColumn = pX->iIdxCol; | - | ||||||||||||||||||||||||
| 658 | pExpr->y.pTab = 0; | - | ||||||||||||||||||||||||
| 659 | return executed 72 times by 1 test: 1;return 1;Executed by:
executed 72 times by 1 test: return 1;Executed by:
| 72 | ||||||||||||||||||||||||
| 660 | }else{ | - | ||||||||||||||||||||||||
| 661 | return executed 303 times by 1 test: 0;return 0;Executed by:
executed 303 times by 1 test: return 0;Executed by:
| 303 | ||||||||||||||||||||||||
| 662 | } | - | ||||||||||||||||||||||||
| 663 | } | - | ||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||
| 665 | - | |||||||||||||||||||||||||
| 666 | - | |||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||
| 670 | static void whereIndexExprTrans( | - | ||||||||||||||||||||||||
| 671 | Index *pIdx, | - | ||||||||||||||||||||||||
| 672 | int iTabCur, | - | ||||||||||||||||||||||||
| 673 | int iIdxCur, | - | ||||||||||||||||||||||||
| 674 | WhereInfo *pWInfo | - | ||||||||||||||||||||||||
| 675 | ){ | - | ||||||||||||||||||||||||
| 676 | int iIdxCol; | - | ||||||||||||||||||||||||
| 677 | ExprList *aColExpr; | - | ||||||||||||||||||||||||
| 678 | Walker w; | - | ||||||||||||||||||||||||
| 679 | IdxExprTrans x; | - | ||||||||||||||||||||||||
| 680 | aColExpr = pIdx->aColExpr; | - | ||||||||||||||||||||||||
| 681 | if( aColExpr==0
executed 30967 times by 2 tests: return;Executed by:
| 62-30967 | ||||||||||||||||||||||||
| 682 | memset(&w, 0, sizeof(w)); | - | ||||||||||||||||||||||||
| 683 | w.xExprCallback = whereIndexExprTransNode; | - | ||||||||||||||||||||||||
| 684 | w.u.pIdxTrans = &x; | - | ||||||||||||||||||||||||
| 685 | x.iTabCur = iTabCur; | - | ||||||||||||||||||||||||
| 686 | x.iIdxCur = iIdxCur; | - | ||||||||||||||||||||||||
| 687 | for(iIdxCol=0; iIdxCol<aColExpr->nExpr
| 62-79 | ||||||||||||||||||||||||
| 688 | if( pIdx->aiColumn[iIdxCol]!=(-2)
executed 16 times by 1 test: continue;Executed by:
| 16-63 | ||||||||||||||||||||||||
| 689 | - | |||||||||||||||||||||||||
| 690 | ((void) (0)) | - | ||||||||||||||||||||||||
| 691 | ; | - | ||||||||||||||||||||||||
| 692 | x.iIdxCol = iIdxCol; | - | ||||||||||||||||||||||||
| 693 | x.pIdxExpr = aColExpr->a[iIdxCol].pExpr; | - | ||||||||||||||||||||||||
| 694 | sqlite3WalkExpr(&w, pWInfo->pWhere); | - | ||||||||||||||||||||||||
| 695 | sqlite3WalkExprList(&w, pWInfo->pOrderBy); | - | ||||||||||||||||||||||||
| 696 | sqlite3WalkExprList(&w, pWInfo->pResultSet); | - | ||||||||||||||||||||||||
| 697 | } executed 63 times by 1 test: end of blockExecuted by:
| 63 | ||||||||||||||||||||||||
| 698 | } executed 62 times by 1 test: end of blockExecuted by:
| 62 | ||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | - | |||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||
| 702 | - | |||||||||||||||||||||||||
| 703 | - | |||||||||||||||||||||||||
| 704 | Bitmask sqlite3WhereCodeOneLoopStart( | - | ||||||||||||||||||||||||
| 705 | WhereInfo *pWInfo, | - | ||||||||||||||||||||||||
| 706 | int iLevel, | - | ||||||||||||||||||||||||
| 707 | Bitmask notReady | - | ||||||||||||||||||||||||
| 708 | ){ | - | ||||||||||||||||||||||||
| 709 | int j, k; | - | ||||||||||||||||||||||||
| 710 | int iCur; | - | ||||||||||||||||||||||||
| 711 | int addrNxt; | - | ||||||||||||||||||||||||
| 712 | int omitTable; | - | ||||||||||||||||||||||||
| 713 | int bRev; | - | ||||||||||||||||||||||||
| 714 | WhereLevel *pLevel; | - | ||||||||||||||||||||||||
| 715 | WhereLoop *pLoop; | - | ||||||||||||||||||||||||
| 716 | WhereClause *pWC; | - | ||||||||||||||||||||||||
| 717 | WhereTerm *pTerm; | - | ||||||||||||||||||||||||
| 718 | Parse *pParse; | - | ||||||||||||||||||||||||
| 719 | sqlite3 *db; | - | ||||||||||||||||||||||||
| 720 | Vdbe *v; | - | ||||||||||||||||||||||||
| 721 | struct SrcList_item *pTabItem; | - | ||||||||||||||||||||||||
| 722 | int addrBrk; | - | ||||||||||||||||||||||||
| 723 | int addrHalt; | - | ||||||||||||||||||||||||
| 724 | int addrCont; | - | ||||||||||||||||||||||||
| 725 | int iRowidReg = 0; | - | ||||||||||||||||||||||||
| 726 | int iReleaseReg = 0; | - | ||||||||||||||||||||||||
| 727 | Index *pIdx = 0; | - | ||||||||||||||||||||||||
| 728 | int iLoop; | - | ||||||||||||||||||||||||
| 729 | - | |||||||||||||||||||||||||
| 730 | pParse = pWInfo->pParse; | - | ||||||||||||||||||||||||
| 731 | v = pParse->pVdbe; | - | ||||||||||||||||||||||||
| 732 | pWC = &pWInfo->sWC; | - | ||||||||||||||||||||||||
| 733 | db = pParse->db; | - | ||||||||||||||||||||||||
| 734 | pLevel = &pWInfo->a[iLevel]; | - | ||||||||||||||||||||||||
| 735 | pLoop = pLevel->pWLoop; | - | ||||||||||||||||||||||||
| 736 | pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; | - | ||||||||||||||||||||||||
| 737 | iCur = pTabItem->iCursor; | - | ||||||||||||||||||||||||
| 738 | pLevel->notReady = notReady & ~sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); | - | ||||||||||||||||||||||||
| 739 | bRev = (pWInfo->revMask>>iLevel)&1; | - | ||||||||||||||||||||||||
| 740 | omitTable = (
| 11022-267474 | ||||||||||||||||||||||||
| 741 | && (
| 1195-9827 | ||||||||||||||||||||||||
| 742 | ; | - | ||||||||||||||||||||||||
| 743 | addrBrk = pLevel->addrBrk = pLevel->addrNxt = sqlite3VdbeMakeLabel(v); | - | ||||||||||||||||||||||||
| 744 | addrCont = pLevel->addrCont = sqlite3VdbeMakeLabel(v); | - | ||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||
| 746 | - | |||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||
| 748 | - | |||||||||||||||||||||||||
| 749 | - | |||||||||||||||||||||||||
| 750 | - | |||||||||||||||||||||||||
| 751 | ((void) (0)) | - | ||||||||||||||||||||||||
| 752 | - | |||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||
| 754 | ; | - | ||||||||||||||||||||||||
| 755 | if( pLevel->iFrom>0
| 425-267368 | ||||||||||||||||||||||||
| 756 | pLevel->iLeftJoin = ++pParse->nMem; | - | ||||||||||||||||||||||||
| 757 | sqlite3VdbeAddOp2(v, 70, 0, pLevel->iLeftJoin); | - | ||||||||||||||||||||||||
| 758 | ; | - | ||||||||||||||||||||||||
| 759 | } executed 425 times by 1 test: end of blockExecuted by:
| 425 | ||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||
| 761 | - | |||||||||||||||||||||||||
| 762 | - | |||||||||||||||||||||||||
| 763 | for(j=iLevel; j>0
executed 98867 times by 1 test: end of blockExecuted by:
| 460-278036 | ||||||||||||||||||||||||
| 764 | addrHalt = pWInfo->a[j].addrBrk; | - | ||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||
| 766 | - | |||||||||||||||||||||||||
| 767 | if( pTabItem->fg.viaCoroutine
| 35364-243132 | ||||||||||||||||||||||||
| 768 | int regYield = pTabItem->regReturn; | - | ||||||||||||||||||||||||
| 769 | sqlite3VdbeAddOp3(v, 13, regYield, 0, pTabItem->addrFillSub); | - | ||||||||||||||||||||||||
| 770 | pLevel->p2 = sqlite3VdbeAddOp2(v, 14, regYield, addrBrk); | - | ||||||||||||||||||||||||
| 771 | ; | - | ||||||||||||||||||||||||
| 772 | ; | - | ||||||||||||||||||||||||
| 773 | pLevel->op = 11; | - | ||||||||||||||||||||||||
| 774 | } executed 35364 times by 1 test: elseend of blockExecuted by:
| 35364 | ||||||||||||||||||||||||
| 775 | - | |||||||||||||||||||||||||
| 776 | - | |||||||||||||||||||||||||
| 777 | if( (
| 11058-232074 | ||||||||||||||||||||||||
| 778 | - | |||||||||||||||||||||||||
| 779 | - | |||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||
| 781 | int iReg; | - | ||||||||||||||||||||||||
| 782 | int addrNotFound; | - | ||||||||||||||||||||||||
| 783 | int nConstraint = pLoop->nLTerm; | - | ||||||||||||||||||||||||
| 784 | int iIn; | - | ||||||||||||||||||||||||
| 785 | - | |||||||||||||||||||||||||
| 786 | iReg = sqlite3GetTempRange(pParse, nConstraint+2); | - | ||||||||||||||||||||||||
| 787 | addrNotFound = pLevel->addrBrk; | - | ||||||||||||||||||||||||
| 788 | for(j=0; j<nConstraint
| 11058-18422 | ||||||||||||||||||||||||
| 789 | int iTarget = iReg+j+2; | - | ||||||||||||||||||||||||
| 790 | pTerm = pLoop->aLTerm[j]; | - | ||||||||||||||||||||||||
| 791 | if( (
never executed: continue; | 0-18422 | ||||||||||||||||||||||||
| 792 | if( pTerm->eOperator & 0x0001
| 21-18401 | ||||||||||||||||||||||||
| 793 | codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget); | - | ||||||||||||||||||||||||
| 794 | addrNotFound = pLevel->addrNxt; | - | ||||||||||||||||||||||||
| 795 | } executed 21 times by 1 test: else{end of blockExecuted by:
| 21 | ||||||||||||||||||||||||
| 796 | Expr *pRight = pTerm->pExpr->pRight; | - | ||||||||||||||||||||||||
| 797 | codeExprOrVector(pParse, pRight, iTarget, 1); | - | ||||||||||||||||||||||||
| 798 | } executed 18401 times by 1 test: end of blockExecuted by:
| 18401 | ||||||||||||||||||||||||
| 799 | } | - | ||||||||||||||||||||||||
| 800 | sqlite3VdbeAddOp2(v, 70, pLoop->u.vtab.idxNum, iReg); | - | ||||||||||||||||||||||||
| 801 | sqlite3VdbeAddOp2(v, 70, nConstraint, iReg+1); | - | ||||||||||||||||||||||||
| 802 | sqlite3VdbeAddOp4(v, 9, iCur, addrNotFound, iReg, | - | ||||||||||||||||||||||||
| 803 | pLoop->u.vtab.idxStr, | - | ||||||||||||||||||||||||
| 804 | pLoop->u.vtab.needFree ? (-7) : (-1)); | - | ||||||||||||||||||||||||
| 805 | ; | - | ||||||||||||||||||||||||
| 806 | pLoop->u.vtab.needFree = 0; | - | ||||||||||||||||||||||||
| 807 | pLevel->p1 = iCur; | - | ||||||||||||||||||||||||
| 808 | pLevel->op = pWInfo->eOnePass
| 8-11050 | ||||||||||||||||||||||||
| 809 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); | - | ||||||||||||||||||||||||
| 810 | iIn = pLevel->u.in.nIn; | - | ||||||||||||||||||||||||
| 811 | for(j=nConstraint-1; j>=0
| 11058-18422 | ||||||||||||||||||||||||
| 812 | pTerm = pLoop->aLTerm[j]; | - | ||||||||||||||||||||||||
| 813 | if( j<16
| 0-18422 | ||||||||||||||||||||||||
| 814 | disableTerm(pLevel, pTerm); | - | ||||||||||||||||||||||||
| 815 | } executed 17776 times by 1 test: else if( (end of blockExecuted by:
| 8-17776 | ||||||||||||||||||||||||
| 816 | Expr *pCompare; | - | ||||||||||||||||||||||||
| 817 | Expr *pRight; | - | ||||||||||||||||||||||||
| 818 | VdbeOp *pOp; | - | ||||||||||||||||||||||||
| 819 | - | |||||||||||||||||||||||||
| 820 | - | |||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||
| 822 | - | |||||||||||||||||||||||||
| 823 | - | |||||||||||||||||||||||||
| 824 | - | |||||||||||||||||||||||||
| 825 | ((void) (0)) | - | ||||||||||||||||||||||||
| 826 | ; | - | ||||||||||||||||||||||||
| 827 | if( !db->mallocFailed
| 0-8 | ||||||||||||||||||||||||
| 828 | - | |||||||||||||||||||||||||
| 829 | ((void) (0)) | - | ||||||||||||||||||||||||
| 830 | ; | - | ||||||||||||||||||||||||
| 831 | pOp = sqlite3VdbeGetOp(v, pLevel->u.in.aInLoop[--iIn].addrInTop); | - | ||||||||||||||||||||||||
| 832 | - | |||||||||||||||||||||||||
| 833 | ((void) (0)) | - | ||||||||||||||||||||||||
| 834 | ; | - | ||||||||||||||||||||||||
| 835 | - | |||||||||||||||||||||||||
| 836 | ((void) (0)) | - | ||||||||||||||||||||||||
| 837 | ; | - | ||||||||||||||||||||||||
| 838 | - | |||||||||||||||||||||||||
| 839 | ((void) (0)) | - | ||||||||||||||||||||||||
| 840 | ; | - | ||||||||||||||||||||||||
| 841 | ; | - | ||||||||||||||||||||||||
| 842 | sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3); | - | ||||||||||||||||||||||||
| 843 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 844 | - | |||||||||||||||||||||||||
| 845 | - | |||||||||||||||||||||||||
| 846 | - | |||||||||||||||||||||||||
| 847 | pCompare = sqlite3PExpr(pParse, 53, 0, 0); | - | ||||||||||||||||||||||||
| 848 | - | |||||||||||||||||||||||||
| 849 | ((void) (0)) | - | ||||||||||||||||||||||||
| 850 | ; | - | ||||||||||||||||||||||||
| 851 | if( pCompare
| 0-8 | ||||||||||||||||||||||||
| 852 | pCompare->pLeft = pTerm->pExpr->pLeft; | - | ||||||||||||||||||||||||
| 853 | pCompare->pRight = pRight = sqlite3Expr(db, 164, 0); | - | ||||||||||||||||||||||||
| 854 | if( pRight
| 0-8 | ||||||||||||||||||||||||
| 855 | pRight->iTable = iReg+j+2; | - | ||||||||||||||||||||||||
| 856 | sqlite3ExprIfFalse(pParse, pCompare, pLevel->addrCont, 0); | - | ||||||||||||||||||||||||
| 857 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 858 | pCompare->pLeft = 0; | - | ||||||||||||||||||||||||
| 859 | sqlite3ExprDelete(db, pCompare); | - | ||||||||||||||||||||||||
| 860 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 861 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||||||||
| 862 | } executed 18422 times by 1 test: end of blockExecuted by:
| 18422 | ||||||||||||||||||||||||
| 863 | - | |||||||||||||||||||||||||
| 864 | - | |||||||||||||||||||||||||
| 865 | - | |||||||||||||||||||||||||
| 866 | - | |||||||||||||||||||||||||
| 867 | - | |||||||||||||||||||||||||
| 868 | - | |||||||||||||||||||||||||
| 869 | - | |||||||||||||||||||||||||
| 870 | } executed 11058 times by 1 test: elseend of blockExecuted by:
| 11058 | ||||||||||||||||||||||||
| 871 | - | |||||||||||||||||||||||||
| 872 | - | |||||||||||||||||||||||||
| 873 | if( (
| 33643-198431 | ||||||||||||||||||||||||
| 874 | && (
| 30233-168198 | ||||||||||||||||||||||||
| 875 | ){ | - | ||||||||||||||||||||||||
| 876 | - | |||||||||||||||||||||||||
| 877 | - | |||||||||||||||||||||||||
| 878 | - | |||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||
| 880 | - | |||||||||||||||||||||||||
| 881 | - | |||||||||||||||||||||||||
| 882 | ((void) (0)) | - | ||||||||||||||||||||||||
| 883 | ; | - | ||||||||||||||||||||||||
| 884 | pTerm = pLoop->aLTerm[0]; | - | ||||||||||||||||||||||||
| 885 | - | |||||||||||||||||||||||||
| 886 | ((void) (0)) | - | ||||||||||||||||||||||||
| 887 | ; | - | ||||||||||||||||||||||||
| 888 | - | |||||||||||||||||||||||||
| 889 | ((void) (0)) | - | ||||||||||||||||||||||||
| 890 | ; | - | ||||||||||||||||||||||||
| 891 | - | |||||||||||||||||||||||||
| 892 | ((void) (0)) | - | ||||||||||||||||||||||||
| 893 | ; | - | ||||||||||||||||||||||||
| 894 | ; | - | ||||||||||||||||||||||||
| 895 | iReleaseReg = ++pParse->nMem; | - | ||||||||||||||||||||||||
| 896 | iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); | - | ||||||||||||||||||||||||
| 897 | if( iRowidReg!=iReleaseReg
executed 23620 times by 30 tests: sqlite3ReleaseTempReg(pParse, iReleaseReg);Executed by:
| 6613-23620 | ||||||||||||||||||||||||
| 898 | addrNxt = pLevel->addrNxt; | - | ||||||||||||||||||||||||
| 899 | sqlite3VdbeAddOp3(v, 30, iCur, addrNxt, iRowidReg); | - | ||||||||||||||||||||||||
| 900 | ; | - | ||||||||||||||||||||||||
| 901 | pLevel->op = 171; | - | ||||||||||||||||||||||||
| 902 | } executed 30233 times by 30 tests: else if( (end of blockExecuted by:
| 30233-168198 | ||||||||||||||||||||||||
| 903 | && (
| 3124-165074 | ||||||||||||||||||||||||
| 904 | ){ | - | ||||||||||||||||||||||||
| 905 | - | |||||||||||||||||||||||||
| 906 | - | |||||||||||||||||||||||||
| 907 | int testOp = 171; | - | ||||||||||||||||||||||||
| 908 | int start; | - | ||||||||||||||||||||||||
| 909 | int memEndValue = 0; | - | ||||||||||||||||||||||||
| 910 | WhereTerm *pStart, *pEnd; | - | ||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||
| 913 | ((void) (0)) | - | ||||||||||||||||||||||||
| 914 | ; | - | ||||||||||||||||||||||||
| 915 | j = 0; | - | ||||||||||||||||||||||||
| 916 | pStart = pEnd = 0; | - | ||||||||||||||||||||||||
| 917 | if( pLoop->wsFlags & 0x00000020
executed 2561 times by 1 test: pStart = pLoop->aLTerm[j++];Executed by:
| 563-2561 | ||||||||||||||||||||||||
| 918 | if( pLoop->wsFlags & 0x00000010
executed 2458 times by 1 test: pEnd = pLoop->aLTerm[j++];Executed by:
| 666-2458 | ||||||||||||||||||||||||
| 919 | - | |||||||||||||||||||||||||
| 920 | ((void) (0)) | - | ||||||||||||||||||||||||
| 921 | ; | - | ||||||||||||||||||||||||
| 922 | if( bRev
| 440-2684 | ||||||||||||||||||||||||
| 923 | pTerm = pStart; | - | ||||||||||||||||||||||||
| 924 | pStart = pEnd; | - | ||||||||||||||||||||||||
| 925 | pEnd = pTerm; | - | ||||||||||||||||||||||||
| 926 | } executed 440 times by 1 test: end of blockExecuted by:
| 440 | ||||||||||||||||||||||||
| 927 | ; | - | ||||||||||||||||||||||||
| 928 | if( pStart
| 416-2708 | ||||||||||||||||||||||||
| 929 | Expr *pX; | - | ||||||||||||||||||||||||
| 930 | int r1, rTemp; | - | ||||||||||||||||||||||||
| 931 | int op; | - | ||||||||||||||||||||||||
| 932 | - | |||||||||||||||||||||||||
| 933 | - | |||||||||||||||||||||||||
| 934 | - | |||||||||||||||||||||||||
| 935 | - | |||||||||||||||||||||||||
| 936 | const u8 aMoveOp[] = { | - | ||||||||||||||||||||||||
| 937 | 25, | - | ||||||||||||||||||||||||
| 938 | 23, | - | ||||||||||||||||||||||||
| 939 | 22, | - | ||||||||||||||||||||||||
| 940 | 24 | - | ||||||||||||||||||||||||
| 941 | }; | - | ||||||||||||||||||||||||
| 942 | - | |||||||||||||||||||||||||
| 943 | ((void) (0)) | - | ||||||||||||||||||||||||
| 944 | ; | - | ||||||||||||||||||||||||
| 945 | - | |||||||||||||||||||||||||
| 946 | ((void) (0)) | - | ||||||||||||||||||||||||
| 947 | ; | - | ||||||||||||||||||||||||
| 948 | - | |||||||||||||||||||||||||
| 949 | ((void) (0)) | - | ||||||||||||||||||||||||
| 950 | ; | - | ||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||
| 952 | - | |||||||||||||||||||||||||
| 953 | ((void) (0)) | - | ||||||||||||||||||||||||
| 954 | ; | - | ||||||||||||||||||||||||
| 955 | ; | - | ||||||||||||||||||||||||
| 956 | pX = pStart->pExpr; | - | ||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||
| 958 | ((void) (0)) | - | ||||||||||||||||||||||||
| 959 | ; | - | ||||||||||||||||||||||||
| 960 | ; | - | ||||||||||||||||||||||||
| 961 | if( sqlite3ExprIsVector(pX->pRight)
| 38-2670 | ||||||||||||||||||||||||
| 962 | r1 = rTemp = sqlite3GetTempReg(pParse); | - | ||||||||||||||||||||||||
| 963 | codeExprOrVector(pParse, pX->pRight, r1, 1); | - | ||||||||||||||||||||||||
| 964 | ; | - | ||||||||||||||||||||||||
| 965 | ; | - | ||||||||||||||||||||||||
| 966 | ; | - | ||||||||||||||||||||||||
| 967 | ; | - | ||||||||||||||||||||||||
| 968 | op = aMoveOp[((pX->op - 54 - 1) & 0x3) | 0x1]; | - | ||||||||||||||||||||||||
| 969 | - | |||||||||||||||||||||||||
| 970 | ((void) (0)) | - | ||||||||||||||||||||||||
| 971 | ; | - | ||||||||||||||||||||||||
| 972 | - | |||||||||||||||||||||||||
| 973 | ((void) (0)) | - | ||||||||||||||||||||||||
| 974 | ; | - | ||||||||||||||||||||||||
| 975 | - | |||||||||||||||||||||||||
| 976 | ((void) (0)) | - | ||||||||||||||||||||||||
| 977 | ; | - | ||||||||||||||||||||||||
| 978 | - | |||||||||||||||||||||||||
| 979 | ((void) (0)) | - | ||||||||||||||||||||||||
| 980 | ; | - | ||||||||||||||||||||||||
| 981 | } executed 38 times by 1 test: else{end of blockExecuted by:
| 38 | ||||||||||||||||||||||||
| 982 | r1 = sqlite3ExprCodeTemp(pParse, pX->pRight, &rTemp); | - | ||||||||||||||||||||||||
| 983 | disableTerm(pLevel, pStart); | - | ||||||||||||||||||||||||
| 984 | op = aMoveOp[(pX->op - 54)]; | - | ||||||||||||||||||||||||
| 985 | } executed 2670 times by 1 test: end of blockExecuted by:
| 2670 | ||||||||||||||||||||||||
| 986 | sqlite3VdbeAddOp3(v, op, iCur, addrBrk, r1); | - | ||||||||||||||||||||||||
| 987 | ; | - | ||||||||||||||||||||||||
| 988 | ; | - | ||||||||||||||||||||||||
| 989 | ; | - | ||||||||||||||||||||||||
| 990 | ; | - | ||||||||||||||||||||||||
| 991 | ; | - | ||||||||||||||||||||||||
| 992 | sqlite3ReleaseTempReg(pParse, rTemp); | - | ||||||||||||||||||||||||
| 993 | } executed 2708 times by 1 test: else{end of blockExecuted by:
| 2708 | ||||||||||||||||||||||||
| 994 | sqlite3VdbeAddOp2(v, bRev ? 32 : 36, iCur, addrHalt); | - | ||||||||||||||||||||||||
| 995 | ; | - | ||||||||||||||||||||||||
| 996 | ; | - | ||||||||||||||||||||||||
| 997 | } executed 416 times by 1 test: end of blockExecuted by:
| 416 | ||||||||||||||||||||||||
| 998 | if( pEnd
| 813-2311 | ||||||||||||||||||||||||
| 999 | Expr *pX; | - | ||||||||||||||||||||||||
| 1000 | pX = pEnd->pExpr; | - | ||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||
| 1002 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1003 | ; | - | ||||||||||||||||||||||||
| 1004 | - | |||||||||||||||||||||||||
| 1005 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1006 | ; | - | ||||||||||||||||||||||||
| 1007 | ; | - | ||||||||||||||||||||||||
| 1008 | ; | - | ||||||||||||||||||||||||
| 1009 | memEndValue = ++pParse->nMem; | - | ||||||||||||||||||||||||
| 1010 | codeExprOrVector(pParse, pX->pRight, memEndValue, 1); | - | ||||||||||||||||||||||||
| 1011 | if( 0==sqlite3ExprIsVector(pX->pRight)
| 4-2307 | ||||||||||||||||||||||||
| 1012 | && (pX->op==56
| 74-2187 | ||||||||||||||||||||||||
| 1013 | ){ | - | ||||||||||||||||||||||||
| 1014 | testOp = bRev
| 74-120 | ||||||||||||||||||||||||
| 1015 | } executed 194 times by 1 test: else{end of blockExecuted by:
| 194 | ||||||||||||||||||||||||
| 1016 | testOp = bRev
| 73-2044 | ||||||||||||||||||||||||
| 1017 | } executed 2117 times by 1 test: end of blockExecuted by:
| 2117 | ||||||||||||||||||||||||
| 1018 | if( 0==sqlite3ExprIsVector(pX->pRight)
| 4-2307 | ||||||||||||||||||||||||
| 1019 | disableTerm(pLevel, pEnd); | - | ||||||||||||||||||||||||
| 1020 | } executed 2307 times by 1 test: end of blockExecuted by:
| 2307 | ||||||||||||||||||||||||
| 1021 | } executed 2311 times by 1 test: end of blockExecuted by:
| 2311 | ||||||||||||||||||||||||
| 1022 | start = sqlite3VdbeCurrentAddr(v); | - | ||||||||||||||||||||||||
| 1023 | pLevel->op = bRev
| 440-2684 | ||||||||||||||||||||||||
| 1024 | pLevel->p1 = iCur; | - | ||||||||||||||||||||||||
| 1025 | pLevel->p2 = start; | - | ||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||
| 1027 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1028 | ; | - | ||||||||||||||||||||||||
| 1029 | if( testOp!=171
| 813-2311 | ||||||||||||||||||||||||
| 1030 | iRowidReg = ++pParse->nMem; | - | ||||||||||||||||||||||||
| 1031 | sqlite3VdbeAddOp2(v, 129, iCur, iRowidReg); | - | ||||||||||||||||||||||||
| 1032 | sqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg); | - | ||||||||||||||||||||||||
| 1033 | ; | - | ||||||||||||||||||||||||
| 1034 | ; | - | ||||||||||||||||||||||||
| 1035 | ; | - | ||||||||||||||||||||||||
| 1036 | ; | - | ||||||||||||||||||||||||
| 1037 | sqlite3VdbeChangeP5(v, 'C' | 0x10); | - | ||||||||||||||||||||||||
| 1038 | } executed 2311 times by 1 test: end of blockExecuted by:
| 2311 | ||||||||||||||||||||||||
| 1039 | } executed 3124 times by 1 test: else if( pLoop->wsFlags & 0x00000200end of blockExecuted by:
| 3124-167440 | ||||||||||||||||||||||||
| 1040 | static const u8 aStartOp[] = { | - | ||||||||||||||||||||||||
| 1041 | 0, | - | ||||||||||||||||||||||||
| 1042 | 0, | - | ||||||||||||||||||||||||
| 1043 | 36, | - | ||||||||||||||||||||||||
| 1044 | 32, | - | ||||||||||||||||||||||||
| 1045 | 25, | - | ||||||||||||||||||||||||
| 1046 | 22, | - | ||||||||||||||||||||||||
| 1047 | 24, | - | ||||||||||||||||||||||||
| 1048 | 23 | - | ||||||||||||||||||||||||
| 1049 | }; | - | ||||||||||||||||||||||||
| 1050 | static const u8 aEndOp[] = { | - | ||||||||||||||||||||||||
| 1051 | 40, | - | ||||||||||||||||||||||||
| 1052 | 38, | - | ||||||||||||||||||||||||
| 1053 | 37, | - | ||||||||||||||||||||||||
| 1054 | 39, | - | ||||||||||||||||||||||||
| 1055 | }; | - | ||||||||||||||||||||||||
| 1056 | u16 nEq = pLoop->u.btree.nEq; | - | ||||||||||||||||||||||||
| 1057 | u16 nBtm = pLoop->u.btree.nBtm; | - | ||||||||||||||||||||||||
| 1058 | u16 nTop = pLoop->u.btree.nTop; | - | ||||||||||||||||||||||||
| 1059 | int regBase; | - | ||||||||||||||||||||||||
| 1060 | WhereTerm *pRangeStart = 0; | - | ||||||||||||||||||||||||
| 1061 | WhereTerm *pRangeEnd = 0; | - | ||||||||||||||||||||||||
| 1062 | int startEq; | - | ||||||||||||||||||||||||
| 1063 | int endEq; | - | ||||||||||||||||||||||||
| 1064 | int start_constraints; | - | ||||||||||||||||||||||||
| 1065 | int nConstraint; | - | ||||||||||||||||||||||||
| 1066 | int iIdxCur; | - | ||||||||||||||||||||||||
| 1067 | int nExtraReg = 0; | - | ||||||||||||||||||||||||
| 1068 | int op; | - | ||||||||||||||||||||||||
| 1069 | char *zStartAff; | - | ||||||||||||||||||||||||
| 1070 | char *zEndAff = 0; | - | ||||||||||||||||||||||||
| 1071 | u8 bSeekPastNull = 0; | - | ||||||||||||||||||||||||
| 1072 | u8 bStopAtNull = 0; | - | ||||||||||||||||||||||||
| 1073 | - | |||||||||||||||||||||||||
| 1074 | pIdx = pLoop->u.btree.pIndex; | - | ||||||||||||||||||||||||
| 1075 | iIdxCur = pLevel->iIdxCur; | - | ||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||
| 1077 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1078 | ; | - | ||||||||||||||||||||||||
| 1079 | - | |||||||||||||||||||||||||
| 1080 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1081 | - | |||||||||||||||||||||||||
| 1082 | - | |||||||||||||||||||||||||
| 1083 | ; | - | ||||||||||||||||||||||||
| 1084 | if( (
| 57-31220 | ||||||||||||||||||||||||
| 1085 | && pWInfo->nOBSat>0
| 5-52 | ||||||||||||||||||||||||
| 1086 | && (
| 2-50 | ||||||||||||||||||||||||
| 1087 | ){ | - | ||||||||||||||||||||||||
| 1088 | - | |||||||||||||||||||||||||
| 1089 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1090 | ; | - | ||||||||||||||||||||||||
| 1091 | bSeekPastNull = 1; | - | ||||||||||||||||||||||||
| 1092 | nExtraReg = 1; | - | ||||||||||||||||||||||||
| 1093 | } executed 50 times by 1 test: end of blockExecuted by:
| 50 | ||||||||||||||||||||||||
| 1094 | - | |||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||
| 1096 | - | |||||||||||||||||||||||||
| 1097 | - | |||||||||||||||||||||||||
| 1098 | j = nEq; | - | ||||||||||||||||||||||||
| 1099 | if( pLoop->wsFlags & 0x00000020
| 5997-25280 | ||||||||||||||||||||||||
| 1100 | pRangeStart = pLoop->aLTerm[j++]; | - | ||||||||||||||||||||||||
| 1101 | nExtraReg = ((
| 0-5997 | ||||||||||||||||||||||||
| 1102 | - | |||||||||||||||||||||||||
| 1103 | - | |||||||||||||||||||||||||
| 1104 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1105 | - | |||||||||||||||||||||||||
| 1106 | ; | - | ||||||||||||||||||||||||
| 1107 | } executed 5997 times by 1 test: end of blockExecuted by:
| 5997 | ||||||||||||||||||||||||
| 1108 | if( pLoop->wsFlags & 0x00000010
| 5908-25369 | ||||||||||||||||||||||||
| 1109 | pRangeEnd = pLoop->aLTerm[j++]; | - | ||||||||||||||||||||||||
| 1110 | nExtraReg = ((
| 0-5908 | ||||||||||||||||||||||||
| 1111 | - | |||||||||||||||||||||||||
| 1112 | if( (
| 1726-4182 | ||||||||||||||||||||||||
| 1113 | - | |||||||||||||||||||||||||
| 1114 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1115 | ; | - | ||||||||||||||||||||||||
| 1116 | - | |||||||||||||||||||||||||
| 1117 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1118 | ; | - | ||||||||||||||||||||||||
| 1119 | pLevel->iLikeRepCntr = (u32)++pParse->nMem; | - | ||||||||||||||||||||||||
| 1120 | sqlite3VdbeAddOp2(v, 70, 1, (int)pLevel->iLikeRepCntr); | - | ||||||||||||||||||||||||
| 1121 | ; | - | ||||||||||||||||||||||||
| 1122 | pLevel->addrLikeRep = sqlite3VdbeCurrentAddr(v); | - | ||||||||||||||||||||||||
| 1123 | - | |||||||||||||||||||||||||
| 1124 | - | |||||||||||||||||||||||||
| 1125 | ; | - | ||||||||||||||||||||||||
| 1126 | ; | - | ||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||
| 1128 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1129 | ; | - | ||||||||||||||||||||||||
| 1130 | pLevel->iLikeRepCntr <<=1; | - | ||||||||||||||||||||||||
| 1131 | pLevel->iLikeRepCntr |= bRev ^ (pIdx->aSortOrder[nEq]==1); | - | ||||||||||||||||||||||||
| 1132 | } executed 1726 times by 1 test: end of blockExecuted by:
| 1726 | ||||||||||||||||||||||||
| 1133 | - | |||||||||||||||||||||||||
| 1134 | if( pRangeStart==0
| 1812-4096 | ||||||||||||||||||||||||
| 1135 | j = pIdx->aiColumn[nEq]; | - | ||||||||||||||||||||||||
| 1136 | if( (j>=0
| 6-1658 | ||||||||||||||||||||||||
| 1137 | bSeekPastNull = 1; | - | ||||||||||||||||||||||||
| 1138 | } executed 1655 times by 1 test: end of blockExecuted by:
| 1655 | ||||||||||||||||||||||||
| 1139 | } executed 1812 times by 1 test: end of blockExecuted by:
| 1812 | ||||||||||||||||||||||||
| 1140 | } executed 5908 times by 1 test: end of blockExecuted by:
| 5908 | ||||||||||||||||||||||||
| 1141 | - | |||||||||||||||||||||||||
| 1142 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1143 | ; | - | ||||||||||||||||||||||||
| 1144 | - | |||||||||||||||||||||||||
| 1145 | - | |||||||||||||||||||||||||
| 1146 | - | |||||||||||||||||||||||||
| 1147 | - | |||||||||||||||||||||||||
| 1148 | - | |||||||||||||||||||||||||
| 1149 | if( (nEq<pIdx->nKeyCol
| 1399-15722 | ||||||||||||||||||||||||
| 1150 | || (bRev
| 36-29671 | ||||||||||||||||||||||||
| 1151 | ){ | - | ||||||||||||||||||||||||
| 1152 | {WhereTerm * t=pRangeEnd; pRangeEnd=pRangeStart; pRangeStart=t;}; | - | ||||||||||||||||||||||||
| 1153 | {u8 t=bSeekPastNull; bSeekPastNull=bStopAtNull; bStopAtNull=t;}; | - | ||||||||||||||||||||||||
| 1154 | {u8 t=nBtm; nBtm=nTop; nTop=t;}; | - | ||||||||||||||||||||||||
| 1155 | } executed 1570 times by 1 test: end of blockExecuted by:
| 1570 | ||||||||||||||||||||||||
| 1156 | - | |||||||||||||||||||||||||
| 1157 | - | |||||||||||||||||||||||||
| 1158 | - | |||||||||||||||||||||||||
| 1159 | - | |||||||||||||||||||||||||
| 1160 | - | |||||||||||||||||||||||||
| 1161 | ; | - | ||||||||||||||||||||||||
| 1162 | regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); | - | ||||||||||||||||||||||||
| 1163 | - | |||||||||||||||||||||||||
| 1164 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1165 | ; | - | ||||||||||||||||||||||||
| 1166 | if( zStartAff
| 8-31269 | ||||||||||||||||||||||||
| 1167 | zEndAff = sqlite3DbStrDup(db, &zStartAff[nEq]); | - | ||||||||||||||||||||||||
| 1168 | } executed 5909 times by 1 test: end of blockExecuted by:
| 5909 | ||||||||||||||||||||||||
| 1169 | addrNxt = pLevel->addrNxt; | - | ||||||||||||||||||||||||
| 1170 | - | |||||||||||||||||||||||||
| 1171 | ; | - | ||||||||||||||||||||||||
| 1172 | ; | - | ||||||||||||||||||||||||
| 1173 | ; | - | ||||||||||||||||||||||||
| 1174 | ; | - | ||||||||||||||||||||||||
| 1175 | startEq = !pRangeStart
| 1097-25285 | ||||||||||||||||||||||||
| 1176 | endEq = !pRangeEnd
| 1192-25364 | ||||||||||||||||||||||||
| 1177 | start_constraints = pRangeStart
| 5992-25285 | ||||||||||||||||||||||||
| 1178 | - | |||||||||||||||||||||||||
| 1179 | - | |||||||||||||||||||||||||
| 1180 | nConstraint = nEq; | - | ||||||||||||||||||||||||
| 1181 | if( pRangeStart
| 5992-25285 | ||||||||||||||||||||||||
| 1182 | Expr *pRight = pRangeStart->pExpr->pRight; | - | ||||||||||||||||||||||||
| 1183 | codeExprOrVector(pParse, pRight, regBase+nEq, nBtm); | - | ||||||||||||||||||||||||
| 1184 | whereLikeOptimizationStringFixup(v, pLevel, pRangeStart); | - | ||||||||||||||||||||||||
| 1185 | if( (
| 0-5992 | ||||||||||||||||||||||||
| 1186 | && sqlite3ExprCanBeNull(pRight)
| 1141-4851 | ||||||||||||||||||||||||
| 1187 | ){ | - | ||||||||||||||||||||||||
| 1188 | sqlite3VdbeAddOp2(v, 50, regBase+nEq, addrNxt); | - | ||||||||||||||||||||||||
| 1189 | ; | - | ||||||||||||||||||||||||
| 1190 | } executed 1141 times by 1 test: end of blockExecuted by:
| 1141 | ||||||||||||||||||||||||
| 1191 | if( zStartAff
| 4-5988 | ||||||||||||||||||||||||
| 1192 | updateRangeAffinityStr(pRight, nBtm, &zStartAff[nEq]); | - | ||||||||||||||||||||||||
| 1193 | } executed 5988 times by 1 test: end of blockExecuted by:
| 5988 | ||||||||||||||||||||||||
| 1194 | nConstraint += nBtm; | - | ||||||||||||||||||||||||
| 1195 | ; | - | ||||||||||||||||||||||||
| 1196 | if( sqlite3ExprIsVector(pRight)==0
| 1008-4984 | ||||||||||||||||||||||||
| 1197 | disableTerm(pLevel, pRangeStart); | - | ||||||||||||||||||||||||
| 1198 | } executed 4984 times by 1 test: else{end of blockExecuted by:
| 4984 | ||||||||||||||||||||||||
| 1199 | startEq = 1; | - | ||||||||||||||||||||||||
| 1200 | } executed 1008 times by 1 test: end of blockExecuted by:
| 1008 | ||||||||||||||||||||||||
| 1201 | bSeekPastNull = 0; | - | ||||||||||||||||||||||||
| 1202 | } executed 5992 times by 1 test: else if( bSeekPastNullend of blockExecuted by:
| 1527-23758 | ||||||||||||||||||||||||
| 1203 | sqlite3VdbeAddOp2(v, 73, 0, regBase+nEq); | - | ||||||||||||||||||||||||
| 1204 | nConstraint++; | - | ||||||||||||||||||||||||
| 1205 | startEq = 0; | - | ||||||||||||||||||||||||
| 1206 | start_constraints = 1; | - | ||||||||||||||||||||||||
| 1207 | } executed 1527 times by 1 test: end of blockExecuted by:
| 1527 | ||||||||||||||||||||||||
| 1208 | codeApplyAffinity(pParse, regBase, nConstraint - bSeekPastNull, zStartAff); | - | ||||||||||||||||||||||||
| 1209 | if( pLoop->nSkip>0
| 0-31233 | ||||||||||||||||||||||||
| 1210 | - | |||||||||||||||||||||||||
| 1211 | - | |||||||||||||||||||||||||
| 1212 | - | |||||||||||||||||||||||||
| 1213 | } never executed: else{end of block | 0 | ||||||||||||||||||||||||
| 1214 | if( pLoop->wsFlags & 0x00040000
| 223-31054 | ||||||||||||||||||||||||
| 1215 | sqlite3VdbeAddOp1(v, 119, iIdxCur); | - | ||||||||||||||||||||||||
| 1216 | } executed 223 times by 1 test: end of blockExecuted by:
| 223 | ||||||||||||||||||||||||
| 1217 | op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; | - | ||||||||||||||||||||||||
| 1218 | - | |||||||||||||||||||||||||
| 1219 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1220 | ; | - | ||||||||||||||||||||||||
| 1221 | sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); | - | ||||||||||||||||||||||||
| 1222 | ; | - | ||||||||||||||||||||||||
| 1223 | ; ; | - | ||||||||||||||||||||||||
| 1224 | ; ; | - | ||||||||||||||||||||||||
| 1225 | ; ; | - | ||||||||||||||||||||||||
| 1226 | ; ; | - | ||||||||||||||||||||||||
| 1227 | ; ; | - | ||||||||||||||||||||||||
| 1228 | ; ; | - | ||||||||||||||||||||||||
| 1229 | } executed 31277 times by 2 tests: end of blockExecuted by:
| 31277 | ||||||||||||||||||||||||
| 1230 | - | |||||||||||||||||||||||||
| 1231 | - | |||||||||||||||||||||||||
| 1232 | - | |||||||||||||||||||||||||
| 1233 | - | |||||||||||||||||||||||||
| 1234 | nConstraint = nEq; | - | ||||||||||||||||||||||||
| 1235 | if( pRangeEnd
| 5913-25364 | ||||||||||||||||||||||||
| 1236 | Expr *pRight = pRangeEnd->pExpr->pRight; | - | ||||||||||||||||||||||||
| 1237 | codeExprOrVector(pParse, pRight, regBase+nEq, nTop); | - | ||||||||||||||||||||||||
| 1238 | whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd); | - | ||||||||||||||||||||||||
| 1239 | if( (
| 0-5913 | ||||||||||||||||||||||||
| 1240 | && sqlite3ExprCanBeNull(pRight)
| 1122-4791 | ||||||||||||||||||||||||
| 1241 | ){ | - | ||||||||||||||||||||||||
| 1242 | sqlite3VdbeAddOp2(v, 50, regBase+nEq, addrNxt); | - | ||||||||||||||||||||||||
| 1243 | ; | - | ||||||||||||||||||||||||
| 1244 | } executed 1122 times by 1 test: end of blockExecuted by:
| 1122 | ||||||||||||||||||||||||
| 1245 | if( zEndAff
| 6-5907 | ||||||||||||||||||||||||
| 1246 | updateRangeAffinityStr(pRight, nTop, zEndAff); | - | ||||||||||||||||||||||||
| 1247 | codeApplyAffinity(pParse, regBase+nEq, nTop, zEndAff); | - | ||||||||||||||||||||||||
| 1248 | } executed 5907 times by 1 test: else{end of blockExecuted by:
| 5907 | ||||||||||||||||||||||||
| 1249 | - | |||||||||||||||||||||||||
| 1250 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1251 | ; | - | ||||||||||||||||||||||||
| 1252 | } executed 6 times by 1 test: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||
| 1253 | nConstraint += nTop; | - | ||||||||||||||||||||||||
| 1254 | ; | - | ||||||||||||||||||||||||
| 1255 | - | |||||||||||||||||||||||||
| 1256 | if( sqlite3ExprIsVector(pRight)==0
| 1000-4913 | ||||||||||||||||||||||||
| 1257 | disableTerm(pLevel, pRangeEnd); | - | ||||||||||||||||||||||||
| 1258 | } executed 4913 times by 1 test: else{end of blockExecuted by:
| 4913 | ||||||||||||||||||||||||
| 1259 | endEq = 1; | - | ||||||||||||||||||||||||
| 1260 | } executed 1000 times by 1 test: end of blockExecuted by:
| 1000 | ||||||||||||||||||||||||
| 1261 | }else if( bStopAtNull
| 163-25201 | ||||||||||||||||||||||||
| 1262 | sqlite3VdbeAddOp2(v, 73, 0, regBase+nEq); | - | ||||||||||||||||||||||||
| 1263 | endEq = 0; | - | ||||||||||||||||||||||||
| 1264 | nConstraint++; | - | ||||||||||||||||||||||||
| 1265 | } executed 163 times by 1 test: end of blockExecuted by:
| 163 | ||||||||||||||||||||||||
| 1266 | sqlite3DbFree(db, zStartAff); | - | ||||||||||||||||||||||||
| 1267 | sqlite3DbFree(db, zEndAff); | - | ||||||||||||||||||||||||
| 1268 | - | |||||||||||||||||||||||||
| 1269 | - | |||||||||||||||||||||||||
| 1270 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); | - | ||||||||||||||||||||||||
| 1271 | - | |||||||||||||||||||||||||
| 1272 | - | |||||||||||||||||||||||||
| 1273 | if( nConstraint
| 6226-25051 | ||||||||||||||||||||||||
| 1274 | op = aEndOp[bRev*2 + endEq]; | - | ||||||||||||||||||||||||
| 1275 | sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); | - | ||||||||||||||||||||||||
| 1276 | ; ; | - | ||||||||||||||||||||||||
| 1277 | ; ; | - | ||||||||||||||||||||||||
| 1278 | ; ; | - | ||||||||||||||||||||||||
| 1279 | ; ; | - | ||||||||||||||||||||||||
| 1280 | } executed 25051 times by 1 test: end of blockExecuted by:
| 25051 | ||||||||||||||||||||||||
| 1281 | - | |||||||||||||||||||||||||
| 1282 | if( pLoop->wsFlags & 0x00040000
| 223-31054 | ||||||||||||||||||||||||
| 1283 | sqlite3VdbeAddOp2(v, 119, iIdxCur, 1); | - | ||||||||||||||||||||||||
| 1284 | } executed 223 times by 1 test: end of blockExecuted by:
| 223 | ||||||||||||||||||||||||
| 1285 | - | |||||||||||||||||||||||||
| 1286 | - | |||||||||||||||||||||||||
| 1287 | if( omitTable
| 9827-21450 | ||||||||||||||||||||||||
| 1288 | - | |||||||||||||||||||||||||
| 1289 | } executed 9827 times by 1 test: else if( (((end of blockExecuted by:
| 45-21405 | ||||||||||||||||||||||||
| 1290 | if( (
| 247-21158 | ||||||||||||||||||||||||
| 1291 | (
| 131-21027 | ||||||||||||||||||||||||
| 1292 | && (
| 45-86 | ||||||||||||||||||||||||
| 1293 | )){ | - | ||||||||||||||||||||||||
| 1294 | iRowidReg = ++pParse->nMem; | - | ||||||||||||||||||||||||
| 1295 | sqlite3VdbeAddOp2(v, 136, iIdxCur, iRowidReg); | - | ||||||||||||||||||||||||
| 1296 | sqlite3VdbeAddOp3(v, 31, iCur, 0, iRowidReg); | - | ||||||||||||||||||||||||
| 1297 | ; | - | ||||||||||||||||||||||||
| 1298 | } executed 333 times by 1 test: else{end of blockExecuted by:
| 333 | ||||||||||||||||||||||||
| 1299 | codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur); | - | ||||||||||||||||||||||||
| 1300 | } executed 21072 times by 2 tests: end of blockExecuted by:
| 21072 | ||||||||||||||||||||||||
| 1301 | }else if( iCur!=iIdxCur
| 7-38 | ||||||||||||||||||||||||
| 1302 | Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable); | - | ||||||||||||||||||||||||
| 1303 | iRowidReg = sqlite3GetTempRange(pParse, pPk->nKeyCol); | - | ||||||||||||||||||||||||
| 1304 | for(j=0; j<pPk->nKeyCol
| 38-42 | ||||||||||||||||||||||||
| 1305 | k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[j]); | - | ||||||||||||||||||||||||
| 1306 | sqlite3VdbeAddOp3(v, 90, iIdxCur, k, iRowidReg+j); | - | ||||||||||||||||||||||||
| 1307 | } executed 42 times by 1 test: end of blockExecuted by:
| 42 | ||||||||||||||||||||||||
| 1308 | sqlite3VdbeAddOp4Int(v, 28, iCur, addrCont, | - | ||||||||||||||||||||||||
| 1309 | iRowidReg, pPk->nKeyCol); ; | - | ||||||||||||||||||||||||
| 1310 | } executed 38 times by 1 test: end of blockExecuted by:
| 38 | ||||||||||||||||||||||||
| 1311 | if( pLevel->iLeftJoin==0
| 248-31029 | ||||||||||||||||||||||||
| 1312 | whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo); | - | ||||||||||||||||||||||||
| 1313 | } executed 31029 times by 2 tests: end of blockExecuted by:
| 31029 | ||||||||||||||||||||||||
| 1314 | - | |||||||||||||||||||||||||
| 1315 | - | |||||||||||||||||||||||||
| 1316 | if( pLoop->wsFlags & 0x00001000
| 878-30399 | ||||||||||||||||||||||||
| 1317 | pLevel->op = 171; | - | ||||||||||||||||||||||||
| 1318 | } executed 878 times by 1 test: else if( bRevend of blockExecuted by:
| 878-28901 | ||||||||||||||||||||||||
| 1319 | pLevel->op = 4; | - | ||||||||||||||||||||||||
| 1320 | } executed 1498 times by 1 test: else{end of blockExecuted by:
| 1498 | ||||||||||||||||||||||||
| 1321 | pLevel->op = 5; | - | ||||||||||||||||||||||||
| 1322 | } executed 28901 times by 2 tests: end of blockExecuted by:
| 28901 | ||||||||||||||||||||||||
| 1323 | pLevel->p1 = iIdxCur; | - | ||||||||||||||||||||||||
| 1324 | pLevel->p3 = (
| 11785-19492 | ||||||||||||||||||||||||
| 1325 | if( (
| 4766-26511 | ||||||||||||||||||||||||
| 1326 | pLevel->p5 = 1; | - | ||||||||||||||||||||||||
| 1327 | } executed 4766 times by 2 tests: else{end of blockExecuted by:
| 4766 | ||||||||||||||||||||||||
| 1328 | - | |||||||||||||||||||||||||
| 1329 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1330 | ; | - | ||||||||||||||||||||||||
| 1331 | } executed 26511 times by 1 test: end of blockExecuted by:
| 26511 | ||||||||||||||||||||||||
| 1332 | if( omitTable
executed 9827 times by 1 test: pIdx = 0;Executed by:
| 9827-21450 | ||||||||||||||||||||||||
| 1333 | } executed 31277 times by 2 tests: elseend of blockExecuted by:
| 31277 | ||||||||||||||||||||||||
| 1334 | - | |||||||||||||||||||||||||
| 1335 | - | |||||||||||||||||||||||||
| 1336 | if( pLoop->wsFlags & 0x00002000
| 2366-165074 | ||||||||||||||||||||||||
| 1337 | WhereClause *pOrWc; | - | ||||||||||||||||||||||||
| 1338 | SrcList *pOrTab; | - | ||||||||||||||||||||||||
| 1339 | Index *pCov = 0; | - | ||||||||||||||||||||||||
| 1340 | int iCovCur = pParse->nTab++; | - | ||||||||||||||||||||||||
| 1341 | - | |||||||||||||||||||||||||
| 1342 | int regReturn = ++pParse->nMem; | - | ||||||||||||||||||||||||
| 1343 | int regRowset = 0; | - | ||||||||||||||||||||||||
| 1344 | int regRowid = 0; | - | ||||||||||||||||||||||||
| 1345 | int iLoopBody = sqlite3VdbeMakeLabel(v); | - | ||||||||||||||||||||||||
| 1346 | int iRetInit; | - | ||||||||||||||||||||||||
| 1347 | int untestedTerms = 0; | - | ||||||||||||||||||||||||
| 1348 | int ii; | - | ||||||||||||||||||||||||
| 1349 | u16 wctrlFlags; | - | ||||||||||||||||||||||||
| 1350 | Expr *pAndExpr = 0; | - | ||||||||||||||||||||||||
| 1351 | Table *pTab = pTabItem->pTab; | - | ||||||||||||||||||||||||
| 1352 | - | |||||||||||||||||||||||||
| 1353 | pTerm = pLoop->aLTerm[0]; | - | ||||||||||||||||||||||||
| 1354 | - | |||||||||||||||||||||||||
| 1355 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1356 | ; | - | ||||||||||||||||||||||||
| 1357 | - | |||||||||||||||||||||||||
| 1358 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1359 | ; | - | ||||||||||||||||||||||||
| 1360 | - | |||||||||||||||||||||||||
| 1361 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1362 | ; | - | ||||||||||||||||||||||||
| 1363 | pOrWc = &pTerm->u.pOrInfo->wc; | - | ||||||||||||||||||||||||
| 1364 | pLevel->op = 66; | - | ||||||||||||||||||||||||
| 1365 | pLevel->p1 = regReturn; | - | ||||||||||||||||||||||||
| 1366 | - | |||||||||||||||||||||||||
| 1367 | - | |||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||
| 1369 | - | |||||||||||||||||||||||||
| 1370 | - | |||||||||||||||||||||||||
| 1371 | if( pWInfo->nLevel>1
| 120-2246 | ||||||||||||||||||||||||
| 1372 | int nNotReady; | - | ||||||||||||||||||||||||
| 1373 | struct SrcList_item *origSrc; | - | ||||||||||||||||||||||||
| 1374 | nNotReady = pWInfo->nLevel - iLevel - 1; | - | ||||||||||||||||||||||||
| 1375 | pOrTab = sqlite3DbMallocRaw(db,sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])) | - | ||||||||||||||||||||||||
| 1376 | ; | - | ||||||||||||||||||||||||
| 1377 | if( pOrTab==0
never executed: notReady;return notReady;never executed: return notReady; | 0-120 | ||||||||||||||||||||||||
| 1378 | pOrTab->nAlloc = (u8)(nNotReady + 1); | - | ||||||||||||||||||||||||
| 1379 | pOrTab->nSrc = pOrTab->nAlloc; | - | ||||||||||||||||||||||||
| 1380 | memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem)); | - | ||||||||||||||||||||||||
| 1381 | origSrc = pWInfo->pTabList->a; | - | ||||||||||||||||||||||||
| 1382 | for(k=1; k<=nNotReady
| 83-120 | ||||||||||||||||||||||||
| 1383 | memcpy(&pOrTab->a[k], &origSrc[pLevel[k].iFrom], sizeof(pOrTab->a[k])); | - | ||||||||||||||||||||||||
| 1384 | } executed 83 times by 1 test: end of blockExecuted by:
| 83 | ||||||||||||||||||||||||
| 1385 | } executed 120 times by 1 test: else{end of blockExecuted by:
| 120 | ||||||||||||||||||||||||
| 1386 | pOrTab = pWInfo->pTabList; | - | ||||||||||||||||||||||||
| 1387 | } executed 2246 times by 1 test: end of blockExecuted by:
| 2246 | ||||||||||||||||||||||||
| 1388 | if( (
| 14-2352 | ||||||||||||||||||||||||
| 1389 | if( (((
| 12-2340 | ||||||||||||||||||||||||
| 1390 | regRowset = ++pParse->nMem; | - | ||||||||||||||||||||||||
| 1391 | sqlite3VdbeAddOp2(v, 73, 0, regRowset); | - | ||||||||||||||||||||||||
| 1392 | } executed 2340 times by 1 test: else{end of blockExecuted by:
| 2340 | ||||||||||||||||||||||||
| 1393 | Index *pPk = sqlite3PrimaryKeyIndex(pTab); | - | ||||||||||||||||||||||||
| 1394 | regRowset = pParse->nTab++; | - | ||||||||||||||||||||||||
| 1395 | sqlite3VdbeAddOp2(v, 113, regRowset, pPk->nKeyCol); | - | ||||||||||||||||||||||||
| 1396 | sqlite3VdbeSetP4KeyInfo(pParse, pPk); | - | ||||||||||||||||||||||||
| 1397 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||||||||||||||
| 1398 | regRowid = ++pParse->nMem; | - | ||||||||||||||||||||||||
| 1399 | } executed 2352 times by 1 test: end of blockExecuted by:
| 2352 | ||||||||||||||||||||||||
| 1400 | iRetInit = sqlite3VdbeAddOp2(v, 70, 0, regReturn); | - | ||||||||||||||||||||||||
| 1401 | if( pWC->nTerm>1
| 66-2300 | ||||||||||||||||||||||||
| 1402 | int iTerm; | - | ||||||||||||||||||||||||
| 1403 | for(iTerm=0; iTerm<pWC->nTerm
| 66-166 | ||||||||||||||||||||||||
| 1404 | Expr *pExpr = pWC->a[iTerm].pExpr; | - | ||||||||||||||||||||||||
| 1405 | if( &pWC->a[iTerm] == pTerm
executed 66 times by 1 test: continue;Executed by:
| 66-100 | ||||||||||||||||||||||||
| 1406 | ; | - | ||||||||||||||||||||||||
| 1407 | ; | - | ||||||||||||||||||||||||
| 1408 | if( (
executed 60 times by 1 test: continue;Executed by:
| 40-60 | ||||||||||||||||||||||||
| 1409 | if( (
executed 8 times by 1 test: continue;Executed by:
| 8-32 | ||||||||||||||||||||||||
| 1410 | ; | - | ||||||||||||||||||||||||
| 1411 | pExpr = sqlite3ExprDup(db, pExpr, 0); | - | ||||||||||||||||||||||||
| 1412 | pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr); | - | ||||||||||||||||||||||||
| 1413 | } executed 32 times by 1 test: end of blockExecuted by:
| 32 | ||||||||||||||||||||||||
| 1414 | if( pAndExpr
| 26-40 | ||||||||||||||||||||||||
| 1415 | pAndExpr = sqlite3PExpr(pParse, 44|0x100, 0, pAndExpr); | - | ||||||||||||||||||||||||
| 1416 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 1417 | } executed 66 times by 1 test: end of blockExecuted by:
| 66 | ||||||||||||||||||||||||
| 1418 | - | |||||||||||||||||||||||||
| 1419 | - | |||||||||||||||||||||||||
| 1420 | - | |||||||||||||||||||||||||
| 1421 | - | |||||||||||||||||||||||||
| 1422 | - | |||||||||||||||||||||||||
| 1423 | wctrlFlags = 0x0020 | (pWInfo->wctrlFlags & 0x0400); | - | ||||||||||||||||||||||||
| 1424 | sqlite3VdbeExplain (pParse, 1, "MULTI-INDEX OR"); | - | ||||||||||||||||||||||||
| 1425 | for(ii=0; ii<pOrWc->nTerm
| 2366-17848 | ||||||||||||||||||||||||
| 1426 | WhereTerm *pOrTerm = &pOrWc->a[ii]; | - | ||||||||||||||||||||||||
| 1427 | if( pOrTerm->leftCursor==iCur
| 61-9714 | ||||||||||||||||||||||||
| 1428 | WhereInfo *pSubWInfo; | - | ||||||||||||||||||||||||
| 1429 | Expr *pOrExpr = pOrTerm->pExpr; | - | ||||||||||||||||||||||||
| 1430 | int jmp1 = 0; | - | ||||||||||||||||||||||||
| 1431 | - | |||||||||||||||||||||||||
| 1432 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1433 | - | |||||||||||||||||||||||||
| 1434 | - | |||||||||||||||||||||||||
| 1435 | ; | - | ||||||||||||||||||||||||
| 1436 | if( pAndExpr
| 1608-16179 | ||||||||||||||||||||||||
| 1437 | pAndExpr->pLeft = pOrExpr; | - | ||||||||||||||||||||||||
| 1438 | pOrExpr = pAndExpr; | - | ||||||||||||||||||||||||
| 1439 | } executed 1608 times by 1 test: end of blockExecuted by:
| 1608 | ||||||||||||||||||||||||
| 1440 | - | |||||||||||||||||||||||||
| 1441 | ; | - | ||||||||||||||||||||||||
| 1442 | pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, | - | ||||||||||||||||||||||||
| 1443 | wctrlFlags, iCovCur); | - | ||||||||||||||||||||||||
| 1444 | - | |||||||||||||||||||||||||
| 1445 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1446 | ; | - | ||||||||||||||||||||||||
| 1447 | if( pSubWInfo
| 0-17787 | ||||||||||||||||||||||||
| 1448 | WhereLoop *pSubLoop; | - | ||||||||||||||||||||||||
| 1449 | int addrExplain = sqlite3WhereExplainOneScan( | - | ||||||||||||||||||||||||
| 1450 | pParse, pOrTab, &pSubWInfo->a[0], 0 | - | ||||||||||||||||||||||||
| 1451 | ); | - | ||||||||||||||||||||||||
| 1452 | ((void)addrExplain); | - | ||||||||||||||||||||||||
| 1453 | - | |||||||||||||||||||||||||
| 1454 | - | |||||||||||||||||||||||||
| 1455 | - | |||||||||||||||||||||||||
| 1456 | - | |||||||||||||||||||||||||
| 1457 | - | |||||||||||||||||||||||||
| 1458 | - | |||||||||||||||||||||||||
| 1459 | if( (
| 36-17751 | ||||||||||||||||||||||||
| 1460 | int iSet = ((
| 2335-15416 | ||||||||||||||||||||||||
| 1461 | if( (((
| 25-17726 | ||||||||||||||||||||||||
| 1462 | sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, -1, regRowid); | - | ||||||||||||||||||||||||
| 1463 | jmp1 = sqlite3VdbeAddOp4Int(v, 42, regRowset, 0, | - | ||||||||||||||||||||||||
| 1464 | regRowid, iSet); | - | ||||||||||||||||||||||||
| 1465 | ; | - | ||||||||||||||||||||||||
| 1466 | } executed 17726 times by 1 test: else{end of blockExecuted by:
| 17726 | ||||||||||||||||||||||||
| 1467 | Index *pPk = sqlite3PrimaryKeyIndex(pTab); | - | ||||||||||||||||||||||||
| 1468 | int nPk = pPk->nKeyCol; | - | ||||||||||||||||||||||||
| 1469 | int iPk; | - | ||||||||||||||||||||||||
| 1470 | int r; | - | ||||||||||||||||||||||||
| 1471 | - | |||||||||||||||||||||||||
| 1472 | - | |||||||||||||||||||||||||
| 1473 | r = sqlite3GetTempRange(pParse, nPk); | - | ||||||||||||||||||||||||
| 1474 | for(iPk=0; iPk<nPk
| 25-33 | ||||||||||||||||||||||||
| 1475 | int iCol = pPk->aiColumn[iPk]; | - | ||||||||||||||||||||||||
| 1476 | sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, iCol, r+iPk); | - | ||||||||||||||||||||||||
| 1477 | } executed 33 times by 1 test: end of blockExecuted by:
| 33 | ||||||||||||||||||||||||
| 1478 | if( iSet
| 12-13 | ||||||||||||||||||||||||
| 1479 | jmp1 = sqlite3VdbeAddOp4Int(v, 29, regRowset, 0, r, nPk); | - | ||||||||||||||||||||||||
| 1480 | ; | - | ||||||||||||||||||||||||
| 1481 | } executed 13 times by 1 test: end of blockExecuted by:
| 13 | ||||||||||||||||||||||||
| 1482 | if( iSet>=0
| 12-13 | ||||||||||||||||||||||||
| 1483 | sqlite3VdbeAddOp3(v, 102, r, nPk, regRowid); | - | ||||||||||||||||||||||||
| 1484 | sqlite3VdbeAddOp4Int(v, 133, regRowset, regRowid, | - | ||||||||||||||||||||||||
| 1485 | r, nPk); | - | ||||||||||||||||||||||||
| 1486 | if( iSet
executed 1 time by 1 test: sqlite3VdbeChangeP5(v, 0x10);Executed by:
| 1-12 | ||||||||||||||||||||||||
| 1487 | } executed 13 times by 1 test: end of blockExecuted by:
| 13 | ||||||||||||||||||||||||
| 1488 | - | |||||||||||||||||||||||||
| 1489 | - | |||||||||||||||||||||||||
| 1490 | sqlite3ReleaseTempRange(pParse, r, nPk); | - | ||||||||||||||||||||||||
| 1491 | } executed 25 times by 1 test: end of blockExecuted by:
| 25 | ||||||||||||||||||||||||
| 1492 | } | - | ||||||||||||||||||||||||
| 1493 | - | |||||||||||||||||||||||||
| 1494 | - | |||||||||||||||||||||||||
| 1495 | sqlite3VdbeAddOp2(v, 12, regReturn, iLoopBody); | - | ||||||||||||||||||||||||
| 1496 | - | |||||||||||||||||||||||||
| 1497 | - | |||||||||||||||||||||||||
| 1498 | - | |||||||||||||||||||||||||
| 1499 | if( jmp1
executed 17739 times by 1 test: sqlite3VdbeJumpHere(v, jmp1);Executed by:
| 48-17739 | ||||||||||||||||||||||||
| 1500 | - | |||||||||||||||||||||||||
| 1501 | - | |||||||||||||||||||||||||
| 1502 | - | |||||||||||||||||||||||||
| 1503 | - | |||||||||||||||||||||||||
| 1504 | - | |||||||||||||||||||||||||
| 1505 | - | |||||||||||||||||||||||||
| 1506 | if( pSubWInfo->untestedTerms
executed 73 times by 1 test: untestedTerms = 1;Executed by:
| 73-17714 | ||||||||||||||||||||||||
| 1507 | pSubLoop = pSubWInfo->a[0].pWLoop; | - | ||||||||||||||||||||||||
| 1508 | - | |||||||||||||||||||||||||
| 1509 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1510 | ; | - | ||||||||||||||||||||||||
| 1511 | if( (
| 4467-13320 | ||||||||||||||||||||||||
| 1512 | && (ii==0
| 1007-11515 | ||||||||||||||||||||||||
| 1513 | && ((((
| 4-2797 | ||||||||||||||||||||||||
| 1514 | ){ | - | ||||||||||||||||||||||||
| 1515 | - | |||||||||||||||||||||||||
| 1516 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1517 | ; | - | ||||||||||||||||||||||||
| 1518 | pCov = pSubLoop->u.btree.pIndex; | - | ||||||||||||||||||||||||
| 1519 | } executed 2808 times by 1 test: else{end of blockExecuted by:
| 2808 | ||||||||||||||||||||||||
| 1520 | pCov = 0; | - | ||||||||||||||||||||||||
| 1521 | } executed 14979 times by 1 test: end of blockExecuted by:
| 14979 | ||||||||||||||||||||||||
| 1522 | - | |||||||||||||||||||||||||
| 1523 | - | |||||||||||||||||||||||||
| 1524 | sqlite3WhereEnd(pSubWInfo); | - | ||||||||||||||||||||||||
| 1525 | } executed 17787 times by 1 test: end of blockExecuted by:
| 17787 | ||||||||||||||||||||||||
| 1526 | } executed 17787 times by 1 test: end of blockExecuted by:
| 17787 | ||||||||||||||||||||||||
| 1527 | } executed 17848 times by 1 test: end of blockExecuted by:
| 17848 | ||||||||||||||||||||||||
| 1528 | sqlite3VdbeExplainPop(pParse); | - | ||||||||||||||||||||||||
| 1529 | pLevel->u.pCovidx = pCov; | - | ||||||||||||||||||||||||
| 1530 | if( pCov
executed 202 times by 1 test: pLevel->iIdxCur = iCovCur;Executed by:
| 202-2164 | ||||||||||||||||||||||||
| 1531 | if( pAndExpr
| 26-2340 | ||||||||||||||||||||||||
| 1532 | pAndExpr->pLeft = 0; | - | ||||||||||||||||||||||||
| 1533 | sqlite3ExprDelete(db, pAndExpr); | - | ||||||||||||||||||||||||
| 1534 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||||||||||||||
| 1535 | sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); | - | ||||||||||||||||||||||||
| 1536 | sqlite3VdbeGoto(v, pLevel->addrBrk); | - | ||||||||||||||||||||||||
| 1537 | sqlite3VdbeResolveLabel(v, iLoopBody); | - | ||||||||||||||||||||||||
| 1538 | - | |||||||||||||||||||||||||
| 1539 | if( pWInfo->nLevel>1
executed 120 times by 1 test: sqlite3DbFree(db,pOrTab);Executed by:
| 120-2246 | ||||||||||||||||||||||||
| 1540 | if( !untestedTerms
executed 2327 times by 1 test: disableTerm(pLevel, pTerm);Executed by:
| 39-2327 | ||||||||||||||||||||||||
| 1541 | } executed 2366 times by 1 test: elseend of blockExecuted by:
| 2366 | ||||||||||||||||||||||||
| 1542 | - | |||||||||||||||||||||||||
| 1543 | - | |||||||||||||||||||||||||
| 1544 | { | - | ||||||||||||||||||||||||
| 1545 | - | |||||||||||||||||||||||||
| 1546 | - | |||||||||||||||||||||||||
| 1547 | - | |||||||||||||||||||||||||
| 1548 | static const u8 aStep[] = { 5, 4 }; | - | ||||||||||||||||||||||||
| 1549 | static const u8 aStart[] = { 36, 32 }; | - | ||||||||||||||||||||||||
| 1550 | - | |||||||||||||||||||||||||
| 1551 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1552 | ; | - | ||||||||||||||||||||||||
| 1553 | if( pTabItem->fg.isRecursive
| 272-164802 | ||||||||||||||||||||||||
| 1554 | - | |||||||||||||||||||||||||
| 1555 | - | |||||||||||||||||||||||||
| 1556 | pLevel->op = 171; | - | ||||||||||||||||||||||||
| 1557 | } executed 272 times by 1 test: else{end of blockExecuted by:
| 272 | ||||||||||||||||||||||||
| 1558 | ; | - | ||||||||||||||||||||||||
| 1559 | pLevel->op = aStep[bRev]; | - | ||||||||||||||||||||||||
| 1560 | pLevel->p1 = iCur; | - | ||||||||||||||||||||||||
| 1561 | pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrHalt); | - | ||||||||||||||||||||||||
| 1562 | ; | - | ||||||||||||||||||||||||
| 1563 | ; | - | ||||||||||||||||||||||||
| 1564 | pLevel->p5 = 1; | - | ||||||||||||||||||||||||
| 1565 | } executed 164802 times by 435 tests: end of blockExecuted by:
| 164802 | ||||||||||||||||||||||||
| 1566 | } | - | ||||||||||||||||||||||||
| 1567 | iLoop = (pIdx
| 21450-257046 | ||||||||||||||||||||||||
| 1568 | do{ | - | ||||||||||||||||||||||||
| 1569 | int iNext = 0; | - | ||||||||||||||||||||||||
| 1570 | for(pTerm=pWC->a, j=pWC->nTerm; j>0
| 285808-348383 | ||||||||||||||||||||||||
| 1571 | Expr *pE; | - | ||||||||||||||||||||||||
| 1572 | int skipLikeAddr = 0; | - | ||||||||||||||||||||||||
| 1573 | ; | - | ||||||||||||||||||||||||
| 1574 | ; | - | ||||||||||||||||||||||||
| 1575 | if( pTerm->wtFlags & (0x02|0x04)
executed 172476 times by 30 tests: continue;Executed by:
| 172476-175907 | ||||||||||||||||||||||||
| 1576 | if( (
| 53673-122234 | ||||||||||||||||||||||||
| 1577 | - | |||||||||||||||||||||||||
| 1578 | ; | - | ||||||||||||||||||||||||
| 1579 | pWInfo->untestedTerms = 1; | - | ||||||||||||||||||||||||
| 1580 | continue; executed 53673 times by 1 test: continue;Executed by:
| 53673 | ||||||||||||||||||||||||
| 1581 | } | - | ||||||||||||||||||||||||
| 1582 | pE = pTerm->pExpr; | - | ||||||||||||||||||||||||
| 1583 | - | |||||||||||||||||||||||||
| 1584 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1585 | ; | - | ||||||||||||||||||||||||
| 1586 | if( (
| 47-122044 | ||||||||||||||||||||||||
| 1587 | continue; executed 47 times by 1 test: continue;Executed by:
| 47 | ||||||||||||||||||||||||
| 1588 | } | - | ||||||||||||||||||||||||
| 1589 | - | |||||||||||||||||||||||||
| 1590 | if( iLoop==1
| 3039-109110 | ||||||||||||||||||||||||
| 1591 | iNext = 2; | - | ||||||||||||||||||||||||
| 1592 | continue; executed 10038 times by 1 test: continue;Executed by:
| 10038 | ||||||||||||||||||||||||
| 1593 | } | - | ||||||||||||||||||||||||
| 1594 | if( iLoop<3
| 77-112072 | ||||||||||||||||||||||||
| 1595 | if( iNext==0
executed 69 times by 1 test: iNext = 3;Executed by:
| 8-69 | ||||||||||||||||||||||||
| 1596 | continue; executed 77 times by 1 test: continue;Executed by:
| 77 | ||||||||||||||||||||||||
| 1597 | } | - | ||||||||||||||||||||||||
| 1598 | - | |||||||||||||||||||||||||
| 1599 | if( (
| 225-111847 | ||||||||||||||||||||||||
| 1600 | u32 x = pLevel->iLikeRepCntr; | - | ||||||||||||||||||||||||
| 1601 | if( x>0
| 0-225 | ||||||||||||||||||||||||
| 1602 | skipLikeAddr = sqlite3VdbeAddOp1(v, (x&1)?20:18,(int)(x>>1)); | - | ||||||||||||||||||||||||
| 1603 | } executed 225 times by 1 test: end of blockExecuted by:
| 225 | ||||||||||||||||||||||||
| 1604 | ; | - | ||||||||||||||||||||||||
| 1605 | - | |||||||||||||||||||||||||
| 1606 | } executed 225 times by 1 test: end of blockExecuted by:
| 225 | ||||||||||||||||||||||||
| 1607 | - | |||||||||||||||||||||||||
| 1608 | - | |||||||||||||||||||||||||
| 1609 | - | |||||||||||||||||||||||||
| 1610 | - | |||||||||||||||||||||||||
| 1611 | - | |||||||||||||||||||||||||
| 1612 | - | |||||||||||||||||||||||||
| 1613 | sqlite3ExprIfFalse(pParse, pE, addrCont, 0x10); | - | ||||||||||||||||||||||||
| 1614 | if( skipLikeAddr
executed 225 times by 1 test: sqlite3VdbeJumpHere(v, skipLikeAddr);Executed by:
| 225-111847 | ||||||||||||||||||||||||
| 1615 | pTerm->wtFlags |= 0x04; | - | ||||||||||||||||||||||||
| 1616 | } executed 112072 times by 366 tests: end of blockExecuted by:
| 112072 | ||||||||||||||||||||||||
| 1617 | iLoop = iNext; | - | ||||||||||||||||||||||||
| 1618 | } executed 285808 times by 435 tests: while( iLoop>0end of blockExecuted by:
| 7312-285808 | ||||||||||||||||||||||||
| 1619 | for(pTerm=pWC->a, j=pWC->nTerm; j>0
| 278496-329064 | ||||||||||||||||||||||||
| 1620 | Expr *pE, sEAlt; | - | ||||||||||||||||||||||||
| 1621 | WhereTerm *pAlt; | - | ||||||||||||||||||||||||
| 1622 | if( pTerm->wtFlags & (0x02|0x04)
executed 275381 times by 368 tests: continue;Executed by:
| 53683-275381 | ||||||||||||||||||||||||
| 1623 | if( (
executed 2681 times by 1 test: continue;Executed by:
| 2681-51002 | ||||||||||||||||||||||||
| 1624 | if( (
executed 46966 times by 1 test: continue;Executed by:
| 4036-46966 | ||||||||||||||||||||||||
| 1625 | if( pTerm->leftCursor!=iCur
executed 2411 times by 1 test: continue;Executed by:
| 1625-2411 | ||||||||||||||||||||||||
| 1626 | if( pLevel->iLeftJoin
executed 1 time by 1 test: continue;Executed by:
| 1-1624 | ||||||||||||||||||||||||
| 1627 | pE = pTerm->pExpr; | - | ||||||||||||||||||||||||
| 1628 | - | |||||||||||||||||||||||||
| 1629 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1630 | ; | - | ||||||||||||||||||||||||
| 1631 | - | |||||||||||||||||||||||||
| 1632 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1633 | ; | - | ||||||||||||||||||||||||
| 1634 | pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.leftColumn, notReady, | - | ||||||||||||||||||||||||
| 1635 | 0x0002|0x0001|0x0080, 0); | - | ||||||||||||||||||||||||
| 1636 | if( pAlt==0
executed 1599 times by 1 test: continue;Executed by:
| 25-1599 | ||||||||||||||||||||||||
| 1637 | if( pAlt->wtFlags & (0x04)
executed 21 times by 1 test: continue;Executed by:
| 4-21 | ||||||||||||||||||||||||
| 1638 | if( (
| 0-4 | ||||||||||||||||||||||||
| 1639 | && (
| 2 | ||||||||||||||||||||||||
| 1640 | && (
| 0-2 | ||||||||||||||||||||||||
| 1641 | ){ | - | ||||||||||||||||||||||||
| 1642 | continue; executed 2 times by 1 test: continue;Executed by:
| 2 | ||||||||||||||||||||||||
| 1643 | } | - | ||||||||||||||||||||||||
| 1644 | ; | - | ||||||||||||||||||||||||
| 1645 | ; | - | ||||||||||||||||||||||||
| 1646 | ; | - | ||||||||||||||||||||||||
| 1647 | ; | - | ||||||||||||||||||||||||
| 1648 | sEAlt = *pAlt->pExpr; | - | ||||||||||||||||||||||||
| 1649 | sEAlt.pLeft = pE->pLeft; | - | ||||||||||||||||||||||||
| 1650 | sqlite3ExprIfFalse(pParse, &sEAlt, addrCont, 0x10); | - | ||||||||||||||||||||||||
| 1651 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||
| 1652 | - | |||||||||||||||||||||||||
| 1653 | - | |||||||||||||||||||||||||
| 1654 | - | |||||||||||||||||||||||||
| 1655 | - | |||||||||||||||||||||||||
| 1656 | if( pLevel->iLeftJoin
| 425-278071 | ||||||||||||||||||||||||
| 1657 | pLevel->addrFirst = sqlite3VdbeCurrentAddr(v); | - | ||||||||||||||||||||||||
| 1658 | sqlite3VdbeAddOp2(v, 70, 1, pLevel->iLeftJoin); | - | ||||||||||||||||||||||||
| 1659 | ; | - | ||||||||||||||||||||||||
| 1660 | for(pTerm=pWC->a, j=0; j<pWC->nTerm
| 425-1514 | ||||||||||||||||||||||||
| 1661 | ; | - | ||||||||||||||||||||||||
| 1662 | ; | - | ||||||||||||||||||||||||
| 1663 | if( pTerm->wtFlags & (0x02|0x04)
executed 1347 times by 1 test: continue;Executed by:
| 167-1347 | ||||||||||||||||||||||||
| 1664 | if( (
| 45-122 | ||||||||||||||||||||||||
| 1665 | - | |||||||||||||||||||||||||
| 1666 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1667 | ; | - | ||||||||||||||||||||||||
| 1668 | continue; executed 122 times by 1 test: continue;Executed by:
| 122 | ||||||||||||||||||||||||
| 1669 | } | - | ||||||||||||||||||||||||
| 1670 | - | |||||||||||||||||||||||||
| 1671 | ((void) (0)) | - | ||||||||||||||||||||||||
| 1672 | ; | - | ||||||||||||||||||||||||
| 1673 | sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, 0x10); | - | ||||||||||||||||||||||||
| 1674 | pTerm->wtFlags |= 0x04; | - | ||||||||||||||||||||||||
| 1675 | } executed 45 times by 1 test: end of blockExecuted by:
| 45 | ||||||||||||||||||||||||
| 1676 | } executed 425 times by 1 test: end of blockExecuted by:
| 425 | ||||||||||||||||||||||||
| 1677 | - | |||||||||||||||||||||||||
| 1678 | return executed 278496 times by 435 tests: pLevel->notReady;return pLevel->notReady;Executed by:
executed 278496 times by 435 tests: return pLevel->notReady;Executed by:
| 278496 | ||||||||||||||||||||||||
| 1679 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |