1.1 --- a/extensions/sqlite/sqlite-source/vdbe.h Fri Jul 11 06:51:21 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,151 +0,0 @@
1.4 -/*
1.5 -** 2001 September 15
1.6 -**
1.7 -** The author disclaims copyright to this source code. In place of
1.8 -** a legal notice, here is a blessing:
1.9 -**
1.10 -** May you do good and not evil.
1.11 -** May you find forgiveness for yourself and forgive others.
1.12 -** May you share freely, never taking more than you give.
1.13 -**
1.14 -*************************************************************************
1.15 -** Header file for the Virtual DataBase Engine (VDBE)
1.16 -**
1.17 -** This header defines the interface to the virtual database engine
1.18 -** or VDBE. The VDBE implements an abstract machine that runs a
1.19 -** simple program to access and modify the underlying database.
1.20 -**
1.21 -** $Id$
1.22 -*/
1.23 -#ifndef _SQLITE_VDBE_H_
1.24 -#define _SQLITE_VDBE_H_
1.25 -#include <stdio.h>
1.26 -
1.27 -/*
1.28 -** A single VDBE is an opaque structure named "Vdbe". Only routines
1.29 -** in the source file sqliteVdbe.c are allowed to see the insides
1.30 -** of this structure.
1.31 -*/
1.32 -typedef struct Vdbe Vdbe;
1.33 -
1.34 -/*
1.35 -** A single instruction of the virtual machine has an opcode
1.36 -** and as many as three operands. The instruction is recorded
1.37 -** as an instance of the following structure:
1.38 -*/
1.39 -struct VdbeOp {
1.40 - u8 opcode; /* What operation to perform */
1.41 - int p1; /* First operand */
1.42 - int p2; /* Second parameter (often the jump destination) */
1.43 - char *p3; /* Third parameter */
1.44 - int p3type; /* One of the P3_xxx constants defined below */
1.45 -#ifdef VDBE_PROFILE
1.46 - int cnt; /* Number of times this instruction was executed */
1.47 - long long cycles; /* Total time spend executing this instruction */
1.48 -#endif
1.49 -};
1.50 -typedef struct VdbeOp VdbeOp;
1.51 -
1.52 -/*
1.53 -** A smaller version of VdbeOp used for the VdbeAddOpList() function because
1.54 -** it takes up less space.
1.55 -*/
1.56 -struct VdbeOpList {
1.57 - u8 opcode; /* What operation to perform */
1.58 - signed char p1; /* First operand */
1.59 - short int p2; /* Second parameter (often the jump destination) */
1.60 - char *p3; /* Third parameter */
1.61 -};
1.62 -typedef struct VdbeOpList VdbeOpList;
1.63 -
1.64 -/*
1.65 -** Allowed values of VdbeOp.p3type
1.66 -*/
1.67 -#define P3_NOTUSED 0 /* The P3 parameter is not used */
1.68 -#define P3_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */
1.69 -#define P3_STATIC (-2) /* Pointer to a static string */
1.70 -#define P3_COLLSEQ (-4) /* P3 is a pointer to a CollSeq structure */
1.71 -#define P3_FUNCDEF (-5) /* P3 is a pointer to a FuncDef structure */
1.72 -#define P3_KEYINFO (-6) /* P3 is a pointer to a KeyInfo structure */
1.73 -#define P3_VDBEFUNC (-7) /* P3 is a pointer to a VdbeFunc structure */
1.74 -#define P3_MEM (-8) /* P3 is a pointer to a Mem* structure */
1.75 -#define P3_TRANSIENT (-9) /* P3 is a pointer to a transient string */
1.76 -#define P3_VTAB (-10) /* P3 is a pointer to an sqlite3_vtab structure */
1.77 -#define P3_MPRINTF (-11) /* P3 is a string obtained from sqlite3_mprintf() */
1.78 -
1.79 -/* When adding a P3 argument using P3_KEYINFO, a copy of the KeyInfo structure
1.80 -** is made. That copy is freed when the Vdbe is finalized. But if the
1.81 -** argument is P3_KEYINFO_HANDOFF, the passed in pointer is used. It still
1.82 -** gets freed when the Vdbe is finalized so it still should be obtained
1.83 -** from a single sqliteMalloc(). But no copy is made and the calling
1.84 -** function should *not* try to free the KeyInfo.
1.85 -*/
1.86 -#define P3_KEYINFO_HANDOFF (-9)
1.87 -
1.88 -/*
1.89 -** The Vdbe.aColName array contains 5n Mem structures, where n is the
1.90 -** number of columns of data returned by the statement.
1.91 -*/
1.92 -#define COLNAME_NAME 0
1.93 -#define COLNAME_DECLTYPE 1
1.94 -#define COLNAME_DATABASE 2
1.95 -#define COLNAME_TABLE 3
1.96 -#define COLNAME_COLUMN 4
1.97 -#define COLNAME_N 5 /* Number of COLNAME_xxx symbols */
1.98 -
1.99 -/*
1.100 -** The following macro converts a relative address in the p2 field
1.101 -** of a VdbeOp structure into a negative number so that
1.102 -** sqlite3VdbeAddOpList() knows that the address is relative. Calling
1.103 -** the macro again restores the address.
1.104 -*/
1.105 -#define ADDR(X) (-1-(X))
1.106 -
1.107 -/*
1.108 -** The makefile scans the vdbe.c source file and creates the "opcodes.h"
1.109 -** header file that defines a number for each opcode used by the VDBE.
1.110 -*/
1.111 -#include "opcodes.h"
1.112 -
1.113 -/*
1.114 -** Prototypes for the VDBE interface. See comments on the implementation
1.115 -** for a description of what each of these routines does.
1.116 -*/
1.117 -Vdbe *sqlite3VdbeCreate(sqlite3*);
1.118 -int sqlite3VdbeAddOp(Vdbe*,int,int,int);
1.119 -int sqlite3VdbeOp3(Vdbe*,int,int,int,const char *zP3,int);
1.120 -int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
1.121 -void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
1.122 -void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
1.123 -void sqlite3VdbeJumpHere(Vdbe*, int addr);
1.124 -void sqlite3VdbeChangeToNoop(Vdbe*, int addr, int N);
1.125 -void sqlite3VdbeChangeP3(Vdbe*, int addr, const char *zP1, int N);
1.126 -void sqlite3VdbeUsesBtree(Vdbe*, int);
1.127 -VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);
1.128 -int sqlite3VdbeMakeLabel(Vdbe*);
1.129 -void sqlite3VdbeDelete(Vdbe*);
1.130 -void sqlite3VdbeMakeReady(Vdbe*,int,int,int,int);
1.131 -int sqlite3VdbeFinalize(Vdbe*);
1.132 -void sqlite3VdbeResolveLabel(Vdbe*, int);
1.133 -int sqlite3VdbeCurrentAddr(Vdbe*);
1.134 -#ifdef SQLITE_DEBUG
1.135 - void sqlite3VdbeTrace(Vdbe*,FILE*);
1.136 -#endif
1.137 -void sqlite3VdbeResetStepResult(Vdbe*);
1.138 -int sqlite3VdbeReset(Vdbe*);
1.139 -void sqlite3VdbeSetNumCols(Vdbe*,int);
1.140 -int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, int);
1.141 -void sqlite3VdbeCountChanges(Vdbe*);
1.142 -sqlite3 *sqlite3VdbeDb(Vdbe*);
1.143 -void sqlite3VdbeSetSql(Vdbe*, const char *z, int n);
1.144 -const char *sqlite3VdbeGetSql(Vdbe*);
1.145 -void sqlite3VdbeSwap(Vdbe*,Vdbe*);
1.146 -
1.147 -#ifndef NDEBUG
1.148 - void sqlite3VdbeComment(Vdbe*, const char*, ...);
1.149 -# define VdbeComment(X) sqlite3VdbeComment X
1.150 -#else
1.151 -# define VdbeComment(X)
1.152 -#endif
1.153 -
1.154 -#endif