Index: src/build.c ================================================================== --- src/build.c +++ src/build.c @@ -20,11 +20,11 @@ ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.483 2008/04/28 18:46:43 drh Exp $ +** $Id: build.c,v 1.484 2008/05/01 17:16:53 drh Exp $ */ #include "sqliteInt.h" #include /* @@ -157,24 +157,27 @@ ** transaction on each used database and to verify the schema cookie ** on each used database. */ if( pParse->cookieGoto>0 ){ u32 mask; - int iDb, i; + int iDb; sqlite3VdbeJumpHere(v, pParse->cookieGoto-1); for(iDb=0, mask=1; iDbnDb; mask<<=1, iDb++){ if( (mask & pParse->cookieMask)==0 ) continue; sqlite3VdbeUsesBtree(v, iDb); sqlite3VdbeAddOp2(v,OP_Transaction, iDb, (mask & pParse->writeMask)!=0); sqlite3VdbeAddOp2(v,OP_VerifyCookie, iDb, pParse->cookieValue[iDb]); } #ifndef SQLITE_OMIT_VIRTUALTABLE - for(i=0; inVtabLock; i++){ - char *vtab = (char *)pParse->apVtabLock[i]->pVtab; - sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB); + { + int i; + for(i=0; inVtabLock; i++){ + char *vtab = (char *)pParse->apVtabLock[i]->pVtab; + sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB); + } + pParse->nVtabLock = 0; } - pParse->nVtabLock = 0; #endif /* Once all the cookies have been verified and transactions opened, ** obtain the required table-locks. This is a no-op unless the ** shared-cache feature is enabled. Index: src/expr.c ================================================================== --- src/expr.c +++ src/expr.c @@ -10,11 +10,11 @@ ** ************************************************************************* ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** -** $Id: expr.c,v 1.370 2008/04/29 00:15:21 drh Exp $ +** $Id: expr.c,v 1.371 2008/05/01 17:16:53 drh Exp $ */ #include "sqliteInt.h" #include /* @@ -264,22 +264,20 @@ Expr *pLeft, /* Left operand */ Expr *pRight, /* Right operand */ const Token *pToken /* Argument token */ ){ Expr *pNew; - static const Expr zeroExpr; - pNew = sqlite3DbMallocRaw(db, sizeof(Expr)); + pNew = sqlite3DbMallocZero(db, sizeof(Expr)); if( pNew==0 ){ /* When malloc fails, delete pLeft and pRight. Expressions passed to ** this function must always be allocated with sqlite3Expr() for this ** reason. */ sqlite3ExprDelete(pLeft); sqlite3ExprDelete(pRight); return 0; } - *pNew = zeroExpr; pNew->op = op; pNew->pLeft = pLeft; pNew->pRight = pRight; pNew->iAgg = -1; if( pToken ){ Index: src/pager.c ================================================================== --- src/pager.c +++ src/pager.c @@ -16,11 +16,11 @@ ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.437 2008/05/01 17:03:49 drh Exp $ +** @(#) $Id: pager.c,v 1.438 2008/05/01 17:16:53 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" #include #include @@ -514,11 +514,13 @@ #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT static void pagerEnter(Pager *p){ p->iInUseDB++; if( p->iInUseMM && p->iInUseDB==1 ){ sqlite3_mutex *mutex; +#ifndef SQLITE_MUTEX_NOOP mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM2); +#endif p->iInUseDB = 0; sqlite3_mutex_enter(mutex); p->iInUseDB = 1; sqlite3_mutex_leave(mutex); } @@ -2322,11 +2324,13 @@ *ppPager = pPager; #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT pPager->iInUseMM = 0; pPager->iInUseDB = 0; if( !memDb ){ +#ifndef SQLITE_MUTEX_NOOP sqlite3_mutex *mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM2); +#endif sqlite3_mutex_enter(mutex); pPager->pNext = sqlite3PagerList; if( sqlite3PagerList ){ assert( sqlite3PagerList->pPrev==0 ); sqlite3PagerList->pPrev = pPager; @@ -2704,11 +2708,13 @@ ** to the caller. */ int sqlite3PagerClose(Pager *pPager){ #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT if( !MEMDB ){ +#ifndef SQLITE_MUTEX_NOOP sqlite3_mutex *mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM2); +#endif sqlite3_mutex_enter(mutex); if( pPager->pPrev ){ pPager->pPrev->pNext = pPager->pNext; }else{ sqlite3PagerList = pPager->pNext; @@ -3221,11 +3227,13 @@ BusyHandler *savedBusy; /* Saved copy of the busy handler */ int rc = SQLITE_OK; /* Acquire the memory-management mutex */ +#ifndef SQLITE_MUTEX_NOOP mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM2); +#endif sqlite3_mutex_enter(mutex); /* Signal all database connections that memory management wants ** to have access to the pagers. */ Index: src/tclsqlite.c ================================================================== --- src/tclsqlite.c +++ src/tclsqlite.c @@ -10,11 +10,11 @@ ** ************************************************************************* ** A TCL Interface to SQLite. Append this file to sqlite3.c and ** compile the whole thing to build a TCL-enabled version of SQLite. ** -** $Id: tclsqlite.c,v 1.216 2008/04/16 00:28:14 drh Exp $ +** $Id: tclsqlite.c,v 1.217 2008/05/01 17:16:53 drh Exp $ */ #include "tcl.h" #include /* @@ -477,10 +477,11 @@ return 0; } return 1; } +#ifndef SQLITE_OMIT_PROGRESS_CALLBACK /* ** This routine is invoked as the 'progress callback' for the database. */ static int DbProgressHandler(void *cd){ SqliteDb *pDb = (SqliteDb*)cd; @@ -491,10 +492,11 @@ if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){ return 1; } return 0; } +#endif #ifndef SQLITE_OMIT_TRACE /* ** This routine is called by the SQLite trace handler whenever a new ** block of SQL is executed. The TCL script in pDb->zTrace is executed. Index: src/test_schema.c ================================================================== --- src/test_schema.c +++ src/test_schema.c @@ -11,11 +11,11 @@ ************************************************************************* ** Code for testing the virtual table interfaces. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test_schema.c,v 1.13 2007/08/16 04:30:40 drh Exp $ +** $Id: test_schema.c,v 1.14 2008/05/01 17:16:53 drh Exp $ */ /* The code in this file defines a sqlite3 virtual-table module that ** provides a read-only view of the current database schema. There is one ** row in the schema table for each column in the database schema. @@ -64,10 +64,15 @@ sqlite3_stmt *pTableList; sqlite3_stmt *pColumnList; int rowid; }; +/* +** None of this works unless we have virtual tables. +*/ +#ifndef SQLITE_OMIT_VIRTUALTABLE + /* ** Table destructor for the schema module. */ static int schemaDestroy(sqlite3_vtab *pVtab){ sqlite3_free(pVtab); @@ -285,10 +290,11 @@ 0, /* xRollback */ 0, /* xFindMethod */ 0, /* xRename */ }; +#endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */ #ifdef SQLITE_TEST /* ** Decode a pointer to an sqlite3 object. Index: src/vdbeapi.c ================================================================== --- src/vdbeapi.c +++ src/vdbeapi.c @@ -45,10 +45,11 @@ ** Check that the list looks to be internally consistent. This is used ** as part of an assert() statement as follows: ** ** assert( stmtLruCheck() ); */ +#ifndef NDEBUG static int stmtLruCheck(){ Vdbe *p; for(p=sqlite3LruStatements.pFirst; p; p=p->pLruNext){ assert(p->pLruNext || p==sqlite3LruStatements.pLast); assert(!p->pLruNext || p->pLruNext->pLruPrev==p); @@ -55,10 +56,11 @@ assert(p->pLruPrev || p==sqlite3LruStatements.pFirst); assert(!p->pLruPrev || p->pLruPrev->pLruNext==p); } return 1; } +#endif /* ** Add vdbe p to the end of the statement lru list. It is assumed that ** p is not already part of the list when this is called. The lru list ** is protected by the SQLITE_MUTEX_STATIC_LRU mutex.