Eneboo - Documentación para desarrolladores
src/sqlite/vdbe.h
Ir a la documentación de este archivo.
00001 /*
00002 ** 2001 September 15
00003 **
00004 ** The author disclaims copyright to this source code.  In place of
00005 ** a legal notice, here is a blessing:
00006 **
00007 **    May you do good and not evil.
00008 **    May you find forgiveness for yourself and forgive others.
00009 **    May you share freely, never taking more than you give.
00010 **
00011 *************************************************************************
00012 ** Header file for the Virtual DataBase Engine (VDBE)
00013 **
00014 ** This header defines the interface to the virtual database engine
00015 ** or VDBE.  The VDBE implements an abstract machine that runs a
00016 ** simple program to access and modify the underlying database.
00017 **
00018 **
00019 */
00020 #ifndef _SQLITE_VDBE_H_
00021 #define _SQLITE_VDBE_H_
00022 #include <stdio.h>
00023 
00024 /*
00025 ** A single VDBE is an opaque structure named "Vdbe".  Only routines
00026 ** in the source file sqliteVdbe.c are allowed to see the insides
00027 ** of this structure.
00028 */
00029 typedef struct Vdbe Vdbe;
00030 
00031 /*
00032 ** A single instruction of the virtual machine has an opcode
00033 ** and as many as three operands.  The instruction is recorded
00034 ** as an instance of the following structure:
00035 */
00036 struct VdbeOp {
00037   u8 opcode;          /* What operation to perform */
00038   int p1;             /* First operand */
00039   int p2;             /* Second parameter (often the jump destination) */
00040   char *p3;           /* Third parameter */
00041   int p3type;         /* P3_STATIC, P3_DYNAMIC or P3_POINTER */
00042 #ifdef VDBE_PROFILE
00043   int cnt;            /* Number of times this instruction was executed */
00044   long long cycles;   /* Total time spend executing this instruction */
00045 #endif
00046 };
00047 typedef struct VdbeOp VdbeOp;
00048 
00049 /*
00050 ** A smaller version of VdbeOp used for the VdbeAddOpList() function because
00051 ** it takes up less space.
00052 */
00053 struct VdbeOpList {
00054   u8 opcode;          /* What operation to perform */
00055   signed char p1;     /* First operand */
00056   short int p2;       /* Second parameter (often the jump destination) */
00057   char *p3;           /* Third parameter */
00058 };
00059 typedef struct VdbeOpList VdbeOpList;
00060 
00061 /*
00062 ** Allowed values of VdbeOp.p3type
00063 */
00064 #define P3_NOTUSED    0   /* The P3 parameter is not used */
00065 #define P3_DYNAMIC  (-1)  /* Pointer to a string obtained from sqliteMalloc() */
00066 #define P3_STATIC   (-2)  /* Pointer to a static string */
00067 #define P3_POINTER  (-3)  /* P3 is a pointer to some structure or object */
00068 
00069 /*
00070 ** The following macro converts a relative address in the p2 field
00071 ** of a VdbeOp structure into a negative number so that 
00072 ** sqliteVdbeAddOpList() knows that the address is relative.  Calling
00073 ** the macro again restores the address.
00074 */
00075 #define ADDR(X)  (-1-(X))
00076 
00077 /*
00078 ** The makefile scans the vdbe.c source file and creates the "opcodes.h"
00079 ** header file that defines a number for each opcode used by the VDBE.
00080 */
00081 #include "opcodes.h"
00082 
00083 /*
00084 ** Prototypes for the VDBE interface.  See comments on the implementation
00085 ** for a description of what each of these routines does.
00086 */
00087 Vdbe *sqliteVdbeCreate(sqlite*);
00088 void sqliteVdbeCreateCallback(Vdbe*, int*);
00089 int sqliteVdbeAddOp(Vdbe*,int,int,int);
00090 int sqliteVdbeOp3(Vdbe*,int,int,int,const char *zP3,int);
00091 int sqliteVdbeCode(Vdbe*,...);
00092 int sqliteVdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
00093 void sqliteVdbeChangeP1(Vdbe*, int addr, int P1);
00094 void sqliteVdbeChangeP2(Vdbe*, int addr, int P2);
00095 void sqliteVdbeChangeP3(Vdbe*, int addr, const char *zP1, int N);
00096 void sqliteVdbeDequoteP3(Vdbe*, int addr);
00097 int sqliteVdbeFindOp(Vdbe*, int, int);
00098 VdbeOp *sqliteVdbeGetOp(Vdbe*, int);
00099 int sqliteVdbeMakeLabel(Vdbe*);
00100 void sqliteVdbeDelete(Vdbe*);
00101 void sqliteVdbeMakeReady(Vdbe*,int,int);
00102 int sqliteVdbeExec(Vdbe*);
00103 int sqliteVdbeList(Vdbe*);
00104 int sqliteVdbeFinalize(Vdbe*,char**);
00105 void sqliteVdbeResolveLabel(Vdbe*, int);
00106 int sqliteVdbeCurrentAddr(Vdbe*);
00107 void sqliteVdbeTrace(Vdbe*,FILE*);
00108 void sqliteVdbeCompressSpace(Vdbe*,int);
00109 int sqliteVdbeReset(Vdbe*,char **);
00110 int sqliteVdbeSetVariables(Vdbe*,int,const char**);
00111 
00112 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'