source: trunk/src/3rdparty/sqlite/vdbe.h@ 205

Last change on this file since 205 was 205, checked in by rudi, 14 years ago

Added SQLite 2.8.17 sources. This allows to build at least one of the sql drivers / plugins.

File size: 3.8 KB
Line 
1/*
2** 2001 September 15
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** Header file for the Virtual DataBase Engine (VDBE)
13**
14** This header defines the interface to the virtual database engine
15** or VDBE. The VDBE implements an abstract machine that runs a
16** simple program to access and modify the underlying database.
17**
18** $Id: vdbe.h,v 1.71 2004/02/22 20:05:02 drh Exp $
19*/
20#ifndef _SQLITE_VDBE_H_
21#define _SQLITE_VDBE_H_
22#include <stdio.h>
23
24/*
25** A single VDBE is an opaque structure named "Vdbe". Only routines
26** in the source file sqliteVdbe.c are allowed to see the insides
27** of this structure.
28*/
29typedef struct Vdbe Vdbe;
30
31/*
32** A single instruction of the virtual machine has an opcode
33** and as many as three operands. The instruction is recorded
34** as an instance of the following structure:
35*/
36struct VdbeOp {
37 u8 opcode; /* What operation to perform */
38 int p1; /* First operand */
39 int p2; /* Second parameter (often the jump destination) */
40 char *p3; /* Third parameter */
41 int p3type; /* P3_STATIC, P3_DYNAMIC or P3_POINTER */
42#ifdef VDBE_PROFILE
43 int cnt; /* Number of times this instruction was executed */
44 long long cycles; /* Total time spend executing this instruction */
45#endif
46};
47typedef struct VdbeOp VdbeOp;
48
49/*
50** A smaller version of VdbeOp used for the VdbeAddOpList() function because
51** it takes up less space.
52*/
53struct VdbeOpList {
54 u8 opcode; /* What operation to perform */
55 signed char p1; /* First operand */
56 short int p2; /* Second parameter (often the jump destination) */
57 char *p3; /* Third parameter */
58};
59typedef struct VdbeOpList VdbeOpList;
60
61/*
62** Allowed values of VdbeOp.p3type
63*/
64#define P3_NOTUSED 0 /* The P3 parameter is not used */
65#define P3_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */
66#define P3_STATIC (-2) /* Pointer to a static string */
67#define P3_POINTER (-3) /* P3 is a pointer to some structure or object */
68
69/*
70** The following macro converts a relative address in the p2 field
71** of a VdbeOp structure into a negative number so that
72** sqliteVdbeAddOpList() knows that the address is relative. Calling
73** the macro again restores the address.
74*/
75#define ADDR(X) (-1-(X))
76
77/*
78** The makefile scans the vdbe.c source file and creates the "opcodes.h"
79** header file that defines a number for each opcode used by the VDBE.
80*/
81#include "opcodes.h"
82
83/*
84** Prototypes for the VDBE interface. See comments on the implementation
85** for a description of what each of these routines does.
86*/
87Vdbe *sqliteVdbeCreate(sqlite*);
88void sqliteVdbeCreateCallback(Vdbe*, int*);
89int sqliteVdbeAddOp(Vdbe*,int,int,int);
90int sqliteVdbeOp3(Vdbe*,int,int,int,const char *zP3,int);
91int sqliteVdbeCode(Vdbe*,...);
92int sqliteVdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
93void sqliteVdbeChangeP1(Vdbe*, int addr, int P1);
94void sqliteVdbeChangeP2(Vdbe*, int addr, int P2);
95void sqliteVdbeChangeP3(Vdbe*, int addr, const char *zP1, int N);
96void sqliteVdbeDequoteP3(Vdbe*, int addr);
97int sqliteVdbeFindOp(Vdbe*, int, int);
98VdbeOp *sqliteVdbeGetOp(Vdbe*, int);
99int sqliteVdbeMakeLabel(Vdbe*);
100void sqliteVdbeDelete(Vdbe*);
101void sqliteVdbeMakeReady(Vdbe*,int,int);
102int sqliteVdbeExec(Vdbe*);
103int sqliteVdbeList(Vdbe*);
104int sqliteVdbeFinalize(Vdbe*,char**);
105void sqliteVdbeResolveLabel(Vdbe*, int);
106int sqliteVdbeCurrentAddr(Vdbe*);
107void sqliteVdbeTrace(Vdbe*,FILE*);
108void sqliteVdbeCompressSpace(Vdbe*,int);
109int sqliteVdbeReset(Vdbe*,char **);
110int sqliteVdbeSetVariables(Vdbe*,int,const char**);
111
112#endif
Note: See TracBrowser for help on using the repository browser.