Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/sqlite/src/vdbe.h

Issue 3108030: Move bundled copy of sqlite one level deeper to better separate it... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/src/vacuum.c ('k') | third_party/sqlite/src/vdbe.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 ** 2001 September 15
3 **
4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
6 **
7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give.
10 **
11 *************************************************************************
12 ** Header file for the Virtual DataBase Engine (VDBE)
13 **
14 ** This header defines the interface to the virtual database engine
15 ** or VDBE. The VDBE implements an abstract machine that runs a
16 ** simple program to access and modify the underlying database.
17 **
18 ** $Id: vdbe.h,v 1.142 2009/07/24 17:58:53 danielk1977 Exp $
19 */
20 #ifndef _SQLITE_VDBE_H_
21 #define _SQLITE_VDBE_H_
22 #include <stdio.h>
23
24 /*
25 ** A single VDBE is an opaque structure named "Vdbe". Only routines
26 ** in the source file sqliteVdbe.c are allowed to see the insides
27 ** of this structure.
28 */
29 typedef struct Vdbe Vdbe;
30
31 /*
32 ** The names of the following types declared in vdbeInt.h are required
33 ** for the VdbeOp definition.
34 */
35 typedef struct VdbeFunc VdbeFunc;
36 typedef struct Mem Mem;
37 typedef struct SubProgram SubProgram;
38
39 /*
40 ** A single instruction of the virtual machine has an opcode
41 ** and as many as three operands. The instruction is recorded
42 ** as an instance of the following structure:
43 */
44 struct VdbeOp {
45 u8 opcode; /* What operation to perform */
46 signed char p4type; /* One of the P4_xxx constants for p4 */
47 u8 opflags; /* Not currently used */
48 u8 p5; /* Fifth parameter is an unsigned character */
49 int p1; /* First operand */
50 int p2; /* Second parameter (often the jump destination) */
51 int p3; /* The third parameter */
52 union { /* fourth parameter */
53 int i; /* Integer value if p4type==P4_INT32 */
54 void *p; /* Generic pointer */
55 char *z; /* Pointer to data for string (char array) types */
56 i64 *pI64; /* Used when p4type is P4_INT64 */
57 double *pReal; /* Used when p4type is P4_REAL */
58 FuncDef *pFunc; /* Used when p4type is P4_FUNCDEF */
59 VdbeFunc *pVdbeFunc; /* Used when p4type is P4_VDBEFUNC */
60 CollSeq *pColl; /* Used when p4type is P4_COLLSEQ */
61 Mem *pMem; /* Used when p4type is P4_MEM */
62 VTable *pVtab; /* Used when p4type is P4_VTAB */
63 KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */
64 int *ai; /* Used when p4type is P4_INTARRAY */
65 SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */
66 } p4;
67 #ifdef SQLITE_DEBUG
68 char *zComment; /* Comment to improve readability */
69 #endif
70 #ifdef VDBE_PROFILE
71 int cnt; /* Number of times this instruction was executed */
72 u64 cycles; /* Total time spent executing this instruction */
73 #endif
74 };
75 typedef struct VdbeOp VdbeOp;
76
77
78 /*
79 ** A sub-routine used to implement a trigger program.
80 */
81 struct SubProgram {
82 VdbeOp *aOp; /* Array of opcodes for sub-program */
83 int nOp; /* Elements in aOp[] */
84 int nMem; /* Number of memory cells required */
85 int nCsr; /* Number of cursors required */
86 int nRef; /* Number of pointers to this structure */
87 void *token; /* id that may be used to recursive triggers */
88 };
89
90 /*
91 ** A smaller version of VdbeOp used for the VdbeAddOpList() function because
92 ** it takes up less space.
93 */
94 struct VdbeOpList {
95 u8 opcode; /* What operation to perform */
96 signed char p1; /* First operand */
97 signed char p2; /* Second parameter (often the jump destination) */
98 signed char p3; /* Third parameter */
99 };
100 typedef struct VdbeOpList VdbeOpList;
101
102 /*
103 ** Allowed values of VdbeOp.p4type
104 */
105 #define P4_NOTUSED 0 /* The P4 parameter is not used */
106 #define P4_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */
107 #define P4_STATIC (-2) /* Pointer to a static string */
108 #define P4_COLLSEQ (-4) /* P4 is a pointer to a CollSeq structure */
109 #define P4_FUNCDEF (-5) /* P4 is a pointer to a FuncDef structure */
110 #define P4_KEYINFO (-6) /* P4 is a pointer to a KeyInfo structure */
111 #define P4_VDBEFUNC (-7) /* P4 is a pointer to a VdbeFunc structure */
112 #define P4_MEM (-8) /* P4 is a pointer to a Mem* structure */
113 #define P4_TRANSIENT (-9) /* P4 is a pointer to a transient string */
114 #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() */
116 #define P4_REAL (-12) /* P4 is a 64-bit floating point value */
117 #define P4_INT64 (-13) /* P4 is a 64-bit signed integer */
118 #define P4_INT32 (-14) /* P4 is a 32-bit signed integer */
119 #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 */
121
122 /* When adding a P4 argument using P4_KEYINFO, a copy of the KeyInfo structure
123 ** is made. That copy is freed when the Vdbe is finalized. But if the
124 ** argument is P4_KEYINFO_HANDOFF, the passed in pointer is used. It still
125 ** gets freed when the Vdbe is finalized so it still should be obtained
126 ** from a single sqliteMalloc(). But no copy is made and the calling
127 ** function should *not* try to free the KeyInfo.
128 */
129 #define P4_KEYINFO_HANDOFF (-16)
130 #define P4_KEYINFO_STATIC (-17)
131
132 /*
133 ** The Vdbe.aColName array contains 5n Mem structures, where n is the
134 ** number of columns of data returned by the statement.
135 */
136 #define COLNAME_NAME 0
137 #define COLNAME_DECLTYPE 1
138 #define COLNAME_DATABASE 2
139 #define COLNAME_TABLE 3
140 #define COLNAME_COLUMN 4
141 #ifdef SQLITE_ENABLE_COLUMN_METADATA
142 # define COLNAME_N 5 /* Number of COLNAME_xxx symbols */
143 #else
144 # ifdef SQLITE_OMIT_DECLTYPE
145 # define COLNAME_N 1 /* Store only the name */
146 # else
147 # define COLNAME_N 2 /* Store the name and decltype */
148 # endif
149 #endif
150
151 /*
152 ** The following macro converts a relative address in the p2 field
153 ** of a VdbeOp structure into a negative number so that
154 ** sqlite3VdbeAddOpList() knows that the address is relative. Calling
155 ** the macro again restores the address.
156 */
157 #define ADDR(X) (-1-(X))
158
159 /*
160 ** The makefile scans the vdbe.c source file and creates the "opcodes.h"
161 ** header file that defines a number for each opcode used by the VDBE.
162 */
163 #include "opcodes.h"
164
165 /*
166 ** Prototypes for the VDBE interface. See comments on the implementation
167 ** for a description of what each of these routines does.
168 */
169 Vdbe *sqlite3VdbeCreate(sqlite3*);
170 int sqlite3VdbeAddOp0(Vdbe*,int);
171 int sqlite3VdbeAddOp1(Vdbe*,int,int);
172 int sqlite3VdbeAddOp2(Vdbe*,int,int,int);
173 int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);
174 int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);
175 int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
176 void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
177 void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
178 void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3);
179 void sqlite3VdbeChangeP5(Vdbe*, u8 P5);
180 void sqlite3VdbeJumpHere(Vdbe*, int addr);
181 void sqlite3VdbeChangeToNoop(Vdbe*, int addr, int N);
182 void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N);
183 void sqlite3VdbeUsesBtree(Vdbe*, int);
184 VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);
185 int sqlite3VdbeMakeLabel(Vdbe*);
186 void sqlite3VdbeDelete(Vdbe*);
187 void sqlite3VdbeMakeReady(Vdbe*,int,int,int,int,int,int);
188 int sqlite3VdbeFinalize(Vdbe*);
189 void sqlite3VdbeResolveLabel(Vdbe*, int);
190 int sqlite3VdbeCurrentAddr(Vdbe*);
191 #ifdef SQLITE_DEBUG
192 int sqlite3VdbeAssertMayAbort(Vdbe *, int);
193 void sqlite3VdbeTrace(Vdbe*,FILE*);
194 #endif
195 void sqlite3VdbeResetStepResult(Vdbe*);
196 int sqlite3VdbeReset(Vdbe*);
197 void sqlite3VdbeSetNumCols(Vdbe*,int);
198 int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*));
199 void sqlite3VdbeCountChanges(Vdbe*);
200 sqlite3 *sqlite3VdbeDb(Vdbe*);
201 void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int);
202 void sqlite3VdbeSwap(Vdbe*,Vdbe*);
203 VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*);
204 void sqlite3VdbeProgramDelete(sqlite3 *, SubProgram *, int);
205
206 #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
207 int sqlite3VdbeReleaseMemory(int);
208 #endif
209 UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,char*,int);
210 void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord*);
211 int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*);
212
213
214 #ifndef NDEBUG
215 void sqlite3VdbeComment(Vdbe*, const char*, ...);
216 # define VdbeComment(X) sqlite3VdbeComment X
217 void sqlite3VdbeNoopComment(Vdbe*, const char*, ...);
218 # define VdbeNoopComment(X) sqlite3VdbeNoopComment X
219 #else
220 # define VdbeComment(X)
221 # define VdbeNoopComment(X)
222 #endif
223
224 #endif
OLDNEW
« no previous file with comments | « third_party/sqlite/src/vacuum.c ('k') | third_party/sqlite/src/vdbe.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698