#
#
# patch "ChangeLog"
# from [7e3f2af89ea9ec553866e68fbfa20bbdae260af4]
# to [160712b2d9190a93bd87608f7008bbb4ec1042fc]
#
# patch "sqlite/btree.c"
# from [3d1fd3a87683ecd195c72f757faf3fbb960b2f29]
# to [6837dcc4da8677e695a49fcc4505418ff1e0fc54]
#
# patch "sqlite/date.c"
# from [9602457c49210f77f860d1919a8249a3118cd43f]
# to [393c73fc027597e008dcd81454544659e978b05c]
#
# patch "sqlite/os_win.c"
# from [92df146ed964401969831a19bb490d76ce4de4c0]
# to [8999403beb4b442393b59723b3d54da0ee7d343b]
#
# patch "sqlite/pager.c"
# from [1e9580475b4a858a923930473d59263067bf4bfc]
# to [d6ad66eb119602cb2e6a097f8f635372ba677d23]
#
# patch "sqlite/pragma.c"
# from [d0891d3504b6291b506a5ec2226bbf79ffcef003]
# to [fd4df6cf0857dd78a7cb5be5f9805419b53ae7a0]
#
# patch "sqlite/prepare.c"
# from [f4f45b4560defbb566cf8255763625d2c09a8023]
# to [484389c6811415b8f23d259ac9c029613e1c72c3]
#
# patch "sqlite/random.c"
# from [d40f8d356cecbd351ccfab6eaedd7ec1b54f5261]
# to [6119474a6f6917f708c1dee25b9a8e519a620e88]
#
# patch "sqlite/sqlite3.h"
# from [9d3ddb04e2bb107eac50266b2dafcf27a03ec5c1]
# to [bda6b4bcb2d58bd9485bae930c5e692fe9bf4098]
#
# patch "sqlite/sqlite3ext.h"
# from [2c2156cc32a158e2b7bd9042d42accf94bff2e40]
# to [011c75fd6459a61454514af07c7a4f1f5c767f27]
#
# patch "sqlite/vdbe.c"
# from [180ea84f8087d4b56ccc4c4d496d4558cfaf4450]
# to [074cda811466f8f752c2dd71b1dcaea001f4be64]
#
# patch "sqlite/vdbe.h"
# from [9720cae673359dc2bdcb106285ecf686b7d3ef24]
# to [0025259af1939fb264a545816c69e4b5b8d52691]
#
# patch "sqlite/vdbeaux.c"
# from [05cc6f0f82b86dfb4c356e06ab07ec8cc83a2eda]
# to [c5324d62f51529bccc5be3b04bac2e4eeae1569a]
#
# patch "sqlite/vtab.c"
# from [aa30e940058ea56a1b7a9a7019ec21d307316fb4]
# to [7fbda947e28cbe7adb3ba752a76ca9ef29936750]
#
============================================================
--- ChangeLog 7e3f2af89ea9ec553866e68fbfa20bbdae260af4
+++ ChangeLog 160712b2d9190a93bd87608f7008bbb4ec1042fc
@@ -1,3 +1,7 @@
+2007-01-14 Matthew Gregan
+
+ * sqlite/*: Import SQLite 3.3.10.
+
2007-01-13 Zack Weinberg
* schema_migration.cc (sql::exec): Process an entire sequence of
============================================================
--- sqlite/btree.c 3d1fd3a87683ecd195c72f757faf3fbb960b2f29
+++ sqlite/btree.c 6837dcc4da8677e695a49fcc4505418ff1e0fc54
@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.332 2006/12/18 18:34:51 drh Exp $
+** $Id: btree.c,v 1.333 2007/01/05 02:00:47 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
============================================================
--- sqlite/date.c 9602457c49210f77f860d1919a8249a3118cd43f
+++ sqlite/date.c 393c73fc027597e008dcd81454544659e978b05c
@@ -16,7 +16,7 @@
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: date.c,v 1.58 2006/09/25 18:05:04 drh Exp $
+** $Id: date.c,v 1.60 2007/01/08 16:19:07 drh Exp $
**
** NOTES:
**
@@ -840,7 +840,7 @@ static void strftimeFunc(
y.M = 1;
y.D = 1;
computeJD(&y);
- nDay = x.rJD - y.rJD;
+ nDay = x.rJD - y.rJD + 0.5;
if( zFmt[i]=='W' ){
int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */
wd = ((int)(x.rJD+0.5)) % 7;
@@ -860,7 +860,7 @@ static void strftimeFunc(
j += strlen(&z[j]);
break;
}
- case 'S': sprintf(&z[j],"%02d",(int)(x.s+0.5)); j+=2; break;
+ case 'S': sprintf(&z[j],"%02d",(int)x.s); j+=2; break;
case 'w': z[j++] = (((int)(x.rJD+1.5)) % 7) + '0'; break;
case 'Y': sprintf(&z[j],"%04d",x.Y); j+=strlen(&z[j]); break;
case '%': z[j++] = '%'; break;
============================================================
--- sqlite/os_win.c 92df146ed964401969831a19bb490d76ce4de4c0
+++ sqlite/os_win.c 8999403beb4b442393b59723b3d54da0ee7d343b
@@ -1000,15 +1000,13 @@ static int winRead(OsFile *id, void *pBu
static int winRead(OsFile *id, void *pBuf, int amt){
DWORD got;
assert( id!=0 );
- SimulateIOError(return SQLITE_IOERR);
+ SimulateIOError(return SQLITE_IOERR_READ);
TRACE3("READ %d lock=%d\n", ((winFile*)id)->h, ((winFile*)id)->locktype);
if( !ReadFile(((winFile*)id)->h, pBuf, amt, &got, 0) ){
- got = -1;
+ return SQLITE_IOERR_READ;
}
if( got==(DWORD)amt ){
return SQLITE_OK;
- }else if( got<0 ){
- return SQLITE_IOERR_READ;
}else{
memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ;
@@ -1023,7 +1021,7 @@ static int winWrite(OsFile *id, const vo
int rc = 0;
DWORD wrote;
assert( id!=0 );
- SimulateIOError(return SQLITE_IOERR);
+ SimulateIOError(return SQLITE_IOERR_READ);
SimulateDiskfullError(return SQLITE_FULL);
TRACE3("WRITE %d lock=%d\n", ((winFile*)id)->h, ((winFile*)id)->locktype);
assert( amt>0 );
@@ -1083,7 +1081,7 @@ int sqlite3WinSyncDirectory(const char *
** than UNIX.
*/
int sqlite3WinSyncDirectory(const char *zDirname){
- SimulateIOError(return SQLITE_IOERR);
+ SimulateIOError(return SQLITE_IOERR_READ);
return SQLITE_OK;
}
@@ -1094,7 +1092,7 @@ static int winTruncate(OsFile *id, i64 n
LONG upperBits = nByte>>32;
assert( id!=0 );
TRACE3("TRUNCATE %d %lld\n", ((winFile*)id)->h, nByte);
- SimulateIOError(return SQLITE_IOERR);
+ SimulateIOError(return SQLITE_IOERR_TRUNCATE);
SetFilePointer(((winFile*)id)->h, nByte, &upperBits, FILE_BEGIN);
SetEndOfFile(((winFile*)id)->h);
return SQLITE_OK;
@@ -1106,7 +1104,7 @@ static int winFileSize(OsFile *id, i64 *
static int winFileSize(OsFile *id, i64 *pSize){
DWORD upperBits, lowerBits;
assert( id!=0 );
- SimulateIOError(return SQLITE_IOERR);
+ SimulateIOError(return SQLITE_IOERR_FSTAT);
lowerBits = GetFileSize(((winFile*)id)->h, &upperBits);
*pSize = (((i64)upperBits)<<32) + lowerBits;
return SQLITE_OK;
@@ -1367,7 +1365,7 @@ static int winUnlock(OsFile *id, int loc
if( locktype==SHARED_LOCK && !getReadLock(pFile) ){
/* This should never happen. We should always be able to
** reacquire the read lock */
- rc = SQLITE_IOERR;
+ rc = SQLITE_IOERR_UNLOCK;
}
}
if( type>=RESERVED_LOCK ){
@@ -1405,26 +1403,26 @@ char *sqlite3WinFullPathname(const char
void *zConverted;
zConverted = convertUtf8Filename(zRelative);
if( isNT() ){
- WCHAR *zTemp, *zNotUsedW;
- nByte = GetFullPathNameW((WCHAR*)zConverted, 0, 0, &zNotUsedW) + 1;
+ WCHAR *zTemp;
+ nByte = GetFullPathNameW((WCHAR*)zConverted, 0, 0, 0) + 3;
zTemp = sqliteMalloc( nByte*sizeof(zTemp[0]) );
if( zTemp==0 ){
sqliteFree(zConverted);
return 0;
}
- GetFullPathNameW((WCHAR*)zConverted, nByte, zTemp, &zNotUsedW);
+ GetFullPathNameW((WCHAR*)zConverted, nByte, zTemp, 0);
sqliteFree(zConverted);
zFull = unicodeToUtf8(zTemp);
sqliteFree(zTemp);
}else{
- char *zTemp, *zNotUsed;
- nByte = GetFullPathNameA((char*)zConverted, 0, 0, &zNotUsed) + 1;
+ char *zTemp;
+ nByte = GetFullPathNameA((char*)zConverted, 0, 0, 0) + 3;
zTemp = sqliteMalloc( nByte*sizeof(zTemp[0]) );
if( zTemp==0 ){
sqliteFree(zConverted);
return 0;
}
- GetFullPathNameA((char*)zConverted, nByte, zTemp, &zNotUsed);
+ GetFullPathNameA((char*)zConverted, nByte, zTemp, 0);
sqliteFree(zConverted);
zFull = mbcsToUtf8(zTemp);
sqliteFree(zTemp);
============================================================
--- sqlite/pager.c 1e9580475b4a858a923930473d59263067bf4bfc
+++ sqlite/pager.c d6ad66eb119602cb2e6a097f8f635372ba677d23
@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.281 2007/01/04 14:58:14 drh Exp $
+** @(#) $Id: pager.c,v 1.282 2007/01/05 02:00:47 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
============================================================
--- sqlite/pragma.c d0891d3504b6291b506a5ec2226bbf79ffcef003
+++ sqlite/pragma.c fd4df6cf0857dd78a7cb5be5f9805419b53ae7a0
@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
-** $Id: pragma.c,v 1.125 2006/11/30 13:06:37 drh Exp $
+** $Id: pragma.c,v 1.126 2007/01/04 22:13:42 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -894,6 +894,7 @@ void sqlite3Pragma(
sqlite3VdbeChangeP1(v, addr, iDb);
sqlite3VdbeChangeP2(v, addr, iCookie);
sqlite3VdbeSetNumCols(v, 1);
+ sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, P3_TRANSIENT);
}
}
#endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */
============================================================
--- sqlite/prepare.c f4f45b4560defbb566cf8255763625d2c09a8023
+++ sqlite/prepare.c 484389c6811415b8f23d259ac9c029613e1c72c3
@@ -13,7 +13,7 @@
** interface, and routines that contribute to loading the database schema
** from disk.
**
-** $Id: prepare.c,v 1.41 2006/11/09 00:24:54 drh Exp $
+** $Id: prepare.c,v 1.43 2007/01/09 14:01:13 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -575,8 +575,10 @@ int sqlite3Reprepare(Vdbe *p){
}else{
assert( pNew!=0 );
}
- sqlite3VdbeSwapOps(pNew, p);
- sqlite3_finalize((sqlite3_stmt*)pNew);
+ sqlite3VdbeSwap(pNew, p);
+ sqlite3_transfer_bindings((sqlite3_stmt*)pNew, (sqlite3_stmt*)p);
+ sqlite3VdbeResetStepResult(pNew);
+ sqlite3VdbeFinalize(pNew);
return 1;
}
============================================================
--- sqlite/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
+++ sqlite/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
@@ -15,7 +15,7 @@
** Random numbers are used by some of the database backends in order
** to generate random integer keys for tables or random filenames.
**
-** $Id: random.c,v 1.15 2006/01/06 14:32:20 drh Exp $
+** $Id: random.c,v 1.16 2007/01/05 14:38:56 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -37,7 +37,7 @@
** (Later): Actually, OP_NewRowid does not depend on a good source of
** randomness any more. But we will leave this code in all the same.
*/
-static int randomByte(){
+static int randomByte(void){
unsigned char t;
/* All threads share a single random number generator.
============================================================
--- sqlite/sqlite3.h 9d3ddb04e2bb107eac50266b2dafcf27a03ec5c1
+++ sqlite/sqlite3.h bda6b4bcb2d58bd9485bae930c5e692fe9bf4098
@@ -12,7 +12,7 @@
** This header file defines the interface that the SQLite library
** presents to client programs.
**
-** @(#) $Id: sqlite.h.in,v 1.195 2006/11/09 00:24:54 drh Exp $
+** @(#) $Id: sqlite.h.in,v 1.197 2007/01/10 12:57:29 drh Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
@@ -31,7 +31,7 @@ extern "C" {
#ifdef SQLITE_VERSION
# undef SQLITE_VERSION
#endif
-#define SQLITE_VERSION "3.3.9"
+#define SQLITE_VERSION "3.3.10"
/*
** The format of the version string is "X.Y.Z", where
@@ -48,7 +48,7 @@ extern "C" {
#ifdef SQLITE_VERSION_NUMBER
# undef SQLITE_VERSION_NUMBER
#endif
-#define SQLITE_VERSION_NUMBER 3003009
+#define SQLITE_VERSION_NUMBER 3003010
/*
** The version string is also compiled into the library so that a program
@@ -125,7 +125,7 @@ typedef int (*sqlite3_callback)(void*,in
** value then the query is aborted, all subsequent SQL statements
** are skipped and the sqlite3_exec() function returns the SQLITE_ABORT.
**
-** The 4th parameter is an arbitrary pointer that is passed
+** The 1st parameter is an arbitrary pointer that is passed
** to the callback function as its first parameter.
**
** The 2nd parameter to the callback function is the number of
@@ -315,13 +315,30 @@ int sqlite3_complete16(const void *sql);
** currently locked by another process or thread. If the busy callback
** is NULL, then sqlite3_exec() returns SQLITE_BUSY immediately if
** it finds a locked table. If the busy callback is not NULL, then
-** sqlite3_exec() invokes the callback with three arguments. The
-** second argument is the name of the locked table and the third
-** argument is the number of times the table has been busy. If the
+** sqlite3_exec() invokes the callback with two arguments. The
+** first argument to the handler is a copy of the void* pointer which
+** is the third argument to this routine. The second argument to
+** the handler is the number of times that the busy handler has
+** been invoked for this locking event. If the
** busy callback returns 0, then sqlite3_exec() immediately returns
** SQLITE_BUSY. If the callback returns non-zero, then sqlite3_exec()
** tries to open the table again and the cycle repeats.
**
+** The presence of a busy handler does not guarantee that
+** it will be invoked when there is lock contention.
+** If SQLite determines that invoking the busy handler could result in
+** a deadlock, it will return SQLITE_BUSY instead.
+** Consider a scenario where one process is holding a read lock that
+** it is trying to promote to a reserved lock and
+** a second process is holding a reserved lock that it is trying
+** to promote to an exclusive lock. The first process cannot proceed
+** because it is blocked by the second and the second process cannot
+** proceed because it is blocked by the first. If both processes
+** invoke the busy handlers, neither will make any progress. Therefore,
+** SQLite returns SQLITE_BUSY for the first process, hoping that this
+** will induce the first process to release its read lock and allow
+** the second process to proceed.
+**
** The default busy callback is NULL.
**
** Sqlite is re-entrant, so the busy handler may start a new query.
============================================================
--- sqlite/sqlite3ext.h 2c2156cc32a158e2b7bd9042d42accf94bff2e40
+++ sqlite/sqlite3ext.h 011c75fd6459a61454514af07c7a4f1f5c767f27
@@ -15,7 +15,7 @@
** as extensions by SQLite should #include this file instead of
** sqlite3.h.
**
-** @(#) $Id: sqlite3ext.h,v 1.7 2006/09/22 23:38:21 shess Exp $
+** @(#) $Id: sqlite3ext.h,v 1.8 2007/01/09 14:37:18 drh Exp $
*/
#ifndef _SQLITE3EXT_H_
#define _SQLITE3EXT_H_
@@ -92,7 +92,7 @@ struct sqlite3_api_routines {
void * (*get_auxdata)(sqlite3_context*,int);
int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
int (*global_recover)(void);
- void (*interrupt)(sqlite3*);
+ void (*interruptx)(sqlite3*);
sqlite_int64 (*last_insert_rowid)(sqlite3*);
const char * (*libversion)(void);
int (*libversion_number)(void);
@@ -222,7 +222,7 @@ struct sqlite3_api_routines {
#define sqlite3_get_auxdata sqlite3_api->get_auxdata
#define sqlite3_get_table sqlite3_api->get_table
#define sqlite3_global_recover sqlite3_api->global_recover
-#define sqlite3_interrupt sqlite3_api->interrupt
+#define sqlite3_interrupt sqlite3_api->interruptx
#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid
#define sqlite3_libversion sqlite3_api->libversion
#define sqlite3_libversion_number sqlite3_api->libversion_number
============================================================
--- sqlite/vdbe.c 180ea84f8087d4b56ccc4c4d496d4558cfaf4450
+++ sqlite/vdbe.c 074cda811466f8f752c2dd71b1dcaea001f4be64
@@ -43,7 +43,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.583 2007/01/04 01:20:11 drh Exp $
+** $Id: vdbe.c,v 1.585 2007/01/09 14:01:14 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -454,6 +454,21 @@ int sqlite3VdbeExec(
p->resOnStack = 0;
db->busyHandler.nBusy = 0;
CHECK_FOR_INTERRUPT;
+#ifdef SQLITE_DEBUG
+ if( (p->db->flags & SQLITE_VdbeListing)!=0
+ || sqlite3OsFileExists("vdbe_explain")
+ ){
+ int i;
+ printf("VDBE Program Listing:\n");
+ sqlite3VdbePrintSql(p);
+ for(i=0; inOp; i++){
+ sqlite3VdbePrintOp(stdout, i, &p->aOp[i]);
+ }
+ }
+ if( sqlite3OsFileExists("vdbe_trace") ){
+ p->trace = stdout;
+ }
+#endif
for(pc=p->pc; rc==SQLITE_OK; pc++){
assert( pc>=0 && pcnOp );
assert( pTos<=&p->aStack[pc] );
@@ -3878,9 +3893,9 @@ case OP_Destroy: {
*/
case OP_Destroy: {
int iMoved;
- Vdbe *pVdbe;
int iCnt;
#ifndef SQLITE_OMIT_VIRTUALTABLE
+ Vdbe *pVdbe;
iCnt = 0;
for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){
if( pVdbe->magic==VDBE_MAGIC_RUN && pVdbe->inVtabMethod<2 && pVdbe->pc>=0 ){
@@ -4004,10 +4019,14 @@ case OP_CreateTable: {
break;
}
-/* Opcode: ParseSchema P1 * P3
+/* Opcode: ParseSchema P1 P2 P3
**
** Read and parse all entries from the SQLITE_MASTER table of database P1
-** that match the WHERE clause P3.
+** that match the WHERE clause P3. P2 is the "force" flag. Always do
+** the parsing if P2 is true. If P2 is false, then this routine is a
+** no-op if the schema is not currently loaded. In other words, if P2
+** is false, the SQLITE_MASTER table is only parsed if the rest of the
+** schema is already loaded into the symbol table.
**
** This opcode invokes the parser to create a new virtual machine,
** then runs the new virtual machine. It is thus a reentrant opcode.
@@ -4019,7 +4038,9 @@ case OP_ParseSchema: { /* no-push
InitData initData;
assert( iDb>=0 && iDbnDb );
- if( !DbHasProperty(db, iDb, DB_SchemaLoaded) ) break;
+ if( !pOp->p2 && !DbHasProperty(db, iDb, DB_SchemaLoaded) ){
+ break;
+ }
zMaster = SCHEMA_TABLE(iDb);
initData.db = db;
initData.iDb = pOp->p1;
============================================================
--- sqlite/vdbe.h 9720cae673359dc2bdcb106285ecf686b7d3ef24
+++ sqlite/vdbe.h 0025259af1939fb264a545816c69e4b5b8d52691
@@ -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.106 2006/11/09 00:24:54 drh Exp $
+** $Id: vdbe.h,v 1.108 2007/01/09 14:01:14 drh Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
@@ -129,6 +129,7 @@ void sqlite3VdbeTrace(Vdbe*,FILE*);
void sqlite3VdbeResolveLabel(Vdbe*, int);
int sqlite3VdbeCurrentAddr(Vdbe*);
void sqlite3VdbeTrace(Vdbe*,FILE*);
+void sqlite3VdbeResetStepResult(Vdbe*);
int sqlite3VdbeReset(Vdbe*);
int sqliteVdbeSetVariables(Vdbe*,int,const char**);
void sqlite3VdbeSetNumCols(Vdbe*,int);
@@ -137,7 +138,7 @@ const char *sqlite3VdbeGetSql(Vdbe*);
sqlite3 *sqlite3VdbeDb(Vdbe*);
void sqlite3VdbeSetSql(Vdbe*, const char *z, int n);
const char *sqlite3VdbeGetSql(Vdbe*);
-void sqlite3VdbeSwapOps(Vdbe*,Vdbe*);
+void sqlite3VdbeSwap(Vdbe*,Vdbe*);
#ifndef NDEBUG
void sqlite3VdbeComment(Vdbe*, const char*, ...);
============================================================
--- sqlite/vdbeaux.c 05cc6f0f82b86dfb4c356e06ab07ec8cc83a2eda
+++ sqlite/vdbeaux.c c5324d62f51529bccc5be3b04bac2e4eeae1569a
@@ -65,19 +65,27 @@ const char *sqlite3VdbeGetSql(Vdbe *p){
}
/*
-** Swap the set of Opcodes between to Vdbe structures. No
-** other parts of either Vdbe structure are changed.
+** Swap all content between two VDBE structures.
*/
-void sqlite3VdbeSwapOps(Vdbe *pA, Vdbe *pB){
- Op *aOp;
- int nOp;
-
- aOp = pA->aOp;
- nOp = pA->nOp;
- pA->aOp = pB->aOp;
- pA->nOp = pB->nOp;
- pB->aOp = aOp;
- pB->nOp = nOp;
+void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
+ Vdbe tmp, *pTmp;
+ char *zTmp;
+ int nTmp;
+ tmp = *pA;
+ *pA = *pB;
+ *pB = tmp;
+ pTmp = pA->pNext;
+ pA->pNext = pB->pNext;
+ pB->pNext = pTmp;
+ pTmp = pA->pPrev;
+ pA->pPrev = pB->pPrev;
+ pB->pPrev = pTmp;
+ zTmp = pA->zSql;
+ pA->zSql = pB->zSql;
+ pB->zSql = zTmp;
+ nTmp = pA->nSql;
+ pA->nSql = pB->nSql;
+ pB->nSql = nTmp;
}
/*
@@ -844,21 +852,6 @@ void sqlite3VdbeMakeReady(
p->aMem[n].flags = MEM_Null;
}
-#ifdef SQLITE_DEBUG
- if( (p->db->flags & SQLITE_VdbeListing)!=0
- || sqlite3OsFileExists("vdbe_explain")
- ){
- int i;
- printf("VDBE Program Listing:\n");
- sqlite3VdbePrintSql(p);
- for(i=0; inOp; i++){
- sqlite3VdbePrintOp(stdout, i, &p->aOp[i]);
- }
- }
- if( sqlite3OsFileExists("vdbe_trace") ){
- p->trace = stdout;
- }
-#endif
p->pTos = &p->aStack[-1];
p->pc = -1;
p->rc = SQLITE_OK;
@@ -1457,6 +1450,14 @@ int sqlite3VdbeHalt(Vdbe *p){
}
/*
+** Each VDBE holds the result of the most recent sqlite3_step() call
+** in p->rc. This routine sets that result back to SQLITE_OK.
+*/
+void sqlite3VdbeResetStepResult(Vdbe *p){
+ p->rc = SQLITE_OK;
+}
+
+/*
** Clean up a VDBE after execution but do not delete the VDBE just yet.
** Write any error messages into *pzErrMsg. Return the result code.
**
============================================================
--- sqlite/vtab.c aa30e940058ea56a1b7a9a7019ec21d307316fb4
+++ sqlite/vtab.c 7fbda947e28cbe7adb3ba752a76ca9ef29936750
@@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to help implement virtual tables.
**
-** $Id: vtab.c,v 1.37 2006/09/18 20:24:03 drh Exp $
+** $Id: vtab.c,v 1.39 2007/01/09 14:01:14 drh Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"
@@ -230,7 +230,7 @@ void sqlite3VtabFinishParse(Parse *pPars
sqlite3VdbeAddOp(v, OP_Expire, 0, 0);
zWhere = sqlite3MPrintf("name='%q'", pTab->zName);
- sqlite3VdbeOp3(v, OP_ParseSchema, iDb, 0, zWhere, P3_DYNAMIC);
+ sqlite3VdbeOp3(v, OP_ParseSchema, iDb, 1, zWhere, P3_DYNAMIC);
sqlite3VdbeOp3(v, OP_VCreate, iDb, 0, pTab->zName, strlen(pTab->zName) + 1);
}
@@ -340,7 +340,6 @@ int sqlite3VtabCallConnect(Parse *pParse
*/
int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){
Module *pMod;
- const char *zModule;
int rc = SQLITE_OK;
if( !pTab || !pTab->isVirtual || pTab->pVtab ){
@@ -348,7 +347,6 @@ int sqlite3VtabCallConnect(Parse *pParse
}
pMod = pTab->pMod;
- zModule = pTab->azModuleArg[0];
if( !pMod ){
const char *zModule = pTab->azModuleArg[0];
sqlite3ErrorMsg(pParse, "no such module: %s", zModule);