mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-08 03:22:21 +03:00
Change the OP_Insert opcode to read the key and data to insert from memory cells, not the stack. (CVS 4666)
FossilOrigin-Name: 46501f490a5f5577ea31c758df749e02c7c65f39
This commit is contained in:
18
src/delete.c
18
src/delete.c
@@ -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.141 2008/01/03 07:54:24 danielk1977 Exp $
|
||||
** $Id: delete.c,v 1.142 2008/01/03 09:51:55 danielk1977 Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -60,6 +60,20 @@ int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** This function is a temporary measure required because OP_Insert now
|
||||
** reads the key and data to insert from memory cells.
|
||||
*/
|
||||
void sqlite3CodeInsert(Parse *p, int iCur, u8 flags){
|
||||
int iData = p->nMem++;
|
||||
int iKey = p->nMem++;
|
||||
Vdbe *v = sqlite3GetVdbe(p);
|
||||
sqlite3VdbeAddOp2(v, OP_MemStore, iData, 1);
|
||||
sqlite3VdbeAddOp2(v, OP_MemStore, iKey, 1);
|
||||
sqlite3VdbeAddOp3(v, OP_Insert, iCur, iData, iKey);
|
||||
sqlite3VdbeChangeP5(v, sqlite3VdbeCurrentAddr(v)-1, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate code that will open a table for reading.
|
||||
*/
|
||||
@@ -325,7 +339,7 @@ void sqlite3DeleteFrom(
|
||||
}else{
|
||||
sqlite3VdbeAddOp0(v, OP_Null);
|
||||
}
|
||||
sqlite3VdbeAddOp1(v, OP_Insert, oldIdx);
|
||||
sqlite3CodeInsert(pParse, oldIdx, 0);
|
||||
|
||||
/* Jump back and run the BEFORE triggers */
|
||||
sqlite3VdbeAddOp2(v, OP_Goto, 0, iBeginBeforeTrigger);
|
||||
|
||||
Reference in New Issue
Block a user