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. 10 ** 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. 17 */ 18 #ifndef _VDBEINT_H_ 19 #define _VDBEINT_H_ 20 21 /* 22 ** The maximum number of times that a statement will try to reparse 23 ** itself before giving up and returning SQLITE_SCHEMA. 24 */ 25 #ifndef SQLITE_MAX_SCHEMA_RETRY 26 # define SQLITE_MAX_SCHEMA_RETRY 50 27 #endif 28 29 /* 30 ** SQL is translated into a sequence of instructions to be 31 ** executed by a virtual machine. Each instruction is an instance 32 ** of the following structure. 33 */ 34 typedef struct VdbeOp Op; 35 36 /* 37 ** Boolean values 38 */ 39 typedef unsigned Bool; 40 41 /* Opaque type used by code in vdbesort.c */ 42 typedef struct VdbeSorter VdbeSorter; 43 44 /* Opaque type used by the explainer */ 45 typedef struct Explain Explain; 46 47 /* Elements of the linked list at Vdbe.pAuxData */ 48 typedef struct AuxData AuxData; 49 50 /* 51 ** A cursor is a pointer into a single BTree within a database file. 52 ** The cursor can seek to a BTree entry with a particular key, or 53 ** loop over all entries of the Btree. You can also insert new BTree 54 ** entries or retrieve the key or data from the entry that the cursor 55 ** is currently pointing to. 56 ** 57 ** Cursors can also point to virtual tables, sorters, or "pseudo-tables". 58 ** A pseudo-table is a single-row table implemented by registers. 59 ** 60 ** Every cursor that the virtual machine has open is represented by an 61 ** instance of the following structure. 62 */ 63 struct VdbeCursor { 64 BtCursor *pCursor; /* The cursor structure of the backend */ 65 Btree *pBt; /* Separate file holding temporary table */ 66 KeyInfo *pKeyInfo; /* Info about index keys needed by index cursors */ 67 int seekResult; /* Result of previous sqlite3BtreeMoveto() */ 68 int pseudoTableReg; /* Register holding pseudotable content. */ 69 i16 nField; /* Number of fields in the header */ 70 u16 nHdrParsed; /* Number of header fields parsed so far */ 71 i8 iDb; /* Index of cursor database in db->aDb[] (or -1) */ 72 u8 nullRow; /* True if pointing to a row with no data */ 73 u8 rowidIsValid; /* True if lastRowid is valid */ 74 u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */ 75 Bool useRandomRowid:1;/* Generate new record numbers semi-randomly */ 76 Bool isTable:1; /* True if a table requiring integer keys */ 77 Bool isOrdered:1; /* True if the underlying table is BTREE_UNORDERED */ 78 Bool multiPseudo:1; /* Multi-register pseudo-cursor */ 79 sqlite3_vtab_cursor *pVtabCursor; /* The cursor for a virtual table */ 80 i64 seqCount; /* Sequence counter */ 81 i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */ 82 i64 lastRowid; /* Rowid being deleted by OP_Delete */ 83 VdbeSorter *pSorter; /* Sorter object for OP_SorterOpen cursors */ 84 85 /* Cached information about the header for the data record that the 86 ** cursor is currently pointing to. Only valid if cacheStatus matches 87 ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of 88 ** CACHE_STALE and so setting cacheStatus=CACHE_STALE guarantees that 89 ** the cache is out of date. 90 ** 91 ** aRow might point to (ephemeral) data for the current row, or it might 92 ** be NULL. 93 */ 94 u32 cacheStatus; /* Cache is valid if this matches Vdbe.cacheCtr */ 95 u32 payloadSize; /* Total number of bytes in the record */ 96 u32 szRow; /* Byte available in aRow */ 97 u32 iHdrOffset; /* Offset to next unparsed byte of the header */ 98 const u8 *aRow; /* Data for the current row, if all on one page */ 99 u32 aType[1]; /* Type values for all entries in the record */ 100 /* 2*nField extra array elements allocated for aType[], beyond the one 101 ** static element declared in the structure. nField total array slots for 102 ** aType[] and nField+1 array slots for aOffset[] */ 103 }; 104 typedef struct VdbeCursor VdbeCursor; 105 106 /* 107 ** When a sub-program is executed (OP_Program), a structure of this type 108 ** is allocated to store the current value of the program counter, as 109 ** well as the current memory cell array and various other frame specific 110 ** values stored in the Vdbe struct. When the sub-program is finished, 111 ** these values are copied back to the Vdbe from the VdbeFrame structure, 112 ** restoring the state of the VM to as it was before the sub-program 113 ** began executing. 114 ** 115 ** The memory for a VdbeFrame object is allocated and managed by a memory 116 ** cell in the parent (calling) frame. When the memory cell is deleted or 117 ** overwritten, the VdbeFrame object is not freed immediately. Instead, it 118 ** is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame 119 ** list is deleted when the VM is reset in VdbeHalt(). The reason for doing 120 ** this instead of deleting the VdbeFrame immediately is to avoid recursive 121 ** calls to sqlite3VdbeMemRelease() when the memory cells belonging to the 122 ** child frame are released. 123 ** 124 ** The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is 125 ** set to NULL if the currently executing frame is the main program. 126 */ 127 typedef struct VdbeFrame VdbeFrame; 128 struct VdbeFrame { 129 Vdbe *v; /* VM this frame belongs to */ 130 VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */ 131 Op *aOp; /* Program instructions for parent frame */ 132 Mem *aMem; /* Array of memory cells for parent frame */ 133 u8 *aOnceFlag; /* Array of OP_Once flags for parent frame */ 134 VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */ 135 void *token; /* Copy of SubProgram.token */ 136 i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */ 137 int nCursor; /* Number of entries in apCsr */ 138 int pc; /* Program Counter in parent (calling) frame */ 139 int nOp; /* Size of aOp array */ 140 int nMem; /* Number of entries in aMem */ 141 int nOnceFlag; /* Number of entries in aOnceFlag */ 142 int nChildMem; /* Number of memory cells for child frame */ 143 int nChildCsr; /* Number of cursors for child frame */ 144 int nChange; /* Statement changes (Vdbe.nChanges) */ 145 }; 146 147 #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))]) 148 149 /* 150 ** A value for VdbeCursor.cacheValid that means the cache is always invalid. 151 */ 152 #define CACHE_STALE 0 153 154 /* 155 ** Internally, the vdbe manipulates nearly all SQL values as Mem 156 ** structures. Each Mem struct may cache multiple representations (string, 157 ** integer etc.) of the same value. 158 */ 159 struct Mem { 160 sqlite3 *db; /* The associated database connection */ 161 char *z; /* String or BLOB value */ 162 double r; /* Real value */ 163 union { 164 i64 i; /* Integer value used when MEM_Int is set in flags */ 165 int nZero; /* Used when bit MEM_Zero is set in flags */ 166 FuncDef *pDef; /* Used only when flags==MEM_Agg */ 167 RowSet *pRowSet; /* Used only when flags==MEM_RowSet */ 168 VdbeFrame *pFrame; /* Used when flags==MEM_Frame */ 169 } u; 170 int n; /* Number of characters in string value, excluding '\0' */ 171 u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */ 172 u8 type; /* One of SQLITE_NULL, SQLITE_TEXT, SQLITE_INTEGER, etc */ 173 u8 enc; /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */ 174 #ifdef SQLITE_DEBUG 175 Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ 176 void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */ 177 #endif 178 void (*xDel)(void *); /* If not null, call this function to delete Mem.z */ 179 char *zMalloc; /* Dynamic buffer allocated by sqlite3_malloc() */ 180 }; 181 182 /* One or more of the following flags are set to indicate the validOK 183 ** representations of the value stored in the Mem struct. 184 ** 185 ** If the MEM_Null flag is set, then the value is an SQL NULL value. 186 ** No other flags may be set in this case. 187 ** 188 ** If the MEM_Str flag is set then Mem.z points at a string representation. 189 ** Usually this is encoded in the same unicode encoding as the main 190 ** database (see below for exceptions). If the MEM_Term flag is also 191 ** set, then the string is nul terminated. The MEM_Int and MEM_Real 192 ** flags may coexist with the MEM_Str flag. 193 */ 194 #define MEM_Null 0x0001 /* Value is NULL */ 195 #define MEM_Str 0x0002 /* Value is a string */ 196 #define MEM_Int 0x0004 /* Value is an integer */ 197 #define MEM_Real 0x0008 /* Value is a real number */ 198 #define MEM_Blob 0x0010 /* Value is a BLOB */ 199 #define MEM_RowSet 0x0020 /* Value is a RowSet object */ 200 #define MEM_Frame 0x0040 /* Value is a VdbeFrame object */ 201 #define MEM_Invalid 0x0080 /* Value is undefined */ 202 #define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */ 203 #define MEM_TypeMask 0x01ff /* Mask of type bits */ 204 205 206 /* Whenever Mem contains a valid string or blob representation, one of 207 ** the following flags must be set to determine the memory management 208 ** policy for Mem.z. The MEM_Term flag tells us whether or not the 209 ** string is \000 or \u0000 terminated 210 */ 211 #define MEM_Term 0x0200 /* String rep is nul terminated */ 212 #define MEM_Dyn 0x0400 /* Need to call sqliteFree() on Mem.z */ 213 #define MEM_Static 0x0800 /* Mem.z points to a static string */ 214 #define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */ 215 #define MEM_Agg 0x2000 /* Mem.z points to an agg function context */ 216 #define MEM_Zero 0x4000 /* Mem.i contains count of 0s appended to blob */ 217 #ifdef SQLITE_OMIT_INCRBLOB 218 #undef MEM_Zero 219 #define MEM_Zero 0x0000 220 #endif 221 222 /* 223 ** Clear any existing type flags from a Mem and replace them with f 224 */ 225 #define MemSetTypeFlag(p, f) \ 226 ((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero))|f) 227 228 /* 229 ** Return true if a memory cell is not marked as invalid. This macro 230 ** is for use inside assert() statements only. 231 */ 232 #ifdef SQLITE_DEBUG 233 #define memIsValid(M) ((M)->flags & MEM_Invalid)==0 234 #endif 235 236 /* 237 ** Each auxilliary data pointer stored by a user defined function 238 ** implementation calling sqlite3_set_auxdata() is stored in an instance 239 ** of this structure. All such structures associated with a single VM 240 ** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed 241 ** when the VM is halted (if not before). 242 */ 243 struct AuxData { 244 int iOp; /* Instruction number of OP_Function opcode */ 245 int iArg; /* Index of function argument. */ 246 void *pAux; /* Aux data pointer */ 247 void (*xDelete)(void *); /* Destructor for the aux data */ 248 AuxData *pNext; /* Next element in list */ 249 }; 250 251 /* 252 ** The "context" argument for a installable function. A pointer to an 253 ** instance of this structure is the first argument to the routines used 254 ** implement the SQL functions. 255 ** 256 ** There is a typedef for this structure in sqlite.h. So all routines, 257 ** even the public interface to SQLite, can use a pointer to this structure. 258 ** But this file is the only place where the internal details of this 259 ** structure are known. 260 ** 261 ** This structure is defined inside of vdbeInt.h because it uses substructures 262 ** (Mem) which are only defined there. 263 */ 264 struct sqlite3_context { 265 FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */ 266 Mem s; /* The return value is stored here */ 267 Mem *pMem; /* Memory cell used to store aggregate context */ 268 CollSeq *pColl; /* Collating sequence */ 269 Vdbe *pVdbe; /* The VM that owns this context */ 270 int iOp; /* Instruction number of OP_Function */ 271 int isError; /* Error code returned by the function. */ 272 u8 skipFlag; /* Skip skip accumulator loading if true */ 273 u8 fErrorOrAux; /* isError!=0 or pVdbe->pAuxData modified */ 274 }; 275 276 /* 277 ** An Explain object accumulates indented output which is helpful 278 ** in describing recursive data structures. 279 */ 280 struct Explain { 281 Vdbe *pVdbe; /* Attach the explanation to this Vdbe */ 282 StrAccum str; /* The string being accumulated */ 283 int nIndent; /* Number of elements in aIndent */ 284 u16 aIndent[100]; /* Levels of indentation */ 285 char zBase[100]; /* Initial space */ 286 }; 287 288 /* A bitfield type for use inside of structures. Always follow with :N where 289 ** N is the number of bits. 290 */ 291 typedef unsigned bft; /* Bit Field Type */ 292 293 /* 294 ** An instance of the virtual machine. This structure contains the complete 295 ** state of the virtual machine. 296 ** 297 ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare() 298 ** is really a pointer to an instance of this structure. 299 ** 300 ** The Vdbe.inVtabMethod variable is set to non-zero for the duration of 301 ** any virtual table method invocations made by the vdbe program. It is 302 ** set to 2 for xDestroy method calls and 1 for all other methods. This 303 ** variable is used for two purposes: to allow xDestroy methods to execute 304 ** "DROP TABLE" statements and to prevent some nasty side effects of 305 ** malloc failure when SQLite is invoked recursively by a virtual table 306 ** method function. 307 */ 308 struct Vdbe { 309 sqlite3 *db; /* The database connection that owns this statement */ 310 Op *aOp; /* Space to hold the virtual machine's program */ 311 Mem *aMem; /* The memory locations */ 312 Mem **apArg; /* Arguments to currently executing user function */ 313 Mem *aColName; /* Column names to return */ 314 Mem *pResultSet; /* Pointer to an array of results */ 315 Parse *pParse; /* Parsing context used to create this Vdbe */ 316 int nMem; /* Number of memory locations currently allocated */ 317 int nOp; /* Number of instructions in the program */ 318 int nCursor; /* Number of slots in apCsr[] */ 319 u32 magic; /* Magic number for sanity checking */ 320 char *zErrMsg; /* Error message written here */ 321 Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */ 322 VdbeCursor **apCsr; /* One element of this array for each open cursor */ 323 Mem *aVar; /* Values for the OP_Variable opcode. */ 324 char **azVar; /* Name of variables */ 325 ynVar nVar; /* Number of entries in aVar[] */ 326 ynVar nzVar; /* Number of entries in azVar[] */ 327 u32 cacheCtr; /* VdbeCursor row cache generation counter */ 328 int pc; /* The program counter */ 329 int rc; /* Value to return */ 330 u16 nResColumn; /* Number of columns in one row of the result set */ 331 u8 errorAction; /* Recovery action to do in case of an error */ 332 u8 minWriteFileFormat; /* Minimum file format for writable database files */ 333 bft explain:2; /* True if EXPLAIN present on SQL command */ 334 bft inVtabMethod:2; /* See comments above */ 335 bft changeCntOn:1; /* True to update the change-counter */ 336 bft expired:1; /* True if the VM needs to be recompiled */ 337 bft runOnlyOnce:1; /* Automatically expire on reset */ 338 bft usesStmtJournal:1; /* True if uses a statement journal */ 339 bft readOnly:1; /* True for statements that do not write */ 340 bft bIsReader:1; /* True for statements that read */ 341 bft isPrepareV2:1; /* True if prepared with prepare_v2() */ 342 bft doingRerun:1; /* True if rerunning after an auto-reprepare */ 343 int nChange; /* Number of db changes made since last reset */ 344 yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ 345 yDbMask lockMask; /* Subset of btreeMask that requires a lock */ 346 int iStatement; /* Statement number (or 0 if has not opened stmt) */ 347 u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */ 348 #ifndef SQLITE_OMIT_TRACE 349 i64 startTime; /* Time when query started - used for profiling */ 350 #endif 351 i64 iCurrentTime; /* Value of julianday('now') for this statement */ 352 i64 nFkConstraint; /* Number of imm. FK constraints this VM */ 353 i64 nStmtDefCons; /* Number of def. constraints when stmt started */ 354 i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */ 355 char *zSql; /* Text of the SQL statement that generated this */ 356 void *pFree; /* Free this when deleting the vdbe */ 357 #ifdef SQLITE_ENABLE_TREE_EXPLAIN 358 Explain *pExplain; /* The explainer */ 359 char *zExplain; /* Explanation of data structures */ 360 #endif 361 VdbeFrame *pFrame; /* Parent frame */ 362 VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */ 363 int nFrame; /* Number of frames in pFrame list */ 364 u32 expmask; /* Binding to these vars invalidates VM */ 365 SubProgram *pProgram; /* Linked list of all sub-programs used by VM */ 366 int nOnceFlag; /* Size of array aOnceFlag[] */ 367 u8 *aOnceFlag; /* Flags for OP_Once */ 368 AuxData *pAuxData; /* Linked list of auxdata allocations */ 369 }; 370 371 /* 372 ** The following are allowed values for Vdbe.magic 373 */ 374 #define VDBE_MAGIC_INIT 0x26bceaa5 /* Building a VDBE program */ 375 #define VDBE_MAGIC_RUN 0xbdf20da3 /* VDBE is ready to execute */ 376 #define VDBE_MAGIC_HALT 0x519c2973 /* VDBE has completed execution */ 377 #define VDBE_MAGIC_DEAD 0xb606c3c8 /* The VDBE has been deallocated */ 378 379 /* 380 ** Function prototypes 381 */ 382 void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*); 383 void sqliteVdbePopStack(Vdbe*,int); 384 int sqlite3VdbeCursorMoveto(VdbeCursor*); 385 #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) 386 void sqlite3VdbePrintOp(FILE*, int, Op*); 387 #endif 388 u32 sqlite3VdbeSerialTypeLen(u32); 389 u32 sqlite3VdbeSerialType(Mem*, int); 390 u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32); 391 u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); 392 void sqlite3VdbeDeleteAuxData(Vdbe*, int, int); 393 394 int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); 395 int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*); 396 int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *); 397 int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); 398 int sqlite3VdbeExec(Vdbe*); 399 int sqlite3VdbeList(Vdbe*); 400 int sqlite3VdbeHalt(Vdbe*); 401 int sqlite3VdbeChangeEncoding(Mem *, int); 402 int sqlite3VdbeMemTooBig(Mem*); 403 int sqlite3VdbeMemCopy(Mem*, const Mem*); 404 void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int); 405 void sqlite3VdbeMemMove(Mem*, Mem*); 406 int sqlite3VdbeMemNulTerminate(Mem*); 407 int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*)); 408 void sqlite3VdbeMemSetInt64(Mem*, i64); 409 #ifdef SQLITE_OMIT_FLOATING_POINT 410 # define sqlite3VdbeMemSetDouble sqlite3VdbeMemSetInt64 411 #else 412 void sqlite3VdbeMemSetDouble(Mem*, double); 413 #endif 414 void sqlite3VdbeMemSetNull(Mem*); 415 void sqlite3VdbeMemSetZeroBlob(Mem*,int); 416 void sqlite3VdbeMemSetRowSet(Mem*); 417 int sqlite3VdbeMemMakeWriteable(Mem*); 418 int sqlite3VdbeMemStringify(Mem*, int); 419 i64 sqlite3VdbeIntValue(Mem*); 420 int sqlite3VdbeMemIntegerify(Mem*); 421 double sqlite3VdbeRealValue(Mem*); 422 void sqlite3VdbeIntegerAffinity(Mem*); 423 int sqlite3VdbeMemRealify(Mem*); 424 int sqlite3VdbeMemNumerify(Mem*); 425 int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,int,Mem*); 426 void sqlite3VdbeMemRelease(Mem *p); 427 void sqlite3VdbeMemReleaseExternal(Mem *p); 428 #define VdbeMemRelease(X) \ 429 if((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame)) \ 430 sqlite3VdbeMemReleaseExternal(X); 431 int sqlite3VdbeMemFinalize(Mem*, FuncDef*); 432 const char *sqlite3OpcodeName(int); 433 int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); 434 int sqlite3VdbeCloseStatement(Vdbe *, int); 435 void sqlite3VdbeFrameDelete(VdbeFrame*); 436 int sqlite3VdbeFrameRestore(VdbeFrame *); 437 void sqlite3VdbeMemStoreType(Mem *pMem); 438 int sqlite3VdbeTransferError(Vdbe *p); 439 440 int sqlite3VdbeSorterInit(sqlite3 *, VdbeCursor *); 441 void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *); 442 int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *); 443 int sqlite3VdbeSorterNext(sqlite3 *, const VdbeCursor *, int *); 444 int sqlite3VdbeSorterRewind(sqlite3 *, const VdbeCursor *, int *); 445 int sqlite3VdbeSorterWrite(sqlite3 *, const VdbeCursor *, Mem *); 446 int sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *); 447 448 #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0 449 void sqlite3VdbeEnter(Vdbe*); 450 void sqlite3VdbeLeave(Vdbe*); 451 #else 452 # define sqlite3VdbeEnter(X) 453 # define sqlite3VdbeLeave(X) 454 #endif 455 456 #ifdef SQLITE_DEBUG 457 void sqlite3VdbeMemAboutToChange(Vdbe*,Mem*); 458 #endif 459 460 #ifndef SQLITE_OMIT_FOREIGN_KEY 461 int sqlite3VdbeCheckFk(Vdbe *, int); 462 #else 463 # define sqlite3VdbeCheckFk(p,i) 0 464 #endif 465 466 int sqlite3VdbeMemTranslate(Mem*, u8); 467 #ifdef SQLITE_DEBUG 468 void sqlite3VdbePrintSql(Vdbe*); 469 void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf); 470 #endif 471 int sqlite3VdbeMemHandleBom(Mem *pMem); 472 473 #ifndef SQLITE_OMIT_INCRBLOB 474 int sqlite3VdbeMemExpandBlob(Mem *); 475 #define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0) 476 #else 477 #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK 478 #define ExpandBlob(P) SQLITE_OK 479 #endif 480 481 #endif /* !defined(_VDBEINT_H_) */ 482