Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Identify specific FuncDef objects for window functions using the pointer to the function name (FuncDef.zName) rather than the pointer to the xStep method. This allows xStep method pointer to be replaced with a single noopStepFunc() procedure, and thus save having lots of different no-op step functions. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
410e13b0e0fb6e040808f076014d55ec |
User & Date: | drh 2018-07-08 01:02:26.110 |
Context
2018-07-09
| ||
02:02 | During WITHOUT ROWID table creation, if the sqlite3CreateTable() call fails due to an authorizer denying the INSERT into the sqlite_master table, then detect this fact and abort the CREATE TABLE early, to avoid an assertion fault. (check-in: 164b1641e3 user: drh tags: trunk) | |
2018-07-08
| ||
01:02 | Identify specific FuncDef objects for window functions using the pointer to the function name (FuncDef.zName) rather than the pointer to the xStep method. This allows xStep method pointer to be replaced with a single noopStepFunc() procedure, and thus save having lots of different no-op step functions. (check-in: 410e13b0e0 user: drh tags: trunk) | |
2018-07-07
| ||
20:55 | Simplifications to the implementation of the sum() SQL function. (check-in: a8b1300237 user: drh tags: trunk) | |
Changes
Changes to src/window.c.
︙ | |||
148 149 150 151 152 153 154 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | - - - - - - | sqlite3_context *pCtx, int nArg, sqlite3_value **apArg ){ i64 *p = (i64*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ) (*p)++; } |
︙ | |||
184 185 186 187 188 189 190 | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | - - - - - - | int nArg, sqlite3_value **apArg ){ struct CallCount *p; p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); if( p ) p->nStep = 1; } |
︙ | |||
222 223 224 225 226 227 228 | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | - - - - - - | if( p ){ p->nStep++; if( p->nValue==0 ){ p->nValue = p->nStep; } } } |
︙ | |||
262 263 264 265 266 267 268 | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | - - - - - - | } p->nStep++; if( p->nValue==0 ){ p->nValue = p->nStep; } } } |
︙ | |||
304 305 306 307 308 309 310 | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | - - - - - - | if( p ){ if( p->nTotal==0 ){ p->nTotal = sqlite3_value_int64(apArg[0]); } p->nStep++; } } |
︙ | |||
355 356 357 358 359 360 361 | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | - - - - - - | pCtx, "argument of ntile must be a positive integer", -1 ); } } p->iRow++; } } |
︙ | |||
445 446 447 448 449 450 451 | 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + - + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + | sqlite3_result_value(pCtx, p->pVal); sqlite3_value_free(p->pVal); p->pVal = 0; } } /* |
︙ | |||
540 541 542 543 544 545 546 | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | - + - - + + | if( pFunc->funcFlags & SQLITE_FUNC_WINDOW ){ sqlite3 *db = pParse->db; if( pWin->pFilter ){ sqlite3ErrorMsg(pParse, "FILTER clause may only be used with aggregate window functions" ); }else |
︙ | |||
977 978 979 980 981 982 983 | 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | - + - + | assert( pKeyInfo->aSortOrder[0]==0 ); pKeyInfo->aSortOrder[0] = 1; } sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pWin->csrApp, 2); sqlite3VdbeAppendP4(v, pKeyInfo, P4_KEYINFO); sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); } |
︙ | |||
1097 1098 1099 1100 1101 1102 1103 | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | - - + + - - + + | sqlite3VdbeAddOp4Int(v, OP_SeekGE, pWin->csrApp, 0, regArg, 1); VdbeCoverage(v); sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp); sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); } sqlite3VdbeJumpHere(v, addrIsNull); }else if( pWin->regApp ){ |
︙ | |||
1259 1260 1261 1262 1263 1264 1265 | 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 | - - + + - + - + - + - + | int regGosub, int addrGosub ){ Vdbe *v = sqlite3GetVdbe(pParse); Window *pWin; for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ FuncDef *pFunc = pWin->pFunc; |
︙ | |||
1369 1370 1371 1372 1373 1374 1375 | 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | - - + + | int regArg; int nArg = 0; Window *pWin; for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ FuncDef *pFunc = pWin->pFunc; sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); nArg = MAX(nArg, windowArgCount(pWin)); |
︙ | |||
2156 2157 2158 2159 2160 2161 2162 | 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 | - - - - + + + + | if( pMWin->eStart==TK_CURRENT && pMWin->eEnd==TK_UNBOUNDED ){ bCache = 1; }else{ for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ FuncDef *pFunc = pWin->pFunc; if( (pFunc->funcFlags & SQLITE_FUNC_WINDOW_SIZE) |
︙ |