aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build.c5
-rw-r--r--src/vdbe.c9
2 files changed, 9 insertions, 5 deletions
diff --git a/src/build.c b/src/build.c
index e9e35333c..b0dac9965 100644
--- a/src/build.c
+++ b/src/build.c
@@ -1292,7 +1292,10 @@ void sqlite3AddReturning(Parse *pParse, ExprList *pList){
pRet->retSel.pSrc = (SrcList*)&pRet->retSrcList;
pHash = &(db->aDb[1].pSchema->trigHash);
assert( sqlite3HashFind(pHash, RETURNING_TRIGGER)==0 );
- sqlite3HashInsert(pHash, "sqlite_returning", &pRet->retTrig);
+ if( sqlite3HashInsert(pHash, "sqlite_returning", &pRet->retTrig)
+ ==&pRet->retTrig ){
+ sqlite3OomFault(db);
+ }
}
/*
diff --git a/src/vdbe.c b/src/vdbe.c
index 3a00515e5..d38d9a068 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -1470,9 +1470,10 @@ case OP_ResultRow: {
goto abort_due_to_error;
}
- /* If the SQLITE_CountRows flag is set in sqlite3.flags mask, then
- ** DML statements invoke this opcode to return the number of rows
- ** modified to the user. This is the only way that a VM that
+ /* DML statements can invoke this opcode to return the number of rows
+ ** modified to the user if the "PRAGMA count_changes=ON" pragma has been
+ ** run. DML statement triggers can invoke this satement to implement
+ ** the RETURNING clause. Thess are the only ways that a VM that
** opens a statement transaction may invoke this opcode.
**
** In case this is such a statement, close any statement transaction
@@ -1485,7 +1486,7 @@ case OP_ResultRow: {
** The statement transaction is never a top-level transaction. Hence
** the RELEASE call below can never fail.
*/
- assert( p->iStatement==0 || db->flags&SQLITE_CountRows );
+ assert( p->iStatement==0 || db->flags&SQLITE_CountRows || p->pFrame );
rc = sqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE);
assert( rc==SQLITE_OK );