diff options
Diffstat (limited to 'src/vdbeblob.c')
-rw-r--r-- | src/vdbeblob.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/vdbeblob.c b/src/vdbeblob.c index 11e018e19..5e809fc78 100644 --- a/src/vdbeblob.c +++ b/src/vdbeblob.c @@ -546,17 +546,23 @@ int sqlite3_index_writer( sqlite3VdbeAddOp2(v, OP_Variable, i, i); } regRec = ++pParse->nMem; - sqlite3VdbeAddOp3(v, OP_MakeRecord, 1, pIdx->nColumn, regRec); - /* If this is a UNIQUE index, check the constraint. */ - if( pIdx->onError ){ - int addr = sqlite3VdbeAddOp4Int(v, OP_NoConflict, 0, 0, 1, pIdx->nKeyCol); - sqlite3UniqueConstraint(pParse, SQLITE_ABORT, pIdx); - sqlite3VdbeJumpHere(v, addr); - } + if( bDelete==0 ){ + sqlite3VdbeAddOp3(v, OP_MakeRecord, 1, pIdx->nColumn, regRec); + + /* If this is a UNIQUE index, check the constraint. */ + if( pIdx->onError ){ + int addr = sqlite3VdbeAddOp4Int(v, OP_NoConflict, 0, 0, 1, pIdx->nKeyCol); + sqlite3UniqueConstraint(pParse, SQLITE_ABORT, pIdx); + sqlite3VdbeJumpHere(v, addr); + } - /* Code the IdxInsert to write to the b-tree index. */ - sqlite3VdbeAddOp2(v, OP_IdxInsert, 0, regRec); + /* Code the IdxInsert to write to the b-tree index. */ + sqlite3VdbeAddOp2(v, OP_IdxInsert, 0, regRec); + }else{ + /* Code the IdxDelete to remove the entry from the b-tree index. */ + sqlite3VdbeAddOp3(v, OP_IdxDelete, 0, 1, pIdx->nColumn); + } sqlite3FinishCoding(pParse); index_writer_out: |