-C More\schanges\sto\sdo\swith\sthe\snew\ssqlite3_step()\sAPI.\s(CVS\s1458)
-D 2004-05-26T00:07:25
+C Use\sthe\snew\sAPI\scalls\smore\sconsistently.\s(CVS\s1459)
+D 2004-05-26T02:04:57
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
F src/insert.c 48bb15bff280767684a0f9ee4ae5973c9504f880
-F src/legacy.c 706484c32e86b95d65aeb31f661c0e4a3649b862
-F src/main.c 843361d68f275bc9dd3494897a105b34ad80e019
+F src/legacy.c a856d2d5317ed2ac93c2c6cbba7d4faa564a5b20
+F src/main.c c9044ad6896e41aa9bab1957cfd4e9725e5efb01
F src/md5.c 32ec4d879e9b34d6a597ae8bda684d8e395003f4
F src/os.h ab42f4a7c4c716f26b988e759b6e12085a3bfc67
F src/os_common.h 744286a27de55c52f1b18921e8d17abbf7fafc0f
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
F src/select.c 867cab23c0577d4ac0510c925a85b8e032cfe139
F src/shell.c ed4d237b3e52a0a42512bfcc53530e46de20c28f
-F src/sqlite.h.in 532e8b3b4a266ab5d7245a8ca3173fdd10f4a89f
+F src/sqlite.h.in a9d71fd4f781cc61e586b8eabed4d271d88e31c2
F src/sqliteInt.h 6559811caeae0d1855e0b973e363a8c5141e566b
F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2
-F src/tclsqlite.c 0b62e8df6da5abdddf49f3d9274a8103ee61fb63
-F src/test1.c 616c288a49b48facb54b9a925aeede1ba4093d8c
+F src/tclsqlite.c a125a8b99d427e132cb6e728cf9310f6554b410b
+F src/test1.c a9f40903f6a14150ca1201da492d4f5a652a1c0c
F src/test2.c 6195a1ca2c8d0d2d93644e86da3289b403486872
F src/test3.c 5e4a6d596f982f6f47a5f9f75ede9b4a3b739968
-F src/test4.c b9947c319a5c023c10c1e953e6610abd571c2283
+F src/test4.c 014478492bddb3f9b4a3151b05f9ac708fe279fb
F src/test5.c 9a1f15133f6955f067c5246e564723b5f23ff221
F src/tokenize.c e7536dd31205d5afb76c1bdc832dea009c7a3847
F src/trigger.c 11afe9abfba13a2ba142944c797c952e162d117f
F src/utf.c 1d38da85bffb928fb0d9f301e7db913a6df486ce
F src/util.c 4c0adcbc9ce6678dd046931253e45d623c6d279f
F src/vacuum.c 8734f89742f246abd91dbd3e087fc153bddbfbad
-F src/vdbe.c 7f41e2f73dcca885618b9baec0ffea9f8b0714aa
+F src/vdbe.c 0c10b0036444f99eb625c6a003d007e3043187ef
F src/vdbe.h ebd59ee7a988d39c58b27149593f09a432ad1410
-F src/vdbeInt.h e500998a0ab3b10850c771c60d6b132037ff56e7
-F src/vdbeaux.c b2527b7ce884c2c1dc102d48a07c6327f8eac3c2
+F src/vdbeInt.h c8706615ad49c7a5292daa31425dd1b0b24b3b9b
+F src/vdbeaux.c a792ac602eb81c15ebdea64931bd3fad85b025f2
F src/where.c efe5d25fe18cd7381722457898cd863e84097a0c
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P 143c502a59e727975f61c8d13b6c5a90dad038f3
-R aab0f00d021548c4204f1bc870566ab7
+P e83138250ce0a8caacbd1822eec2e06796d2f5f2
+R 2d9cfc7b0183db7d18c182936822729e
U danielk1977
-Z 3b5c9e0de208be70045790485a870245
+Z a8211c11f21dbceb0c77c5b2788c41e4
-e83138250ce0a8caacbd1822eec2e06796d2f5f2
\ No newline at end of file
+17e7db488dac6b30d174f2272edf1046c2bb9990
\ No newline at end of file
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: legacy.c,v 1.1 2004/05/26 00:01:35 danielk1977 Exp $
+** $Id: legacy.c,v 1.2 2004/05/26 02:04:57 danielk1977 Exp $
*/
#include "sqliteInt.h"
pStmt = 0;
rc = sqlite3_prepare(db, zSql, -1, &pStmt, &zLeftover);
if( rc!=SQLITE_OK ){
- if( pStmt ) sqlite3_finalize_new(pStmt);
+ if( pStmt ) sqlite3_finalize(pStmt);
continue;
}
if( !pStmt ){
}
if( rc!=SQLITE_ROW ){
- rc = sqlite3_finalize_new(pStmt);
+ rc = sqlite3_finalize(pStmt);
pStmt = 0;
if( db->pVdbe==0 ){
nChange = db->nChange;
}
exec_out:
- if( pStmt ) sqlite3_finalize_new(pStmt);
+ if( pStmt ) sqlite3_finalize(pStmt);
if( azCols ) sqliteFree(azCols);
if( rc!=SQLITE_OK && rc==sqlite3_errcode(db) && pzErrMsg ){
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.189 2004/05/25 23:35:18 danielk1977 Exp $
+** $Id: main.c,v 1.190 2004/05/26 02:04:57 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
/* sqlite3RollbackInternalChanges(db); */
}
-/*
-** Compile a single statement of SQL into a virtual machine. Return one
-** of the SQLITE_ success/failure codes. Also write an error message into
-** memory obtained from malloc() and make *pzErrMsg point to that message.
-*/
-int sqlite3_compile(
- sqlite *db, /* The database on which the SQL executes */
- const char *zSql, /* The SQL to be executed */
- const char **pzTail, /* OUT: Next statement after the first */
- sqlite_vm **ppVm, /* OUT: The virtual machine */
- char **pzErrMsg /* OUT: Write error messages here */
-){
- Parse sParse;
-
- if( pzErrMsg ) *pzErrMsg = 0;
- if( sqlite3SafetyOn(db) ) goto exec_misuse;
- if( !db->init.busy ){
- if( (db->flags & SQLITE_Initialized)==0 ){
- int rc, cnt = 1;
- while( (rc = sqlite3Init(db, pzErrMsg))==SQLITE_BUSY
- && db->xBusyCallback
- && db->xBusyCallback(db->pBusyArg, "", cnt++)!=0 ){}
- if( rc!=SQLITE_OK ){
- sqlite3StrRealloc(pzErrMsg);
- sqlite3SafetyOff(db);
- return rc;
- }
- if( pzErrMsg ){
- sqliteFree(*pzErrMsg);
- *pzErrMsg = 0;
- }
- }
- }
- assert( (db->flags & SQLITE_Initialized)!=0 || db->init.busy );
- if( db->pVdbe==0 ){ db->nChange = 0; }
- memset(&sParse, 0, sizeof(sParse));
- sParse.db = db;
- sqlite3RunParser(&sParse, zSql, pzErrMsg);
- if( db->xTrace && !db->init.busy ){
- /* Trace only the statment that was compiled.
- ** Make a copy of that part of the SQL string since zSQL is const
- ** and we must pass a zero terminated string to the trace function
- ** The copy is unnecessary if the tail pointer is pointing at the
- ** beginnig or end of the SQL string.
- */
- if( sParse.zTail && sParse.zTail!=zSql && *sParse.zTail ){
- char *tmpSql = sqliteStrNDup(zSql, sParse.zTail - zSql);
- if( tmpSql ){
- db->xTrace(db->pTraceArg, tmpSql);
- free(tmpSql);
- }else{
- /* If a memory error occurred during the copy,
- ** trace entire SQL string and fall through to the
- ** sqlite3_malloc_failed test to report the error.
- */
- db->xTrace(db->pTraceArg, zSql);
- }
- }else{
- db->xTrace(db->pTraceArg, zSql);
- }
- }
- if( sqlite3_malloc_failed ){
- sqlite3SetString(pzErrMsg, "out of memory", (char*)0);
- sParse.rc = SQLITE_NOMEM;
- sqlite3RollbackAll(db);
- sqlite3ResetInternalSchema(db, 0);
- db->flags &= ~SQLITE_InTrans;
- }
- if( sParse.rc==SQLITE_DONE ) sParse.rc = SQLITE_OK;
- if( sParse.rc!=SQLITE_OK && pzErrMsg && *pzErrMsg==0 ){
- sqlite3SetString(pzErrMsg, sqlite3_error_string(sParse.rc), (char*)0);
- }
- sqlite3StrRealloc(pzErrMsg);
- if( sParse.rc==SQLITE_SCHEMA ){
- sqlite3ResetInternalSchema(db, 0);
- }
- assert( ppVm );
- *ppVm = (sqlite_vm*)sParse.pVdbe;
- if( pzTail ) *pzTail = sParse.zTail;
- if( sqlite3SafetyOff(db) ) goto exec_misuse;
- return sParse.rc;
-
-exec_misuse:
- if( pzErrMsg ){
- *pzErrMsg = 0;
- sqlite3SetString(pzErrMsg, sqlite3_error_string(SQLITE_MISUSE), (char*)0);
- sqlite3StrRealloc(pzErrMsg);
- }
- return SQLITE_MISUSE;
-}
-
-
-/*
-** The following routine destroys a virtual machine that is created by
-** the sqlite3_compile() routine.
-**
-** The integer returned is an SQLITE_ success/failure code that describes
-** the result of executing the virtual machine. An error message is
-** written into memory obtained from malloc and *pzErrMsg is made to
-** point to that error if pzErrMsg is not NULL. The calling routine
-** should use sqlite3_freemem() to delete the message when it has finished
-** with it.
-*/
-int sqlite3_finalize(
- sqlite_vm *pVm, /* The virtual machine to be destroyed */
- char **pzErrMsg /* OUT: Write error messages here */
-){
- int rc = sqlite3VdbeFinalize((Vdbe*)pVm, pzErrMsg);
- sqlite3StrRealloc(pzErrMsg);
- return rc;
-}
-
-/*
-** Terminate the current execution of a virtual machine then
-** reset the virtual machine back to its starting state so that it
-** can be reused. Any error message resulting from the prior execution
-** is written into *pzErrMsg. A success code from the prior execution
-** is returned.
-*/
-int sqlite3_reset(
- sqlite_vm *pVm, /* The virtual machine to be destroyed */
- char **pzErrMsg /* OUT: Write error messages here */
-){
- int rc = sqlite3VdbeReset((Vdbe*)pVm, pzErrMsg);
- sqlite3VdbeMakeReady((Vdbe*)pVm, -1, 0);
- sqlite3StrRealloc(pzErrMsg);
- return rc;
-}
-
/*
** Return a static string that describes the kind of error specified in the
** argument.
** This routine sets the error code and string returned by
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
*/
-int sqlite3_finalize_new(sqlite3_stmt *pStmt){
+int sqlite3_finalize(sqlite3_stmt *pStmt){
return sqlite3VdbeFinalize((Vdbe*)pStmt, 0);
}
** This routine sets the error code and string returned by
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
*/
-int sqlite3_reset_new(sqlite3_stmt *pStmt){
+int sqlite3_reset(sqlite3_stmt *pStmt){
int rc = sqlite3VdbeReset((Vdbe*)pStmt, 0);
sqlite3VdbeMakeReady((Vdbe*)pStmt, -1, 0);
return rc;
** This header file defines the interface that the SQLite library
** presents to client programs.
**
-** @(#) $Id: sqlite.h.in,v 1.78 2004/05/26 00:07:25 danielk1977 Exp $
+** @(#) $Id: sqlite.h.in,v 1.79 2004/05/26 02:04:57 danielk1977 Exp $
*/
#ifndef _SQLITE_H_
#define _SQLITE_H_
*/
void *sqlite3_trace(sqlite*, void(*xTrace)(void*,const char*), void*);
-/*** The Callback-Free API
-**
-** The following routines implement a new way to access SQLite that does not
-** involve the use of callbacks.
-**
-** An sqlite_vm is an opaque object that represents a single SQL statement
-** that is ready to be executed.
-*/
-typedef struct sqlite_vm sqlite_vm;
-
-/*
-** To execute an SQLite query without the use of callbacks, you first have
-** to compile the SQL using this routine. The 1st parameter "db" is a pointer
-** to an sqlite object obtained from sqlite3_open(). The 2nd parameter
-** "zSql" is the text of the SQL to be compiled. The remaining parameters
-** are all outputs.
-**
-** *pzTail is made to point to the first character past the end of the first
-** SQL statement in zSql. This routine only compiles the first statement
-** in zSql, so *pzTail is left pointing to what remains uncompiled.
-**
-** *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
-** error message. The calling routine is responsible for freeing the text
-** of this message when it has finished with it. Use sqlite3_freemem() to
-** free the message. pzErrMsg may be NULL in which case no error message
-** will be generated.
-**
-** On success, SQLITE_OK is returned. Otherwise and error code is returned.
-*/
-int sqlite3_compile(
- sqlite *db, /* The open database */
- const char *zSql, /* SQL statement to be compiled */
- const char **pzTail, /* OUT: uncompiled tail of zSql */
- sqlite_vm **ppVm, /* OUT: the virtual machine to execute zSql */
- char **pzErrmsg /* OUT: Error message. */
-);
-
-/*
-** This routine is called to delete a virtual machine after it has finished
-** executing. The return value is the result code. SQLITE_OK is returned
-** if the statement executed successfully and some other value is returned if
-** there was any kind of error. If an error occurred and pzErrMsg is not
-** NULL, then an error message is written into memory obtained from malloc()
-** and *pzErrMsg is made to point to that error message. The calling routine
-** should use sqlite3_freemem() to delete this message when it has finished
-** with it.
-**
-** This routine can be called at any point during the execution of the
-** virtual machine. If the virtual machine has not completed execution
-** when this routine is called, that is like encountering an error or
-** an interrupt. (See sqlite3_interrupt().) Incomplete updates may be
-** rolled back and transactions cancelled, depending on the circumstances,
-** and the result code returned will be SQLITE_ABORT.
-*/
-int sqlite3_finalize(sqlite_vm*, char **pzErrMsg);
-
-/*
-** This routine deletes the virtual machine, writes any error message to
-** *pzErrMsg and returns an SQLite return code in the same way as the
-** sqlite3_finalize() function.
-**
-** Additionally, if ppVm is not NULL, *ppVm is left pointing to a new virtual
-** machine loaded with the compiled version of the original query ready for
-** execution.
-**
-** If sqlite3_reset() returns SQLITE_SCHEMA, then *ppVm is set to NULL.
-**
-******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
-*/
-int sqlite3_reset(sqlite_vm*, char **pzErrMsg);
-
-/*
-** If the SQL that was handed to sqlite3_prepare contains variables that
-** are represeted in the SQL text by a question mark ('?'). This routine
-** is used to assign values to those variables.
-**
-** The first parameter is a virtual machine obtained from sqlite3_prepare().
-** The 2nd "idx" parameter determines which variable in the SQL statement
-** to bind the value to. The left most '?' is 1. The 3rd parameter is
-** the value to assign to that variable. The 4th parameter is the number
-** of bytes in the value, including the terminating \000 for strings.
-** Finally, the 5th "copy" parameter is TRUE if SQLite should make its
-** own private copy of this value, or false if the space that the 3rd
-** parameter points to will be unchanging and can be used directly by
-** SQLite.
-**
-** Unbound variables are treated as having a value of NULL. To explicitly
-** set a variable to NULL, call this routine with the 3rd parameter as a
-** NULL pointer.
-**
-** If the 4th "len" parameter is -1, then strlen() is used to find the
-** length.
-**
-** This routine can only be called immediately after sqlite3_prepare()
-** or sqlite3_reset() and before any calls to sqlite3_step().
-**
-******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
-*/
-int sqlite3_bind(sqlite_vm*, int idx, const char *value, int len, int copy);
-
/*
** This routine configures a callback function - the progress callback - that
** is invoked periodically during long running calls to sqlite3_exec(),
** in less than N opcodes being executed, then the progress callback is not
** invoked.
**
-** Calling this routine overwrites any previously installed progress callback.
** To remove the progress callback altogether, pass NULL as the third
** argument to this function.
**
int sqlite_decode_binary(const unsigned char *in, unsigned char *out);
-/* FIX ME */
-typedef sqlite_vm sqlite3_stmt;
typedef sqlite sqlite3;
+typedef struct sqlite3_stmt sqlite3_stmt;
+
/*
** This routine is used to bind a 32-bit integer value to a variable
** in an SQL statement compiled by sqlite3_prepare(). See comments for
** or sqlite3_prepare16(). If the statement was executed successfully, or
** not executed at all, then SQLITE_OK is returned. If execution of the
** statement failed then an error code is returned.
+**
+** This routine can be called at any point during the execution of the
+** virtual machine. If the virtual machine has not completed execution
+** when this routine is called, that is like encountering an error or
+** an interrupt. (See sqlite3_interrupt().) Incomplete updates may be
+** rolled back and transactions cancelled, depending on the circumstances,
+** and the result code returned will be SQLITE_ABORT.
*/
-int sqlite3_finalize_new(sqlite3_stmt *pStmt);
+int sqlite3_finalize(sqlite3_stmt *pStmt);
/*
** The sqlite3_reset() function is called to reset a compiled SQL
** Any SQL statement variables that had values bound to them using
** the sqlite3_bind_*() API retain their values.
*/
-int sqlite3_reset_new(sqlite3_stmt *pStmt);
+int sqlite3_reset(sqlite3_stmt *pStmt);
/*
** Open the sqlite database file "filename", where "filename" is UTF-8
*************************************************************************
** A TCL Interface to SQLite
**
-** $Id: tclsqlite.c,v 1.69 2004/05/25 12:05:57 danielk1977 Exp $
+** $Id: tclsqlite.c,v 1.70 2004/05/26 02:04:57 danielk1977 Exp $
*/
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
Sqlitetest1_Init(interp);
Sqlitetest2_Init(interp);
Sqlitetest3_Init(interp);
-/* Sqlitetest4_Init(interp); */
+ Sqlitetest4_Init(interp);
Sqlitetest5_Init(interp);
Md5_Init(interp);
}
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.53 2004/05/26 00:07:26 danielk1977 Exp $
+** $Id: test1.c,v 1.54 2004/05/26 02:04:57 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
return TCL_OK;
}
-/*
-** Decode a pointer to an sqlite_vm object.
-*/
-static int getVmPointer(Tcl_Interp *interp, const char *zArg, sqlite_vm **ppVm){
- if( sscanf(zArg, PTR_FMT, (void**)ppVm)!=1 ){
- Tcl_AppendResult(interp, "\"", zArg, "\" is not a valid pointer value", 0);
- return TCL_ERROR;
- }
- return TCL_OK;
-}
-
/*
** Decode a pointer to an sqlite3_stmt object.
*/
if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
- rc = sqlite3_finalize_new(pStmt);
+ rc = sqlite3_finalize(pStmt);
if( rc ){
return TCL_ERROR;
}
if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
- rc = sqlite3_reset_new(pStmt);
+ rc = sqlite3_reset(pStmt);
if( rc ){
return TCL_ERROR;
}
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
- sqlite_vm *vm;
+ sqlite3_stmt *pStmt;
int rc;
int idx;
if( argc!=5 ){
" VM IDX VALUE (null|static|normal)\"", 0);
return TCL_ERROR;
}
- if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR;
+ if( getStmtPointer(interp, argv[1], &pStmt) ) return TCL_ERROR;
if( Tcl_GetInt(interp, argv[2], &idx) ) return TCL_ERROR;
if( strcmp(argv[4],"null")==0 ){
- rc = sqlite3_bind(vm, idx, 0, 0, 0);
+ rc = sqlite3_bind_null(pStmt, idx);
}else if( strcmp(argv[4],"static")==0 ){
- rc = sqlite3_bind(vm, idx, sqlite_static_bind_value, -1, 0);
+ rc = sqlite3_bind_text(pStmt, idx, sqlite_static_bind_value, -1, 0);
}else if( strcmp(argv[4],"normal")==0 ){
- rc = sqlite3_bind(vm, idx, argv[3], -1, 1);
+ rc = sqlite3_bind_text(pStmt, idx, argv[3], -1, 1);
}else{
Tcl_AppendResult(interp, "4th argument should be "
"\"null\" or \"static\" or \"normal\"", 0);
*************************************************************************
** Code for testing the the SQLite library in a multithreaded environment.
**
-** $Id: test4.c,v 1.6 2004/05/22 09:21:21 danielk1977 Exp $
+** $Id: test4.c,v 1.7 2004/05/26 02:04:57 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
+#include "os.h"
#if defined(OS_UNIX) && OS_UNIX==1 && defined(THREADSAFE) && THREADSAFE==1
#include <stdlib.h>
#include <string.h>
** master. */
int completed; /* Number of operations completed */
sqlite *db; /* Open database */
- sqlite_vm *vm; /* Pending operation */
+ sqlite3_stmt *pStmt; /* Pending operation */
char *zErr; /* operation error */
char *zStaticErr; /* Static error message */
int rc; /* operation return code */
int argc; /* number of columns in result */
- const char **argv; /* result columns */
- const char **colv; /* result column names */
+ const char *argv[100]; /* result columns */
+ const char *colv[100]; /* result column names */
};
/*
sqlite3_close(p->db);
p->db = 0;
}
- p->vm = 0;
+ p->pStmt = 0;
p->completed = 1;
while( p->opnum<=p->completed ) sched_yield();
while( p->xOp ){
p->completed++;
while( p->opnum<=p->completed ) sched_yield();
}
- if( p->vm ){
- sqlite3_finalize(p->vm, 0);
- p->vm = 0;
+ if( p->pStmt ){
+ sqlite3_finalize(p->pStmt);
+ p->pStmt = 0;
}
if( p->db ){
sqlite3_close(p->db);
p->rc = SQLITE_ERROR;
return;
}
- if( p->vm ){
- sqlite3_finalize(p->vm, 0);
- p->vm = 0;
+ if( p->pStmt ){
+ sqlite3_finalize(p->pStmt);
+ p->pStmt = 0;
}
- p->rc = sqlite3_compile(p->db, p->zArg, 0, &p->vm, &p->zErr);
+ p->rc = sqlite3_prepare(p->db, p->zArg, -1, &p->pStmt, 0);
}
/*
** This procedure runs in the thread to step the virtual machine.
*/
static void do_step(Thread *p){
- if( p->vm==0 ){
+ int i;
+ if( p->pStmt==0 ){
p->zErr = p->zStaticErr = "no virtual machine available";
p->rc = SQLITE_ERROR;
return;
}
- p->rc = sqlite3_step(p->vm, &p->argc, &p->argv, &p->colv);
+ p->rc = sqlite3_step(p->pStmt);
+ if( p->rc==SQLITE_ROW ){
+ p->argc = sqlite3_column_count(p->pStmt);
+ for(i=0; i<sqlite3_data_count(p->pStmt); i++){
+ p->argv[i] = sqlite3_column_data(p->pStmt, i);
+ }
+ for(i=0; i<p->argc; i++){
+ p->colv[i] = sqlite3_column_name(p->pStmt, i);
+ }
+ }
}
/*
** This procedure runs in the thread to finalize a virtual machine.
*/
static void do_finalize(Thread *p){
- if( p->vm==0 ){
+ if( p->pStmt==0 ){
p->zErr = p->zStaticErr = "no virtual machine available";
p->rc = SQLITE_ERROR;
return;
}
- p->rc = sqlite3_finalize(p->vm, &p->zErr);
- p->vm = 0;
+ p->rc = sqlite3_finalize(p->pStmt);
+ p->pStmt = 0;
}
/*
** VDBE instances. This file is solely interested in executing
** the VDBE program.
**
-** In the external interface, an "sqlite_vm*" is an opaque pointer
+** In the external interface, an "sqlite3_stmt*" is an opaque pointer
** to a VDBE.
**
** The SQL parser generates a program which is then executed by
** 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.330 2004/05/26 00:07:26 danielk1977 Exp $
+** $Id: vdbe.c,v 1.331 2004/05/26 02:04:58 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
** An instance of the virtual machine. This structure contains the complete
** state of the virtual machine.
**
-** The "sqlite_vm" structure pointer that is returned by sqlite3_compile()
+** The "sqlite3_stmt" structure pointer that is returned by sqlite3_compile()
** is really a pointer to an instance of this structure.
*/
struct Vdbe {
**
*************************************************************************
** This file contains code used for creating, destroying, and populating
-** a VDBE (or an "sqlite_vm" as it is known to the outside world.) Prior
+** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) Prior
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
*/
return rc;
}
-/*
-** Set the values of all variables. Variable $1 in the original SQL will
-** be the string azValue[0]. $2 will have the value azValue[1]. And
-** so forth. If a value is out of range (for example $3 when nValue==2)
-** then its value will be NULL.
-**
-** This routine overrides any prior call.
-*/
-int sqlite3_bind(sqlite_vm *pVm, int i, const char *zVal, int len, int copy){
- return sqlite3_bind_text(pVm, i, zVal, len, copy);
-}
-
/*
** Delete an entire VDBE.
*/