Lines Matching refs:Vdbe
11952 ** The maximum number of opcodes in a VDBE program.
12754 ** the VDBE-level file format changes. The following macros define the
13284 ** Defer sourcing vdbe.h and btree.h until after the "u8" and
13285 ** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
13668 /************** Include vdbe.h in the middle of sqliteInt.h ******************/
13669 /************** Begin file vdbe.h ********************************************/
13681 ** Header file for the Virtual DataBase Engine (VDBE)
13684 ** or VDBE. The VDBE implements an abstract machine that runs a
13692 ** A single VDBE is an opaque structure named "Vdbe". Only routines
13696 typedef struct Vdbe Vdbe;
13808 ** The Vdbe.aColName array contains 5n Mem structures, where n is the
13835 ** The makefile scans the vdbe.c source file and creates the "opcodes.h"
13836 ** header file that defines a number for each opcode used by the VDBE.
13838 /************** Include opcodes.h in the middle of vdbe.h ********************/
14014 ** comments following the "case" for each opcode in the vdbe.c
14056 /************** Continuing where we left off in vdbe.h ***********************/
14065 ** Prototypes for the VDBE interface. See comments on the implementation
14068 SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse*);
14069 SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe*,int);
14070 SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int);
14071 SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int);
14072 SQLITE_PRIVATE int sqlite3VdbeGoto(Vdbe*,int);
14073 SQLITE_PRIVATE int sqlite3VdbeLoadString(Vdbe*,int,const char*);
14074 SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe*,int,const char*,...);
14075 SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);
14076 SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);
14077 SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8(Vdbe*,int,int,int,int,const u8*,int);
14078 SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int);
14079 SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe*,int);
14081 SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N);
14082 SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p);
14087 SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp, int iLineno);
14088 SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*);
14089 SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe*, u32 addr, u8);
14090 SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1);
14091 SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2);
14092 SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3);
14093 SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u16 P5);
14094 SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr);
14095 SQLITE_PRIVATE int sqlite3VdbeChangeToNoop(Vdbe*, int addr);
14096 SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe*, u8 op);
14097 SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N);
14098 SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe*, void *pP4, int p4type);
14100 SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe*, int);
14101 SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);
14102 SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe*);
14103 SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*);
14104 SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe*);
14105 SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*);
14106 SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*);
14107 SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*);
14108 SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*);
14109 SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int);
14110 SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*);
14112 SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int);
14114 SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*);
14115 SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe*);
14116 SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*);
14117 SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe*,int);
14118 SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*));
14119 SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*);
14120 SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*);
14121 SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe*);
14122 SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, u8);
14123 SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*);
14124 SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*);
14125 SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8);
14126 SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int);
14128 SQLITE_PRIVATE char *sqlite3VdbeExpandSql(Vdbe*, const char*);
14141 SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
14147 ** each VDBE opcode.
14150 ** comments in VDBE programs that show key decision points in the code
14154 SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe*, const char*, ...);
14156 SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe*, const char*, ...);
14171 ** for VDBE branch instructions. The coverage testing points are line
14172 ** numbers in the sqlite3.c source file. VDBE branch coverage testing
14173 ** only works with an amalagmation build. That's ok since a VDBE branch
14175 ** should ever ship with VDBE branch coverage measuring turned on.
14186 ** Every VDBE branch operation must be tagged with one of the macros above.
14189 ** routine in vdbe.c, alerting the developer to the missed tag.
14192 SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe*,int);
14207 SQLITE_PRIVATE void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*);
14214 /************** End of vdbe.h ************************************************/
15213 struct Vdbe *pVdbe; /* List of active virtual machines */
15386 #define SQLITE_VdbeListing 0x10000000 /* Debug listings of VDBE programs */
15387 #define SQLITE_VdbeTrace 0x20000000 /* True to trace VDBE execution */
15503 #define SQLITE_FUNC_EPHEM 0x0010 /* Ephemeral. Delete with VDBE */
15589 ** opened savepoint. Savepoints are added to the list by the vdbe
15962 ** the OP_MakeRecord opcode of the VDBE and is disassembled by the
16029 ** generate VDBE code (as opposed to parsing one read from an sqlite_master
16032 ** used to store the address of a VDBE instruction, not a database page
16033 ** number (it cannot - the database page is not allocated until the VDBE
16204 ** the integer cursor number of a VDBE cursor pointing to that table and
16482 int iCursor; /* The VDBE cursor number used to access this table */
16597 ** in the VDBE that record the limit and offset counters.
16786 ** A Vdbe sub-program that implements the body and WHEN clause of trigger
16843 Vdbe *pVdbe; /* An engine for executing database bytecode */
16858 int nTab; /* Number of previously allocated VDBE cursors */
16860 int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
16861 int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
16933 Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
17191 /* The following callback (if not NULL) is invoked on every VDBE branch
17669 SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int);
17711 SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*);
17744 SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe*,Table*);
17888 SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe*, Table*, int);
17970 SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
18075 SQLITE_PRIVATE int sqlite3VtabSync(sqlite3 *db, Vdbe*);
18082 SQLITE_PRIVATE void sqlite3VtabImportErrmsg(Vdbe*, sqlite3_vtab*);
18107 SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
18110 SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*);
18240 SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe*);
18605 ** the vdbe.c file.
18646 ** VDBE. This information used to all be at the top of the single
18647 ** source code file "vdbe.c". When that file became too big (over
18688 /* Elements of the linked list at Vdbe.pAuxData */
18691 /* Types of VDBE cursors */
18726 ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of
18729 u32 cacheStatus; /* Cache is valid if this matches Vdbe.cacheCtr */
18775 ** values stored in the Vdbe struct. When the sub-program is finished,
18776 ** these values are copied back to the Vdbe from the VdbeFrame structure,
18783 ** is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame
18789 ** The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is
18794 Vdbe *v; /* VM this frame belongs to */
18799 VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */
18810 int nChange; /* Statement changes (Vdbe.nChange) */
18817 ** Internally, the vdbe manipulates nearly all SQL values as Mem
18923 ** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed
18951 Vdbe *pVdbe; /* The VM that owns this context */
18982 struct Vdbe {
18984 Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
18985 Parse *pParse; /* Parsing context used to create this Vdbe */
19000 /* When allocating a new Vdbe object, all of the fields below should be
19035 void *pFree; /* Free this when deleting the vdbe */
19050 ** The following are allowed values for Vdbe.magic
19052 #define VDBE_MAGIC_INIT 0x16bceaa5 /* Building a VDBE program */
19053 #define VDBE_MAGIC_RUN 0x2df20da3 /* VDBE is ready to execute */
19054 #define VDBE_MAGIC_HALT 0x319c2973 /* VDBE has completed execution */
19056 #define VDBE_MAGIC_DEAD 0x5606c3c8 /* The VDBE has been deallocated */
19063 Vdbe *v;
19081 SQLITE_PRIVATE void sqlite3VdbeError(Vdbe*, const char *, ...);
19082 SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*);
19083 void sqliteVdbePopStack(Vdbe*,int);
19099 SQLITE_PRIVATE int sqlite3VdbeExec(Vdbe*);
19100 SQLITE_PRIVATE int sqlite3VdbeList(Vdbe*);
19101 SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe*);
19135 SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int);
19139 SQLITE_PRIVATE void sqlite3VdbePreUpdateHook(Vdbe*,VdbeCursor*,int,const char*,Table*,i64,int);
19141 SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p);
19153 SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe*);
19159 SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe*);
19165 SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe*,Mem*);
19170 SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int);
19176 SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe*);
19497 struct Vdbe *pVdbe; /* Used to iterate through VMs */
68612 ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the
71204 ** stores a single value in the VDBE. Mem is an opaque structure visible
71205 ** only within the VDBE. Interface routines refer to a Mem using the
72007 SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){
72736 Vdbe *v;
72973 ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.)
72981 SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
72983 Vdbe *p;
72984 p = sqlite3DbMallocRawNN(db, sizeof(Vdbe) );
72986 memset(&p->aOp, 0, sizeof(Vdbe)-offsetof(Vdbe,aOp));
73006 ** Change the error string stored in Vdbe.zErrMsg
73008 SQLITE_PRIVATE void sqlite3VdbeError(Vdbe *p, const char *zFormat, ...){
73019 SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, u8 prepFlags){
73030 ** Swap all content between two VDBE structures.
73032 SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
73033 Vdbe tmp, *pTmp;
73055 ** Resize the Vdbe.aOp array so that it is at least nOp elements larger
73060 ** SQLITE_NOMEM. In this case Vdbe.aOp and Parse.nOpAlloc remain
73062 ** correctly deallocated along with the rest of the Vdbe).
73064 static int growOpArray(Vdbe *v, int nOp){
73082 /* Ensure that the size of a VDBE does not grow too large */
73112 ** VDBE. Return the address of the new instruction.
73116 ** p Pointer to the VDBE
73126 static SQLITE_NOINLINE int growOp3(Vdbe *p, int op, int p1, int p2, int p3){
73132 SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
73177 SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe *p, int op){
73180 SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe *p, int op, int p1){
73183 SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe *p, int op, int p1, int p2){
73189 SQLITE_PRIVATE int sqlite3VdbeGoto(Vdbe *p, int iDest){
73196 SQLITE_PRIVATE int sqlite3VdbeLoadString(Vdbe *p, int iDest, const char *zStr){
73211 SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){
73235 Vdbe *p, /* Add the opcode to this VM */
73253 Vdbe *p, /* Add the opcode to this VM */
73274 SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){
73284 Vdbe *p, /* Add the opcode to this VM */
73302 SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe *v, int regYield){
73319 ** the label is resolved to a specific address, the VDBE will scan
73323 ** The VDBE knows that a P2 value is a label because labels are
73329 SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe *v){
73348 SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){
73360 ** Mark the VDBE as one that can only be run one time.
73362 SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){
73367 ** Mark the VDBE as one that can only be run multiple times.
73369 SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe *p){
73377 ** in a Vdbe main program and each of the sub-programs (triggers) it may
73384 ** sIter.v = v; // v is of type Vdbe*
73393 Vdbe *v; /* Vdbe to iterate through the opcodes of */
73400 Vdbe *v = p->v;
73465 SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
73514 ** (3) Update the Vdbe.readOnly and Vdbe.bIsReader flags to accurately
73525 static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
73628 SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){
73642 SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){
73655 SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p){
73665 ** the Vdbe passed as the first argument. It is the callers responsibility
73671 ** the number of entries in the Vdbe.apArg[] array required to execute the
73674 SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe *p, int *pnOp, int *pnMaxArg){
73695 Vdbe *p, /* Add opcodes to the prepared statement */
73743 Vdbe *p, /* VM to add scanstatus() to */
73770 SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe *p, u32 addr, u8 iNewOpcode){
73773 SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe *p, u32 addr, int val){
73776 SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe *p, u32 addr, int val){
73779 SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, u32 addr, int val){
73782 SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u16 p5){
73791 SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){
73883 ** list at Vdbe.pSubProgram. This list is used to delete all sub-program
73886 SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){
73894 SQLITE_PRIVATE int sqlite3VdbeChangeToNoop(Vdbe *p, int addr){
73910 SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){
73931 ** the Vdbe. In these cases we can just copy the pointer.
73936 Vdbe *p,
73954 Vdbe *p, int addr, const char *zP4, int n){
73997 SQLITE_PRIVATE void sqlite3VdbeAppendP4(Vdbe *p, void *pP4, int n){
74018 Vdbe *v = pParse->pVdbe;
74033 static void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){
74042 SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){
74050 SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){
74065 SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe *v, int iLine){
74083 SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
74113 ** Compute a string for the "comment" field of a VDBE opcode listing.
74115 ** The Synopsis: field in comments in the vdbe.c source file gets converted
74395 ** Declare to the Vdbe that the BTree object at db->aDb[i] is used.
74402 SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){
74433 SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){
74454 static SQLITE_NOINLINE void vdbeLeave(Vdbe *p){
74468 SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe *p){
74492 vdbe.c source text */
74594 Vdbe *p /* The VDBE */
74636 ** to trigger subprograms. The VDBE is guaranteed to have at least 9
74643 nSub = pSub->n/sizeof(Vdbe*);
74783 ** Print the SQL that was used to generate a VDBE program.
74785 SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe *p){
74804 SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe *p){
74874 ** Rewind the VDBE back to the beginning in preparation for
74877 SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
74916 ** After the VDBE has be prepped, it can be executed by one or more
74923 ** the Vdbe from the Parse object that helped generate it so that the
74924 ** the Vdbe becomes an independent entity and the Parse object can be
74931 Vdbe *p, /* The VDBE */
74955 ** use aMem[0] which is not otherwise used by the VDBE program. Allocate
75026 ** Close a VDBE cursor and release all the resources that cursor
75029 SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
75066 static void closeCursorsInFrame(Vdbe *p){
75080 ** Copy the values stored in the VdbeFrame structure to its Vdbe. This
75085 Vdbe *v = pFrame->v;
75108 ** Also release any dynamic memory held by the VM in the Vdbe.aMem memory
75113 static void closeAllCursors(Vdbe *p){
75140 ** execution of the vdbe program so that sqlite3_column_count() can
75143 SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){
75166 ** to by zName will be freed by sqlite3DbFree() when the vdbe is destroyed.
75169 Vdbe *p, /* Vdbe being configured */
75196 static int vdbeCommit(sqlite3 *db, Vdbe *p){
75451 ** matches the number of vdbe's in the list sqlite3.pVdbe that are
75460 Vdbe *p;
75482 ** If the Vdbe passed as the first argument opened a statement-transaction,
75491 static SQLITE_NOINLINE int vdbeCloseStatement(Vdbe *p, int eOp){
75537 SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){
75556 SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *p, int deferred){
75571 ** This routine is called the when a VDBE tries to halt. If the VDBE
75583 SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
75678 /* The auto-commit flag is true, the vdbe program was successful
75781 ** Each VDBE holds the result of the most recent sqlite3_step() call
75784 SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe *p){
75789 ** Copy the error code and error message belonging to the VDBE passed
75793 ** This function does not clear the VDBE error code or message, just
75796 SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){
75818 static void vdbeInvokeSqllog(Vdbe *v){
75835 ** Clean up a VDBE after execution but do not delete the VDBE just yet.
75838 ** After this routine is run, the VDBE should be ready to be executed
75845 SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
75859 /* If the VDBE has be run even partially, then transfer the error code
75860 ** and error message from the VDBE into the main database structure. But
75861 ** if the VDBE has just been set to run but has not actually executed any
75869 /* The expired flag was set on the VDBE before the first call
75879 /* Execute assert() statements to ensure that the Vdbe.apCsr[] and
75880 ** Vdbe.aMem[] arrays have already been cleaned up. */
75890 /* Save profiling information from this VDBE run.
75930 ** Clean up and delete a VDBE after execution. Return an integer which is
75933 SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){
75980 ** Free all memory associated with the Vdbe passed as the second argument,
75984 ** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with
75987 SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
76016 ** Delete an entire VDBE.
76018 SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){
76896 ** the user deletes the collation sequence after the vdbe program is
76959 ** created by the OP_MakeRecord opcode of the VDBE. The pPKey2
77498 ** Set a flag in the vdbe to update the change counter when it is finalised
77501 SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe *v){
77516 Vdbe *p;
77523 ** Return the database associated with the Vdbe.
77525 SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){
77530 ** Return the SQLITE_PREPARE flags for a Vdbe.
77532 SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe *v){
77544 SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){
77566 SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){
77601 ** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored
77604 SQLITE_PRIVATE void sqlite3VtabImportErrmsg(Vdbe *p, sqlite3_vtab *pVtab){
77645 Vdbe *v, /* Vdbe pre-update hook is invoked by */
77719 ** VDBE.
77734 Vdbe *p = (Vdbe*)pStmt;
77740 ** Check on a Vdbe to make sure it has not been finalized. Log
77744 static int vdbeSafety(Vdbe *p){
77752 static int vdbeSafetyNotNull(Vdbe *p){
77766 static SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){
77809 Vdbe *v = (Vdbe*)pStmt;
77834 Vdbe *v = (Vdbe*)pStmt;
77853 Vdbe *p = (Vdbe*)pStmt;
77855 sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;
78256 static int sqlite3Step(Vdbe *p){
78391 Vdbe *v = (Vdbe*)pStmt; /* the prepared statement */
78604 Vdbe *pVdbe = pCtx->pVdbe;
78663 Vdbe *pVm = (Vdbe *)pStmt;
78672 Vdbe *pVm = (Vdbe *)pStmt;
78721 Vdbe *pVm;
78724 pVm = (Vdbe *)pStmt;
78762 Vdbe *p = (Vdbe *)pStmt;
78860 Vdbe *p;
78870 p = (Vdbe *)pStmt;
78998 static int vdbeUnbind(Vdbe *p, int i){
79022 /* If the bit corresponding to this variable in Vdbe.expmask is set, then
79049 Vdbe *p = (Vdbe *)pStmt;
79105 Vdbe *p = (Vdbe *)pStmt;
79118 Vdbe *p = (Vdbe *)pStmt;
79128 Vdbe *p = (Vdbe*)pStmt;
79143 Vdbe *p = (Vdbe*)pStmt;
79222 Vdbe *p = (Vdbe *)pStmt;
79232 Vdbe *p = (Vdbe *)pStmt;
79250 Vdbe *p = (Vdbe*)pStmt;
79261 Vdbe *p = (Vdbe*)pStmt;
79271 SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe *p, const char *zName, int nName){
79276 return sqlite3VdbeParameterIndex((Vdbe*)pStmt, zName, sqlite3Strlen30(zName));
79283 Vdbe *pFrom = (Vdbe*)pFromStmt;
79284 Vdbe *pTo = (Vdbe*)pToStmt;
79310 Vdbe *pFrom = (Vdbe*)pFromStmt;
79311 Vdbe *pTo = (Vdbe*)pToStmt;
79334 return pStmt ? ((Vdbe*)pStmt)->db : 0;
79342 return pStmt ? ((Vdbe*)pStmt)->readOnly : 1;
79349 Vdbe *v = (Vdbe*)pStmt;
79371 pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext;
79381 Vdbe *pVdbe = (Vdbe*)pStmt;
79409 Vdbe *p = (Vdbe *)pStmt;
79429 Vdbe *p = (Vdbe *)pStmt;
79634 Vdbe *p = (Vdbe*)pStmt;
79688 Vdbe *p = (Vdbe*)pStmt;
79710 ** The Vdbe parse-tree explainer is also found here.
79767 Vdbe *p, /* The prepared statement being evaluated */
79891 /************** Begin file vdbe.c ********************************************/
79943 ** each instruction in the VDBE. When it reaches zero, the u1.isInterrupted
79966 ** or MEM_Str that has been used by a VDBE opcode. The test procedures
80012 ** Invoke the VDBE coverage callback, if that callback is defined. This
80022 ** generated the VDBE instruction. This instrumentation assumes that all
80076 Vdbe *p, /* The virtual machine */
80084 ** vdbe memory cell to manage the memory allocation required for a
80088 ** purposes in a vdbe program. The different uses might require
80397 /************** Include hwtime.h in the middle of vdbe.c *********************/
80486 /************** Continuing where we left off in vdbe.c ***********************/
80519 static Mem *out2Prerelease(Vdbe *p, VdbeOp *pOp){
80535 ** Execute as much of a VDBE program as we can.
80539 Vdbe *p /* The VDBE */
80601 printf("VDBE Program Listing:\n");
80609 if( once ) printf("VDBE Query Plan:\n");
80615 if( p->db->flags & SQLITE_VdbeTrace ) printf("VDBE Trace:\n");
80720 ** Documentation about VDBE opcodes is generated by scanning this file
80762 ** of VDBE ops have been executed (either since this invocation of
80908 ** VDBE, but do not rollback the transaction.
82349 VdbeCursor *pC; /* The VDBE cursor */
82389 VdbeCursor *pC; /* The VDBE cursor */
83137 ** If a write-transaction is started and the Vdbe.usesStmtJournal flag is
83138 ** true (this flag is set if the Vdbe may modify more than one row and may
83143 ** VDBE to be rolled back after an error without having to roll back the
83145 ** will automatically commit when the VDBE halts.
84231 ** If P3>0 then P3 is a register in the root frame of this VDBE that holds
84244 VdbeFrame *pFrame; /* Root frame of VDBE */
85832 ** memory required by the sub-vdbe at runtime.
85844 VdbeFrame *pFrame; /* New vdbe frame to execute in */
86610 /* Initialize vdbe cursor object */
87290 /************** End of vdbe.c ************************************************/
87348 Vdbe *v = (Vdbe *)p->pStmt;
87538 /* This VDBE program seeks a btree cursor to the identified
87539 ** db/table/row entry. The reason for using a vdbe program instead
87541 ** vdbe program will take advantage of the various transaction,
87542 ** locking and error handling infrastructure built into the vdbe.
87544 ** After seeking the cursor, the vdbe executes an OP_ResultRow.
87545 ** Code external to the Vdbe then "borrows" the b-tree cursor and
87549 ** The sqlite3_blob_close() function finalizes the vdbe program,
87563 Vdbe *v = (Vdbe *)pBlob->pStmt;
87601 ** we can invoke OP_Column to fill in the vdbe cursors type
87628 if( pBlob && pBlob->pStmt ) sqlite3VdbeFinalize((Vdbe *)pBlob->pStmt);
87672 Vdbe *v;
87678 v = (Vdbe*)p->pStmt;
87912 ** incrementally as keys are retreived from the sorter by the VDBE. The
88111 ** sorter cursor created by the VDBE.
90021 ** main VDBE thread. But that is Ok, as that thread cannot return
90022 ** control to the VDBE or proceed with anything useful until the
90207 VdbeSorter *pSorter, /* The VDBE cursor that implements the sort */
90376 ** sort the VdbeSorter.pRecord list. The vdbe layer will read data directly
92547 ** Expr.iTable The VDBE cursor number for X.Y
92700 ** for generating VDBE code that evaluates expressions in SQLite.
93235 Vdbe *v = pParse->pVdbe;
94814 static void sqlite3SetHasNullFlag(Vdbe *v, int iCur, int regHasNull){
94935 Vdbe *v = sqlite3GetVdbe(pParse); /* Virtual machine being coded */
95244 Vdbe *v = sqlite3GetVdbe(pParse);
95534 Vdbe *v; /* Statement under construction */
95765 static void codeReal(Vdbe *v, const char *z, int negateFlag, int iMem){
95784 Vdbe *v = pParse->pVdbe;
95983 Vdbe *v, /* The VDBE under construction */
96028 Vdbe *v = pParse->pVdbe;
96168 ** Generate code into the current Vdbe to evaluate the given
96179 Vdbe *v = pParse->pVdbe; /* The VM under construction */
96841 Expr *pExpr, /* The expression to code when the VDBE initializes */
96879 ** VDBE program, in order to factor it out of the evaluation loop.
96962 Vdbe *v = pParse->pVdbe;
97003 Vdbe *v = pParse->pVdbe;
97124 ** operation. Special comments in vdbe.c and the mkopcodeh.awk script in
97129 Vdbe *v = pParse->pVdbe;
97136 if( NEVER(v==0) ) return; /* Existence of VDBE checked by caller */
97252 Vdbe *v = pParse->pVdbe;
97259 if( NEVER(v==0) ) return; /* Existence of VDBE checked by caller */
97415 ** or NULL value - then the VDBE currently being prepared is configured
98031 ** This file contains C code routines that used to generate VDBE code
98348 Vdbe *v;
98420 Vdbe *v;
98622 Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */
98753 Vdbe *v;
99028 Vdbe *v = sqlite3GetVdbe(pParse);
99789 static void callStatGet(Vdbe *v, int regStat4, int iParam, int regOut){
99819 Vdbe *v; /* The virtual machine being built up */
100155 Vdbe *v = sqlite3GetVdbe(pParse);
100230 Vdbe *v;
101072 ** This procedure generates VDBE code for a single invocation of either the
101086 Vdbe *v;
101711 Vdbe *pVdbe;
101714 assert( pVdbe!=0 ); /* sqlite3GetVdbe cannot fail: VDBE already allocated */
101742 ** parsed and a VDBE program to execute that statement has been
101744 ** VDBE program and resets the pParse structure for the next
101748 ** no VDBE code was generated.
101752 Vdbe *v;
101763 ** vdbe program
101843 /* Get the VDBE program ready for execution
102320 Vdbe *v = sqlite3GetVdbe(p);
102475 Vdbe *v;
103100 Vdbe *v = pParse->pVdbe;
103291 ** internal schema data structures and the generated VDBE code so that they
103318 Vdbe *v = pParse->pVdbe;
103382 ** table entry. This is only required if currently generating VDBE
103532 Vdbe *v;
103912 ** This function is called by the VDBE to adjust the internal schema
103960 Vdbe *v = sqlite3GetVdbe(pParse);
103983 ** Write VDBE code to erase table pTab and all associated indices on disk.
104061 Vdbe *v;
104133 Vdbe *v;
104398 Vdbe *v; /* Generate code into this virtual machine */
104966 Vdbe *v;
104980 ** the Noop with a Goto to jump over the VDBE code generated below. */
105108 Vdbe *v;
105566 ** Generate VDBE code for a BEGIN statement.
105570 Vdbe *v;
105591 ** Generate VDBE code for a COMMIT or ROLLBACK statement.
105596 Vdbe *v;
105620 Vdbe *v = sqlite3GetVdbe(pParse);
105669 ** will occur at the end of the top-level VDBE and will be generated
105703 ** Generate VDBE code that prepares for doing an operation that
105756 ** Code an OP_Halt that causes the vdbe to return an SQLITE_CONSTRAINT
105768 Vdbe *v = sqlite3GetVdbe(pParse);
106795 Vdbe *v; /* The virtual database engine */
106801 int iDataCur = 0; /* VDBE cursor for the canonical data source */
107187 ** This routine generates VDBE code that causes a single row of a
107240 Vdbe *v = pParse->pVdbe; /* Vdbe */
107245 /* Vdbe is guaranteed to have been allocated by this stage. */
107361 ** This routine generates VDBE code that causes the deletion of all
107391 Vdbe *v; /* The prepared statement under construction */
107452 Vdbe *v = pParse->pVdbe;
107980 ** as VDBE code so that unused argument values do not have to be computed.
109502 ** object (struct Vdbe). If, after the statement has run, its immediate
109521 ** row are required by the FK processing VDBE code (i.e. if FKs were
109540 ** VDBE Calling Convention
109712 ** Each time it is called, this function generates VDBE code to locate the
109743 Vdbe *v = sqlite3GetVdbe(pParse); /* Vdbe to add code to */
109967 Vdbe *v = sqlite3GetVdbe(pParse);
110046 /* Create VDBE to loop through the entries in pSrc that match the WHERE
110122 Vdbe *v = sqlite3GetVdbe(pParse);
110124 assert( v ); /* VDBE has already been allocated */
110128 ** generating any VDBE code. If one can be found, then jump over
110145 ** violations, halt the VDBE and return an error at this point, before
110250 ** table pTab to generate VDBE code to perform foreign key constraint
110329 Vdbe *v = sqlite3GetVdbe(pParse);
110864 Parse *pParse, /* Generate code into this VDBE */
110870 Vdbe *v;
110967 SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){
110998 ** have been opened at any point in the VDBE program. This is used to see if
111003 Vdbe *v = sqlite3GetVdbe(p);
111098 Vdbe *v = pParse->pVdbe; /* VDBE under construction */
111163 Vdbe *v = pParse->pVdbe;
111325 Vdbe *v; /* Generate code into this virtual machine */
111329 int iDataCur = 0; /* VDBE cursor that is the main data repository */
111421 /* Allocate a VDBE
112074 Vdbe *v; /* VDBE under constrution */
112262 ** also invoke MultiWrite() to indicate that this VDBE may require
112519 SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe *v, Table *pTab){
112554 Vdbe *v; /* Prepared statements under construction */
112659 Vdbe *v;
112802 Vdbe *v; /* The VDBE we are building */
113204 sqlite3VdbeFinalize((Vdbe *)pStmt);
113212 rc = sqlite3VdbeFinalize((Vdbe *)pStmt);
113225 if( pStmt ) sqlite3VdbeFinalize((Vdbe *)pStmt);
115462 Vdbe *v, /* The query under construction */
115480 static void returnSingleInt(Vdbe *v, i64 value){
115489 Vdbe *v, /* Prepared statement under construction */
115598 static int integrityCheckResultRow(Vdbe *v){
115638 Vdbe *v = sqlite3GetVdbe(pParse); /* Prepared statement */
116756 ** the VDBE created below.
116760 ** to -1 here, to indicate that the VDBE should verify the integrity
116766 /* Initialize the VDBE program */
117826 ** This routine is also called from the OP_ParseSchema opcode of the VDBE.
117855 ** But because db->init.busy is set to 1, no VDBE code is generated
118293 Vdbe *pReprepare, /* VM being reprepared */
118449 Vdbe *pOld, /* VM being reprepared */
118488 SQLITE_PRIVATE int sqlite3Reprepare(Vdbe *p){
118511 sqlite3VdbeSwap((Vdbe*)pNew, p);
118513 sqlite3VdbeResetStepResult((Vdbe*)pNew);
118514 sqlite3VdbeFinalize((Vdbe*)pNew);
119194 Vdbe *v = pParse->pVdbe; /* Stmt under construction */
119307 Vdbe *v, /* Generate code into this VM */
119333 Vdbe *v;
119364 Vdbe *v = pParse->pVdbe;
119829 Vdbe *v = pParse->pVdbe;
119874 Vdbe *v = pParse->pVdbe;
119900 Vdbe *v = pParse->pVdbe; /* The prepared statement */
120191 ** Generate code that will tell the VDBE the declaration types of columns
120200 Vdbe *v = pParse->pVdbe;
120215 /* The vdbe must make its own copy of the column-type and other
120265 Vdbe *v = pParse->pVdbe;
120540 ** Get a VDBE for the given parser context. Create a new one if necessary.
120543 SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse *pParse){
120580 Vdbe *v = 0;
120694 ** This routine generates VDBE code to compute the content of a WITH RECURSIVE
120736 Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */
120951 Vdbe *v; /* Generate code to this VDBE */
120976 assert( v!=0 ); /* The VDBE already created by calling function */
121319 Vdbe *v = pParse->pVdbe;
121525 Vdbe *v; /* Generate code to this VDBE */
121566 assert( v!=0 ); /* Already thrown the error if VDBE alloc failed */
121847 ** FROM clause of a SELECT such that the VDBE cursor assigned to that
122107 int iParent; /* VDBE cursor number of the pSub result set temp table */
122981 ** (1) Make sure VDBE cursor numbers have been assigned to every
123407 ** * VDBE Cursor numbers are assigned to all FROM-clause terms.
123439 Vdbe *v = pParse->pVdbe;
123480 Vdbe *v = pParse->pVdbe;
123496 Vdbe *v = pParse->pVdbe;
123574 ** Add a single OP_Explain instruction to the VDBE to explain a simple
123800 Vdbe *v; /* The virtual machine under construction */
123866 /* Get a pointer the VDBE under construction, allocating a new VDBE if one
125240 Vdbe *v;
125500 Vdbe *v;
125641 ** Generate VDBE code for the statements inside the body of a single
125650 Vdbe *v = pParse->pVdbe;
125726 ** This function is used to add VdbeComment() annotations to a VDBE
125743 ** Parse context structure pFrom has just been used to create a sub-vdbe
125773 Vdbe *v; /* Temporary VM */
125774 NameContext sNC; /* Name context for sub-vdbe */
125775 SubProgram *pProgram = 0; /* Sub-vdbe for trigger program */
125776 Parse *pSubParse; /* Parse context for sub-vdbe */
125829 ** (or NULL) the sub-vdbe is immediately halted by jumping to the
125842 /* Code the trigger program into the sub-vdbe. */
125920 Vdbe *v = sqlite3GetVdbe(pParse); /* Main VM */
125925 /* Code the OP_Program opcode in the parent VDBE. P4 of the OP_Program
125926 ** is a pointer to the sub-vdbe containing the trigger program. */
126139 SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){
126178 int addrTop = 0; /* VDBE instruction address of the start of the loop */
126180 Vdbe *v; /* The virtual database engine */
126873 Vdbe *v = pParse->pVdbe; /* Virtual machine under construction */
127085 Vdbe *v = sqlite3GetVdbe(pParse);
127112 ** This routine implements the OP_Vacuum opcode of the VDBE.
127765 Vdbe *v;
128049 ** This function is invoked by the vdbe to call the xCreate method
128176 ** This function is invoked by the vdbe to call the xDestroy method
128248 SQLITE_PRIVATE int sqlite3VtabSync(sqlite3 *db, Vdbe *p){
128617 ** This module contains C code that generates VDBE code used to process
128691 int iTabCur; /* The VDBE cursor used to access the table */
128692 int iIdxCur; /* The VDBE cursor used to access pIdx */
128710 int iCur; /* The VDBE cursor used by this IN operator */
128863 ** bits that will fit in a Bitmask. The VDBE cursor numbers might be
128979 ** between VDBE cursor numbers and bits of the bitmasks in WhereTerm.
128981 ** The VDBE cursor numbers are small integers contained in
128990 ** corresponds VDBE cursor number B. The A-th bit of a bitmask is 1<<A.
128992 ** For example, if the WHERE clause expression used these VDBE
129106 Vdbe *v, /* Vdbe to add scanstatus entry to */
129303 Vdbe *v = pParse->pVdbe; /* VM being constructed */
129402 Vdbe *v, /* Vdbe to add scanstatus entry to */
129496 Vdbe *v = pParse->pVdbe;
129668 Vdbe *v = pParse->pVdbe;
129833 Vdbe *v = pParse->pVdbe; /* The vm under construction */
129945 Vdbe *v, /* prepared statement under construction */
130049 Vdbe *v = pWalker->pParse->pVdbe;
130085 Vdbe *v = pParse->pVdbe;
130206 Vdbe *v = pParse->pVdbe; /* Vdbe to generate code within */
130243 Vdbe *v = pParse->pVdbe;
130335 int iCur; /* The VDBE cursor for the table */
130345 Vdbe *v; /* The prepared stmt under constructions */
130679 int iIdxCur; /* The VDBE cursor for the index */
131388 ** This module contains C code that generates VDBE code used to process
131596 Vdbe *pReprepare = pParse->pReprepare;
131662 Vdbe *v = pParse->pVdbe;
132920 ** This module contains C code that generates VDBE code used to process
132990 ** Return the VDBE address or label to jump to in order to continue
132999 ** Return the VDBE address or label to jump to in order to break
133433 ** This routine runs over generated VDBE code and translates OP_Column
133449 Vdbe *v = pParse->pVdbe;
133570 Vdbe *v; /* Prepared statement under construction */
137322 ** And so forth. This routine generates code to open those VDBE cursors
137389 Vdbe *v = pParse->pVdbe; /* The virtual database engine */
137916 Vdbe *v = pParse->pVdbe;
138049 /* If this scan uses an index, make VDBE code substitutions to read data
147223 ** Set the VDBE coverage callback function to xCallback with context
155194 ** be tested by the VDBE layer. The test will always be false (since
168867 ** require the VDBE to evaluate the MATCH constraint, which is not currently