Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a couple of minor problems with the new delete logic. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | optimize-delete |
Files: | files | file ages | folders |
SHA1: |
a11243f840d35aaed8ee3b9901c3950b |
User & Date: | drh 2013-11-16 23:16:31.845 |
Context
2013-11-17
| ||
02:42 | Make sure one-pass DELETE for WITHOUT ROWID tables correctly positions the PRIMARY KEY cursor. Make the same fix for UPDATE. (Closed-Leaf check-in: 6bd5750b7d user: drh tags: optimize-delete) | |
2013-11-16
| ||
23:16 | Fix a couple of minor problems with the new delete logic. (check-in: a11243f840 user: drh tags: optimize-delete) | |
23:03 | Fix an OOM-recovery problem in the DELETE code generator. (check-in: dc7be158b8 user: drh tags: optimize-delete) | |
Changes
Changes to src/delete.c.
︙ | ︙ | |||
399 400 401 402 403 404 405 | sqlite3VdbeSetP4KeyInfo(pParse, pPk); } /* Construct a query to find the rowid or primary key for every row ** to be deleted, based on the WHERE clause. */ pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, | | > | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | sqlite3VdbeSetP4KeyInfo(pParse, pPk); } /* Construct a query to find the rowid or primary key for every row ** to be deleted, based on the WHERE clause. */ pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK, iTabCur+1); if( pWInfo==0 ) goto delete_from_cleanup; okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); /* Keep track of the number of rows to be deleted */ if( db->flags & SQLITE_CountRows ){ sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1); } |
︙ | ︙ |
Changes to src/update.c.
︙ | ︙ | |||
110 111 112 113 114 115 116 | ** an expression for the i-th column of the table. ** aXRef[i]==-1 if the i-th column is not changed. */ u8 *aToOpen; /* 1 for tables and indices to be opened */ u8 chngPk; /* PRIMARY KEY changed in a WITHOUT ROWID table */ u8 chngRowid; /* Rowid changed in a normal table */ u8 chngKey; /* Either chngPk or chngRowid */ Expr *pRowidExpr = 0; /* Expression defining the new record number */ | < | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | ** an expression for the i-th column of the table. ** aXRef[i]==-1 if the i-th column is not changed. */ u8 *aToOpen; /* 1 for tables and indices to be opened */ u8 chngPk; /* PRIMARY KEY changed in a WITHOUT ROWID table */ u8 chngRowid; /* Rowid changed in a normal table */ u8 chngKey; /* Either chngPk or chngRowid */ Expr *pRowidExpr = 0; /* Expression defining the new record number */ AuthContext sContext; /* The authorization context */ NameContext sNC; /* The name-context to resolve expressions in */ int iDb; /* Database containing the table being updated */ int okOnePass; /* True for one-pass algorithm without the FIFO */ int hasFK; /* True if foreign key processing is required */ int labelBreak; /* Jump here to break out of UPDATE loop */ int labelContinue; /* Jump here to continue next step of UPDATE loop */ |
︙ | ︙ | |||
618 619 620 621 622 623 624 | sqlite3VdbeAddOp2(v, OP_Goto, 0, labelContinue); } sqlite3VdbeResolveLabel(v, labelBreak); /* Close all tables */ for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ assert( aRegIdx ); | | | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | sqlite3VdbeAddOp2(v, OP_Goto, 0, labelContinue); } sqlite3VdbeResolveLabel(v, labelBreak); /* Close all tables */ for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ assert( aRegIdx ); if( aToOpen[i+1] ){ sqlite3VdbeAddOp2(v, OP_Close, iIdxCur+i, 0); } } if( iDataCur<iIdxCur ) sqlite3VdbeAddOp2(v, OP_Close, iDataCur, 0); /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into |
︙ | ︙ |