Simplify sqlcipher_export tracing test
[sqlcipher.git] / src / vdbeInt.h
blob86445cef66b6840be23a2826e1ffd83b98dc13d6
1 /*
2 ** 2003 September 6
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.
11 *************************************************************************
12 ** This is the header file for information that is private to the
13 ** VDBE. This information used to all be at the top of the single
14 ** source code file "vdbe.c". When that file became too big (over
15 ** 6000 lines long) it was split up into several smaller files and
16 ** this header information was factored out.
18 #ifndef SQLITE_VDBEINT_H
19 #define SQLITE_VDBEINT_H
22 ** The maximum number of times that a statement will try to reparse
23 ** itself before giving up and returning SQLITE_SCHEMA.
25 #ifndef SQLITE_MAX_SCHEMA_RETRY
26 # define SQLITE_MAX_SCHEMA_RETRY 50
27 #endif
30 ** VDBE_DISPLAY_P4 is true or false depending on whether or not the
31 ** "explain" P4 display logic is enabled.
33 #if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) \
34 || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
35 # define VDBE_DISPLAY_P4 1
36 #else
37 # define VDBE_DISPLAY_P4 0
38 #endif
41 ** SQL is translated into a sequence of instructions to be
42 ** executed by a virtual machine. Each instruction is an instance
43 ** of the following structure.
45 typedef struct VdbeOp Op;
48 ** Boolean values
50 typedef unsigned Bool;
52 /* Opaque type used by code in vdbesort.c */
53 typedef struct VdbeSorter VdbeSorter;
55 /* Elements of the linked list at Vdbe.pAuxData */
56 typedef struct AuxData AuxData;
58 /* Types of VDBE cursors */
59 #define CURTYPE_BTREE 0
60 #define CURTYPE_SORTER 1
61 #define CURTYPE_VTAB 2
62 #define CURTYPE_PSEUDO 3
65 ** A VdbeCursor is an superclass (a wrapper) for various cursor objects:
67 ** * A b-tree cursor
68 ** - In the main database or in an ephemeral database
69 ** - On either an index or a table
70 ** * A sorter
71 ** * A virtual table
72 ** * A one-row "pseudotable" stored in a single register
74 typedef struct VdbeCursor VdbeCursor;
75 struct VdbeCursor {
76 u8 eCurType; /* One of the CURTYPE_* values above */
77 i8 iDb; /* Index of cursor database in db->aDb[] (or -1) */
78 u8 nullRow; /* True if pointing to a row with no data */
79 u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */
80 u8 isTable; /* True for rowid tables. False for indexes */
81 #ifdef SQLITE_DEBUG
82 u8 seekOp; /* Most recent seek operation on this cursor */
83 u8 wrFlag; /* The wrFlag argument to sqlite3BtreeCursor() */
84 #endif
85 Bool isEphemeral:1; /* True for an ephemeral table */
86 Bool useRandomRowid:1;/* Generate new record numbers semi-randomly */
87 Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */
88 Pgno pgnoRoot; /* Root page of the open btree cursor */
89 i16 nField; /* Number of fields in the header */
90 u16 nHdrParsed; /* Number of header fields parsed so far */
91 union {
92 BtCursor *pCursor; /* CURTYPE_BTREE. Btree cursor */
93 sqlite3_vtab_cursor *pVCur; /* CURTYPE_VTAB. Vtab cursor */
94 int pseudoTableReg; /* CURTYPE_PSEUDO. Reg holding content. */
95 VdbeSorter *pSorter; /* CURTYPE_SORTER. Sorter object */
96 } uc;
97 Btree *pBt; /* Separate file holding temporary table */
98 KeyInfo *pKeyInfo; /* Info about index keys needed by index cursors */
99 int seekResult; /* Result of previous sqlite3BtreeMoveto() */
100 i64 seqCount; /* Sequence counter */
101 i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */
102 VdbeCursor *pAltCursor; /* Associated index cursor from which to read */
103 int *aAltMap; /* Mapping from table to index column numbers */
104 #ifdef SQLITE_ENABLE_COLUMN_USED_MASK
105 u64 maskUsed; /* Mask of columns used by this cursor */
106 #endif
108 /* Cached information about the header for the data record that the
109 ** cursor is currently pointing to. Only valid if cacheStatus matches
110 ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of
111 ** CACHE_STALE and so setting cacheStatus=CACHE_STALE guarantees that
112 ** the cache is out of date.
114 ** aRow might point to (ephemeral) data for the current row, or it might
115 ** be NULL.
117 u32 cacheStatus; /* Cache is valid if this matches Vdbe.cacheCtr */
118 u32 payloadSize; /* Total number of bytes in the record */
119 u32 szRow; /* Byte available in aRow */
120 u32 iHdrOffset; /* Offset to next unparsed byte of the header */
121 const u8 *aRow; /* Data for the current row, if all on one page */
122 u32 *aOffset; /* Pointer to aType[nField] */
123 u32 aType[1]; /* Type values for all entries in the record */
124 /* 2*nField extra array elements allocated for aType[], beyond the one
125 ** static element declared in the structure. nField total array slots for
126 ** aType[] and nField+1 array slots for aOffset[] */
131 ** A value for VdbeCursor.cacheStatus that means the cache is always invalid.
133 #define CACHE_STALE 0
136 ** When a sub-program is executed (OP_Program), a structure of this type
137 ** is allocated to store the current value of the program counter, as
138 ** well as the current memory cell array and various other frame specific
139 ** values stored in the Vdbe struct. When the sub-program is finished,
140 ** these values are copied back to the Vdbe from the VdbeFrame structure,
141 ** restoring the state of the VM to as it was before the sub-program
142 ** began executing.
144 ** The memory for a VdbeFrame object is allocated and managed by a memory
145 ** cell in the parent (calling) frame. When the memory cell is deleted or
146 ** overwritten, the VdbeFrame object is not freed immediately. Instead, it
147 ** is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame
148 ** list is deleted when the VM is reset in VdbeHalt(). The reason for doing
149 ** this instead of deleting the VdbeFrame immediately is to avoid recursive
150 ** calls to sqlite3VdbeMemRelease() when the memory cells belonging to the
151 ** child frame are released.
153 ** The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is
154 ** set to NULL if the currently executing frame is the main program.
156 typedef struct VdbeFrame VdbeFrame;
157 struct VdbeFrame {
158 Vdbe *v; /* VM this frame belongs to */
159 VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */
160 Op *aOp; /* Program instructions for parent frame */
161 i64 *anExec; /* Event counters from parent frame */
162 Mem *aMem; /* Array of memory cells for parent frame */
163 VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
164 void *token; /* Copy of SubProgram.token */
165 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */
166 AuxData *pAuxData; /* Linked list of auxdata allocations */
167 int nCursor; /* Number of entries in apCsr */
168 int pc; /* Program Counter in parent (calling) frame */
169 int nOp; /* Size of aOp array */
170 int nMem; /* Number of entries in aMem */
171 int nChildMem; /* Number of memory cells for child frame */
172 int nChildCsr; /* Number of cursors for child frame */
173 int nChange; /* Statement changes (Vdbe.nChange) */
174 int nDbChange; /* Value of db->nChange */
177 #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
180 ** Internally, the vdbe manipulates nearly all SQL values as Mem
181 ** structures. Each Mem struct may cache multiple representations (string,
182 ** integer etc.) of the same value.
184 struct Mem {
185 union MemValue {
186 double r; /* Real value used when MEM_Real is set in flags */
187 i64 i; /* Integer value used when MEM_Int is set in flags */
188 int nZero; /* Used when bit MEM_Zero is set in flags */
189 FuncDef *pDef; /* Used only when flags==MEM_Agg */
190 RowSet *pRowSet; /* Used only when flags==MEM_RowSet */
191 VdbeFrame *pFrame; /* Used when flags==MEM_Frame */
192 } u;
193 u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */
194 u8 enc; /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */
195 u8 eSubtype; /* Subtype for this value */
196 int n; /* Number of characters in string value, excluding '\0' */
197 char *z; /* String or BLOB value */
198 /* ShallowCopy only needs to copy the information above */
199 char *zMalloc; /* Space to hold MEM_Str or MEM_Blob if szMalloc>0 */
200 int szMalloc; /* Size of the zMalloc allocation */
201 u32 uTemp; /* Transient storage for serial_type in OP_MakeRecord */
202 sqlite3 *db; /* The associated database connection */
203 void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */
204 #ifdef SQLITE_DEBUG
205 Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
206 void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */
207 #endif
211 ** Size of struct Mem not including the Mem.zMalloc member or anything that
212 ** follows.
214 #define MEMCELLSIZE offsetof(Mem,zMalloc)
216 /* One or more of the following flags are set to indicate the validOK
217 ** representations of the value stored in the Mem struct.
219 ** If the MEM_Null flag is set, then the value is an SQL NULL value.
220 ** No other flags may be set in this case.
222 ** If the MEM_Str flag is set then Mem.z points at a string representation.
223 ** Usually this is encoded in the same unicode encoding as the main
224 ** database (see below for exceptions). If the MEM_Term flag is also
225 ** set, then the string is nul terminated. The MEM_Int and MEM_Real
226 ** flags may coexist with the MEM_Str flag.
228 #define MEM_Null 0x0001 /* Value is NULL */
229 #define MEM_Str 0x0002 /* Value is a string */
230 #define MEM_Int 0x0004 /* Value is an integer */
231 #define MEM_Real 0x0008 /* Value is a real number */
232 #define MEM_Blob 0x0010 /* Value is a BLOB */
233 #define MEM_AffMask 0x001f /* Mask of affinity bits */
234 #define MEM_RowSet 0x0020 /* Value is a RowSet object */
235 #define MEM_Frame 0x0040 /* Value is a VdbeFrame object */
236 #define MEM_Undefined 0x0080 /* Value is undefined */
237 #define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */
238 #define MEM_TypeMask 0x81ff /* Mask of type bits */
241 /* Whenever Mem contains a valid string or blob representation, one of
242 ** the following flags must be set to determine the memory management
243 ** policy for Mem.z. The MEM_Term flag tells us whether or not the
244 ** string is \000 or \u0000 terminated
246 #define MEM_Term 0x0200 /* String rep is nul terminated */
247 #define MEM_Dyn 0x0400 /* Need to call Mem.xDel() on Mem.z */
248 #define MEM_Static 0x0800 /* Mem.z points to a static string */
249 #define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */
250 #define MEM_Agg 0x2000 /* Mem.z points to an agg function context */
251 #define MEM_Zero 0x4000 /* Mem.i contains count of 0s appended to blob */
252 #define MEM_Subtype 0x8000 /* Mem.eSubtype is valid */
253 #ifdef SQLITE_OMIT_INCRBLOB
254 #undef MEM_Zero
255 #define MEM_Zero 0x0000
256 #endif
258 /* Return TRUE if Mem X contains dynamically allocated content - anything
259 ** that needs to be deallocated to avoid a leak.
261 #define VdbeMemDynamic(X) \
262 (((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame))!=0)
265 ** Clear any existing type flags from a Mem and replace them with f
267 #define MemSetTypeFlag(p, f) \
268 ((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero))|f)
271 ** Return true if a memory cell is not marked as invalid. This macro
272 ** is for use inside assert() statements only.
274 #ifdef SQLITE_DEBUG
275 #define memIsValid(M) ((M)->flags & MEM_Undefined)==0
276 #endif
279 ** Each auxiliary data pointer stored by a user defined function
280 ** implementation calling sqlite3_set_auxdata() is stored in an instance
281 ** of this structure. All such structures associated with a single VM
282 ** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed
283 ** when the VM is halted (if not before).
285 struct AuxData {
286 int iOp; /* Instruction number of OP_Function opcode */
287 int iArg; /* Index of function argument. */
288 void *pAux; /* Aux data pointer */
289 void (*xDelete)(void *); /* Destructor for the aux data */
290 AuxData *pNext; /* Next element in list */
294 ** The "context" argument for an installable function. A pointer to an
295 ** instance of this structure is the first argument to the routines used
296 ** implement the SQL functions.
298 ** There is a typedef for this structure in sqlite.h. So all routines,
299 ** even the public interface to SQLite, can use a pointer to this structure.
300 ** But this file is the only place where the internal details of this
301 ** structure are known.
303 ** This structure is defined inside of vdbeInt.h because it uses substructures
304 ** (Mem) which are only defined there.
306 struct sqlite3_context {
307 Mem *pOut; /* The return value is stored here */
308 FuncDef *pFunc; /* Pointer to function information */
309 Mem *pMem; /* Memory cell used to store aggregate context */
310 Vdbe *pVdbe; /* The VM that owns this context */
311 int iOp; /* Instruction number of OP_Function */
312 int isError; /* Error code returned by the function. */
313 u8 skipFlag; /* Skip accumulator loading if true */
314 u8 fErrorOrAux; /* isError!=0 or pVdbe->pAuxData modified */
315 u8 argc; /* Number of arguments */
316 sqlite3_value *argv[1]; /* Argument set */
319 /* A bitfield type for use inside of structures. Always follow with :N where
320 ** N is the number of bits.
322 typedef unsigned bft; /* Bit Field Type */
324 typedef struct ScanStatus ScanStatus;
325 struct ScanStatus {
326 int addrExplain; /* OP_Explain for loop */
327 int addrLoop; /* Address of "loops" counter */
328 int addrVisit; /* Address of "rows visited" counter */
329 int iSelectID; /* The "Select-ID" for this loop */
330 LogEst nEst; /* Estimated output rows per loop */
331 char *zName; /* Name of table or index */
335 ** An instance of the virtual machine. This structure contains the complete
336 ** state of the virtual machine.
338 ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
339 ** is really a pointer to an instance of this structure.
341 struct Vdbe {
342 sqlite3 *db; /* The database connection that owns this statement */
343 Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
344 Parse *pParse; /* Parsing context used to create this Vdbe */
345 ynVar nVar; /* Number of entries in aVar[] */
346 ynVar nzVar; /* Number of entries in azVar[] */
347 u32 magic; /* Magic number for sanity checking */
348 int nMem; /* Number of memory locations currently allocated */
349 int nCursor; /* Number of slots in apCsr[] */
350 u32 cacheCtr; /* VdbeCursor row cache generation counter */
351 int pc; /* The program counter */
352 int rc; /* Value to return */
353 int nChange; /* Number of db changes made since last reset */
354 int iStatement; /* Statement number (or 0 if has not opened stmt) */
355 i64 iCurrentTime; /* Value of julianday('now') for this statement */
356 i64 nFkConstraint; /* Number of imm. FK constraints this VM */
357 i64 nStmtDefCons; /* Number of def. constraints when stmt started */
358 i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */
360 /* When allocating a new Vdbe object, all of the fields below should be
361 ** initialized to zero or NULL */
363 Op *aOp; /* Space to hold the virtual machine's program */
364 Mem *aMem; /* The memory locations */
365 Mem **apArg; /* Arguments to currently executing user function */
366 Mem *aColName; /* Column names to return */
367 Mem *pResultSet; /* Pointer to an array of results */
368 char *zErrMsg; /* Error message written here */
369 VdbeCursor **apCsr; /* One element of this array for each open cursor */
370 Mem *aVar; /* Values for the OP_Variable opcode. */
371 char **azVar; /* Name of variables */
372 #ifndef SQLITE_OMIT_TRACE
373 i64 startTime; /* Time when query started - used for profiling */
374 #endif
375 int nOp; /* Number of instructions in the program */
376 #ifdef SQLITE_DEBUG
377 int rcApp; /* errcode set by sqlite3_result_error_code() */
378 #endif
379 u16 nResColumn; /* Number of columns in one row of the result set */
380 u8 errorAction; /* Recovery action to do in case of an error */
381 u8 minWriteFileFormat; /* Minimum file format for writable database files */
382 bft expired:1; /* True if the VM needs to be recompiled */
383 bft doingRerun:1; /* True if rerunning after an auto-reprepare */
384 bft explain:2; /* True if EXPLAIN present on SQL command */
385 bft changeCntOn:1; /* True to update the change-counter */
386 bft runOnlyOnce:1; /* Automatically expire on reset */
387 bft usesStmtJournal:1; /* True if uses a statement journal */
388 bft readOnly:1; /* True for statements that do not write */
389 bft bIsReader:1; /* True for statements that read */
390 bft isPrepareV2:1; /* True if prepared with prepare_v2() */
391 yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
392 yDbMask lockMask; /* Subset of btreeMask that requires a lock */
393 u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */
394 char *zSql; /* Text of the SQL statement that generated this */
395 void *pFree; /* Free this when deleting the vdbe */
396 VdbeFrame *pFrame; /* Parent frame */
397 VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */
398 int nFrame; /* Number of frames in pFrame list */
399 u32 expmask; /* Binding to these vars invalidates VM */
400 SubProgram *pProgram; /* Linked list of all sub-programs used by VM */
401 AuxData *pAuxData; /* Linked list of auxdata allocations */
402 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
403 i64 *anExec; /* Number of times each op has been executed */
404 int nScan; /* Entries in aScan[] */
405 ScanStatus *aScan; /* Scan definitions for sqlite3_stmt_scanstatus() */
406 #endif
410 ** The following are allowed values for Vdbe.magic
412 #define VDBE_MAGIC_INIT 0x16bceaa5 /* Building a VDBE program */
413 #define VDBE_MAGIC_RUN 0x2df20da3 /* VDBE is ready to execute */
414 #define VDBE_MAGIC_HALT 0x319c2973 /* VDBE has completed execution */
415 #define VDBE_MAGIC_RESET 0x48fa9f76 /* Reset and ready to run again */
416 #define VDBE_MAGIC_DEAD 0x5606c3c8 /* The VDBE has been deallocated */
419 ** Structure used to store the context required by the
420 ** sqlite3_preupdate_*() API functions.
422 struct PreUpdate {
423 Vdbe *v;
424 VdbeCursor *pCsr; /* Cursor to read old values from */
425 int op; /* One of SQLITE_INSERT, UPDATE, DELETE */
426 u8 *aRecord; /* old.* database record */
427 KeyInfo keyinfo;
428 UnpackedRecord *pUnpacked; /* Unpacked version of aRecord[] */
429 UnpackedRecord *pNewUnpacked; /* Unpacked version of new.* record */
430 int iNewReg; /* Register for new.* values */
431 i64 iKey1; /* First key value passed to hook */
432 i64 iKey2; /* Second key value passed to hook */
433 Mem *aNew; /* Array of new.* values */
434 Table *pTab; /* Schema object being upated */
438 ** Function prototypes
440 void sqlite3VdbeError(Vdbe*, const char *, ...);
441 void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*);
442 void sqliteVdbePopStack(Vdbe*,int);
443 int sqlite3VdbeCursorMoveto(VdbeCursor**, int*);
444 int sqlite3VdbeCursorRestore(VdbeCursor*);
445 #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
446 void sqlite3VdbePrintOp(FILE*, int, Op*);
447 #endif
448 u32 sqlite3VdbeSerialTypeLen(u32);
449 u8 sqlite3VdbeOneByteSerialTypeLen(u8);
450 u32 sqlite3VdbeSerialType(Mem*, int, u32*);
451 u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
452 u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
453 void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int);
455 int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
456 int sqlite3VdbeIdxKeyCompare(sqlite3*,VdbeCursor*,UnpackedRecord*,int*);
457 int sqlite3VdbeIdxRowid(sqlite3*, BtCursor*, i64*);
458 int sqlite3VdbeExec(Vdbe*);
459 int sqlite3VdbeList(Vdbe*);
460 int sqlite3VdbeHalt(Vdbe*);
461 int sqlite3VdbeChangeEncoding(Mem *, int);
462 int sqlite3VdbeMemTooBig(Mem*);
463 int sqlite3VdbeMemCopy(Mem*, const Mem*);
464 void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);
465 void sqlite3VdbeMemMove(Mem*, Mem*);
466 int sqlite3VdbeMemNulTerminate(Mem*);
467 int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*));
468 void sqlite3VdbeMemSetInt64(Mem*, i64);
469 #ifdef SQLITE_OMIT_FLOATING_POINT
470 # define sqlite3VdbeMemSetDouble sqlite3VdbeMemSetInt64
471 #else
472 void sqlite3VdbeMemSetDouble(Mem*, double);
473 #endif
474 void sqlite3VdbeMemInit(Mem*,sqlite3*,u16);
475 void sqlite3VdbeMemSetNull(Mem*);
476 void sqlite3VdbeMemSetZeroBlob(Mem*,int);
477 void sqlite3VdbeMemSetRowSet(Mem*);
478 int sqlite3VdbeMemMakeWriteable(Mem*);
479 int sqlite3VdbeMemStringify(Mem*, u8, u8);
480 i64 sqlite3VdbeIntValue(Mem*);
481 int sqlite3VdbeMemIntegerify(Mem*);
482 double sqlite3VdbeRealValue(Mem*);
483 void sqlite3VdbeIntegerAffinity(Mem*);
484 int sqlite3VdbeMemRealify(Mem*);
485 int sqlite3VdbeMemNumerify(Mem*);
486 void sqlite3VdbeMemCast(Mem*,u8,u8);
487 int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,int,Mem*);
488 void sqlite3VdbeMemRelease(Mem *p);
489 int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
490 const char *sqlite3OpcodeName(int);
491 int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
492 int sqlite3VdbeMemClearAndResize(Mem *pMem, int n);
493 int sqlite3VdbeCloseStatement(Vdbe *, int);
494 void sqlite3VdbeFrameDelete(VdbeFrame*);
495 int sqlite3VdbeFrameRestore(VdbeFrame *);
496 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
497 void sqlite3VdbePreUpdateHook(Vdbe*,VdbeCursor*,int,const char*,Table*,i64,int);
498 #endif
499 int sqlite3VdbeTransferError(Vdbe *p);
501 int sqlite3VdbeSorterInit(sqlite3 *, int, VdbeCursor *);
502 void sqlite3VdbeSorterReset(sqlite3 *, VdbeSorter *);
503 void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *);
504 int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *);
505 int sqlite3VdbeSorterNext(sqlite3 *, const VdbeCursor *, int *);
506 int sqlite3VdbeSorterRewind(const VdbeCursor *, int *);
507 int sqlite3VdbeSorterWrite(const VdbeCursor *, Mem *);
508 int sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *);
510 #if !defined(SQLITE_OMIT_SHARED_CACHE)
511 void sqlite3VdbeEnter(Vdbe*);
512 #else
513 # define sqlite3VdbeEnter(X)
514 #endif
516 #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0
517 void sqlite3VdbeLeave(Vdbe*);
518 #else
519 # define sqlite3VdbeLeave(X)
520 #endif
522 #ifdef SQLITE_DEBUG
523 void sqlite3VdbeMemAboutToChange(Vdbe*,Mem*);
524 int sqlite3VdbeCheckMemInvariants(Mem*);
525 #endif
527 #ifndef SQLITE_OMIT_FOREIGN_KEY
528 int sqlite3VdbeCheckFk(Vdbe *, int);
529 #else
530 # define sqlite3VdbeCheckFk(p,i) 0
531 #endif
533 int sqlite3VdbeMemTranslate(Mem*, u8);
534 #ifdef SQLITE_DEBUG
535 void sqlite3VdbePrintSql(Vdbe*);
536 void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
537 #endif
538 int sqlite3VdbeMemHandleBom(Mem *pMem);
540 #ifndef SQLITE_OMIT_INCRBLOB
541 int sqlite3VdbeMemExpandBlob(Mem *);
542 #define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)
543 #else
544 #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK
545 #define ExpandBlob(P) SQLITE_OK
546 #endif
548 #endif /* !defined(SQLITE_VDBEINT_H) */