Fixed behaviour of last_insert_rowid() with triggers and add last_statement_change_count() function that works correctly with triggers. (CVS 1251)

FossilOrigin-Name: 3383413a53bff0fef0765144de3bb9a298a5bb5c
This commit is contained in:
rdc
2004-02-20 22:53:38 +00:00
parent fcabd4641e
commit b0c374ffbb
12 changed files with 163 additions and 38 deletions
+5 -2
View File
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.91 2004/02/16 03:44:02 drh Exp $
** $Id: insert.c,v 1.92 2004/02/20 22:53:39 rdc Exp $
*/
#include "sqliteInt.h"
@@ -535,6 +535,7 @@ void sqliteInsert(
}
}
sqliteVdbeAddOp(v, OP_SetCounts, 0, 0);
sqliteEndWriteOperation(pParse);
/*
@@ -906,7 +907,9 @@ void sqliteCompleteInsertion(
sqliteVdbeAddOp(v, OP_Dup, 1, 0);
sqliteVdbeAddOp(v, OP_PutIntKey, newIdx, 0);
}
sqliteVdbeAddOp(v, OP_PutIntKey, base, pParse->trigStack?0:1);
sqliteVdbeAddOp(v, OP_PutIntKey, base,
(pParse->trigStack?0:OPFLAG_NCHANGE) |
(isUpdate?0:OPFLAG_LASTROWID) | OPFLAG_CSCHANGE);
if( isUpdate && recnoChng ){
sqliteVdbeAddOp(v, OP_Pop, 1, 0);
}