wasCSharpSQLite – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 using System;
2 using System.Diagnostics;
3 using System.Runtime.InteropServices;
4  
5 using FILE = System.IO.TextWriter;
6  
7 using i64 = System.Int64;
8 using u8 = System.Byte;
9 using u16 = System.UInt16;
10 using u32 = System.UInt32;
11 using u64 = System.UInt64;
12 using unsigned = System.UIntPtr;
13  
14 using Pgno = System.UInt32;
15  
16 #if !SQLITE_MAX_VARIABLE_NUMBER
17 using ynVar = System.Int16;
18 #else
19 using ynVar = System.Int32;
20 #endif
21 /*
22 ** The yDbMask datatype for the bitmask of all attached databases.
23 */
24 #if SQLITE_MAX_ATTACHED//>30
25 // typedef sqlite3_uint64 yDbMask;
26 using yDbMask = System.Int64;
27 #else
28 // typedef unsigned int yDbMask;
29 using yDbMask = System.Int32;
30 #endif
31  
32  
33 namespace Community.CsharpSqlite
34 {
35 using Op = Sqlite3.VdbeOp;
36  
37 public partial class Sqlite3
38 {
39 /*
40 ** 2003 September 6
41 **
42 ** The author disclaims copyright to this source code. In place of
43 ** a legal notice, here is a blessing:
44 **
45 ** May you do good and not evil.
46 ** May you find forgiveness for yourself and forgive others.
47 ** May you share freely, never taking more than you give.
48 **
49 *************************************************************************
50 ** This is the header file for information that is private to the
51 ** VDBE. This information used to all be at the top of the single
52 ** source code file "vdbe.c". When that file became too big (over
53 ** 6000 lines long) it was split up into several smaller files and
54 ** this header information was factored out.
55 *************************************************************************
56 ** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
57 ** C#-SQLite is an independent reimplementation of the SQLite software library
58 **
59 ** SQLITE_SOURCE_ID: 2011-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2
60 **
61 *************************************************************************
62 */
63 //#if !_VDBEINT_H_
64 //#define _VDBEINT_H_
65  
66 /*
67 ** SQL is translated into a sequence of instructions to be
68 ** executed by a virtual machine. Each instruction is an instance
69 ** of the following structure.
70 */
71 //typedef struct VdbeOp Op;
72  
73 /*
74 ** Boolean values
75 */
76 //typedef unsigned char Bool;
77  
78 /*
79 ** A cursor is a pointer into a single BTree within a database file.
80 ** The cursor can seek to a BTree entry with a particular key, or
81 ** loop over all entries of the Btree. You can also insert new BTree
82 ** entries or retrieve the key or data from the entry that the cursor
83 ** is currently pointing to.
84 **
85 ** Every cursor that the virtual machine has open is represented by an
86 ** instance of the following structure.
87 */
88 public class VdbeCursor
89 {
90 public BtCursor pCursor; /* The cursor structure of the backend */
91 public Btree pBt; /* Separate file holding temporary table */
92 public KeyInfo pKeyInfo; /* Info about index keys needed by index cursors */
93 public int iDb; /* Index of cursor database in db->aDb[] (or -1) */
94 public int pseudoTableReg; /* Register holding pseudotable content. */
95 public int nField; /* Number of fields in the header */
96 public bool zeroed; /* True if zeroed out and ready for reuse */
97 public bool rowidIsValid; /* True if lastRowid is valid */
98 public bool atFirst; /* True if pointing to first entry */
99 public bool useRandomRowid; /* Generate new record numbers semi-randomly */
100 public bool nullRow; /* True if pointing to a row with no data */
101 public bool deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */
102 public bool isTable; /* True if a table requiring integer keys */
103 public bool isIndex; /* True if an index containing keys only - no data */
104 public bool isOrdered; /* True if the underlying table is BTREE_UNORDERED */
105 #if !SQLITE_OMIT_VIRTUALTABLE
106 public sqlite3_vtab_cursor pVtabCursor; /* The cursor for a virtual table */
107 public sqlite3_module pModule; /* Module for cursor pVtabCursor */
108 #endif
109 public i64 seqCount; /* Sequence counter */
110 public i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */
111 public i64 lastRowid; /* Last rowid from a Next or NextIdx operation */
112  
113 /* Result of last sqlite3BtreeMoveto() done by an OP_NotExists or
114 ** OP_IsUnique opcode on this cursor. */
115 public int seekResult;
116  
117 /* Cached information about the header for the data record that the
118 ** cursor is currently pointing to. Only valid if cacheStatus matches
119 ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of
120 ** CACHE_STALE and so setting cacheStatus=CACHE_STALE guarantees that
121 ** the cache is out of date.
122 **
123 ** aRow might point to (ephemeral) data for the current row, or it might
124 ** be NULL.
125 */
126 public u32 cacheStatus; /* Cache is valid if this matches Vdbe.cacheCtr */
127 public Pgno payloadSize; /* Total number of bytes in the record */
128 public u32[] aType; /* Type values for all entries in the record */
129 public u32[] aOffset; /* Cached offsets to the start of each columns data */
130 public int aRow; /* Pointer to Data for the current row, if all on one page */
131  
132 public VdbeCursor Copy()
133 {
134 return (VdbeCursor)MemberwiseClone();
135 }
136 };
137 //typedef struct VdbeCursor VdbeCursor;
138  
139  
140 /*
141 ** When a sub-program is executed (OP_Program), a structure of this type
142 ** is allocated to store the current value of the program counter, as
143 ** well as the current memory cell array and various other frame specific
144 ** values stored in the Vdbe struct. When the sub-program is finished,
145 ** these values are copied back to the Vdbe from the VdbeFrame structure,
146 ** restoring the state of the VM to as it was before the sub-program
147 ** began executing.
148 **
149 ** The memory for a VdbeFrame object is allocated and managed by a memory
150 ** cell in the parent (calling) frame. When the memory cell is deleted or
151 ** overwritten, the VdbeFrame object is not freed immediately. Instead, it
152 ** is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame
153 ** list is deleted when the VM is reset in VdbeHalt(). The reason for doing
154 ** this instead of deleting the VdbeFrame immediately is to avoid recursive
155 ** calls to sqlite3VdbeMemRelease() when the memory cells belonging to the
156 ** child frame are released.
157 **
158 ** The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is
159 ** set to NULL if the currently executing frame is the main program.
160 */
161 //typedef struct VdbeFrame VdbeFrame;
162 public class VdbeFrame
163 {
164 public Vdbe v; /* VM this frame belongs to */
165 public int pc; /* Program Counter in parent (calling) frame */
166 public Op[] aOp; /* Program instructions for parent frame */
167 public int nOp; /* Size of aOp array */
168 public Mem[] aMem; /* Array of memory cells for parent frame */
169 public int nMem; /* Number of entries in aMem */
170 public VdbeCursor[] apCsr; /* Array of Vdbe cursors for parent frame */
171 public u16 nCursor; /* Number of entries in apCsr */
172 public int token; /* Copy of SubProgram.token */
173 public int nChildMem; /* Number of memory cells for child frame */
174 public int nChildCsr; /* Number of cursors for child frame */
175 public i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
176 public int nChange; /* Statement changes (Vdbe.nChanges) */
177 public VdbeFrame pParent; /* Parent of this frame, or NULL if parent is main */
178 //
179 // Needed for C# Implementation
180 //
181 public Mem[] aChildMem; /* Array of memory cells for child frame */
182 public VdbeCursor[] aChildCsr; /* Array of cursors for child frame */
183 };
184  
185 //#define VdbeFrameMem(p) ((Mem )&((u8 )p)[ROUND8(sizeof(VdbeFrame))])
186 /*
187 ** A value for VdbeCursor.cacheValid that means the cache is always invalid.
188 */
189 const int CACHE_STALE = 0;
190  
191 /*
192 ** Internally, the vdbe manipulates nearly all SQL values as Mem
193 ** structures. Each Mem struct may cache multiple representations (string,
194 ** integer etc.) of the same value.
195 */
196 public class Mem
197 {
198 public sqlite3 db; /* The associated database connection */
199 public string z; /* String value */
200 public double r; /* Real value */
201 public struct union_ip
202 {
203 #if DEBUG_CLASS_MEM || DEBUG_CLASS_ALL
204 public i64 _i; /* First operand */
205 public i64 i
206 {
207 get { return _i; }
208 set { _i = value; }
209 }
210 #else
211 public i64 i; /* Integer value used when MEM_Int is set in flags */
212 #endif
213 public int nZero; /* Used when bit MEM_Zero is set in flags */
214 public FuncDef pDef; /* Used only when flags==MEM_Agg */
215 public RowSet pRowSet; /* Used only when flags==MEM_RowSet */
216 public VdbeFrame pFrame; /* Used when flags==MEM_Frame */
217 };
218 public union_ip u;
219 public byte[] zBLOB; /* BLOB value */
220 public int n; /* Number of characters in string value, excluding '\0' */
221 #if DEBUG_CLASS_MEM || DEBUG_CLASS_ALL
222 public u16 _flags; /* First operand */
223 public u16 flags
224 {
225 get { return _flags; }
226 set { _flags = value; }
227 }
228 #else
229 public u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */
230 #endif
231 public u8 type; /* One of SQLITE_NULL, SQLITE_TEXT, SQLITE_INTEGER, etc */
232 public u8 enc; /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */
233 #if SQLITE_DEBUG
234 public Mem pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
235 public object pFiller; /* So that sizeof(Mem) is a multiple of 8 */
236 #endif
237 public dxDel xDel; /* If not null, call this function to delete Mem.z */
238 // Not used under c#
239 //public string zMalloc; /* Dynamic buffer allocated by sqlite3Malloc() */
240 public Mem _Mem; /* Used when C# overload Z as MEM space */
241 public SumCtx _SumCtx; /* Used when C# overload Z as Sum context */
242 public SubProgram[] _SubProgram;/* Used when C# overload Z as SubProgram*/
243 public StrAccum _StrAccum; /* Used when C# overload Z as STR context */
244 public object _MD5Context; /* Used when C# overload Z as MD5 context */
245  
246 public Mem()
247 {
248 }
249  
250 public Mem( sqlite3 db, string z, double r, int i, int n, u16 flags, u8 type, u8 enc
251 #if SQLITE_DEBUG
252 , Mem pScopyFrom, object pFiller /* pScopyFrom, pFiller */
253 #endif
254 )
255 {
256 this.db = db;
257 this.z = z;
258 this.r = r;
259 this.u.i = i;
260 this.n = n;
261 this.flags = flags;
262 #if SQLITE_DEBUG
263 this.pScopyFrom = pScopyFrom;
264 this.pFiller = pFiller;
265 #endif
266 this.type = type;
267 this.enc = enc;
268 }
269  
270 public void CopyTo( ref Mem ct )
271 {
272 if ( ct == null )
273 ct = new Mem();
274 ct.u = u;
275 ct.r = r;
276 ct.db = db;
277 ct.z = z;
278 if ( zBLOB == null )
279 ct.zBLOB = null;
280 else
281 {
282 ct.zBLOB = sqlite3Malloc( zBLOB.Length );
283 Buffer.BlockCopy( zBLOB, 0, ct.zBLOB, 0, zBLOB.Length );
284 }
285 ct.n = n;
286 ct.flags = flags;
287 ct.type = type;
288 ct.enc = enc;
289 ct.xDel = xDel;
290 }
291  
292 };
293  
294 /* One or more of the following flags are set to indicate the validOK
295 ** representations of the value stored in the Mem struct.
296 **
297 ** If the MEM_Null flag is set, then the value is an SQL NULL value.
298 ** No other flags may be set in this case.
299 **
300 ** If the MEM_Str flag is set then Mem.z points at a string representation.
301 ** Usually this is encoded in the same unicode encoding as the main
302 ** database (see below for exceptions). If the MEM_Term flag is also
303 ** set, then the string is nul terminated. The MEM_Int and MEM_Real
304 ** flags may coexist with the MEM_Str flag.
305 */
306 //#define MEM_Null 0x0001 /* Value is NULL */
307 //#define MEM_Str 0x0002 /* Value is a string */
308 //#define MEM_Int 0x0004 /* Value is an integer */
309 //#define MEM_Real 0x0008 /* Value is a real number */
310 //#define MEM_Blob 0x0010 /* Value is a BLOB */
311 //#define MEM_RowSet 0x0020 /* Value is a RowSet object */
312 //#define MEM_Frame 0x0040 /* Value is a VdbeFrame object */
313 //#define MEM_Invalid 0x0080 /* Value is undefined */
314 //#define MEM_TypeMask 0x00ff /* Mask of type bits */
315 const int MEM_Null = 0x0001;
316 const int MEM_Str = 0x0002;
317 const int MEM_Int = 0x0004;
318 const int MEM_Real = 0x0008;
319 const int MEM_Blob = 0x0010;
320 const int MEM_RowSet = 0x0020;
321 const int MEM_Frame = 0x0040;
322 const int MEM_Invalid = 0x0080;
323 const int MEM_TypeMask = 0x00ff;
324  
325 /* Whenever Mem contains a valid string or blob representation, one of
326 ** the following flags must be set to determine the memory management
327 ** policy for Mem.z. The MEM_Term flag tells us whether or not the
328 ** string is \000 or \u0000 terminated
329 // */
330 //#define MEM_Term 0x0200 /* String rep is nul terminated */
331 //#define MEM_Dyn 0x0400 /* Need to call sqliteFree() on Mem.z */
332 //#define MEM_Static 0x0800 /* Mem.z points to a static string */
333 //#define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */
334 //#define MEM_Agg 0x2000 /* Mem.z points to an agg function context */
335 //#define MEM_Zero 0x4000 /* Mem.i contains count of 0s appended to blob */
336 //#if SQLITE_OMIT_INCRBLOB
337 // #undef MEM_Zero
338 // #define MEM_Zero 0x0000
339 //#endif
340 const int MEM_Term = 0x0200;
341 const int MEM_Dyn = 0x0400;
342 const int MEM_Static = 0x0800;
343 const int MEM_Ephem = 0x1000;
344 const int MEM_Agg = 0x2000;
345 #if !SQLITE_OMIT_INCRBLOB
346 const int MEM_Zero = 0x4000;
347 #else
348 const int MEM_Zero = 0x0000;
349 #endif
350  
351 /*
352 ** Clear any existing type flags from a Mem and replace them with f
353 */
354 //#define MemSetTypeFlag(p, f) \
355 // ((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero))|f)
356 static void MemSetTypeFlag( Mem p, int f )
357 {
358 p.flags = (u16)( p.flags & ~( MEM_TypeMask | MEM_Zero ) | f );
359 }// TODO -- Convert back to inline for speed
360  
361 /*
362 ** Return true if a memory cell is not marked as invalid. This macro
363 ** is for use inside Debug.Assert() statements only.
364 */
365 #if SQLITE_DEBUG
366 //#define memIsValid(M) ((M)->flags & MEM_Invalid)==0
367 static bool memIsValid( Mem M )
368 {
369 return ( ( M ).flags & MEM_Invalid ) == 0;
370 }
371 #else
372 static bool memIsValid( Mem M ) { return true; }
373 #endif
374  
375 /* A VdbeFunc is just a FuncDef (defined in sqliteInt.h) that contains
376 ** additional information about auxiliary information bound to arguments
377 ** of the function. This is used to implement the sqlite3_get_auxdata()
378 ** and sqlite3_set_auxdata() APIs. The "auxdata" is some auxiliary data
379 ** that can be associated with a constant argument to a function. This
380 ** allows functions such as "regexp" to compile their constant regular
381 ** expression argument once and reused the compiled code for multiple
382 ** invocations.
383 */
384 public class AuxData
385 {
386 public object pAux; /* Aux data for the i-th argument */
387 //(void ); /* Destructor for the aux data */
388 };
389  
390 public class VdbeFunc : FuncDef
391 {
392 public FuncDef pFunc; /* The definition of the function */
393 public int nAux; /* Number of entries allocated for apAux[] */
394 public AuxData[] apAux = new AuxData[2]; /* One slot for each function argument */
395 };
396  
397 /*
398 ** The "context" argument for a installable function. A pointer to an
399 ** instance of this structure is the first argument to the routines used
400 ** implement the SQL functions.
401 **
402 ** There is a typedef for this structure in sqlite.h. So all routines,
403 ** even the public interface to SQLite, can use a pointer to this structure.
404 ** But this file is the only place where the internal details of this
405 ** structure are known.
406 **
407 ** This structure is defined inside of vdbeInt.h because it uses substructures
408 ** (Mem) which are only defined there.
409 */
410 public class sqlite3_context
411 {
412 public FuncDef pFunc; /* Pointer to function information. MUST BE FIRST */
413 public VdbeFunc pVdbeFunc; /* Auxilary data, if created. */
414 public Mem s = new Mem(); /* The return value is stored here */
415 public Mem pMem; /* Memory cell used to store aggregate context */
416 public int isError; /* Error code returned by the function. */
417 public CollSeq pColl; /* Collating sequence */
418  
419 };
420  
421 /*
422 ** An instance of the virtual machine. This structure contains the complete
423 ** state of the virtual machine.
424 **
425 ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
426 ** is really a pointer to an instance of this structure.
427 **
428 ** The Vdbe.inVtabMethod variable is set to non-zero for the duration of
429 ** any virtual table method invocations made by the vdbe program. It is
430 ** set to 2 for xDestroy method calls and 1 for all other methods. This
431 ** variable is used for two purposes: to allow xDestroy methods to execute
432 ** "DROP TABLE" statements and to prevent some nasty side effects of
433 ** malloc failure when SQLite is invoked recursively by a virtual table
434 ** method function.
435 */
436 public class Vdbe
437 {
438 public sqlite3 db; /* The database connection that owns this statement */
439 public Op[] aOp; /* Space to hold the virtual machine's program */
440 public Mem[] aMem; /* The memory locations */
441 public Mem[] apArg; /* Arguments to currently executing user function */
442 public Mem[] aColName; /* Column names to return */
443 public Mem[] pResultSet; /* Pointer to an array of results */
444 public int nMem; /* Number of memory locations currently allocated */
445 public int nOp; /* Number of instructions in the program */
446 public int nOpAlloc; /* Number of slots allocated for aOp[] */
447 public int nLabel; /* Number of labels used */
448 public int nLabelAlloc; /* Number of slots allocated in aLabel[] */
449 public int[] aLabel; /* Space to hold the labels */
450 public u16 nResColumn; /* Number of columns in one row of the result set */
451 public u16 nCursor; /* Number of slots in apCsr[] */
452 public u32 magic; /* Magic number for sanity checking */
453 public string zErrMsg; /* Error message written here */
454 public Vdbe pPrev; /* Linked list of VDBEs with the same Vdbe.db */
455 public Vdbe pNext; /* Linked list of VDBEs with the same Vdbe.db */
456 public VdbeCursor[] apCsr; /* One element of this array for each open cursor */
457 public Mem[] aVar; /* Values for the OP_Variable opcode. */
458 public string[] azVar; /* Name of variables */
459 public ynVar nVar; /* Number of entries in aVar[] */
460 public ynVar nzVar; /* Number of entries in azVar[] */
461 public u32 cacheCtr; /* VdbeCursor row cache generation counter */
462 public int pc; /* The program counter */
463 public int rc; /* Value to return */
464 public u8 errorAction; /* Recovery action to do in case of an error */
465 public int explain; /* True if EXPLAIN present on SQL command */
466 public bool changeCntOn; /* True to update the change-counter */
467 public bool expired; /* True if the VM needs to be recompiled */
468 public u8 runOnlyOnce; /* Automatically expire on reset */
469 public int minWriteFileFormat; /* Minimum file format for writable database files */
470 public int inVtabMethod; /* See comments above */
471 public bool usesStmtJournal; /* True if uses a statement journal */
472 public bool readOnly; /* True for read-only statements */
473 public int nChange; /* Number of db changes made since last reset */
474 public bool isPrepareV2; /* True if prepared with prepare_v2() */
475 public yDbMask btreeMask; /* Bitmask of db.aDb[] entries referenced */
476 public yDbMask lockMask; /* Subset of btreeMask that requires a lock */
477  
478 public int iStatement; /* Statement number (or 0 if has not opened stmt) */
479 public int[] aCounter = new int[3]; /* Counters used by sqlite3_stmt_status() */
480 #if !SQLITE_OMIT_TRACE
481 public i64 startTime; /* Time when query started - used for profiling */
482 #endif
483 public i64 nFkConstraint; /* Number of imm. FK constraints this VM */
484 public i64 nStmtDefCons; /* Number of def. constraints when stmt started */
485 public string zSql = string.Empty; /* Text of the SQL statement that generated this */
486 public object pFree; /* Free this when deleting the vdbe */
487 #if SQLITE_DEBUG
488 public FILE trace; /* Write an execution trace here, if not NULL */
489 #endif
490 public VdbeFrame pFrame; /* Parent frame */
491 public VdbeFrame pDelFrame; /* List of frame objects to free on VM reset */
492 public int nFrame; /* Number of frames in pFrame list */
493 public u32 expmask; /* Binding to these vars invalidates VM */
494 public SubProgram pProgram; /* Linked list of all sub-programs used by VM */
495  
496 public Vdbe Copy()
497 {
498 Vdbe cp = (Vdbe)MemberwiseClone();
499 return cp;
500 }
501 public void CopyTo( Vdbe ct )
502 {
503 ct.db = db;
504 ct.pPrev = pPrev;
505 ct.pNext = pNext;
506 ct.nOp = nOp;
507 ct.nOpAlloc = nOpAlloc;
508 ct.aOp = aOp;
509 ct.nLabel = nLabel;
510 ct.nLabelAlloc = nLabelAlloc;
511 ct.aLabel = aLabel;
512 ct.apArg = apArg;
513 ct.aColName = aColName;
514 ct.nCursor = nCursor;
515 ct.apCsr = apCsr;
516 ct.aVar = aVar;
517 ct.azVar = azVar;
518 ct.nVar = nVar;
519 ct.nzVar = nzVar;
520 ct.magic = magic;
521 ct.nMem = nMem;
522 ct.aMem = aMem;
523 ct.cacheCtr = cacheCtr;
524 ct.pc = pc;
525 ct.rc = rc;
526 ct.errorAction = errorAction;
527 ct.nResColumn = nResColumn;
528 ct.zErrMsg = zErrMsg;
529 ct.pResultSet = pResultSet;
530 ct.explain = explain;
531 ct.changeCntOn = changeCntOn;
532 ct.expired = expired;
533 ct.minWriteFileFormat = minWriteFileFormat;
534 ct.inVtabMethod = inVtabMethod;
535 ct.usesStmtJournal = usesStmtJournal;
536 ct.readOnly = readOnly;
537 ct.nChange = nChange;
538 ct.isPrepareV2 = isPrepareV2;
539 #if !SQLITE_OMIT_TRACE
540 ct.startTime = startTime;
541 #endif
542 ct.btreeMask = btreeMask;
543 ct.lockMask = lockMask;
544 aCounter.CopyTo( ct.aCounter, 0 );
545 ct.zSql = zSql;
546 ct.pFree = pFree;
547 #if SQLITE_DEBUG
548 ct.trace = trace;
549 #endif
550 ct.nFkConstraint = nFkConstraint;
551 ct.nStmtDefCons = nStmtDefCons;
552 ct.iStatement = iStatement;
553 ct.pFrame = pFrame;
554 ct.nFrame = nFrame;
555 ct.expmask = expmask;
556 ct.pProgram = pProgram;
557 #if SQLITE_SSE
558 ct.fetchId=fetchId;
559 ct.lru=lru;
560 #endif
561 #if SQLITE_ENABLE_MEMORY_MANAGEMENT
562 ct.pLruPrev=pLruPrev;
563 ct.pLruNext=pLruNext;
564 #endif
565 }
566 };
567  
568 /*
569 ** The following are allowed values for Vdbe.magic
570 */
571 //#define VDBE_MAGIC_INIT 0x26bceaa5 /* Building a VDBE program */
572 //#define VDBE_MAGIC_RUN 0xbdf20da3 /* VDBE is ready to execute */
573 //#define VDBE_MAGIC_HALT 0x519c2973 /* VDBE has completed execution */
574 //#define VDBE_MAGIC_DEAD 0xb606c3c8 /* The VDBE has been deallocated */
575 const u32 VDBE_MAGIC_INIT = 0x26bceaa5; /* Building a VDBE program */
576 const u32 VDBE_MAGIC_RUN = 0xbdf20da3; /* VDBE is ready to execute */
577 const u32 VDBE_MAGIC_HALT = 0x519c2973; /* VDBE has completed execution */
578 const u32 VDBE_MAGIC_DEAD = 0xb606c3c8; /* The VDBE has been deallocated */
579 /*
580 ** Function prototypes
581 */
582 //void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor);
583 //void sqliteVdbePopStack(Vdbe*,int);
584 //int sqlite3VdbeCursorMoveto(VdbeCursor);
585 //#if (SQLITE_DEBUG) || defined(VDBE_PROFILE)
586 //void sqlite3VdbePrintOp(FILE*, int, Op);
587 //#endif
588 //u32 sqlite3VdbeSerialTypeLen(u32);
589 //u32 sqlite3VdbeSerialType(Mem*, int);
590 //u32sqlite3VdbeSerialPut(unsigned char*, int, Mem*, int);
591 //u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem);
592 //void sqlite3VdbeDeleteAuxData(VdbeFunc*, int);
593  
594 //int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int );
595 //int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int);
596 //int sqlite3VdbeIdxRowid(sqlite3 *, i64 );
597 //int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq);
598 //int sqlite3VdbeExec(Vdbe);
599 //int sqlite3VdbeList(Vdbe);
600 //int sqlite3VdbeHalt(Vdbe);
601 //int sqlite3VdbeChangeEncoding(Mem *, int);
602 //int sqlite3VdbeMemTooBig(Mem);
603 //int sqlite3VdbeMemCopy(Mem*, const Mem);
604 //void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);
605 //void sqlite3VdbeMemMove(Mem*, Mem);
606 //int sqlite3VdbeMemNulTerminate(Mem);
607 //int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void()(void));
608 //void sqlite3VdbeMemSetInt64(Mem*, i64);
609 #if SQLITE_OMIT_FLOATING_POINT
610 //# define sqlite3VdbeMemSetDouble sqlite3VdbeMemSetInt64
611 #else
612 //void sqlite3VdbeMemSetDouble(Mem*, double);
613 #endif
614 //void sqlite3VdbeMemSetNull(Mem);
615 //void sqlite3VdbeMemSetZeroBlob(Mem*,int);
616 //void sqlite3VdbeMemSetRowSet(Mem);
617 //int sqlite3VdbeMemMakeWriteable(Mem);
618 //int sqlite3VdbeMemStringify(Mem*, int);
619 //i64 sqlite3VdbeIntValue(Mem);
620 //int sqlite3VdbeMemIntegerify(Mem);
621 //double sqlite3VdbeRealValue(Mem);
622 //void sqlite3VdbeIntegerAffinity(Mem);
623 //int sqlite3VdbeMemRealify(Mem);
624 //int sqlite3VdbeMemNumerify(Mem);
625 //int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem);
626 //void sqlite3VdbeMemRelease(Mem p);
627 //void sqlite3VdbeMemReleaseExternal(Mem p);
628 //int sqlite3VdbeMemFinalize(Mem*, FuncDef);
629 //string sqlite3OpcodeName(int);
630 //int sqlite3VdbeMemGrow(Mem pMem, int n, int preserve);
631 //int sqlite3VdbeCloseStatement(Vdbe *, int);
632 //void sqlite3VdbeFrameDelete(VdbeFrame);
633 //int sqlite3VdbeFrameRestore(VdbeFrame );
634 //void sqlite3VdbeMemStoreType(Mem *pMem);
635  
636 #if !(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE//>0
637 //void sqlite3VdbeEnter(Vdbe);
638 //void sqlite3VdbeLeave(Vdbe);
639 #else
640 //# define sqlite3VdbeEnter(X)
641 static void sqlite3VdbeEnter( Vdbe p )
642 {
643 }
644 //# define sqlite3VdbeLeave(X)
645 static void sqlite3VdbeLeave( Vdbe p )
646 {
647 }
648 #endif
649  
650 #if SQLITE_DEBUG
651 //void sqlite3VdbeMemPrepareToChange(Vdbe*,Mem);
652 #endif
653  
654 #if !SQLITE_OMIT_FOREIGN_KEY
655 //int sqlite3VdbeCheckFk(Vdbe *, int);
656 #else
657 //# define sqlite3VdbeCheckFk(p,i) 0
658 static int sqlite3VdbeCheckFk( Vdbe p, int i ) { return 0; }
659 #endif
660  
661 //int sqlite3VdbeMemTranslate(Mem*, u8);
662 //#if SQLITE_DEBUG
663 // void sqlite3VdbePrintSql(Vdbe);
664 // void sqlite3VdbeMemPrettyPrint(Mem pMem, string zBuf);
665 //#endif
666 //int sqlite3VdbeMemHandleBom(Mem pMem);
667  
668 #if !SQLITE_OMIT_INCRBLOB
669 // int sqlite3VdbeMemExpandBlob(Mem );
670 #else
671 // #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK
672 ////static int sqlite3VdbeMemExpandBlob( Mem x )
673 ////{
674 //// return SQLITE_OK;
675 ////}
676 #endif
677  
678 //#endif //* !_VDBEINT_H_) */
679 }
680 }