Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Simplification to the logic used to decide between OP_Seek and OP_NotExists. Use OP_NotExists for both DELETE and UPDATE. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3a695263183303e3f64eb2320752d0fd |
User & Date: | drh 2016-05-06 20:23:12.122 |
Context
2016-05-07
| ||
12:15 | Fix typo in the intpkey-17.2 test. (check-in: a45fda657d user: drh tags: trunk) | |
2016-05-06
| ||
20:23 | Simplification to the logic used to decide between OP_Seek and OP_NotExists. Use OP_NotExists for both DELETE and UPDATE. (check-in: 3a69526318 user: drh tags: trunk) | |
18:47 | Corrections to comments on the whereScanInit() interface. (check-in: ab7ab415d1 user: drh tags: trunk) | |
Changes
Changes to src/update.c.
︙ | ︙ | |||
348 349 350 351 352 353 354 | #endif /* Begin the database scan */ if( HasRowid(pTab) ){ sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid); pWInfo = sqlite3WhereBegin( | | > | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | #endif /* Begin the database scan */ if( HasRowid(pTab) ){ sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid); pWInfo = sqlite3WhereBegin( pParse, pTabList, pWhere, 0, 0, WHERE_ONEPASS_DESIRED | WHERE_SEEK_TABLE, iIdxCur ); if( pWInfo==0 ) goto update_cleanup; okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); /* Remember the rowid of every item to be updated. */ sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid); |
︙ | ︙ |
Changes to src/wherecode.c.
︙ | ︙ | |||
1320 1321 1322 1323 1324 1325 1326 | /* Seek the table cursor, if required */ disableTerm(pLevel, pRangeStart); disableTerm(pLevel, pRangeEnd); if( omitTable ){ /* pIdx is a covering index. No need to access the main table. */ }else if( HasRowid(pIdx->pTable) ){ | < | < | 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | /* Seek the table cursor, if required */ disableTerm(pLevel, pRangeStart); disableTerm(pLevel, pRangeEnd); if( omitTable ){ /* pIdx is a covering index. No need to access the main table. */ }else if( HasRowid(pIdx->pTable) ){ if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)!=0 ){ iRowidReg = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg); sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg); VdbeCoverage(v); }else{ codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur); |
︙ | ︙ |
Changes to test/intpkey.test.
︙ | ︙ | |||
627 628 629 630 631 632 633 | DELETE FROM t17 WHERE x=99 OR x<130; SELECT * FROM t17; } {248 giraffe} do_execsql_test intpkey-17.1 { DROP INDEX t17x; DELETE FROM t17; INSERT INTO t17(x,y) VALUES(123,'elephant'),(248,'giraffe'); | | > > > > > > | 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | DELETE FROM t17 WHERE x=99 OR x<130; SELECT * FROM t17; } {248 giraffe} do_execsql_test intpkey-17.1 { DROP INDEX t17x; DELETE FROM t17; INSERT INTO t17(x,y) VALUES(123,'elephant'),(248,'giraffe'); CREATE UNIQUE INDEX t17x ON t17(abs(x)); DELETE FROM t17 WHERE abs(x) IS NULL OR abs(x)<130; SELECT * FROM t17; } {248 giraffe} do_execsql_test intpkey-17.2 { DELETE FROM t17; INSERT INTO t17(x,y) VALUES(123,'elephant'),(248,'giraffe'); UPDATE FROM t17 SET y='ostrich' WHERE abs(x)=248; SELECT * FROM t17 ORDER BY +x; } {123 elephant 248 ostrich} finish_test |