0000: 2f 2a 0a 2a 2a 20 32 30 30 31 20 53 65 70 74 65 /*.** 2001 Septe
0010: 6d 62 65 72 20 31 35 0a 2a 2a 0a 2a 2a 20 54 68 mber 15.**.** Th
0020: 65 20 61 75 74 68 6f 72 20 64 69 73 63 6c 61 69 e author disclai
0030: 6d 73 20 63 6f 70 79 72 69 67 68 74 20 74 6f 20 ms copyright to
0040: 74 68 69 73 20 73 6f 75 72 63 65 20 63 6f 64 65 this source code
0050: 2e 20 20 49 6e 20 70 6c 61 63 65 20 6f 66 0a 2a . In place of.*
0060: 2a 20 61 20 6c 65 67 61 6c 20 6e 6f 74 69 63 65 * a legal notice
0070: 2c 20 68 65 72 65 20 69 73 20 61 20 62 6c 65 73 , here is a bles
0080: 73 69 6e 67 3a 0a 2a 2a 0a 2a 2a 20 20 20 20 4d sing:.**.** M
0090: 61 79 20 79 6f 75 20 64 6f 20 67 6f 6f 64 20 61 ay you do good a
00a0: 6e 64 20 6e 6f 74 20 65 76 69 6c 2e 0a 2a 2a 20 nd not evil..**
00b0: 20 20 20 4d 61 79 20 79 6f 75 20 66 69 6e 64 20 May you find
00c0: 66 6f 72 67 69 76 65 6e 65 73 73 20 66 6f 72 20 forgiveness for
00d0: 79 6f 75 72 73 65 6c 66 20 61 6e 64 20 66 6f 72 yourself and for
00e0: 67 69 76 65 20 6f 74 68 65 72 73 2e 0a 2a 2a 20 give others..**
00f0: 20 20 20 4d 61 79 20 79 6f 75 20 73 68 61 72 65 May you share
0100: 20 66 72 65 65 6c 79 2c 20 6e 65 76 65 72 20 74 freely, never t
0110: 61 6b 69 6e 67 20 6d 6f 72 65 20 74 68 61 6e 20 aking more than
0120: 79 6f 75 20 67 69 76 65 2e 0a 2a 2a 0a 2a 2a 2a you give..**.***
0130: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0140: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0150: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0160: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0170: 2a 2a 2a 2a 2a 2a 0a 2a 2a 20 48 65 61 64 65 72 ******.** Header
0180: 20 66 69 6c 65 20 66 6f 72 20 74 68 65 20 56 69 file for the Vi
0190: 72 74 75 61 6c 20 44 61 74 61 42 61 73 65 20 45 rtual DataBase E
01a0: 6e 67 69 6e 65 20 28 56 44 42 45 29 0a 2a 2a 0a ngine (VDBE).**.
01b0: 2a 2a 20 54 68 69 73 20 68 65 61 64 65 72 20 64 ** This header d
01c0: 65 66 69 6e 65 73 20 74 68 65 20 69 6e 74 65 72 efines the inter
01d0: 66 61 63 65 20 74 6f 20 74 68 65 20 76 69 72 74 face to the virt
01e0: 75 61 6c 20 64 61 74 61 62 61 73 65 20 65 6e 67 ual database eng
01f0: 69 6e 65 0a 2a 2a 20 6f 72 20 56 44 42 45 2e 20 ine.** or VDBE.
0200: 20 54 68 65 20 56 44 42 45 20 69 6d 70 6c 65 6d The VDBE implem
0210: 65 6e 74 73 20 61 6e 20 61 62 73 74 72 61 63 74 ents an abstract
0220: 20 6d 61 63 68 69 6e 65 20 74 68 61 74 20 72 75 machine that ru
0230: 6e 73 20 61 0a 2a 2a 20 73 69 6d 70 6c 65 20 70 ns a.** simple p
0240: 72 6f 67 72 61 6d 20 74 6f 20 61 63 63 65 73 73 rogram to access
0250: 20 61 6e 64 20 6d 6f 64 69 66 79 20 74 68 65 20 and modify the
0260: 75 6e 64 65 72 6c 79 69 6e 67 20 64 61 74 61 62 underlying datab
0270: 61 73 65 2e 0a 2a 2f 0a 23 69 66 6e 64 65 66 20 ase..*/.#ifndef
0280: 5f 53 51 4c 49 54 45 5f 56 44 42 45 5f 48 5f 0a _SQLITE_VDBE_H_.
0290: 23 64 65 66 69 6e 65 20 5f 53 51 4c 49 54 45 5f #define _SQLITE_
02a0: 56 44 42 45 5f 48 5f 0a 23 69 6e 63 6c 75 64 65 VDBE_H_.#include
02b0: 20 3c 73 74 64 69 6f 2e 68 3e 0a 0a 2f 2a 0a 2a <stdio.h>../*.*
02c0: 2a 20 41 20 73 69 6e 67 6c 65 20 56 44 42 45 20 * A single VDBE
02d0: 69 73 20 61 6e 20 6f 70 61 71 75 65 20 73 74 72 is an opaque str
02e0: 75 63 74 75 72 65 20 6e 61 6d 65 64 20 22 56 64 ucture named "Vd
02f0: 62 65 22 2e 20 20 4f 6e 6c 79 20 72 6f 75 74 69 be". Only routi
0300: 6e 65 73 0a 2a 2a 20 69 6e 20 74 68 65 20 73 6f nes.** in the so
0310: 75 72 63 65 20 66 69 6c 65 20 73 71 6c 69 74 65 urce file sqlite
0320: 56 64 62 65 2e 63 20 61 72 65 20 61 6c 6c 6f 77 Vdbe.c are allow
0330: 65 64 20 74 6f 20 73 65 65 20 74 68 65 20 69 6e ed to see the in
0340: 73 69 64 65 73 0a 2a 2a 20 6f 66 20 74 68 69 73 sides.** of this
0350: 20 73 74 72 75 63 74 75 72 65 2e 0a 2a 2f 0a 74 structure..*/.t
0360: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 56 64 ypedef struct Vd
0370: 62 65 20 56 64 62 65 3b 0a 0a 2f 2a 0a 2a 2a 20 be Vdbe;../*.**
0380: 54 68 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 The names of the
0390: 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 79 70 65 73 following types
03a0: 20 64 65 63 6c 61 72 65 64 20 69 6e 20 76 64 62 declared in vdb
03b0: 65 49 6e 74 2e 68 20 61 72 65 20 72 65 71 75 69 eInt.h are requi
03c0: 72 65 64 0a 2a 2a 20 66 6f 72 20 74 68 65 20 56 red.** for the V
03d0: 64 62 65 4f 70 20 64 65 66 69 6e 69 74 69 6f 6e dbeOp definition
03e0: 2e 0a 2a 2f 0a 74 79 70 65 64 65 66 20 73 74 72 ..*/.typedef str
03f0: 75 63 74 20 56 64 62 65 46 75 6e 63 20 56 64 62 uct VdbeFunc Vdb
0400: 65 46 75 6e 63 3b 0a 74 79 70 65 64 65 66 20 73 eFunc;.typedef s
0410: 74 72 75 63 74 20 4d 65 6d 20 4d 65 6d 3b 0a 74 truct Mem Mem;.t
0420: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 53 75 ypedef struct Su
0430: 62 50 72 6f 67 72 61 6d 20 53 75 62 50 72 6f 67 bProgram SubProg
0440: 72 61 6d 3b 0a 0a 2f 2a 0a 2a 2a 20 41 20 73 69 ram;../*.** A si
0450: 6e 67 6c 65 20 69 6e 73 74 72 75 63 74 69 6f 6e ngle instruction
0460: 20 6f 66 20 74 68 65 20 76 69 72 74 75 61 6c 20 of the virtual
0470: 6d 61 63 68 69 6e 65 20 68 61 73 20 61 6e 20 6f machine has an o
0480: 70 63 6f 64 65 0a 2a 2a 20 61 6e 64 20 61 73 20 pcode.** and as
0490: 6d 61 6e 79 20 61 73 20 74 68 72 65 65 20 6f 70 many as three op
04a0: 65 72 61 6e 64 73 2e 20 20 54 68 65 20 69 6e 73 erands. The ins
04b0: 74 72 75 63 74 69 6f 6e 20 69 73 20 72 65 63 6f truction is reco
04c0: 72 64 65 64 0a 2a 2a 20 61 73 20 61 6e 20 69 6e rded.** as an in
04d0: 73 74 61 6e 63 65 20 6f 66 20 74 68 65 20 66 6f stance of the fo
04e0: 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72 llowing structur
04f0: 65 3a 0a 2a 2f 0a 73 74 72 75 63 74 20 56 64 62 e:.*/.struct Vdb
0500: 65 4f 70 20 7b 0a 20 20 75 38 20 6f 70 63 6f 64 eOp {. u8 opcod
0510: 65 3b 20 20 20 20 20 20 20 20 20 20 2f 2a 20 57 e; /* W
0520: 68 61 74 20 6f 70 65 72 61 74 69 6f 6e 20 74 6f hat operation to
0530: 20 70 65 72 66 6f 72 6d 20 2a 2f 0a 20 20 73 69 perform */. si
0540: 67 6e 65 64 20 63 68 61 72 20 70 34 74 79 70 65 gned char p4type
0550: 3b 20 2f 2a 20 4f 6e 65 20 6f 66 20 74 68 65 20 ; /* One of the
0560: 50 34 5f 78 78 78 20 63 6f 6e 73 74 61 6e 74 73 P4_xxx constants
0570: 20 66 6f 72 20 70 34 20 2a 2f 0a 20 20 75 38 20 for p4 */. u8
0580: 6f 70 66 6c 61 67 73 3b 20 20 20 20 20 20 20 20 opflags;
0590: 20 2f 2a 20 4d 61 73 6b 20 6f 66 20 74 68 65 20 /* Mask of the
05a0: 4f 50 46 4c 47 5f 2a 20 66 6c 61 67 73 20 69 6e OPFLG_* flags in
05b0: 20 6f 70 63 6f 64 65 73 2e 68 20 2a 2f 0a 20 20 opcodes.h */.
05c0: 75 38 20 70 35 3b 20 20 20 20 20 20 20 20 20 20 u8 p5;
05d0: 20 20 20 20 2f 2a 20 46 69 66 74 68 20 70 61 72 /* Fifth par
05e0: 61 6d 65 74 65 72 20 69 73 20 61 6e 20 75 6e 73 ameter is an uns
05f0: 69 67 6e 65 64 20 63 68 61 72 61 63 74 65 72 20 igned character
0600: 2a 2f 0a 20 20 69 6e 74 20 70 31 3b 20 20 20 20 */. int p1;
0610: 20 20 20 20 20 20 20 20 20 2f 2a 20 46 69 72 73 /* Firs
0620: 74 20 6f 70 65 72 61 6e 64 20 2a 2f 0a 20 20 69 t operand */. i
0630: 6e 74 20 70 32 3b 20 20 20 20 20 20 20 20 20 20 nt p2;
0640: 20 20 20 2f 2a 20 53 65 63 6f 6e 64 20 70 61 72 /* Second par
0650: 61 6d 65 74 65 72 20 28 6f 66 74 65 6e 20 74 68 ameter (often th
0660: 65 20 6a 75 6d 70 20 64 65 73 74 69 6e 61 74 69 e jump destinati
0670: 6f 6e 29 20 2a 2f 0a 20 20 69 6e 74 20 70 33 3b on) */. int p3;
0680: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 /*
0690: 54 68 65 20 74 68 69 72 64 20 70 61 72 61 6d 65 The third parame
06a0: 74 65 72 20 2a 2f 0a 20 20 75 6e 69 6f 6e 20 7b ter */. union {
06b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 /*
06c0: 66 6f 75 72 74 68 20 70 61 72 61 6d 65 74 65 72 fourth parameter
06d0: 20 2a 2f 0a 20 20 20 20 69 6e 74 20 69 3b 20 20 */. int i;
06e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f /
06f0: 2a 20 49 6e 74 65 67 65 72 20 76 61 6c 75 65 20 * Integer value
0700: 69 66 20 70 34 74 79 70 65 3d 3d 50 34 5f 49 4e if p4type==P4_IN
0710: 54 33 32 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20 T32 */. void
0720: 2a 70 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 *p;
0730: 20 20 2f 2a 20 47 65 6e 65 72 69 63 20 70 6f 69 /* Generic poi
0740: 6e 74 65 72 20 2a 2f 0a 20 20 20 20 63 68 61 72 nter */. char
0750: 20 2a 7a 3b 20 20 20 20 20 20 20 20 20 20 20 20 *z;
0760: 20 20 20 2f 2a 20 50 6f 69 6e 74 65 72 20 74 6f /* Pointer to
0770: 20 64 61 74 61 20 66 6f 72 20 73 74 72 69 6e 67 data for string
0780: 20 28 63 68 61 72 20 61 72 72 61 79 29 20 74 79 (char array) ty
0790: 70 65 73 20 2a 2f 0a 20 20 20 20 69 36 34 20 2a pes */. i64 *
07a0: 70 49 36 34 3b 20 20 20 20 20 20 20 20 20 20 20 pI64;
07b0: 20 20 2f 2a 20 55 73 65 64 20 77 68 65 6e 20 70 /* Used when p
07c0: 34 74 79 70 65 20 69 73 20 50 34 5f 49 4e 54 36 4type is P4_INT6
07d0: 34 20 2a 2f 0a 20 20 20 20 64 6f 75 62 6c 65 20 4 */. double
07e0: 2a 70 52 65 61 6c 3b 20 20 20 20 20 20 20 20 20 *pReal;
07f0: 2f 2a 20 55 73 65 64 20 77 68 65 6e 20 70 34 74 /* Used when p4t
0800: 79 70 65 20 69 73 20 50 34 5f 52 45 41 4c 20 2a ype is P4_REAL *
0810: 2f 0a 20 20 20 20 46 75 6e 63 44 65 66 20 2a 70 /. FuncDef *p
0820: 46 75 6e 63 3b 20 20 20 20 20 20 20 20 2f 2a 20 Func; /*
0830: 55 73 65 64 20 77 68 65 6e 20 70 34 74 79 70 65 Used when p4type
0840: 20 69 73 20 50 34 5f 46 55 4e 43 44 45 46 20 2a is P4_FUNCDEF *
0850: 2f 0a 20 20 20 20 56 64 62 65 46 75 6e 63 20 2a /. VdbeFunc *
0860: 70 56 64 62 65 46 75 6e 63 3b 20 20 20 2f 2a 20 pVdbeFunc; /*
0870: 55 73 65 64 20 77 68 65 6e 20 70 34 74 79 70 65 Used when p4type
0880: 20 69 73 20 50 34 5f 56 44 42 45 46 55 4e 43 20 is P4_VDBEFUNC
0890: 2a 2f 0a 20 20 20 20 43 6f 6c 6c 53 65 71 20 2a */. CollSeq *
08a0: 70 43 6f 6c 6c 3b 20 20 20 20 20 20 20 20 2f 2a pColl; /*
08b0: 20 55 73 65 64 20 77 68 65 6e 20 70 34 74 79 70 Used when p4typ
08c0: 65 20 69 73 20 50 34 5f 43 4f 4c 4c 53 45 51 20 e is P4_COLLSEQ
08d0: 2a 2f 0a 20 20 20 20 4d 65 6d 20 2a 70 4d 65 6d */. Mem *pMem
08e0: 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a ; /*
08f0: 20 55 73 65 64 20 77 68 65 6e 20 70 34 74 79 70 Used when p4typ
0900: 65 20 69 73 20 50 34 5f 4d 45 4d 20 2a 2f 0a 20 e is P4_MEM */.
0910: 20 20 20 56 54 61 62 6c 65 20 2a 70 56 74 61 62 VTable *pVtab
0920: 3b 20 20 20 20 20 20 20 20 20 2f 2a 20 55 73 65 ; /* Use
0930: 64 20 77 68 65 6e 20 70 34 74 79 70 65 20 69 73 d when p4type is
0940: 20 50 34 5f 56 54 41 42 20 2a 2f 0a 20 20 20 20 P4_VTAB */.
0950: 4b 65 79 49 6e 66 6f 20 2a 70 4b 65 79 49 6e 66 KeyInfo *pKeyInf
0960: 6f 3b 20 20 20 20 20 2f 2a 20 55 73 65 64 20 77 o; /* Used w
0970: 68 65 6e 20 70 34 74 79 70 65 20 69 73 20 50 34 hen p4type is P4
0980: 5f 4b 45 59 49 4e 46 4f 20 2a 2f 0a 20 20 20 20 _KEYINFO */.
0990: 69 6e 74 20 2a 61 69 3b 20 20 20 20 20 20 20 20 int *ai;
09a0: 20 20 20 20 20 20 20 2f 2a 20 55 73 65 64 20 77 /* Used w
09b0: 68 65 6e 20 70 34 74 79 70 65 20 69 73 20 50 34 hen p4type is P4
09c0: 5f 49 4e 54 41 52 52 41 59 20 2a 2f 0a 20 20 20 _INTARRAY */.
09d0: 20 53 75 62 50 72 6f 67 72 61 6d 20 2a 70 50 72 SubProgram *pPr
09e0: 6f 67 72 61 6d 3b 20 20 2f 2a 20 55 73 65 64 20 ogram; /* Used
09f0: 77 68 65 6e 20 70 34 74 79 70 65 20 69 73 20 50 when p4type is P
0a00: 34 5f 53 55 42 50 52 4f 47 52 41 4d 20 2a 2f 0a 4_SUBPROGRAM */.
0a10: 20 20 20 20 54 61 62 6c 65 20 2a 70 54 61 62 3b Table *pTab;
0a20: 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 55 73 /* Us
0a30: 65 64 20 77 68 65 6e 20 70 34 74 79 70 65 20 69 ed when p4type i
0a40: 73 20 50 34 5f 54 41 42 4c 45 20 2a 2f 0a 20 20 s P4_TABLE */.
0a50: 7d 20 70 34 3b 0a 23 69 66 64 65 66 20 53 51 4c } p4;.#ifdef SQL
0a60: 49 54 45 5f 44 45 42 55 47 0a 20 20 63 68 61 72 ITE_DEBUG. char
0a70: 20 2a 7a 43 6f 6d 6d 65 6e 74 3b 20 20 20 20 20 *zComment;
0a80: 20 20 20 20 20 2f 2a 20 43 6f 6d 6d 65 6e 74 20 /* Comment
0a90: 74 6f 20 69 6d 70 72 6f 76 65 20 72 65 61 64 61 to improve reada
0aa0: 62 69 6c 69 74 79 20 2a 2f 0a 23 65 6e 64 69 66 bility */.#endif
0ab0: 0a 23 69 66 64 65 66 20 56 44 42 45 5f 50 52 4f .#ifdef VDBE_PRO
0ac0: 46 49 4c 45 0a 20 20 69 6e 74 20 63 6e 74 3b 20 FILE. int cnt;
0ad0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0ae0: 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 20 74 69 6d /* Number of tim
0af0: 65 73 20 74 68 69 73 20 69 6e 73 74 72 75 63 74 es this instruct
0b00: 69 6f 6e 20 77 61 73 20 65 78 65 63 75 74 65 64 ion was executed
0b10: 20 2a 2f 0a 20 20 75 36 34 20 63 79 63 6c 65 73 */. u64 cycles
0b20: 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f ; /
0b30: 2a 20 54 6f 74 61 6c 20 74 69 6d 65 20 73 70 65 * Total time spe
0b40: 6e 74 20 65 78 65 63 75 74 69 6e 67 20 74 68 69 nt executing thi
0b50: 73 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 2a 2f s instruction */
0b60: 0a 23 65 6e 64 69 66 0a 7d 3b 0a 74 79 70 65 64 .#endif.};.typed
0b70: 65 66 20 73 74 72 75 63 74 20 56 64 62 65 4f 70 ef struct VdbeOp
0b80: 20 56 64 62 65 4f 70 3b 0a 0a 0a 2f 2a 0a 2a 2a VdbeOp;.../*.**
0b90: 20 41 20 73 75 62 2d 72 6f 75 74 69 6e 65 20 75 A sub-routine u
0ba0: 73 65 64 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 sed to implement
0bb0: 20 61 20 74 72 69 67 67 65 72 20 70 72 6f 67 72 a trigger progr
0bc0: 61 6d 2e 0a 2a 2f 0a 73 74 72 75 63 74 20 53 75 am..*/.struct Su
0bd0: 62 50 72 6f 67 72 61 6d 20 7b 0a 20 20 56 64 62 bProgram {. Vdb
0be0: 65 4f 70 20 2a 61 4f 70 3b 20 20 20 20 20 20 20 eOp *aOp;
0bf0: 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 41 72 /* Ar
0c00: 72 61 79 20 6f 66 20 6f 70 63 6f 64 65 73 20 66 ray of opcodes f
0c10: 6f 72 20 73 75 62 2d 70 72 6f 67 72 61 6d 20 2a or sub-program *
0c20: 2f 0a 20 20 69 6e 74 20 6e 4f 70 3b 20 20 20 20 /. int nOp;
0c30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0c40: 20 20 2f 2a 20 45 6c 65 6d 65 6e 74 73 20 69 6e /* Elements in
0c50: 20 61 4f 70 5b 5d 20 2a 2f 0a 20 20 69 6e 74 20 aOp[] */. int
0c60: 6e 4d 65 6d 3b 20 20 20 20 20 20 20 20 20 20 20 nMem;
0c70: 20 20 20 20 20 20 20 20 20 20 2f 2a 20 4e 75 6d /* Num
0c80: 62 65 72 20 6f 66 20 6d 65 6d 6f 72 79 20 63 65 ber of memory ce
0c90: 6c 6c 73 20 72 65 71 75 69 72 65 64 20 2a 2f 0a lls required */.
0ca0: 20 20 69 6e 74 20 6e 43 73 72 3b 20 20 20 20 20 int nCsr;
0cb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0cc0: 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 20 63 75 72 /* Number of cur
0cd0: 73 6f 72 73 20 72 65 71 75 69 72 65 64 20 2a 2f sors required */
0ce0: 0a 20 20 76 6f 69 64 20 2a 74 6f 6b 65 6e 3b 20 . void *token;
0cf0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0d00: 20 2f 2a 20 69 64 20 74 68 61 74 20 6d 61 79 20 /* id that may
0d10: 62 65 20 75 73 65 64 20 74 6f 20 72 65 63 75 72 be used to recur
0d20: 73 69 76 65 20 74 72 69 67 67 65 72 73 20 2a 2f sive triggers */
0d30: 0a 20 20 53 75 62 50 72 6f 67 72 61 6d 20 2a 70 . SubProgram *p
0d40: 4e 65 78 74 3b 20 20 20 20 20 20 20 20 20 20 20 Next;
0d50: 20 2f 2a 20 4e 65 78 74 20 73 75 62 2d 70 72 6f /* Next sub-pro
0d60: 67 72 61 6d 20 61 6c 72 65 61 64 79 20 76 69 73 gram already vis
0d70: 69 74 65 64 20 2a 2f 0a 7d 3b 0a 0a 2f 2a 0a 2a ited */.};../*.*
0d80: 2a 20 41 20 73 6d 61 6c 6c 65 72 20 76 65 72 73 * A smaller vers
0d90: 69 6f 6e 20 6f 66 20 56 64 62 65 4f 70 20 75 73 ion of VdbeOp us
0da0: 65 64 20 66 6f 72 20 74 68 65 20 56 64 62 65 41 ed for the VdbeA
0db0: 64 64 4f 70 4c 69 73 74 28 29 20 66 75 6e 63 74 ddOpList() funct
0dc0: 69 6f 6e 20 62 65 63 61 75 73 65 0a 2a 2a 20 69 ion because.** i
0dd0: 74 20 74 61 6b 65 73 20 75 70 20 6c 65 73 73 20 t takes up less
0de0: 73 70 61 63 65 2e 0a 2a 2f 0a 73 74 72 75 63 74 space..*/.struct
0df0: 20 56 64 62 65 4f 70 4c 69 73 74 20 7b 0a 20 20 VdbeOpList {.
0e00: 75 38 20 6f 70 63 6f 64 65 3b 20 20 20 20 20 20 u8 opcode;
0e10: 20 20 20 20 2f 2a 20 57 68 61 74 20 6f 70 65 72 /* What oper
0e20: 61 74 69 6f 6e 20 74 6f 20 70 65 72 66 6f 72 6d ation to perform
0e30: 20 2a 2f 0a 20 20 73 69 67 6e 65 64 20 63 68 61 */. signed cha
0e40: 72 20 70 31 3b 20 20 20 20 20 2f 2a 20 46 69 72 r p1; /* Fir
0e50: 73 74 20 6f 70 65 72 61 6e 64 20 2a 2f 0a 20 20 st operand */.
0e60: 73 69 67 6e 65 64 20 63 68 61 72 20 70 32 3b 20 signed char p2;
0e70: 20 20 20 20 2f 2a 20 53 65 63 6f 6e 64 20 70 61 /* Second pa
0e80: 72 61 6d 65 74 65 72 20 28 6f 66 74 65 6e 20 74 rameter (often t
0e90: 68 65 20 6a 75 6d 70 20 64 65 73 74 69 6e 61 74 he jump destinat
0ea0: 69 6f 6e 29 20 2a 2f 0a 20 20 73 69 67 6e 65 64 ion) */. signed
0eb0: 20 63 68 61 72 20 70 33 3b 20 20 20 20 20 2f 2a char p3; /*
0ec0: 20 54 68 69 72 64 20 70 61 72 61 6d 65 74 65 72 Third parameter
0ed0: 20 2a 2f 0a 7d 3b 0a 74 79 70 65 64 65 66 20 73 */.};.typedef s
0ee0: 74 72 75 63 74 20 56 64 62 65 4f 70 4c 69 73 74 truct VdbeOpList
0ef0: 20 56 64 62 65 4f 70 4c 69 73 74 3b 0a 0a 2f 2a VdbeOpList;../*
0f00: 0a 2a 2a 20 41 6c 6c 6f 77 65 64 20 76 61 6c 75 .** Allowed valu
0f10: 65 73 20 6f 66 20 56 64 62 65 4f 70 2e 70 34 74 es of VdbeOp.p4t
0f20: 79 70 65 0a 2a 2f 0a 23 64 65 66 69 6e 65 20 50 ype.*/.#define P
0f30: 34 5f 4e 4f 54 55 53 45 44 20 20 20 20 30 20 20 4_NOTUSED 0
0f40: 20 2f 2a 20 54 68 65 20 50 34 20 70 61 72 61 6d /* The P4 param
0f50: 65 74 65 72 20 69 73 20 6e 6f 74 20 75 73 65 64 eter is not used
0f60: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 50 34 5f 44 */.#define P4_D
0f70: 59 4e 41 4d 49 43 20 20 28 2d 31 29 20 20 2f 2a YNAMIC (-1) /*
0f80: 20 50 6f 69 6e 74 65 72 20 74 6f 20 61 20 73 74 Pointer to a st
0f90: 72 69 6e 67 20 6f 62 74 61 69 6e 65 64 20 66 72 ring obtained fr
0fa0: 6f 6d 20 73 71 6c 69 74 65 4d 61 6c 6c 6f 63 28 om sqliteMalloc(
0fb0: 29 20 2a 2f 0a 23 64 65 66 69 6e 65 20 50 34 5f ) */.#define P4_
0fc0: 53 54 41 54 49 43 20 20 20 28 2d 32 29 20 20 2f STATIC (-2) /
0fd0: 2a 20 50 6f 69 6e 74 65 72 20 74 6f 20 61 20 73 * Pointer to a s
0fe0: 74 61 74 69 63 20 73 74 72 69 6e 67 20 2a 2f 0a tatic string */.
0ff0: 23 64 65 66 69 6e 65 20 50 34 5f 43 4f 4c 4c 53 #define P4_COLLS
1000: 45 51 20 20 28 2d 34 29 20 20 2f 2a 20 50 34 20 EQ (-4) /* P4
1010: 69 73 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 is a pointer to
1020: 61 20 43 6f 6c 6c 53 65 71 20 73 74 72 75 63 74 a CollSeq struct
1030: 75 72 65 20 2a 2f 0a 23 64 65 66 69 6e 65 20 50 ure */.#define P
1040: 34 5f 46 55 4e 43 44 45 46 20 20 28 2d 35 29 20 4_FUNCDEF (-5)
1050: 20 2f 2a 20 50 34 20 69 73 20 61 20 70 6f 69 6e /* P4 is a poin
1060: 74 65 72 20 74 6f 20 61 20 46 75 6e 63 44 65 66 ter to a FuncDef
1070: 20 73 74 72 75 63 74 75 72 65 20 2a 2f 0a 23 64 structure */.#d
1080: 65 66 69 6e 65 20 50 34 5f 4b 45 59 49 4e 46 4f efine P4_KEYINFO
1090: 20 20 28 2d 36 29 20 20 2f 2a 20 50 34 20 69 73 (-6) /* P4 is
10a0: 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 61 20 a pointer to a
10b0: 4b 65 79 49 6e 66 6f 20 73 74 72 75 63 74 75 72 KeyInfo structur
10c0: 65 20 2a 2f 0a 23 64 65 66 69 6e 65 20 50 34 5f e */.#define P4_
10d0: 56 44 42 45 46 55 4e 43 20 28 2d 37 29 20 20 2f VDBEFUNC (-7) /
10e0: 2a 20 50 34 20 69 73 20 61 20 70 6f 69 6e 74 65 * P4 is a pointe
10f0: 72 20 74 6f 20 61 20 56 64 62 65 46 75 6e 63 20 r to a VdbeFunc
1100: 73 74 72 75 63 74 75 72 65 20 2a 2f 0a 23 64 65 structure */.#de
1110: 66 69 6e 65 20 50 34 5f 4d 45 4d 20 20 20 20 20 fine P4_MEM
1120: 20 28 2d 38 29 20 20 2f 2a 20 50 34 20 69 73 20 (-8) /* P4 is
1130: 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 61 20 4d a pointer to a M
1140: 65 6d 2a 20 20 20 20 73 74 72 75 63 74 75 72 65 em* structure
1150: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 50 34 5f 54 */.#define P4_T
1160: 52 41 4e 53 49 45 4e 54 20 20 30 20 20 20 2f 2a RANSIENT 0 /*
1170: 20 50 34 20 69 73 20 61 20 70 6f 69 6e 74 65 72 P4 is a pointer
1180: 20 74 6f 20 61 20 74 72 61 6e 73 69 65 6e 74 20 to a transient
1190: 73 74 72 69 6e 67 20 2a 2f 0a 23 64 65 66 69 6e string */.#defin
11a0: 65 20 50 34 5f 56 54 41 42 20 20 20 20 20 28 2d e P4_VTAB (-
11b0: 31 30 29 20 2f 2a 20 50 34 20 69 73 20 61 20 70 10) /* P4 is a p
11c0: 6f 69 6e 74 65 72 20 74 6f 20 61 6e 20 73 71 6c ointer to an sql
11d0: 69 74 65 33 5f 76 74 61 62 20 73 74 72 75 63 74 ite3_vtab struct
11e0: 75 72 65 20 2a 2f 0a 23 64 65 66 69 6e 65 20 50 ure */.#define P
11f0: 34 5f 4d 50 52 49 4e 54 46 20 20 28 2d 31 31 29 4_MPRINTF (-11)
1200: 20 2f 2a 20 50 34 20 69 73 20 61 20 73 74 72 69 /* P4 is a stri
1210: 6e 67 20 6f 62 74 61 69 6e 65 64 20 66 72 6f 6d ng obtained from
1220: 20 73 71 6c 69 74 65 33 5f 6d 70 72 69 6e 74 66 sqlite3_mprintf
1230: 28 29 20 2a 2f 0a 23 64 65 66 69 6e 65 20 50 34 () */.#define P4
1240: 5f 52 45 41 4c 20 20 20 20 20 28 2d 31 32 29 20 _REAL (-12)
1250: 2f 2a 20 50 34 20 69 73 20 61 20 36 34 2d 62 69 /* P4 is a 64-bi
1260: 74 20 66 6c 6f 61 74 69 6e 67 20 70 6f 69 6e 74 t floating point
1270: 20 76 61 6c 75 65 20 2a 2f 0a 23 64 65 66 69 6e value */.#defin
1280: 65 20 50 34 5f 49 4e 54 36 34 20 20 20 20 28 2d e P4_INT64 (-
1290: 31 33 29 20 2f 2a 20 50 34 20 69 73 20 61 20 36 13) /* P4 is a 6
12a0: 34 2d 62 69 74 20 73 69 67 6e 65 64 20 69 6e 74 4-bit signed int
12b0: 65 67 65 72 20 2a 2f 0a 23 64 65 66 69 6e 65 20 eger */.#define
12c0: 50 34 5f 49 4e 54 33 32 20 20 20 20 28 2d 31 34 P4_INT32 (-14
12d0: 29 20 2f 2a 20 50 34 20 69 73 20 61 20 33 32 2d ) /* P4 is a 32-
12e0: 62 69 74 20 73 69 67 6e 65 64 20 69 6e 74 65 67 bit signed integ
12f0: 65 72 20 2a 2f 0a 23 64 65 66 69 6e 65 20 50 34 er */.#define P4
1300: 5f 49 4e 54 41 52 52 41 59 20 28 2d 31 35 29 20 _INTARRAY (-15)
1310: 2f 2a 20 50 34 20 69 73 20 61 20 76 65 63 74 6f /* P4 is a vecto
1320: 72 20 6f 66 20 33 32 2d 62 69 74 20 69 6e 74 65 r of 32-bit inte
1330: 67 65 72 73 20 2a 2f 0a 23 64 65 66 69 6e 65 20 gers */.#define
1340: 50 34 5f 53 55 42 50 52 4f 47 52 41 4d 20 20 28 P4_SUBPROGRAM (
1350: 2d 31 38 29 20 2f 2a 20 50 34 20 69 73 20 61 20 -18) /* P4 is a
1360: 70 6f 69 6e 74 65 72 20 74 6f 20 61 20 53 75 62 pointer to a Sub
1370: 50 72 6f 67 72 61 6d 20 73 74 72 75 63 74 75 72 Program structur
1380: 65 20 2a 2f 0a 23 64 65 66 69 6e 65 20 50 34 5f e */.#define P4_
1390: 54 41 42 4c 45 20 20 20 20 28 2d 31 39 29 20 2f TABLE (-19) /
13a0: 2a 20 50 34 20 69 73 20 61 20 70 6f 69 6e 74 65 * P4 is a pointe
13b0: 72 20 74 6f 20 61 20 54 61 62 6c 65 20 73 74 72 r to a Table str
13c0: 75 63 74 75 72 65 20 2a 2f 0a 0a 2f 2a 20 57 68 ucture */../* Wh
13d0: 65 6e 20 61 64 64 69 6e 67 20 61 20 50 34 20 61 en adding a P4 a
13e0: 72 67 75 6d 65 6e 74 20 75 73 69 6e 67 20 50 34 rgument using P4
13f0: 5f 4b 45 59 49 4e 46 4f 2c 20 61 20 63 6f 70 79 _KEYINFO, a copy
1400: 20 6f 66 20 74 68 65 20 4b 65 79 49 6e 66 6f 20 of the KeyInfo
1410: 73 74 72 75 63 74 75 72 65 0a 2a 2a 20 69 73 20 structure.** is
1420: 6d 61 64 65 2e 20 20 54 68 61 74 20 63 6f 70 79 made. That copy
1430: 20 69 73 20 66 72 65 65 64 20 77 68 65 6e 20 74 is freed when t
1440: 68 65 20 56 64 62 65 20 69 73 20 66 69 6e 61 6c he Vdbe is final
1450: 69 7a 65 64 2e 20 20 42 75 74 20 69 66 20 74 68 ized. But if th
1460: 65 0a 2a 2a 20 61 72 67 75 6d 65 6e 74 20 69 73 e.** argument is
1470: 20 50 34 5f 4b 45 59 49 4e 46 4f 5f 48 41 4e 44 P4_KEYINFO_HAND
1480: 4f 46 46 2c 20 74 68 65 20 70 61 73 73 65 64 20 OFF, the passed
1490: 69 6e 20 70 6f 69 6e 74 65 72 20 69 73 20 75 73 in pointer is us
14a0: 65 64 2e 20 20 49 74 20 73 74 69 6c 6c 0a 2a 2a ed. It still.**
14b0: 20 67 65 74 73 20 66 72 65 65 64 20 77 68 65 6e gets freed when
14c0: 20 74 68 65 20 56 64 62 65 20 69 73 20 66 69 6e the Vdbe is fin
14d0: 61 6c 69 7a 65 64 20 73 6f 20 69 74 20 73 74 69 alized so it sti
14e0: 6c 6c 20 73 68 6f 75 6c 64 20 62 65 20 6f 62 74 ll should be obt
14f0: 61 69 6e 65 64 0a 2a 2a 20 66 72 6f 6d 20 61 20 ained.** from a
1500: 73 69 6e 67 6c 65 20 73 71 6c 69 74 65 4d 61 6c single sqliteMal
1510: 6c 6f 63 28 29 2e 20 20 42 75 74 20 6e 6f 20 63 loc(). But no c
1520: 6f 70 79 20 69 73 20 6d 61 64 65 20 61 6e 64 20 opy is made and
1530: 74 68 65 20 63 61 6c 6c 69 6e 67 0a 2a 2a 20 66 the calling.** f
1540: 75 6e 63 74 69 6f 6e 20 73 68 6f 75 6c 64 20 2a unction should *
1550: 6e 6f 74 2a 20 74 72 79 20 74 6f 20 66 72 65 65 not* try to free
1560: 20 74 68 65 20 4b 65 79 49 6e 66 6f 2e 0a 2a 2f the KeyInfo..*/
1570: 0a 23 64 65 66 69 6e 65 20 50 34 5f 4b 45 59 49 .#define P4_KEYI
1580: 4e 46 4f 5f 48 41 4e 44 4f 46 46 20 28 2d 31 36 NFO_HANDOFF (-16
1590: 29 0a 23 64 65 66 69 6e 65 20 50 34 5f 4b 45 59 ).#define P4_KEY
15a0: 49 4e 46 4f 5f 53 54 41 54 49 43 20 20 28 2d 31 INFO_STATIC (-1
15b0: 37 29 0a 0a 2f 2a 0a 2a 2a 20 54 68 65 20 56 64 7)../*.** The Vd
15c0: 62 65 2e 61 43 6f 6c 4e 61 6d 65 20 61 72 72 61 be.aColName arra
15d0: 79 20 63 6f 6e 74 61 69 6e 73 20 35 6e 20 4d 65 y contains 5n Me
15e0: 6d 20 73 74 72 75 63 74 75 72 65 73 2c 20 77 68 m structures, wh
15f0: 65 72 65 20 6e 20 69 73 20 74 68 65 20 0a 2a 2a ere n is the .**
1600: 20 6e 75 6d 62 65 72 20 6f 66 20 63 6f 6c 75 6d number of colum
1610: 6e 73 20 6f 66 20 64 61 74 61 20 72 65 74 75 72 ns of data retur
1620: 6e 65 64 20 62 79 20 74 68 65 20 73 74 61 74 65 ned by the state
1630: 6d 65 6e 74 2e 0a 2a 2f 0a 23 64 65 66 69 6e 65 ment..*/.#define
1640: 20 43 4f 4c 4e 41 4d 45 5f 4e 41 4d 45 20 20 20 COLNAME_NAME
1650: 20 20 30 0a 23 64 65 66 69 6e 65 20 43 4f 4c 4e 0.#define COLN
1660: 41 4d 45 5f 44 45 43 4c 54 59 50 45 20 31 0a 23 AME_DECLTYPE 1.#
1670: 64 65 66 69 6e 65 20 43 4f 4c 4e 41 4d 45 5f 44 define COLNAME_D
1680: 41 54 41 42 41 53 45 20 32 0a 23 64 65 66 69 6e ATABASE 2.#defin
1690: 65 20 43 4f 4c 4e 41 4d 45 5f 54 41 42 4c 45 20 e COLNAME_TABLE
16a0: 20 20 20 33 0a 23 64 65 66 69 6e 65 20 43 4f 4c 3.#define COL
16b0: 4e 41 4d 45 5f 43 4f 4c 55 4d 4e 20 20 20 34 0a NAME_COLUMN 4.
16c0: 23 69 66 64 65 66 20 53 51 4c 49 54 45 5f 45 4e #ifdef SQLITE_EN
16d0: 41 42 4c 45 5f 43 4f 4c 55 4d 4e 5f 4d 45 54 41 ABLE_COLUMN_META
16e0: 44 41 54 41 0a 23 20 64 65 66 69 6e 65 20 43 4f DATA.# define CO
16f0: 4c 4e 41 4d 45 5f 4e 20 20 20 20 20 20 20 20 35 LNAME_N 5
1700: 20 20 20 20 20 20 2f 2a 20 4e 75 6d 62 65 72 20 /* Number
1710: 6f 66 20 43 4f 4c 4e 41 4d 45 5f 78 78 78 20 73 of COLNAME_xxx s
1720: 79 6d 62 6f 6c 73 20 2a 2f 0a 23 65 6c 73 65 0a ymbols */.#else.
1730: 23 20 69 66 64 65 66 20 53 51 4c 49 54 45 5f 4f # ifdef SQLITE_O
1740: 4d 49 54 5f 44 45 43 4c 54 59 50 45 0a 23 20 20 MIT_DECLTYPE.#
1750: 20 64 65 66 69 6e 65 20 43 4f 4c 4e 41 4d 45 5f define COLNAME_
1760: 4e 20 20 20 20 20 20 31 20 20 20 20 20 20 2f 2a N 1 /*
1770: 20 53 74 6f 72 65 20 6f 6e 6c 79 20 74 68 65 20 Store only the
1780: 6e 61 6d 65 20 2a 2f 0a 23 20 65 6c 73 65 0a 23 name */.# else.#
1790: 20 20 20 64 65 66 69 6e 65 20 43 4f 4c 4e 41 4d define COLNAM
17a0: 45 5f 4e 20 20 20 20 20 20 32 20 20 20 20 20 20 E_N 2
17b0: 2f 2a 20 53 74 6f 72 65 20 74 68 65 20 6e 61 6d /* Store the nam
17c0: 65 20 61 6e 64 20 64 65 63 6c 74 79 70 65 20 2a e and decltype *
17d0: 2f 0a 23 20 65 6e 64 69 66 0a 23 65 6e 64 69 66 /.# endif.#endif
17e0: 0a 0a 2f 2a 0a 2a 2a 20 54 68 65 20 66 6f 6c 6c ../*.** The foll
17f0: 6f 77 69 6e 67 20 6d 61 63 72 6f 20 63 6f 6e 76 owing macro conv
1800: 65 72 74 73 20 61 20 72 65 6c 61 74 69 76 65 20 erts a relative
1810: 61 64 64 72 65 73 73 20 69 6e 20 74 68 65 20 70 address in the p
1820: 32 20 66 69 65 6c 64 0a 2a 2a 20 6f 66 20 61 20 2 field.** of a
1830: 56 64 62 65 4f 70 20 73 74 72 75 63 74 75 72 65 VdbeOp structure
1840: 20 69 6e 74 6f 20 61 20 6e 65 67 61 74 69 76 65 into a negative
1850: 20 6e 75 6d 62 65 72 20 73 6f 20 74 68 61 74 20 number so that
1860: 0a 2a 2a 20 73 71 6c 69 74 65 33 56 64 62 65 41 .** sqlite3VdbeA
1870: 64 64 4f 70 4c 69 73 74 28 29 20 6b 6e 6f 77 73 ddOpList() knows
1880: 20 74 68 61 74 20 74 68 65 20 61 64 64 72 65 73 that the addres
1890: 73 20 69 73 20 72 65 6c 61 74 69 76 65 2e 20 20 s is relative.
18a0: 43 61 6c 6c 69 6e 67 0a 2a 2a 20 74 68 65 20 6d Calling.** the m
18b0: 61 63 72 6f 20 61 67 61 69 6e 20 72 65 73 74 6f acro again resto
18c0: 72 65 73 20 74 68 65 20 61 64 64 72 65 73 73 2e res the address.
18d0: 0a 2a 2f 0a 23 64 65 66 69 6e 65 20 41 44 44 52 .*/.#define ADDR
18e0: 28 58 29 20 20 28 2d 31 2d 28 58 29 29 0a 0a 2f (X) (-1-(X))../
18f0: 2a 0a 2a 2a 20 54 68 65 20 6d 61 6b 65 66 69 6c *.** The makefil
1900: 65 20 73 63 61 6e 73 20 74 68 65 20 76 64 62 65 e scans the vdbe
1910: 2e 63 20 73 6f 75 72 63 65 20 66 69 6c 65 20 61 .c source file a
1920: 6e 64 20 63 72 65 61 74 65 73 20 74 68 65 20 22 nd creates the "
1930: 6f 70 63 6f 64 65 73 2e 68 22 0a 2a 2a 20 68 65 opcodes.h".** he
1940: 61 64 65 72 20 66 69 6c 65 20 74 68 61 74 20 64 ader file that d
1950: 65 66 69 6e 65 73 20 61 20 6e 75 6d 62 65 72 20 efines a number
1960: 66 6f 72 20 65 61 63 68 20 6f 70 63 6f 64 65 20 for each opcode
1970: 75 73 65 64 20 62 79 20 74 68 65 20 56 44 42 45 used by the VDBE
1980: 2e 0a 2a 2f 0a 23 69 6e 63 6c 75 64 65 20 22 6f ..*/.#include "o
1990: 70 63 6f 64 65 73 2e 68 22 0a 0a 2f 2a 0a 2a 2a pcodes.h"../*.**
19a0: 20 50 72 6f 74 6f 74 79 70 65 73 20 66 6f 72 20 Prototypes for
19b0: 74 68 65 20 56 44 42 45 20 69 6e 74 65 72 66 61 the VDBE interfa
19c0: 63 65 2e 20 20 53 65 65 20 63 6f 6d 6d 65 6e 74 ce. See comment
19d0: 73 20 6f 6e 20 74 68 65 20 69 6d 70 6c 65 6d 65 s on the impleme
19e0: 6e 74 61 74 69 6f 6e 0a 2a 2a 20 66 6f 72 20 61 ntation.** for a
19f0: 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 description of
1a00: 77 68 61 74 20 65 61 63 68 20 6f 66 20 74 68 65 what each of the
1a10: 73 65 20 72 6f 75 74 69 6e 65 73 20 64 6f 65 73 se routines does
1a20: 2e 0a 2a 2f 0a 56 64 62 65 20 2a 73 71 6c 69 74 ..*/.Vdbe *sqlit
1a30: 65 33 56 64 62 65 43 72 65 61 74 65 28 73 71 6c e3VdbeCreate(sql
1a40: 69 74 65 33 2a 29 3b 0a 69 6e 74 20 73 71 6c 69 ite3*);.int sqli
1a50: 74 65 33 56 64 62 65 41 64 64 4f 70 30 28 56 64 te3VdbeAddOp0(Vd
1a60: 62 65 2a 2c 69 6e 74 29 3b 0a 69 6e 74 20 73 71 be*,int);.int sq
1a70: 6c 69 74 65 33 56 64 62 65 41 64 64 4f 70 31 28 lite3VdbeAddOp1(
1a80: 56 64 62 65 2a 2c 69 6e 74 2c 69 6e 74 29 3b 0a Vdbe*,int,int);.
1a90: 69 6e 74 20 73 71 6c 69 74 65 33 56 64 62 65 41 int sqlite3VdbeA
1aa0: 64 64 4f 70 32 28 56 64 62 65 2a 2c 69 6e 74 2c ddOp2(Vdbe*,int,
1ab0: 69 6e 74 2c 69 6e 74 29 3b 0a 69 6e 74 20 73 71 int,int);.int sq
1ac0: 6c 69 74 65 33 56 64 62 65 41 64 64 4f 70 33 28 lite3VdbeAddOp3(
1ad0: 56 64 62 65 2a 2c 69 6e 74 2c 69 6e 74 2c 69 6e Vdbe*,int,int,in
1ae0: 74 2c 69 6e 74 29 3b 0a 69 6e 74 20 73 71 6c 69 t,int);.int sqli
1af0: 74 65 33 56 64 62 65 41 64 64 4f 70 34 28 56 64 te3VdbeAddOp4(Vd
1b00: 62 65 2a 2c 69 6e 74 2c 69 6e 74 2c 69 6e 74 2c be*,int,int,int,
1b10: 69 6e 74 2c 63 6f 6e 73 74 20 63 68 61 72 20 2a int,const char *
1b20: 7a 50 34 2c 69 6e 74 29 3b 0a 69 6e 74 20 73 71 zP4,int);.int sq
1b30: 6c 69 74 65 33 56 64 62 65 41 64 64 4f 70 34 49 lite3VdbeAddOp4I
1b40: 6e 74 28 56 64 62 65 2a 2c 69 6e 74 2c 69 6e 74 nt(Vdbe*,int,int
1b50: 2c 69 6e 74 2c 69 6e 74 2c 69 6e 74 29 3b 0a 69 ,int,int,int);.i
1b60: 6e 74 20 73 71 6c 69 74 65 33 56 64 62 65 41 64 nt sqlite3VdbeAd
1b70: 64 4f 70 4c 69 73 74 28 56 64 62 65 2a 2c 20 69 dOpList(Vdbe*, i
1b80: 6e 74 20 6e 4f 70 2c 20 56 64 62 65 4f 70 4c 69 nt nOp, VdbeOpLi
1b90: 73 74 20 63 6f 6e 73 74 20 2a 61 4f 70 29 3b 0a st const *aOp);.
1ba0: 76 6f 69 64 20 73 71 6c 69 74 65 33 56 64 62 65 void sqlite3Vdbe
1bb0: 41 64 64 50 61 72 73 65 53 63 68 65 6d 61 4f 70 AddParseSchemaOp
1bc0: 28 56 64 62 65 2a 2c 69 6e 74 2c 63 68 61 72 2a (Vdbe*,int,char*
1bd0: 29 3b 0a 76 6f 69 64 20 73 71 6c 69 74 65 33 56 );.void sqlite3V
1be0: 64 62 65 43 68 61 6e 67 65 50 31 28 56 64 62 65 dbeChangeP1(Vdbe
1bf0: 2a 2c 20 69 6e 74 20 61 64 64 72 2c 20 69 6e 74 *, int addr, int
1c00: 20 50 31 29 3b 0a 76 6f 69 64 20 73 71 6c 69 74 P1);.void sqlit
1c10: 65 33 56 64 62 65 43 68 61 6e 67 65 50 32 28 56 e3VdbeChangeP2(V
1c20: 64 62 65 2a 2c 20 69 6e 74 20 61 64 64 72 2c 20 dbe*, int addr,
1c30: 69 6e 74 20 50 32 29 3b 0a 76 6f 69 64 20 73 71 int P2);.void sq
1c40: 6c 69 74 65 33 56 64 62 65 43 68 61 6e 67 65 50 lite3VdbeChangeP
1c50: 33 28 56 64 62 65 2a 2c 20 69 6e 74 20 61 64 64 3(Vdbe*, int add
1c60: 72 2c 20 69 6e 74 20 50 33 29 3b 0a 76 6f 69 64 r, int P3);.void
1c70: 20 73 71 6c 69 74 65 33 56 64 62 65 43 68 61 6e sqlite3VdbeChan
1c80: 67 65 50 35 28 56 64 62 65 2a 2c 20 75 38 20 50 geP5(Vdbe*, u8 P
1c90: 35 29 3b 0a 76 6f 69 64 20 73 71 6c 69 74 65 33 5);.void sqlite3
1ca0: 56 64 62 65 4a 75 6d 70 48 65 72 65 28 56 64 62 VdbeJumpHere(Vdb
1cb0: 65 2a 2c 20 69 6e 74 20 61 64 64 72 29 3b 0a 76 e*, int addr);.v
1cc0: 6f 69 64 20 73 71 6c 69 74 65 33 56 64 62 65 43 oid sqlite3VdbeC
1cd0: 68 61 6e 67 65 54 6f 4e 6f 6f 70 28 56 64 62 65 hangeToNoop(Vdbe
1ce0: 2a 2c 20 69 6e 74 20 61 64 64 72 2c 20 69 6e 74 *, int addr, int
1cf0: 20 4e 29 3b 0a 76 6f 69 64 20 73 71 6c 69 74 65 N);.void sqlite
1d00: 33 56 64 62 65 43 68 61 6e 67 65 50 34 28 56 64 3VdbeChangeP4(Vd
1d10: 62 65 2a 2c 20 69 6e 74 20 61 64 64 72 2c 20 63 be*, int addr, c
1d20: 6f 6e 73 74 20 63 68 61 72 20 2a 7a 50 34 2c 20 onst char *zP4,
1d30: 69 6e 74 20 4e 29 3b 0a 76 6f 69 64 20 73 71 6c int N);.void sql
1d40: 69 74 65 33 56 64 62 65 55 73 65 73 42 74 72 65 ite3VdbeUsesBtre
1d50: 65 28 56 64 62 65 2a 2c 20 69 6e 74 29 3b 0a 56 e(Vdbe*, int);.V
1d60: 64 62 65 4f 70 20 2a 73 71 6c 69 74 65 33 56 64 dbeOp *sqlite3Vd
1d70: 62 65 47 65 74 4f 70 28 56 64 62 65 2a 2c 20 69 beGetOp(Vdbe*, i
1d80: 6e 74 29 3b 0a 69 6e 74 20 73 71 6c 69 74 65 33 nt);.int sqlite3
1d90: 56 64 62 65 4d 61 6b 65 4c 61 62 65 6c 28 56 64 VdbeMakeLabel(Vd
1da0: 62 65 2a 29 3b 0a 76 6f 69 64 20 73 71 6c 69 74 be*);.void sqlit
1db0: 65 33 56 64 62 65 52 75 6e 4f 6e 6c 79 4f 6e 63 e3VdbeRunOnlyOnc
1dc0: 65 28 56 64 62 65 2a 29 3b 0a 76 6f 69 64 20 73 e(Vdbe*);.void s
1dd0: 71 6c 69 74 65 33 56 64 62 65 44 65 6c 65 74 65 qlite3VdbeDelete
1de0: 28 56 64 62 65 2a 29 3b 0a 76 6f 69 64 20 73 71 (Vdbe*);.void sq
1df0: 6c 69 74 65 33 56 64 62 65 44 65 6c 65 74 65 4f lite3VdbeDeleteO
1e00: 62 6a 65 63 74 28 73 71 6c 69 74 65 33 2a 2c 56 bject(sqlite3*,V
1e10: 64 62 65 2a 29 3b 0a 76 6f 69 64 20 73 71 6c 69 dbe*);.void sqli
1e20: 74 65 33 56 64 62 65 4d 61 6b 65 52 65 61 64 79 te3VdbeMakeReady
1e30: 28 56 64 62 65 2a 2c 50 61 72 73 65 2a 29 3b 0a (Vdbe*,Parse*);.
1e40: 69 6e 74 20 73 71 6c 69 74 65 33 56 64 62 65 46 int sqlite3VdbeF
1e50: 69 6e 61 6c 69 7a 65 28 56 64 62 65 2a 29 3b 0a inalize(Vdbe*);.
1e60: 76 6f 69 64 20 73 71 6c 69 74 65 33 56 64 62 65 void sqlite3Vdbe
1e70: 52 65 73 6f 6c 76 65 4c 61 62 65 6c 28 56 64 62 ResolveLabel(Vdb
1e80: 65 2a 2c 20 69 6e 74 29 3b 0a 69 6e 74 20 73 71 e*, int);.int sq
1e90: 6c 69 74 65 33 56 64 62 65 43 75 72 72 65 6e 74 lite3VdbeCurrent
1ea0: 41 64 64 72 28 56 64 62 65 2a 29 3b 0a 23 69 66 Addr(Vdbe*);.#if
1eb0: 64 65 66 20 53 51 4c 49 54 45 5f 44 45 42 55 47 def SQLITE_DEBUG
1ec0: 0a 20 20 69 6e 74 20 73 71 6c 69 74 65 33 56 64 . int sqlite3Vd
1ed0: 62 65 41 73 73 65 72 74 4d 61 79 41 62 6f 72 74 beAssertMayAbort
1ee0: 28 56 64 62 65 20 2a 2c 20 69 6e 74 29 3b 0a 20 (Vdbe *, int);.
1ef0: 20 76 6f 69 64 20 73 71 6c 69 74 65 33 56 64 62 void sqlite3Vdb
1f00: 65 54 72 61 63 65 28 56 64 62 65 2a 2c 46 49 4c eTrace(Vdbe*,FIL
1f10: 45 2a 29 3b 0a 23 65 6e 64 69 66 0a 76 6f 69 64 E*);.#endif.void
1f20: 20 73 71 6c 69 74 65 33 56 64 62 65 52 65 73 65 sqlite3VdbeRese
1f30: 74 53 74 65 70 52 65 73 75 6c 74 28 56 64 62 65 tStepResult(Vdbe
1f40: 2a 29 3b 0a 76 6f 69 64 20 73 71 6c 69 74 65 33 *);.void sqlite3
1f50: 56 64 62 65 52 65 77 69 6e 64 28 56 64 62 65 2a VdbeRewind(Vdbe*
1f60: 29 3b 0a 69 6e 74 20 73 71 6c 69 74 65 33 56 64 );.int sqlite3Vd
1f70: 62 65 52 65 73 65 74 28 56 64 62 65 2a 29 3b 0a beReset(Vdbe*);.
1f80: 76 6f 69 64 20 73 71 6c 69 74 65 33 56 64 62 65 void sqlite3Vdbe
1f90: 53 65 74 4e 75 6d 43 6f 6c 73 28 56 64 62 65 2a SetNumCols(Vdbe*
1fa0: 2c 69 6e 74 29 3b 0a 69 6e 74 20 73 71 6c 69 74 ,int);.int sqlit
1fb0: 65 33 56 64 62 65 53 65 74 43 6f 6c 4e 61 6d 65 e3VdbeSetColName
1fc0: 28 56 64 62 65 2a 2c 20 69 6e 74 2c 20 69 6e 74 (Vdbe*, int, int
1fd0: 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 2c 20 , const char *,
1fe0: 76 6f 69 64 28 2a 29 28 76 6f 69 64 2a 29 29 3b void(*)(void*));
1ff0: 0a 76 6f 69 64 20 73 71 6c 69 74 65 33 56 64 62 .void sqlite3Vdb
2000: 65 43 6f 75 6e 74 43 68 61 6e 67 65 73 28 56 64 eCountChanges(Vd
2010: 62 65 2a 29 3b 0a 73 71 6c 69 74 65 33 20 2a 73 be*);.sqlite3 *s
2020: 71 6c 69 74 65 33 56 64 62 65 44 62 28 56 64 62 qlite3VdbeDb(Vdb
2030: 65 2a 29 3b 0a 76 6f 69 64 20 73 71 6c 69 74 65 e*);.void sqlite
2040: 33 56 64 62 65 53 65 74 53 71 6c 28 56 64 62 65 3VdbeSetSql(Vdbe
2050: 2a 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a *, const char *z
2060: 2c 20 69 6e 74 20 6e 2c 20 69 6e 74 29 3b 0a 76 , int n, int);.v
2070: 6f 69 64 20 73 71 6c 69 74 65 33 56 64 62 65 53 oid sqlite3VdbeS
2080: 77 61 70 28 56 64 62 65 2a 2c 56 64 62 65 2a 29 wap(Vdbe*,Vdbe*)
2090: 3b 0a 56 64 62 65 4f 70 20 2a 73 71 6c 69 74 65 ;.VdbeOp *sqlite
20a0: 33 56 64 62 65 54 61 6b 65 4f 70 41 72 72 61 79 3VdbeTakeOpArray
20b0: 28 56 64 62 65 2a 2c 20 69 6e 74 2a 2c 20 69 6e (Vdbe*, int*, in
20c0: 74 2a 29 3b 0a 73 71 6c 69 74 65 33 5f 76 61 6c t*);.sqlite3_val
20d0: 75 65 20 2a 73 71 6c 69 74 65 33 56 64 62 65 47 ue *sqlite3VdbeG
20e0: 65 74 56 61 6c 75 65 28 56 64 62 65 2a 2c 20 69 etValue(Vdbe*, i
20f0: 6e 74 2c 20 75 38 29 3b 0a 76 6f 69 64 20 73 71 nt, u8);.void sq
2100: 6c 69 74 65 33 56 64 62 65 53 65 74 56 61 72 6d lite3VdbeSetVarm
2110: 61 73 6b 28 56 64 62 65 2a 2c 20 69 6e 74 29 3b ask(Vdbe*, int);
2120: 0a 23 69 66 6e 64 65 66 20 53 51 4c 49 54 45 5f .#ifndef SQLITE_
2130: 4f 4d 49 54 5f 54 52 41 43 45 0a 20 20 63 68 61 OMIT_TRACE. cha
2140: 72 20 2a 73 71 6c 69 74 65 33 56 64 62 65 45 78 r *sqlite3VdbeEx
2150: 70 61 6e 64 53 71 6c 28 56 64 62 65 2a 2c 20 63 pandSql(Vdbe*, c
2160: 6f 6e 73 74 20 63 68 61 72 2a 29 3b 0a 23 65 6e onst char*);.#en
2170: 64 69 66 0a 0a 55 6e 70 61 63 6b 65 64 52 65 63 dif..UnpackedRec
2180: 6f 72 64 20 2a 73 71 6c 69 74 65 33 56 64 62 65 ord *sqlite3Vdbe
2190: 52 65 63 6f 72 64 55 6e 70 61 63 6b 28 4b 65 79 RecordUnpack(Key
21a0: 49 6e 66 6f 2a 2c 69 6e 74 2c 63 6f 6e 73 74 20 Info*,int,const
21b0: 76 6f 69 64 2a 2c 63 68 61 72 2a 2c 69 6e 74 29 void*,char*,int)
21c0: 3b 0a 76 6f 69 64 20 73 71 6c 69 74 65 33 56 64 ;.void sqlite3Vd
21d0: 62 65 44 65 6c 65 74 65 55 6e 70 61 63 6b 65 64 beDeleteUnpacked
21e0: 52 65 63 6f 72 64 28 55 6e 70 61 63 6b 65 64 52 Record(UnpackedR
21f0: 65 63 6f 72 64 2a 29 3b 0a 69 6e 74 20 73 71 6c ecord*);.int sql
2200: 69 74 65 33 56 64 62 65 52 65 63 6f 72 64 43 6f ite3VdbeRecordCo
2210: 6d 70 61 72 65 28 69 6e 74 2c 63 6f 6e 73 74 20 mpare(int,const
2220: 76 6f 69 64 2a 2c 55 6e 70 61 63 6b 65 64 52 65 void*,UnpackedRe
2230: 63 6f 72 64 2a 29 3b 0a 0a 23 69 66 6e 64 65 66 cord*);..#ifndef
2240: 20 53 51 4c 49 54 45 5f 4f 4d 49 54 5f 54 52 49 SQLITE_OMIT_TRI
2250: 47 47 45 52 0a 76 6f 69 64 20 73 71 6c 69 74 65 GGER.void sqlite
2260: 33 56 64 62 65 4c 69 6e 6b 53 75 62 50 72 6f 67 3VdbeLinkSubProg
2270: 72 61 6d 28 56 64 62 65 20 2a 2c 20 53 75 62 50 ram(Vdbe *, SubP
2280: 72 6f 67 72 61 6d 20 2a 29 3b 0a 23 65 6e 64 69 rogram *);.#endi
2290: 66 0a 0a 0a 23 69 66 6e 64 65 66 20 4e 44 45 42 f...#ifndef NDEB
22a0: 55 47 0a 20 20 76 6f 69 64 20 73 71 6c 69 74 65 UG. void sqlite
22b0: 33 56 64 62 65 43 6f 6d 6d 65 6e 74 28 56 64 62 3VdbeComment(Vdb
22c0: 65 2a 2c 20 63 6f 6e 73 74 20 63 68 61 72 2a 2c e*, const char*,
22d0: 20 2e 2e 2e 29 3b 0a 23 20 64 65 66 69 6e 65 20 ...);.# define
22e0: 56 64 62 65 43 6f 6d 6d 65 6e 74 28 58 29 20 20 VdbeComment(X)
22f0: 73 71 6c 69 74 65 33 56 64 62 65 43 6f 6d 6d 65 sqlite3VdbeComme
2300: 6e 74 20 58 0a 20 20 76 6f 69 64 20 73 71 6c 69 nt X. void sqli
2310: 74 65 33 56 64 62 65 4e 6f 6f 70 43 6f 6d 6d 65 te3VdbeNoopComme
2320: 6e 74 28 56 64 62 65 2a 2c 20 63 6f 6e 73 74 20 nt(Vdbe*, const
2330: 63 68 61 72 2a 2c 20 2e 2e 2e 29 3b 0a 23 20 64 char*, ...);.# d
2340: 65 66 69 6e 65 20 56 64 62 65 4e 6f 6f 70 43 6f efine VdbeNoopCo
2350: 6d 6d 65 6e 74 28 58 29 20 20 73 71 6c 69 74 65 mment(X) sqlite
2360: 33 56 64 62 65 4e 6f 6f 70 43 6f 6d 6d 65 6e 74 3VdbeNoopComment
2370: 20 58 0a 23 65 6c 73 65 0a 23 20 64 65 66 69 6e X.#else.# defin
2380: 65 20 56 64 62 65 43 6f 6d 6d 65 6e 74 28 58 29 e VdbeComment(X)
2390: 0a 23 20 64 65 66 69 6e 65 20 56 64 62 65 4e 6f .# define VdbeNo
23a0: 6f 70 43 6f 6d 6d 65 6e 74 28 58 29 0a 23 65 6e opComment(X).#en
23b0: 64 69 66 0a 0a 23 65 6e 64 69 66 0a dif..#endif.