aboutsummaryrefslogtreecommitdiff
path: root/src/vdbeInt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vdbeInt.h')
-rw-r--r--src/vdbeInt.h45
1 files changed, 27 insertions, 18 deletions
diff --git a/src/vdbeInt.h b/src/vdbeInt.h
index e44e03a99..c2c19beae 100644
--- a/src/vdbeInt.h
+++ b/src/vdbeInt.h
@@ -89,6 +89,26 @@ struct VdbeCursor {
};
typedef struct VdbeCursor VdbeCursor;
+typedef struct VdbeFrame VdbeFrame;
+struct VdbeFrame {
+ Vdbe *v; /* VM this frame belongs to */
+ int pc; /* Program Counter */
+ Op *aOp; /* Program instructions */
+ int nOp; /* Size of aOp array */
+ Mem *aMem; /* Array of memory cells */
+ int nMem; /* Number of entries in aMem */
+ VdbeCursor **apCsr; /* Element of Vdbe cursors */
+ u16 nCursor; /* Number of entries in apCsr */
+ VdbeFrame *pParent; /* Parent of this frame */
+ void *token; /* Copy of SubProgram.token */
+ int nChildMem; /* Number of memory cells for child frame */
+ int nChildCsr; /* Number of cursors for child frame */
+ i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
+ int nChange; /* Statement changes (Vdbe.nChanges) */
+};
+
+#define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
+
/*
** A value for VdbeCursor.cacheValid that means the cache is always invalid.
*/
@@ -111,6 +131,7 @@ struct Mem {
int nZero; /* Used when bit MEM_Zero is set in flags */
FuncDef *pDef; /* Used only when flags==MEM_Agg */
RowSet *pRowSet; /* Used only when flags==MEM_RowSet */
+ VdbeFrame *pFrame; /* Used when flags==MEM_Frame */
} u;
double r; /* Real value */
sqlite3 *db; /* The associated database connection */
@@ -144,6 +165,7 @@ struct Mem {
#define MEM_Real 0x0008 /* Value is a real number */
#define MEM_Blob 0x0010 /* Value is a BLOB */
#define MEM_RowSet 0x0020 /* Value is a RowSet object */
+#define MEM_Frame 0x0040 /* Value is a VdbeFrame object */
#define MEM_TypeMask 0x00ff /* Mask of type bits */
/* Whenever Mem contains a valid string or blob representation, one of
@@ -224,21 +246,6 @@ struct Set {
};
/*
-** A Context stores the last insert rowid, the last statement change count,
-** and the current statement change count (i.e. changes since last statement).
-** The current keylist is also stored in the context.
-** Elements of Context structure type make up the ContextStack, which is
-** updated by the ContextPush and ContextPop opcodes (used by triggers).
-** The context is pushed before executing a trigger a popped when the
-** trigger finishes.
-*/
-typedef struct Context Context;
-struct Context {
- i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
- int nChange; /* Statement changes (Vdbe.nChanges) */
-};
-
-/*
** An instance of the virtual machine. This structure contains the complete
** state of the virtual machine.
**
@@ -277,9 +284,6 @@ struct Vdbe {
int nMem; /* Number of memory locations currently allocated */
Mem *aMem; /* The memory locations */
int cacheCtr; /* VdbeCursor row cache generation counter */
- int contextStackTop; /* Index of top element in the context stack */
- int contextStackDepth; /* The size of the "context" stack */
- Context *contextStack; /* Stack used by opcodes ContextPush & ContextPop*/
int pc; /* The program counter */
int rc; /* Value to return */
char *zErrMsg; /* Error message written here */
@@ -302,6 +306,9 @@ struct Vdbe {
#ifdef SQLITE_DEBUG
FILE *trace; /* Write an execution trace here, if not NULL */
#endif
+ VdbeFrame *pFrame; /* Parent frame */
+ int nFrame; /* Number of frames in pFrame list */
+ u8 noRecTrigger; /* True to disable recursive triggers */
};
/*
@@ -362,6 +369,8 @@ const char *sqlite3OpcodeName(int);
int sqlite3VdbeOpcodeHasProperty(int, int);
int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
int sqlite3VdbeCloseStatement(Vdbe *, int);
+void sqlite3VdbeFrameDelete(VdbeFrame*);
+int sqlite3VdbeFrameRestore(VdbeFrame *);
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
int sqlite3VdbeReleaseBuffers(Vdbe *p);
#endif