Index: third_party/sqlite/src/src/vdbe.h |
diff --git a/third_party/sqlite/src/src/vdbe.h b/third_party/sqlite/src/src/vdbe.h |
index 43044533f3132385ed5a2704c25f5420e37cd541..f975f95543a34c4ac407fefcb184537e82378fd0 100644 |
--- a/third_party/sqlite/src/src/vdbe.h |
+++ b/third_party/sqlite/src/src/vdbe.h |
@@ -30,7 +30,6 @@ typedef struct Vdbe Vdbe; |
** The names of the following types declared in vdbeInt.h are required |
** for the VdbeOp definition. |
*/ |
-typedef struct VdbeFunc VdbeFunc; |
typedef struct Mem Mem; |
typedef struct SubProgram SubProgram; |
@@ -54,21 +53,24 @@ struct VdbeOp { |
i64 *pI64; /* Used when p4type is P4_INT64 */ |
double *pReal; /* Used when p4type is P4_REAL */ |
FuncDef *pFunc; /* Used when p4type is P4_FUNCDEF */ |
- VdbeFunc *pVdbeFunc; /* Used when p4type is P4_VDBEFUNC */ |
CollSeq *pColl; /* Used when p4type is P4_COLLSEQ */ |
Mem *pMem; /* Used when p4type is P4_MEM */ |
VTable *pVtab; /* Used when p4type is P4_VTAB */ |
KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */ |
int *ai; /* Used when p4type is P4_INTARRAY */ |
SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */ |
+ int (*xAdvance)(BtCursor *, int *); |
} p4; |
-#ifdef SQLITE_DEBUG |
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
char *zComment; /* Comment to improve readability */ |
#endif |
#ifdef VDBE_PROFILE |
- int cnt; /* Number of times this instruction was executed */ |
+ u32 cnt; /* Number of times this instruction was executed */ |
u64 cycles; /* Total time spent executing this instruction */ |
#endif |
+#ifdef SQLITE_VDBE_COVERAGE |
+ int iSrcLine; /* Source-code line that generated this opcode */ |
+#endif |
}; |
typedef struct VdbeOp VdbeOp; |
@@ -81,6 +83,7 @@ struct SubProgram { |
int nOp; /* Elements in aOp[] */ |
int nMem; /* Number of memory cells required */ |
int nCsr; /* Number of cursors required */ |
+ int nOnce; /* Number of OP_Once instructions */ |
void *token; /* id that may be used to recursive triggers */ |
SubProgram *pNext; /* Next sub-program already visited */ |
}; |
@@ -106,7 +109,6 @@ typedef struct VdbeOpList VdbeOpList; |
#define P4_COLLSEQ (-4) /* P4 is a pointer to a CollSeq structure */ |
#define P4_FUNCDEF (-5) /* P4 is a pointer to a FuncDef structure */ |
#define P4_KEYINFO (-6) /* P4 is a pointer to a KeyInfo structure */ |
-#define P4_VDBEFUNC (-7) /* P4 is a pointer to a VdbeFunc structure */ |
#define P4_MEM (-8) /* P4 is a pointer to a Mem* structure */ |
#define P4_TRANSIENT 0 /* P4 is a pointer to a transient string */ |
#define P4_VTAB (-10) /* P4 is a pointer to an sqlite3_vtab structure */ |
@@ -116,16 +118,13 @@ typedef struct VdbeOpList VdbeOpList; |
#define P4_INT32 (-14) /* P4 is a 32-bit signed integer */ |
#define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */ |
#define P4_SUBPROGRAM (-18) /* P4 is a pointer to a SubProgram structure */ |
+#define P4_ADVANCE (-19) /* P4 is a pointer to BtreeNext() or BtreePrev() */ |
-/* When adding a P4 argument using P4_KEYINFO, a copy of the KeyInfo structure |
-** is made. That copy is freed when the Vdbe is finalized. But if the |
-** argument is P4_KEYINFO_HANDOFF, the passed in pointer is used. It still |
-** gets freed when the Vdbe is finalized so it still should be obtained |
-** from a single sqliteMalloc(). But no copy is made and the calling |
-** function should *not* try to free the KeyInfo. |
-*/ |
-#define P4_KEYINFO_HANDOFF (-16) |
-#define P4_KEYINFO_STATIC (-17) |
+/* Error message codes for OP_Halt */ |
+#define P5_ConstraintNotNull 1 |
+#define P5_ConstraintUnique 2 |
+#define P5_ConstraintCheck 3 |
+#define P5_ConstraintFK 4 |
/* |
** The Vdbe.aColName array contains 5n Mem structures, where n is the |
@@ -164,36 +163,39 @@ typedef struct VdbeOpList VdbeOpList; |
** Prototypes for the VDBE interface. See comments on the implementation |
** for a description of what each of these routines does. |
*/ |
-Vdbe *sqlite3VdbeCreate(sqlite3*); |
+Vdbe *sqlite3VdbeCreate(Parse*); |
int sqlite3VdbeAddOp0(Vdbe*,int); |
int sqlite3VdbeAddOp1(Vdbe*,int,int); |
int sqlite3VdbeAddOp2(Vdbe*,int,int,int); |
int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int); |
int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); |
int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int); |
-int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp); |
-void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1); |
-void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2); |
-void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3); |
+int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp, int iLineno); |
+void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*); |
+void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1); |
+void sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2); |
+void sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3); |
void sqlite3VdbeChangeP5(Vdbe*, u8 P5); |
void sqlite3VdbeJumpHere(Vdbe*, int addr); |
-void sqlite3VdbeChangeToNoop(Vdbe*, int addr, int N); |
+void sqlite3VdbeChangeToNoop(Vdbe*, int addr); |
+int sqlite3VdbeDeletePriorOpcode(Vdbe*, u8 op); |
void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N); |
+void sqlite3VdbeSetP4KeyInfo(Parse*, Index*); |
void sqlite3VdbeUsesBtree(Vdbe*, int); |
VdbeOp *sqlite3VdbeGetOp(Vdbe*, int); |
int sqlite3VdbeMakeLabel(Vdbe*); |
void sqlite3VdbeRunOnlyOnce(Vdbe*); |
void sqlite3VdbeDelete(Vdbe*); |
-void sqlite3VdbeDeleteObject(sqlite3*,Vdbe*); |
-void sqlite3VdbeMakeReady(Vdbe*,int,int,int,int,int,int); |
+void sqlite3VdbeClearObject(sqlite3*,Vdbe*); |
+void sqlite3VdbeMakeReady(Vdbe*,Parse*); |
int sqlite3VdbeFinalize(Vdbe*); |
void sqlite3VdbeResolveLabel(Vdbe*, int); |
int sqlite3VdbeCurrentAddr(Vdbe*); |
#ifdef SQLITE_DEBUG |
int sqlite3VdbeAssertMayAbort(Vdbe *, int); |
- void sqlite3VdbeTrace(Vdbe*,FILE*); |
#endif |
void sqlite3VdbeResetStepResult(Vdbe*); |
+void sqlite3VdbeRewind(Vdbe*); |
int sqlite3VdbeReset(Vdbe*); |
void sqlite3VdbeSetNumCols(Vdbe*,int); |
int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*)); |
@@ -202,29 +204,82 @@ sqlite3 *sqlite3VdbeDb(Vdbe*); |
void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int); |
void sqlite3VdbeSwap(Vdbe*,Vdbe*); |
VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*); |
-sqlite3_value *sqlite3VdbeGetValue(Vdbe*, int, u8); |
+sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8); |
void sqlite3VdbeSetVarmask(Vdbe*, int); |
#ifndef SQLITE_OMIT_TRACE |
char *sqlite3VdbeExpandSql(Vdbe*, const char*); |
#endif |
+int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); |
-UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,char*,int); |
-void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord*); |
+void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*); |
int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*); |
+UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **); |
+ |
+typedef int (*RecordCompare)(int,const void*,UnpackedRecord*); |
+RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*); |
#ifndef SQLITE_OMIT_TRIGGER |
void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); |
#endif |
- |
-#ifndef NDEBUG |
+/* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on |
+** each VDBE opcode. |
+** |
+** Use the SQLITE_ENABLE_MODULE_COMMENTS macro to see some extra no-op |
+** comments in VDBE programs that show key decision points in the code |
+** generator. |
+*/ |
+#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
void sqlite3VdbeComment(Vdbe*, const char*, ...); |
# define VdbeComment(X) sqlite3VdbeComment X |
void sqlite3VdbeNoopComment(Vdbe*, const char*, ...); |
# define VdbeNoopComment(X) sqlite3VdbeNoopComment X |
+# ifdef SQLITE_ENABLE_MODULE_COMMENTS |
+# define VdbeModuleComment(X) sqlite3VdbeNoopComment X |
+# else |
+# define VdbeModuleComment(X) |
+# endif |
#else |
# define VdbeComment(X) |
# define VdbeNoopComment(X) |
+# define VdbeModuleComment(X) |
+#endif |
+ |
+/* |
+** The VdbeCoverage macros are used to set a coverage testing point |
+** for VDBE branch instructions. The coverage testing points are line |
+** numbers in the sqlite3.c source file. VDBE branch coverage testing |
+** only works with an amalagmation build. That's ok since a VDBE branch |
+** coverage build designed for testing the test suite only. No application |
+** should ever ship with VDBE branch coverage measuring turned on. |
+** |
+** VdbeCoverage(v) // Mark the previously coded instruction |
+** // as a branch |
+** |
+** VdbeCoverageIf(v, conditional) // Mark previous if conditional true |
+** |
+** VdbeCoverageAlwaysTaken(v) // Previous branch is always taken |
+** |
+** VdbeCoverageNeverTaken(v) // Previous branch is never taken |
+** |
+** Every VDBE branch operation must be tagged with one of the macros above. |
+** If not, then when "make test" is run with -DSQLITE_VDBE_COVERAGE and |
+** -DSQLITE_DEBUG then an ALWAYS() will fail in the vdbeTakeBranch() |
+** routine in vdbe.c, alerting the developer to the missed tag. |
+*/ |
+#ifdef SQLITE_VDBE_COVERAGE |
+ void sqlite3VdbeSetLineNumber(Vdbe*,int); |
+# define VdbeCoverage(v) sqlite3VdbeSetLineNumber(v,__LINE__) |
+# define VdbeCoverageIf(v,x) if(x)sqlite3VdbeSetLineNumber(v,__LINE__) |
+# define VdbeCoverageAlwaysTaken(v) sqlite3VdbeSetLineNumber(v,2); |
+# define VdbeCoverageNeverTaken(v) sqlite3VdbeSetLineNumber(v,1); |
+# define VDBE_OFFSET_LINENO(x) (__LINE__+x) |
+#else |
+# define VdbeCoverage(v) |
+# define VdbeCoverageIf(v,x) |
+# define VdbeCoverageAlwaysTaken(v) |
+# define VdbeCoverageNeverTaken(v) |
+# define VDBE_OFFSET_LINENO(x) 0 |
#endif |
#endif |