diff options
| author | Wez Furlong <wez@php.net> | 2003-04-17 11:27:30 +0000 |
|---|---|---|
| committer | Wez Furlong <wez@php.net> | 2003-04-17 11:27:30 +0000 |
| commit | 05d5a35c9b9c9d8504ac7c1ced1f79450915939e (patch) | |
| tree | ab631aba94d4cc44679419afa7ad00875de2817a /ext/sqlite/libsqlite/src/vdbe.h | |
| parent | 826583dc91b0089422aa1ac3ef75c71fdb788099 (diff) | |
| download | php-git-05d5a35c9b9c9d8504ac7c1ced1f79450915939e.tar.gz | |
Bundle relevant parts of sqlite 2.8.0.
# sqlite has a completely non-restrictive license
Diffstat (limited to 'ext/sqlite/libsqlite/src/vdbe.h')
| -rw-r--r-- | ext/sqlite/libsqlite/src/vdbe.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/ext/sqlite/libsqlite/src/vdbe.h b/ext/sqlite/libsqlite/src/vdbe.h new file mode 100644 index 0000000000..0a885e42d4 --- /dev/null +++ b/ext/sqlite/libsqlite/src/vdbe.h @@ -0,0 +1,95 @@ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** Header file for the Virtual DataBase Engine (VDBE) +** +** This header defines the interface to the virtual database engine +** or VDBE. The VDBE implements an abstract machine that runs a +** simple program to access and modify the underlying database. +** +** $Id$ +*/ +#ifndef _SQLITE_VDBE_H_ +#define _SQLITE_VDBE_H_ +#include <stdio.h> + +/* +** A single VDBE is an opaque structure named "Vdbe". Only routines +** in the source file sqliteVdbe.c are allowed to see the insides +** of this structure. +*/ +typedef struct Vdbe Vdbe; + +/* +** A single instruction of the virtual machine has an opcode +** and as many as three operands. The instruction is recorded +** as an instance of the following structure: +*/ +struct VdbeOp { + int opcode; /* What operation to perform */ + int p1; /* First operand */ + int p2; /* Second parameter (often the jump destination) */ + char *p3; /* Third parameter */ + int p3type; /* P3_STATIC, P3_DYNAMIC or P3_POINTER */ +#ifdef VDBE_PROFILE + int cnt; /* Number of times this instruction was executed */ + long long cycles; /* Total time spend executing this instruction */ +#endif +}; +typedef struct VdbeOp VdbeOp; + +/* +** Allowed values of VdbeOp.p3type +*/ +#define P3_NOTUSED 0 /* The P3 parameter is not used */ +#define P3_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */ +#define P3_STATIC (-2) /* Pointer to a static string */ +#define P3_POINTER (-3) /* P3 is a pointer to some structure or object */ + +/* +** The following macro converts a relative address in the p2 field +** of a VdbeOp structure into a negative number so that +** sqliteVdbeAddOpList() knows that the address is relative. Calling +** the macro again restores the address. +*/ +#define ADDR(X) (-1-(X)) + +/* +** The makefile scans the vdbe.c source file and creates the "opcodes.h" +** header file that defines a number for each opcode used by the VDBE. +*/ +#include "opcodes.h" + +/* +** Prototypes for the VDBE interface. See comments on the implementation +** for a description of what each of these routines does. +*/ +Vdbe *sqliteVdbeCreate(sqlite*); +void sqliteVdbeCreateCallback(Vdbe*, int*); +int sqliteVdbeAddOp(Vdbe*,int,int,int); +int sqliteVdbeAddOpList(Vdbe*, int nOp, VdbeOp const *aOp); +void sqliteVdbeChangeP1(Vdbe*, int addr, int P1); +void sqliteVdbeChangeP2(Vdbe*, int addr, int P2); +void sqliteVdbeChangeP3(Vdbe*, int addr, const char *zP1, int N); +void sqliteVdbeDequoteP3(Vdbe*, int addr); +int sqliteVdbeFindOp(Vdbe*, int, int); +int sqliteVdbeMakeLabel(Vdbe*); +void sqliteVdbeDelete(Vdbe*); +void sqliteVdbeMakeReady(Vdbe*,sqlite_callback,void*,int); +int sqliteVdbeExec(Vdbe*); +int sqliteVdbeList(Vdbe*); +int sqliteVdbeFinalize(Vdbe*,char**); +void sqliteVdbeResolveLabel(Vdbe*, int); +int sqliteVdbeCurrentAddr(Vdbe*); +void sqliteVdbeTrace(Vdbe*,FILE*); +void sqliteVdbeCompressSpace(Vdbe*,int); + +#endif |
