1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Add assert() statements on the nExtraDelete variable in vdbe.c to try to verify

that the FORDELETE and IDXDELETE flags are being generated correctly.  Those
flags are not currently generated correctly, and so the assert()s trip on this
check-in.

FossilOrigin-Name: dde1db0dd2e2cf04706117629756c352b178ebb8
This commit is contained in:
drh
2016-01-27 15:49:32 +00:00
parent 8716bfd8cd
commit b89aeb6aa2
7 changed files with 62 additions and 23 deletions

View File

@@ -479,13 +479,12 @@ void sqlite3DeleteFrom(
*/
if( !isView ){
int iAddrOnce = 0;
u8 p5 = (eOnePass==ONEPASS_OFF ? 0 : OPFLAG_FORDELETE);
if( eOnePass==ONEPASS_MULTI ){
iAddrOnce = sqlite3CodeOnce(pParse); VdbeCoverage(v);
}
testcase( IsVirtual(pTab) );
sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, p5, iTabCur,
aToOpen, &iDataCur, &iIdxCur);
sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, OPFLAG_FORDELETE,
iTabCur, aToOpen, &iDataCur, &iIdxCur);
assert( pPk || IsVirtual(pTab) || iDataCur==iTabCur );
assert( pPk || IsVirtual(pTab) || iIdxCur==iDataCur+1 );
if( eOnePass==ONEPASS_MULTI ) sqlite3VdbeJumpHere(v, iAddrOnce);
@@ -724,9 +723,13 @@ void sqlite3GenerateRowDelete(
if( count ){
sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT);
}
if( eMode!=ONEPASS_OFF ){
sqlite3VdbeChangeP5(v, OPFLAG_IDXDELETE);
p5 = OPFLAG_IDXDELETE;
}
if( iIdxNoSeek>=0 ){
sqlite3VdbeAddOp1(v, OP_Delete, iIdxNoSeek);
if( eMode!=ONEPASS_OFF ) p5 = OPFLAG_IDXDELETE;
p5 = 0;
}
if( eMode==ONEPASS_MULTI ) p5 |= OPFLAG_SAVEPOSITION;
sqlite3VdbeChangeP5(v, p5);