OLD | NEW |
1 /* | 1 /* |
2 ** 2001 September 15 | 2 ** 2001 September 15 |
3 ** | 3 ** |
4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
6 ** | 6 ** |
7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
10 ** | 10 ** |
(...skipping 28 matching lines...) Expand all Loading... |
39 ** as an instance of the following structure: | 39 ** as an instance of the following structure: |
40 */ | 40 */ |
41 struct VdbeOp { | 41 struct VdbeOp { |
42 u8 opcode; /* What operation to perform */ | 42 u8 opcode; /* What operation to perform */ |
43 signed char p4type; /* One of the P4_xxx constants for p4 */ | 43 signed char p4type; /* One of the P4_xxx constants for p4 */ |
44 u8 opflags; /* Mask of the OPFLG_* flags in opcodes.h */ | 44 u8 opflags; /* Mask of the OPFLG_* flags in opcodes.h */ |
45 u8 p5; /* Fifth parameter is an unsigned character */ | 45 u8 p5; /* Fifth parameter is an unsigned character */ |
46 int p1; /* First operand */ | 46 int p1; /* First operand */ |
47 int p2; /* Second parameter (often the jump destination) */ | 47 int p2; /* Second parameter (often the jump destination) */ |
48 int p3; /* The third parameter */ | 48 int p3; /* The third parameter */ |
49 union { /* fourth parameter */ | 49 union p4union { /* fourth parameter */ |
50 int i; /* Integer value if p4type==P4_INT32 */ | 50 int i; /* Integer value if p4type==P4_INT32 */ |
51 void *p; /* Generic pointer */ | 51 void *p; /* Generic pointer */ |
52 char *z; /* Pointer to data for string (char array) types */ | 52 char *z; /* Pointer to data for string (char array) types */ |
53 i64 *pI64; /* Used when p4type is P4_INT64 */ | 53 i64 *pI64; /* Used when p4type is P4_INT64 */ |
54 double *pReal; /* Used when p4type is P4_REAL */ | 54 double *pReal; /* Used when p4type is P4_REAL */ |
55 FuncDef *pFunc; /* Used when p4type is P4_FUNCDEF */ | 55 FuncDef *pFunc; /* Used when p4type is P4_FUNCDEF */ |
| 56 sqlite3_context *pCtx; /* Used when p4type is P4_FUNCCTX */ |
56 CollSeq *pColl; /* Used when p4type is P4_COLLSEQ */ | 57 CollSeq *pColl; /* Used when p4type is P4_COLLSEQ */ |
57 Mem *pMem; /* Used when p4type is P4_MEM */ | 58 Mem *pMem; /* Used when p4type is P4_MEM */ |
58 VTable *pVtab; /* Used when p4type is P4_VTAB */ | 59 VTable *pVtab; /* Used when p4type is P4_VTAB */ |
59 KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */ | 60 KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */ |
60 int *ai; /* Used when p4type is P4_INTARRAY */ | 61 int *ai; /* Used when p4type is P4_INTARRAY */ |
61 SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */ | 62 SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */ |
| 63 #ifdef SQLITE_ENABLE_CURSOR_HINTS |
| 64 Expr *pExpr; /* Used when p4type is P4_EXPR */ |
| 65 #endif |
62 int (*xAdvance)(BtCursor *, int *); | 66 int (*xAdvance)(BtCursor *, int *); |
63 } p4; | 67 } p4; |
64 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS | 68 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
65 char *zComment; /* Comment to improve readability */ | 69 char *zComment; /* Comment to improve readability */ |
66 #endif | 70 #endif |
67 #ifdef VDBE_PROFILE | 71 #ifdef VDBE_PROFILE |
68 u32 cnt; /* Number of times this instruction was executed */ | 72 u32 cnt; /* Number of times this instruction was executed */ |
69 u64 cycles; /* Total time spent executing this instruction */ | 73 u64 cycles; /* Total time spent executing this instruction */ |
70 #endif | 74 #endif |
71 #ifdef SQLITE_VDBE_COVERAGE | 75 #ifdef SQLITE_VDBE_COVERAGE |
(...skipping 30 matching lines...) Expand all Loading... |
102 | 106 |
103 /* | 107 /* |
104 ** Allowed values of VdbeOp.p4type | 108 ** Allowed values of VdbeOp.p4type |
105 */ | 109 */ |
106 #define P4_NOTUSED 0 /* The P4 parameter is not used */ | 110 #define P4_NOTUSED 0 /* The P4 parameter is not used */ |
107 #define P4_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */ | 111 #define P4_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */ |
108 #define P4_STATIC (-2) /* Pointer to a static string */ | 112 #define P4_STATIC (-2) /* Pointer to a static string */ |
109 #define P4_COLLSEQ (-4) /* P4 is a pointer to a CollSeq structure */ | 113 #define P4_COLLSEQ (-4) /* P4 is a pointer to a CollSeq structure */ |
110 #define P4_FUNCDEF (-5) /* P4 is a pointer to a FuncDef structure */ | 114 #define P4_FUNCDEF (-5) /* P4 is a pointer to a FuncDef structure */ |
111 #define P4_KEYINFO (-6) /* P4 is a pointer to a KeyInfo structure */ | 115 #define P4_KEYINFO (-6) /* P4 is a pointer to a KeyInfo structure */ |
| 116 #define P4_EXPR (-7) /* P4 is a pointer to an Expr tree */ |
112 #define P4_MEM (-8) /* P4 is a pointer to a Mem* structure */ | 117 #define P4_MEM (-8) /* P4 is a pointer to a Mem* structure */ |
113 #define P4_TRANSIENT 0 /* P4 is a pointer to a transient string */ | 118 #define P4_TRANSIENT 0 /* P4 is a pointer to a transient string */ |
114 #define P4_VTAB (-10) /* P4 is a pointer to an sqlite3_vtab structure */ | 119 #define P4_VTAB (-10) /* P4 is a pointer to an sqlite3_vtab structure */ |
115 #define P4_MPRINTF (-11) /* P4 is a string obtained from sqlite3_mprintf() */ | 120 #define P4_MPRINTF (-11) /* P4 is a string obtained from sqlite3_mprintf() */ |
116 #define P4_REAL (-12) /* P4 is a 64-bit floating point value */ | 121 #define P4_REAL (-12) /* P4 is a 64-bit floating point value */ |
117 #define P4_INT64 (-13) /* P4 is a 64-bit signed integer */ | 122 #define P4_INT64 (-13) /* P4 is a 64-bit signed integer */ |
118 #define P4_INT32 (-14) /* P4 is a 32-bit signed integer */ | 123 #define P4_INT32 (-14) /* P4 is a 32-bit signed integer */ |
119 #define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */ | 124 #define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */ |
120 #define P4_SUBPROGRAM (-18) /* P4 is a pointer to a SubProgram structure */ | 125 #define P4_SUBPROGRAM (-18) /* P4 is a pointer to a SubProgram structure */ |
121 #define P4_ADVANCE (-19) /* P4 is a pointer to BtreeNext() or BtreePrev() */ | 126 #define P4_ADVANCE (-19) /* P4 is a pointer to BtreeNext() or BtreePrev() */ |
| 127 #define P4_FUNCCTX (-20) /* P4 is a pointer to an sqlite3_context object */ |
122 | 128 |
123 /* Error message codes for OP_Halt */ | 129 /* Error message codes for OP_Halt */ |
124 #define P5_ConstraintNotNull 1 | 130 #define P5_ConstraintNotNull 1 |
125 #define P5_ConstraintUnique 2 | 131 #define P5_ConstraintUnique 2 |
126 #define P5_ConstraintCheck 3 | 132 #define P5_ConstraintCheck 3 |
127 #define P5_ConstraintFK 4 | 133 #define P5_ConstraintFK 4 |
128 | 134 |
129 /* | 135 /* |
130 ** The Vdbe.aColName array contains 5n Mem structures, where n is the | 136 ** The Vdbe.aColName array contains 5n Mem structures, where n is the |
131 ** number of columns of data returned by the statement. | 137 ** number of columns of data returned by the statement. |
(...skipping 28 matching lines...) Expand all Loading... |
160 #include "opcodes.h" | 166 #include "opcodes.h" |
161 | 167 |
162 /* | 168 /* |
163 ** Prototypes for the VDBE interface. See comments on the implementation | 169 ** Prototypes for the VDBE interface. See comments on the implementation |
164 ** for a description of what each of these routines does. | 170 ** for a description of what each of these routines does. |
165 */ | 171 */ |
166 Vdbe *sqlite3VdbeCreate(Parse*); | 172 Vdbe *sqlite3VdbeCreate(Parse*); |
167 int sqlite3VdbeAddOp0(Vdbe*,int); | 173 int sqlite3VdbeAddOp0(Vdbe*,int); |
168 int sqlite3VdbeAddOp1(Vdbe*,int,int); | 174 int sqlite3VdbeAddOp1(Vdbe*,int,int); |
169 int sqlite3VdbeAddOp2(Vdbe*,int,int,int); | 175 int sqlite3VdbeAddOp2(Vdbe*,int,int,int); |
| 176 int sqlite3VdbeGoto(Vdbe*,int); |
| 177 int sqlite3VdbeLoadString(Vdbe*,int,const char*); |
| 178 void sqlite3VdbeMultiLoad(Vdbe*,int,const char*,...); |
170 int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int); | 179 int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int); |
171 int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); | 180 int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); |
| 181 int sqlite3VdbeAddOp4Dup8(Vdbe*,int,int,int,int,const u8*,int); |
172 int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int); | 182 int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int); |
173 int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp, int iLineno); | 183 int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp, int iLineno); |
174 void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*); | 184 void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*); |
| 185 void sqlite3VdbeChangeOpcode(Vdbe*, u32 addr, u8); |
175 void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1); | 186 void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1); |
176 void sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2); | 187 void sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2); |
177 void sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3); | 188 void sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3); |
178 void sqlite3VdbeChangeP5(Vdbe*, u8 P5); | 189 void sqlite3VdbeChangeP5(Vdbe*, u8 P5); |
179 void sqlite3VdbeJumpHere(Vdbe*, int addr); | 190 void sqlite3VdbeJumpHere(Vdbe*, int addr); |
180 void sqlite3VdbeChangeToNoop(Vdbe*, int addr); | 191 void sqlite3VdbeChangeToNoop(Vdbe*, int addr); |
181 int sqlite3VdbeDeletePriorOpcode(Vdbe*, u8 op); | 192 int sqlite3VdbeDeletePriorOpcode(Vdbe*, u8 op); |
182 void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N); | 193 void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N); |
183 void sqlite3VdbeSetP4KeyInfo(Parse*, Index*); | 194 void sqlite3VdbeSetP4KeyInfo(Parse*, Index*); |
184 void sqlite3VdbeUsesBtree(Vdbe*, int); | 195 void sqlite3VdbeUsesBtree(Vdbe*, int); |
(...skipping 21 matching lines...) Expand all Loading... |
206 VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*); | 217 VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*); |
207 sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8); | 218 sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8); |
208 void sqlite3VdbeSetVarmask(Vdbe*, int); | 219 void sqlite3VdbeSetVarmask(Vdbe*, int); |
209 #ifndef SQLITE_OMIT_TRACE | 220 #ifndef SQLITE_OMIT_TRACE |
210 char *sqlite3VdbeExpandSql(Vdbe*, const char*); | 221 char *sqlite3VdbeExpandSql(Vdbe*, const char*); |
211 #endif | 222 #endif |
212 int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); | 223 int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); |
213 | 224 |
214 void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*); | 225 void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*); |
215 int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*); | 226 int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*); |
| 227 int sqlite3VdbeRecordCompareWithSkip(int, const void *, UnpackedRecord *, int); |
216 UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **); | 228 UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **); |
217 | 229 |
218 typedef int (*RecordCompare)(int,const void*,UnpackedRecord*); | 230 typedef int (*RecordCompare)(int,const void*,UnpackedRecord*); |
219 RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*); | 231 RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*); |
220 | 232 |
221 #ifndef SQLITE_OMIT_TRIGGER | 233 #ifndef SQLITE_OMIT_TRIGGER |
222 void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); | 234 void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); |
223 #endif | 235 #endif |
224 | 236 |
225 /* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on | 237 /* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 # define VdbeCoverageNeverTaken(v) sqlite3VdbeSetLineNumber(v,1); | 287 # define VdbeCoverageNeverTaken(v) sqlite3VdbeSetLineNumber(v,1); |
276 # define VDBE_OFFSET_LINENO(x) (__LINE__+x) | 288 # define VDBE_OFFSET_LINENO(x) (__LINE__+x) |
277 #else | 289 #else |
278 # define VdbeCoverage(v) | 290 # define VdbeCoverage(v) |
279 # define VdbeCoverageIf(v,x) | 291 # define VdbeCoverageIf(v,x) |
280 # define VdbeCoverageAlwaysTaken(v) | 292 # define VdbeCoverageAlwaysTaken(v) |
281 # define VdbeCoverageNeverTaken(v) | 293 # define VdbeCoverageNeverTaken(v) |
282 # define VDBE_OFFSET_LINENO(x) 0 | 294 # define VDBE_OFFSET_LINENO(x) 0 |
283 #endif | 295 #endif |
284 | 296 |
| 297 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| 298 void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*); |
| 299 #else |
| 300 # define sqlite3VdbeScanStatus(a,b,c,d,e) |
285 #endif | 301 #endif |
| 302 |
| 303 #endif |
OLD | NEW |