Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Optimize out a NotExists/NotFound opcode that occurs in UPDATE processing after constraint checks if there is no possiblity that the constraint checking code might have moved the cursor. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
74e3ee2ee6ea89af2c12dd0bce248467 |
User & Date: | drh 2013-11-08 01:09:15.717 |
Context
2013-11-08
| ||
12:14 | Merge change to drop the mutex on the multiplexor before entering the xRead VFS call, in order to enhance parallelizability. (check-in: 3c566e41e4 user: drh tags: trunk) | |
01:09 | Optimize out a NotExists/NotFound opcode that occurs in UPDATE processing after constraint checks if there is no possiblity that the constraint checking code might have moved the cursor. (check-in: 74e3ee2ee6 user: drh tags: trunk) | |
00:16 | On the --summary output of wordcount, add the a PRAGMA integrity_check and a 64-bit checksum of the entire table. (check-in: 1d1d13b890 user: drh tags: trunk) | |
Changes
Changes to src/insert.c.
︙ | ︙ | |||
1583 1584 1585 1586 1587 1588 1589 | sqlite3VdbeAddOp2(v, OP_Goto, 0, ipkTop+1); sqlite3VdbeJumpHere(v, ipkBottom); } if( pbMayReplace ){ *pbMayReplace = seenReplace; } | | | 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 | sqlite3VdbeAddOp2(v, OP_Goto, 0, ipkTop+1); sqlite3VdbeJumpHere(v, ipkBottom); } if( pbMayReplace ){ *pbMayReplace = seenReplace; } VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace)); } /* ** This routine generates code to finish the INSERT or UPDATE operation ** that was started by a prior call to sqlite3GenerateConstraintChecks. ** A consecutive range of registers starting at regNewData contains the ** rowid and the content to be inserted. |
︙ | ︙ |
Changes to src/update.c.
︙ | ︙ | |||
543 544 545 546 547 548 549 | if( aXRef[i]<0 && i!=pTab->iPKey ){ sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i); } } } if( !isView ){ | | > | > | | | | > > | | | | > | 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 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | if( aXRef[i]<0 && i!=pTab->iPKey ){ sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i); } } } if( !isView ){ int j1 = 0; /* Address of jump instruction */ int bReplace = 0; /* True if REPLACE conflict resolution might happen */ /* Do constraint checks. */ assert( regOldRowid>0 ); sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, regNewRowid, regOldRowid, chngKey, onError, labelContinue, &bReplace); /* Do FK constraint checks. */ if( hasFK ){ sqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey); } /* Delete the index entries associated with the current record. */ if( bReplace || chngKey ){ if( pPk ){ j1 = sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, 0, regKey, nKey); }else{ j1 = sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, 0, regOldRowid); } } sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, aRegIdx); /* If changing the record number, delete the old record. */ if( hasFK || chngKey || pPk!=0 ){ sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, 0); } if( bReplace || chngKey ){ if( sqlite3VdbeCurrentAddr(v)==j1+1 ){ sqlite3VdbeChangeToNoop(v, j1); }else{ sqlite3VdbeJumpHere(v, j1); } } if( hasFK ){ sqlite3FkCheck(pParse, pTab, 0, regNewRowid, aXRef, chngKey); } /* Insert the new index entries and the new record. */ |
︙ | ︙ |