aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest29
-rw-r--r--manifest.uuid2
-rw-r--r--src/main.c11
-rw-r--r--src/select.c14
-rw-r--r--src/sqlite.h.in4
-rw-r--r--src/sqliteInt.h5
-rw-r--r--src/test1.c20
-rw-r--r--src/tokenize.c8
-rw-r--r--src/util.c4
-rw-r--r--src/vdbe.c40
-rw-r--r--src/vdbe.h9
-rw-r--r--test/capi2.test108
12 files changed, 199 insertions, 55 deletions
diff --git a/manifest b/manifest
index 0f5340f67..611f847ef 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C First\scode\sfor\sthe\snew\scallback-free\sAPI.\s\sAll\sregression\stests\spass\sbut\sthe\nnew\sAPI\sis\smostly\suntested\sand\sis\sunlikely\sto\swork.\s(CVS\s852)
-D 2003-01-28T23:13:11
+C The\scallback-free\sAPI\sis\snow\sworking,\sthough\smuch\smore\stesting\sis\sneed.\s(CVS\s853)
+D 2003-01-29T14:06:08
F Makefile.in 6606854b1512f185b8e8c779b8d7fc2750463d64
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -29,7 +29,7 @@ F src/func.c 90c583f0b91220f7cd411a2407deaf9327245d63
F src/hash.c 4fc39feb7b7711f6495ee9f2159559bedb043e1f
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
F src/insert.c db954e955970795819145a3649fd2ad116a58890
-F src/main.c c58cdfb5f0c1938e78d47584e88799b77091700c
+F src/main.c f1c86161875337c6421cf988bf5595eda515851a
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
F src/os.c ed27e178e0c4b71f2807da81b8851f0fadc50778
F src/os.h afa3e096213bad86845f8bdca81a9e917505e401
@@ -38,23 +38,23 @@ F src/pager.h 540833e8cb826b80ce2e39aa917deee5e12db626
F src/parse.y aea0819c07ec9c81b810039df9be9d5705b1e497
F src/printf.c e8e9a0605602cb1a3a2dc754e0978fa9064ecee7
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
-F src/select.c c3c0b8263587d290592dca8b4371b5c1162ca684
+F src/select.c 13b8e5ea8aacaf204468518aed7b054a583f2f25
F src/shell.c cbb29252f0bd7b144d1e3126e64e17e5a314f2fd
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
-F src/sqlite.h.in ace5c971df379f07ade9ae4b2066cc18ee8b6cfa
-F src/sqliteInt.h 576855338db3e3673605bd08b32a5a8cb3f57cf8
+F src/sqlite.h.in 6f648803f2ffb9beb35cb1cfa42b323d55519171
+F src/sqliteInt.h d4d1eb361e2121d62ec320e53e32b42569b7613e
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
F src/tclsqlite.c 9f2c00a92338c51171ded8943bd42d77f7e69e64
-F src/test1.c c00a4e561287da1976149fe156748253bd8926e7
+F src/test1.c 2ef543e6e49329d5254c0ad4b09586a4eaad5ed4
F src/test2.c 03f05e984c8e2f2badc44644d42baf72b249096b
F src/test3.c c12ea7f1c3fbbd58904e81e6cb10ad424e6fc728
F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
-F src/tokenize.c 0ba74091f432b79687fc7fbecc9e9087bfb40a56
+F src/tokenize.c bc40937d6666f188037aa3e54f0a2661a6fef6d1
F src/trigger.c da142decd2808bc39e801f3bb1f161dbc2bd4005
F src/update.c f06afa9bf1f777d17702e0f6e33cf44c44bc4f75
-F src/util.c e23f8ffc654923e18f8db2d8e0de97c166fca20f
-F src/vdbe.c 899b59df8a6d91020c3d5c54a817fb669f98176b
-F src/vdbe.h 30b808a32f8d66e9948d0a9931f1e1037d2ec2ad
+F src/util.c 757875a366be838d96c09f255631596a2f558fca
+F src/vdbe.c a9dd0f68751587eeff81afb404f9f63e4ac6185a
+F src/vdbe.h 162071f1dd0b43236930712f4238c59a6a0de298
F src/where.c 5bf7f1e1d756ab3d25a18b24bb42106cb8e14d18
F test/all.test 873d30e25a41b3aa48fec5633a7ec1816e107029
F test/auth.test 95aeda24f76b6fd028bdb3d6ae1e30b153d942fe
@@ -64,6 +64,7 @@ F test/btree.test 10e75aec120ecefc0edc4c912a0980a43db1b6c2
F test/btree2.test e3b81ec33dc2f89b3e6087436dfe605b870c9080
F test/btree3.test e597fb59be2ac0ea69c62aaa2064e998e528b665
F test/btree4.test fa955a3d7a8bc91d6084b7f494f9e5d1bdfb15b6
+F test/capi2.test 158d76afd093d71b4aac860c0d12511706b1d8d0
F test/conflict.test 0173a12a257f73bac2c9d53ad44cac9b15ea517e
F test/copy.test 55d60a4d5ed342a0fa08b7cd07d46d43ea0d0d7f
F test/delete.test 5821a95a66061ae09723a88938f23d10d8a881ad
@@ -154,7 +155,7 @@ F www/speed.tcl 4d463e2aea41f688ed320a937f93ff885be918c3
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P c957f4f0c6b486f25bc567dafeed186f91c8c315
-R fba6d74be1d355dfd1b4bac9d5e01203
+P 065fa818ffc8d7562889172acea16e4e44e773ef
+R 0f5c157d8052fdb9f4b710d54301a2ba
U drh
-Z 6e26856c68db7a18e1f9ce32bbc7b32d
+Z b732b2962b2533af4ee430d0fd255a71
diff --git a/manifest.uuid b/manifest.uuid
index 85ce1efb5..841615f10 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-065fa818ffc8d7562889172acea16e4e44e773ef \ No newline at end of file
+162b259188e6967fe9c3722da26b81aab5655d83 \ No newline at end of file
diff --git a/src/main.c b/src/main.c
index 2be750bec..7b5c76e5e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.110 2003/01/28 23:13:12 drh Exp $
+** $Id: main.c,v 1.111 2003/01/29 14:06:08 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -622,8 +622,7 @@ static int sqliteMain(
sqliteSetString(pzErrMsg, "obsolete database file format", 0);
return SQLITE_ERROR;
}
- if( db->recursionDepth==0 ){ db->nChange = 0; }
- db->recursionDepth++;
+ if( db->pVdbe==0 ){ db->nChange = 0; }
memset(&sParse, 0, sizeof(sParse));
sParse.db = db;
sParse.pBe = db->pBe;
@@ -642,6 +641,7 @@ static int sqliteMain(
db->flags &= ~SQLITE_InTrans;
sqliteResetInternalSchema(db);
}
+ if( sParse.rc==SQLITE_DONE ) sParse.rc = SQLITE_OK;
if( sParse.rc!=SQLITE_OK && pzErrMsg && *pzErrMsg==0 ){
sqliteSetString(pzErrMsg, sqlite_error_string(sParse.rc), 0);
}
@@ -649,11 +649,10 @@ static int sqliteMain(
if( sParse.rc==SQLITE_SCHEMA ){
sqliteResetInternalSchema(db);
}
- db->recursionDepth--;
if( sParse.useCallback==0 ){
assert( ppVm );
- *ppVm = sParse.pVdbe;
- *pzTail = &sParse.sLastToken.z[sParse.sLastToken.n];
+ *ppVm = (sqlite_vm*)sParse.pVdbe;
+ *pzTail = sParse.zTail;
}
if( sqliteSafetyOff(db) ) goto exec_misuse;
return sParse.rc;
diff --git a/src/select.c b/src/select.c
index 29b1f9e3a..4998a5352 100644
--- a/src/select.c
+++ b/src/select.c
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
-** $Id: select.c,v 1.123 2003/01/19 03:59:47 drh Exp $
+** $Id: select.c,v 1.124 2003/01/29 14:06:09 drh Exp $
*/
#include "sqliteInt.h"
@@ -697,7 +697,9 @@ static void generateColumnTypes(
){
Vdbe *v = pParse->pVdbe;
int i;
- if( (pParse->db->flags & SQLITE_ReportTypes)==0 ) return;
+ if( pParse->useCallback && (pParse->db->flags & SQLITE_ReportTypes)==0 ){
+ return;
+ }
for(i=0; i<pEList->nExpr; i++){
Expr *p = pEList->a[i].pExpr;
char *zType = 0;
@@ -1456,7 +1458,9 @@ static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){
/* Issue a null callback if that is what the user wants.
*/
- if( (pParse->db->flags & SQLITE_NullCallback)!=0 && eDest==SRT_Callback ){
+ if( eDest==SRT_Callback &&
+ (pParse->useCallback==0 || (pParse->db->flags & SQLITE_NullCallback)!=0)
+ ){
sqliteVdbeAddOp(v, OP_NullCallback, p->pEList->nExpr, 0);
}
return 0;
@@ -2306,7 +2310,9 @@ int sqliteSelect(
/* Issue a null callback if that is what the user wants.
*/
- if( (pParse->db->flags & SQLITE_NullCallback)!=0 && eDest==SRT_Callback ){
+ if( eDest==SRT_Callback &&
+ (pParse->useCallback==0 || (pParse->db->flags & SQLITE_NullCallback)!=0)
+ ){
sqliteVdbeAddOp(v, OP_NullCallback, pEList->nExpr, 0);
}
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 1b1c52892..159045333 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -12,7 +12,7 @@
** This header file defines the interface that the SQLite library
** presents to client programs.
**
-** @(#) $Id: sqlite.h.in,v 1.40 2003/01/28 23:13:12 drh Exp $
+** @(#) $Id: sqlite.h.in,v 1.41 2003/01/29 14:06:09 drh Exp $
*/
#ifndef _SQLITE_H_
#define _SQLITE_H_
@@ -588,6 +588,8 @@ typedef struct sqlite_vm sqlite_vm;
**
** *ppVm is left pointing to a "virtual machine" that can be used to execute
** the compiled statement. Or if there is an error, *ppVm may be set to NULL.
+** If the input text contained no SQL (if the input is and empty string or
+** a comment) then *ppVm is set to NULL.
**
** If any errors are detected during compilation, an error message is written
** into space obtained from malloc() and *pzErrMsg is made to point to that
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 734eadd18..19cf9993e 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.157 2003/01/28 23:13:12 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.158 2003/01/29 14:06:09 drh Exp $
*/
#include "config.h"
#include "sqlite.h"
@@ -224,7 +224,7 @@ struct sqlite {
int onError; /* Default conflict algorithm */
int magic; /* Magic number for detect library misuse */
int nChange; /* Number of rows changed */
- int recursionDepth; /* Number of nested calls to sqlite_exec() */
+ struct Vdbe *pVdbe; /* List of active virtual machines */
#ifndef SQLITE_OMIT_TRACE
void (*xTrace)(void*,const char*); /* Trace function */
void *pTraceArg; /* Argument to the trace function */
@@ -737,6 +737,7 @@ struct Parse {
Token sErrToken; /* The token at which the error occurred */
Token sFirstToken; /* The first token parsed */
Token sLastToken; /* The last token parsed */
+ const char *zTail; /* All SQL text past the last semicolon parsed */
Table *pNewTable; /* A table being constructed by CREATE TABLE */
Vdbe *pVdbe; /* An engine for executing database bytecode */
u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
diff --git a/src/test1.c b/src/test1.c
index 434662a21..09d6c1953 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.17 2003/01/28 23:13:12 drh Exp $
+** $Id: test1.c,v 1.18 2003/01/29 14:06:09 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -733,8 +733,10 @@ static int test_compile(
sqlite_freemem(zErr);
return TCL_ERROR;
}
- sprintf(zBuf, "%p", vm);
- Tcl_AppendResult(interp, zBuf, 0);
+ if( vm ){
+ sprintf(zBuf, "%p", vm);
+ Tcl_AppendResult(interp, zBuf, 0);
+ }
Tcl_SetVar(interp, argv[3], zTail, 0);
return TCL_OK;
}
@@ -765,7 +767,7 @@ static int test_step(
}
if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR;
rc = sqlite_step(vm, &N, &azValue, &azColName);
- if( rc==SQLITE_DONE || SQLITE_ROW ){
+ if( rc==SQLITE_DONE || rc==SQLITE_ROW ){
sprintf(zBuf, "%d", N);
Tcl_SetVar(interp, argv[2], zBuf, 0);
Tcl_SetVar(interp, argv[3], "", 0);
@@ -777,15 +779,15 @@ static int test_step(
}
Tcl_SetVar(interp, argv[4], "", 0);
for(i=0; i<N*2; i++){
- Tcl_SetVar(interp, argv[4], azValue[i] ? azValue[i] : "",
+ Tcl_SetVar(interp, argv[4], azColName[i] ? azColName[i] : "",
TCL_APPEND_VALUE | TCL_LIST_ELEMENT);
}
}
switch( rc ){
case SQLITE_DONE: zRc = "SQLITE_DONE"; break;
- case SQLITE_BUSY: zRc = "SQLITE_DONE"; break;
- case SQLITE_ROW: zRc = "SQLITE_DONE"; break;
- case SQLITE_ERROR: zRc = "SQLITE_DONE"; break;
+ case SQLITE_BUSY: zRc = "SQLITE_BUSY"; break;
+ case SQLITE_ROW: zRc = "SQLITE_ROW"; break;
+ case SQLITE_ERROR: zRc = "SQLITE_ERROR"; break;
case SQLITE_MISUSE: zRc = "SQLITE_MISUSE"; break;
default: zRc = "unknown"; break;
}
@@ -809,7 +811,7 @@ static int test_finalize(
char *zErrMsg = 0;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
- " VM NVAR VALUEVAR COLNAMEVAR", 0);
+ " VM\"", 0);
return TCL_ERROR;
}
if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR;
diff --git a/src/tokenize.c b/src/tokenize.c
index df27fa732..7dd49b21a 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -15,7 +15,7 @@
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
-** $Id: tokenize.c,v 1.54 2003/01/28 23:13:12 drh Exp $
+** $Id: tokenize.c,v 1.55 2003/01/29 14:06:09 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -422,6 +422,7 @@ int sqliteRunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
return 1;
}
pParse->sLastToken.dyn = 0;
+ pParse->zTail = zSql;
while( sqlite_malloc_failed==0 && zSql[i]!=0 ){
assert( i>=0 );
@@ -445,6 +446,10 @@ int sqliteRunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
nErr++;
goto abort_parse;
}
+ case TK_SEMI: {
+ pParse->zTail = &zSql[i];
+ /* Fall thru into the default case */
+ }
default: {
sqliteParser(pEngine, tokenType, pParse->sLastToken, pParse);
lastTokenParsed = tokenType;
@@ -459,6 +464,7 @@ abort_parse:
if( zSql[i]==0 && nErr==0 && pParse->rc==SQLITE_OK ){
if( lastTokenParsed!=TK_SEMI ){
sqliteParser(pEngine, TK_SEMI, pParse->sLastToken, pParse);
+ pParse->zTail = &zSql[i];
}
sqliteParser(pEngine, 0, pParse->sLastToken, pParse);
}
diff --git a/src/util.c b/src/util.c
index f71950cef..26e7afcb2 100644
--- a/src/util.c
+++ b/src/util.c
@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
-** $Id: util.c,v 1.56 2003/01/14 00:44:09 drh Exp $
+** $Id: util.c,v 1.57 2003/01/29 14:06:09 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@@ -1196,7 +1196,7 @@ int sqliteSafetyOff(sqlite *db){
** at the wrong time or in the wrong sequence.
*/
int sqliteSafetyCheck(sqlite *db){
- if( db->recursionDepth ){
+ if( db->pVdbe!=0 ){
db->magic = SQLITE_MAGIC_ERROR;
return 1;
}
diff --git a/src/vdbe.c b/src/vdbe.c
index 0839b303b..c0ec8ac3f 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -36,7 +36,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.200 2003/01/28 23:13:12 drh Exp $
+** $Id: vdbe.c,v 1.201 2003/01/29 14:06:09 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -242,6 +242,7 @@ struct Keylist {
*/
struct Vdbe {
sqlite *db; /* The whole database */
+ Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
Btree *pBt; /* Opaque context structure used by DB backend */
FILE *trace; /* Write an execution trace here, if not NULL */
int nOp; /* Number of instructions in the program */
@@ -316,6 +317,12 @@ Vdbe *sqliteVdbeCreate(sqlite *db){
if( p==0 ) return 0;
p->pBt = db->pBe;
p->db = db;
+ if( db->pVdbe ){
+ db->pVdbe->pPrev = p;
+ }
+ p->pNext = db->pVdbe;
+ p->pPrev = 0;
+ db->pVdbe = p;
p->magic = VDBE_MAGIC_INIT;
return p;
}
@@ -763,17 +770,22 @@ int sqlite_step(
const char ***pazColName /* OUT: Column names and datatypes */
){
Vdbe *p = (Vdbe*)pVm;
+ sqlite *db;
int rc;
if( p->magic!=VDBE_MAGIC_RUN ){
return SQLITE_MISUSE;
}
+ db = p->db;
+ if( sqliteSafetyOn(db) ){
+ return SQLITE_MISUSE;
+ }
if( p->explain ){
rc = sqliteVdbeList(p);
}else{
rc = sqliteVdbeExec(p);
}
- if( rc!=SQLITE_DONE ){
+ if( rc==SQLITE_DONE || rc==SQLITE_ROW ){
*pazColName = (const char**)p->azColName;
*pN = p->nResColumn;
}else{
@@ -785,6 +797,9 @@ int sqlite_step(
}else{
*pazValue = 0;
}
+ if( sqliteSafetyOff(db) ){
+ return SQLITE_MISUSE;
+ }
return rc;
}
@@ -1191,6 +1206,16 @@ void sqliteVdbeDelete(Vdbe *p){
int i;
if( p==0 ) return;
Cleanup(p);
+ if( p->pPrev ){
+ p->pPrev->pNext = p->pNext;
+ }else{
+ assert( p->db->pVdbe==p );
+ p->db->pVdbe = p->pNext;
+ }
+ if( p->pNext ){
+ p->pNext->pPrev = p->pPrev;
+ }
+ p->pPrev = p->pNext = 0;
if( p->nOpAlloc==0 ){
p->aOp = 0;
p->nOp = 0;
@@ -1255,7 +1280,7 @@ int sqliteVdbeList(
p->pc = i+1;
p->azResColumn = p->zStack;
p->nResColumn = 5;
- return SQLITE_CALLBACK;
+ return SQLITE_ROW;
}
if( sqliteSafetyOff(db) ){
p->rc = SQLITE_MISUSE;
@@ -1453,7 +1478,7 @@ __inline__ unsigned long long int hwtime(void){
**
** The behavior of sqliteVdbeExec() is influenced by the parameters to
** this routine. If xCallback is NULL, then sqliteVdbeExec() will return
-** with SQLITE_CALLBACK whenever there is a row of the result set ready
+** with SQLITE_ROW whenever there is a row of the result set ready
** to be delivered. p->azResColumn will point to the row and
** p->nResColumn gives the number of columns in the row. If xCallback
** is not NULL, then the xCallback() routine is invoked to process each
@@ -1523,7 +1548,7 @@ void sqliteVdbeMakeReady(
**
** Whenever a row or result data is available, this routine will either
** invoke the result callback (if there is one) or return with
-** SQLITE_CALLBACK.
+** SQLITE_ROW.
**
** If an attempt is made to open a locked database, then this routine
** will either invoke the busy callback (if there is one) or it will
@@ -1887,7 +1912,7 @@ case OP_Callback: {
p->nResColumn = pOp->p1;
p->popStack = pOp->p1;
p->pc = pc + 1;
- return SQLITE_CALLBACK;
+ return SQLITE_ROW;
}
if( sqliteSafetyOff(db) ) goto abort_due_to_misuse;
if( p->xCallback(p->pCbArg, pOp->p1, &zStack[i], p->azColName)!=0 ){
@@ -1926,6 +1951,7 @@ case OP_NullCallback: {
p->nCallback++;
if( sqlite_malloc_failed ) goto no_mem;
}
+ p->nResColumn = pOp->p1;
break;
}
@@ -4843,7 +4869,7 @@ case OP_SortCallback: {
p->azResColumn = (char**)zStack[i];
p->nResColumn = pOp->p1;
p->popStack = 1;
- return SQLITE_CALLBACK;
+ return SQLITE_ROW;
}else{
if( sqliteSafetyOff(db) ) goto abort_due_to_misuse;
if( p->xCallback(p->pCbArg, pOp->p1, (char**)zStack[i], p->azColName)!=0 ){
diff --git a/src/vdbe.h b/src/vdbe.h
index 535b1e7d6..6a8e191f5 100644
--- a/src/vdbe.h
+++ b/src/vdbe.h
@@ -15,7 +15,7 @@
** 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.62 2003/01/28 23:13:13 drh Exp $
+** $Id: vdbe.h,v 1.63 2003/01/29 14:06:10 drh Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
@@ -63,13 +63,6 @@ typedef struct VdbeOp VdbeOp;
#define ADDR(X) (-1-(X))
/*
-** The sqliteVdbeExec() routine can return any of the normal SQLite return
-** codes defined in sqlite.h. But it can also return the following
-** additional values:
-*/
-#define SQLITE_CALLBACK 100 /* sqliteVdbeExec() hit an OP_Callback */
-
-/*
** 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.
*/
diff --git a/test/capi2.test b/test/capi2.test
new file mode 100644
index 000000000..47f411718
--- /dev/null
+++ b/test/capi2.test
@@ -0,0 +1,108 @@
+# 2003 January 29
+#
+# 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.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this script testing the callback-free C/C++ API.
+#
+# $Id: capi2.test,v 1.1 2003/01/29 14:06:10 drh Exp $
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# Check basic functionality
+#
+do_test capi2-1.1 {
+ db close
+ set ::DB [sqlite db test.db]
+ execsql {CREATE TABLE t1(a,b,c)}
+ set ::VM [sqlite_compile $::DB {SELECT name, rowid FROM sqlite_master} tail]
+ set tail
+} {}
+do_test capi2-1.2 {
+ sqlite_step $::VM ::N ::VALUES ::COLNAMES
+} {SQLITE_ROW}
+do_test capi2-1.3 {
+ set ::N
+} {2}
+do_test capi2-1.4 {
+ set ::VALUES
+} {t1 1}
+do_test capi2-1.5 {
+ set ::COLNAMES
+} {name rowid text INTEGER}
+do_test capi2-1.6 {
+ set ::N x
+ set ::VALUES y
+ set ::COLNAMES z
+ sqlite_step $::VM ::N ::VALUES ::COLNAMES
+} {SQLITE_DONE}
+do_test capi2-1.7 {
+ list $::N $::VALUES $::COLNAMES
+} {2 {} {name rowid text INTEGER}}
+do_test capi2-1.8 {
+ set ::N x
+ set ::VALUES y
+ set ::COLNAMES z
+ sqlite_step $::VM ::N ::VALUES ::COLNAMES
+} {SQLITE_MISUSE}
+do_test capi2-1.9 {
+ list $::N $::VALUES $::COLNAMES
+} {x y z}
+do_test capi2-1.10 {
+ sqlite_finalize $::VM
+} {}
+
+# Check to make sure that the "tail" of a multi-statement SQL script
+# is returned by sqlite_compile.
+#
+do_test capi2-2.1 {
+ set ::SQL {
+ SELECT name, rowid FROM sqlite_master;
+ SELECT name, rowid FROM sqlite_temp_master;
+ -- A comment at the end
+ }
+ set ::VM [sqlite_compile $::DB $::SQL ::SQL]
+ set ::SQL
+} {
+ SELECT name, rowid FROM sqlite_temp_master;
+ -- A comment at the end
+ }
+do_test capi2-2.2 {
+ set r [sqlite_step $::VM n val colname]
+ lappend r $n $val $colname
+} {SQLITE_ROW 2 {t1 1} {name rowid text INTEGER}}
+do_test capi2-2.3 {
+ set r [sqlite_step $::VM n val colname]
+ lappend r $n $val $colname
+} {SQLITE_DONE 2 {} {name rowid text INTEGER}}
+do_test capi2-2.4 {
+ sqlite_finalize $::VM
+} {}
+do_test capi2-2.5 {
+ set ::VM [sqlite_compile $::DB $::SQL ::SQL]
+ set ::SQL
+} {
+ -- A comment at the end
+ }
+do_test capi2-2.6 {
+ set r [sqlite_step $::VM n val colname]
+ lappend r $n $val $colname
+} {SQLITE_DONE 2 {} {name rowid text INTEGER}}
+do_test capi2-2.7 {
+ sqlite_finalize $::VM
+} {}
+do_test capi2-2.8 {
+ set ::VM [sqlite_compile $::DB $::SQL ::SQL]
+ list $::SQL $::VM
+} {{} {}}
+
+
+finish_test