1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

Fix the code generation for UPDATE and DELETE so that

BEFORE triggers that use RAISE(IGNORE) do not leave extra
values on the stack.  Ticket #2767 (CVS 4535)

FossilOrigin-Name: 3391f4139ccfe62cc27739a06567c422ddae9c69
This commit is contained in:
drh
2007-11-11 18:36:34 +00:00
parent bc674334e5
commit 95c0775484
5 changed files with 114 additions and 14 deletions

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** in order to generate code for DELETE FROM statements.
**
** $Id: delete.c,v 1.130 2007/08/16 04:30:40 drh Exp $
** $Id: delete.c,v 1.131 2007/11/11 18:36:34 drh Exp $
*/
#include "sqliteInt.h"
@@ -277,9 +277,10 @@ void sqlite3DeleteFrom(
** row triggers.
*/
if( triggers_exist ){
int mem1 = pParse->nMem++;
addr = sqlite3VdbeAddOp(v, OP_FifoRead, 0, end);
sqlite3VdbeAddOp(v, OP_MemStore, mem1, 0);
if( !isView ){
sqlite3VdbeAddOp(v, OP_Dup, 0, 0);
sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);
}
sqlite3VdbeAddOp(v, OP_MoveGe, iCur, 0);
@@ -293,6 +294,9 @@ void sqlite3DeleteFrom(
(void)sqlite3CodeRowTrigger(pParse, TK_DELETE, 0, TRIGGER_BEFORE, pTab,
-1, oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default,
addr);
if( !isView ){
sqlite3VdbeAddOp(v, OP_MemLoad, mem1, 0);
}
}
if( !isView ){