Files
harbour-core/harbour/contrib/hbsqlit2/vdbe.h
Viktor Szakats 603d77d54b 2008-06-02 23:33 UTC+0100 Viktor Szakats (harbour.01 syenar hu)
* contrib/make_b32_all.bat
   * contrib/make_gcc_all.sh
   * contrib/make_vc_all.bat
   + contrib/hbsqlit2
   + contrib/hbsqlit2/Makefile
   + contrib/hbsqlit2/make_b32.bat
   + contrib/hbsqlit2/make_vc.bat
   + contrib/hbsqlit2/make_gcc.sh
   + contrib/hbsqlit2/common.mak
   + contrib/hbsqlit2/hbsqlit2.c
   + contrib/hbsqlit2/hbsqlit2.ch
   + contrib/hbsqlit2/LICENSE.txt
   + contrib/hbsqlit2/TODO.txt
   + contrib/hbsqlit2/readme.txt
   + contrib/hbsqlit2/attach.c
   + contrib/hbsqlit2/auth.c
   + contrib/hbsqlit2/btree.c
   + contrib/hbsqlit2/btree.h
   + contrib/hbsqlit2/btree_rb.c
   + contrib/hbsqlit2/build.c
   + contrib/hbsqlit2/config.h
   + contrib/hbsqlit2/copy.c
   + contrib/hbsqlit2/date.c
   + contrib/hbsqlit2/delete.c
   + contrib/hbsqlit2/encode.c
   + contrib/hbsqlit2/expr.c
   + contrib/hbsqlit2/func.c
   + contrib/hbsqlit2/hash.c
   + contrib/hbsqlit2/hash.h
   + contrib/hbsqlit2/insert.c
   + contrib/hbsqlit2/main.c
   + contrib/hbsqlit2/opcodes.c
   + contrib/hbsqlit2/opcodes.h
   + contrib/hbsqlit2/os.c
   + contrib/hbsqlit2/os.h
   + contrib/hbsqlit2/pager.c
   + contrib/hbsqlit2/pager.h
   + contrib/hbsqlit2/parse.c
   + contrib/hbsqlit2/parse.h
   + contrib/hbsqlit2/pragma.c
   + contrib/hbsqlit2/printf.c
   + contrib/hbsqlit2/random.c
   + contrib/hbsqlit2/select.c
   + contrib/hbsqlit2/sqlite.h
   + contrib/hbsqlit2/sqliteInt.h
   + contrib/hbsqlit2/table.c
   + contrib/hbsqlit2/tokenize.c
   + contrib/hbsqlit2/trigger.c
   + contrib/hbsqlit2/update.c
   + contrib/hbsqlit2/util.c
   + contrib/hbsqlit2/vacuum.c
   + contrib/hbsqlit2/vdbe.c
   + contrib/hbsqlit2/vdbe.h
   + contrib/hbsqlit2/vdbeaux.c
   + contrib/hbsqlit2/vdbeInt.h
   + contrib/hbsqlit2/where.c
   + contrib/hbsqlit2/tests/bld_b32.bat
   + contrib/hbsqlit2/tests/bld_vc.bat
   + contrib/hbsqlit2/tests/example.db
   + contrib/hbsqlit2/tests/hbsqlite.prg
     + Added hbsqlit2 SQLite 2.x interface library.

       With kind permission from the author:
       Alejandro de Gárate <alex_degarate/at/hotmail.com>

     + Some renames were done here too to better fit into 
       the contrib structure.
     + Added std make files.
     + Added to 'all' make files.
     + Added foreign SQLite 2.8.16 (final 2.x version)
       source code to the repository.
       Compiles with an okay amount of warnings under BCC but 
       doesn't compile in C++ mode in MSVC (due to missing 
       casts).
     ; NOTE: I've added this because this is the original 
             SQLite Harbour interface, clean and working 
             implementation, and SQLite 2 is incompatible 
             with 3, and some may need to access existing 
             2.x databases from Harbour.
2008-06-02 21:46:01 +00:00

113 lines
3.8 KiB
C

/*
** 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: vdbe.h,v 1.71 2004/02/22 20:05:02 drh Exp $
*/
#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 {
u8 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;
/*
** A smaller version of VdbeOp used for the VdbeAddOpList() function because
** it takes up less space.
*/
struct VdbeOpList {
u8 opcode; /* What operation to perform */
signed char p1; /* First operand */
short int p2; /* Second parameter (often the jump destination) */
char *p3; /* Third parameter */
};
typedef struct VdbeOpList VdbeOpList;
/*
** 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 sqliteVdbeOp3(Vdbe*,int,int,int,const char *zP3,int);
int sqliteVdbeCode(Vdbe*,...);
int sqliteVdbeAddOpList(Vdbe*, int nOp, VdbeOpList 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);
VdbeOp *sqliteVdbeGetOp(Vdbe*, int);
int sqliteVdbeMakeLabel(Vdbe*);
void sqliteVdbeDelete(Vdbe*);
void sqliteVdbeMakeReady(Vdbe*,int,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);
int sqliteVdbeReset(Vdbe*,char **);
int sqliteVdbeSetVariables(Vdbe*,int,const char**);
#endif