Index: src/attach.c ================================================================== --- src/attach.c +++ src/attach.c @@ -9,11 +9,11 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. ** -** $Id: attach.c,v 1.16 2004/06/19 14:49:12 drh Exp $ +** $Id: attach.c,v 1.17 2004/06/19 16:06:11 drh Exp $ */ #include "sqliteInt.h" /* ** This routine is called by the parser to process an ATTACH statement: @@ -57,11 +57,12 @@ #endif /* SQLITE_OMIT_AUTHORIZATION */ zName = sqlite3NameFromToken(pDbname); if( zName==0 ) return; for(i=0; inDb; i++){ - if( db->aDb[i].zName && sqlite3StrICmp(db->aDb[i].zName, zName)==0 ){ + char *z = db->aDb[i].zName; + if( z && sqlite3StrICmp(z, zName)==0 ){ sqlite3ErrorMsg(pParse, "database %z is already in use", zName); pParse->rc = SQLITE_ERROR; sqliteFree(zFile); return; } @@ -131,19 +132,21 @@ */ void sqlite3Detach(Parse *pParse, Token *pDbname){ int i; sqlite *db; Vdbe *v; + Db *pDb; v = sqlite3GetVdbe(pParse); sqlite3VdbeAddOp(v, OP_Halt, 0, 0); if( pParse->explain ) return; db = pParse->db; for(i=0; inDb; i++){ - if( db->aDb[i].pBt==0 || db->aDb[i].zName==0 ) continue; - if( strlen(db->aDb[i].zName)!=pDbname->n ) continue; - if( sqlite3StrNICmp(db->aDb[i].zName, pDbname->z, pDbname->n)==0 ) break; + pDb = &db->aDb[i]; + if( pDb->pBt==0 || pDb->zName==0 ) continue; + if( strlen(pDb->zName)!=pDbname->n ) continue; + if( sqlite3StrNICmp(pDb->zName, pDbname->z, pDbname->n)==0 ) break; } if( i>=db->nDb ){ sqlite3ErrorMsg(pParse, "no such database: %T", pDbname); return; } @@ -159,13 +162,13 @@ #ifndef SQLITE_OMIT_AUTHORIZATION if( sqlite3AuthCheck(pParse,SQLITE_DETACH,db->aDb[i].zName,0,0)!=SQLITE_OK ){ return; } #endif /* SQLITE_OMIT_AUTHORIZATION */ - sqlite3BtreeClose(db->aDb[i].pBt); - db->aDb[i].pBt = 0; - sqliteFree(db->aDb[i].zName); + sqlite3BtreeClose(pDb->pBt); + pDb->pBt = 0; + sqliteFree(pDb->zName); sqlite3ResetInternalSchema(db, i); db->nDb--; if( inDb ){ db->aDb[i] = db->aDb[db->nDb]; memset(&db->aDb[db->nDb], 0, sizeof(db->aDb[0])); Index: src/auth.c ================================================================== --- src/auth.c +++ src/auth.c @@ -12,11 +12,11 @@ ** This file contains code used to implement the sqlite3_set_authorizer() ** API. This facility is an optional feature of the library. Embedded ** systems that do not need this facility may omit it by recompiling ** the library with -DSQLITE_OMIT_AUTHORIZATION=1 ** -** $Id: auth.c,v 1.15 2004/06/14 11:35:18 danielk1977 Exp $ +** $Id: auth.c,v 1.16 2004/06/19 16:06:11 drh Exp $ */ #include "sqliteInt.h" /* ** All of the code in this file may be omitted by defining a single @@ -31,11 +31,10 @@ ** phase to verify that the user has read and/or write access permission on ** various fields of the database. The first argument to the auth function ** is a copy of the 3rd argument to this routine. The second argument ** to the auth function is one of these constants: ** -** SQLITE_COPY ** SQLITE_CREATE_INDEX ** SQLITE_CREATE_TABLE ** SQLITE_CREATE_TEMP_INDEX ** SQLITE_CREATE_TEMP_TABLE ** SQLITE_CREATE_TEMP_TRIGGER @@ -148,11 +147,11 @@ }else if( rc==SQLITE_DENY ){ if( db->nDb>2 || pExpr->iDb!=0 ){ sqlite3ErrorMsg(pParse, "access to %s.%s.%s is prohibited", zDBase, pTab->zName, zCol); }else{ - sqlite3ErrorMsg(pParse, "access to %s.%s is prohibited", pTab->zName,zCol); + sqlite3ErrorMsg(pParse, "access to %s.%s is prohibited",pTab->zName,zCol); } pParse->rc = SQLITE_AUTH; }else if( rc!=SQLITE_OK ){ sqliteAuthBadReturnCode(pParse, rc); } @@ -220,8 +219,5 @@ pContext->pParse = 0; } } #endif /* SQLITE_OMIT_AUTHORIZATION */ - - - Index: src/build.c ================================================================== --- src/build.c +++ src/build.c @@ -21,11 +21,11 @@ ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** PRAGMA ** -** $Id: build.c,v 1.225 2004/06/19 14:49:12 drh Exp $ +** $Id: build.c,v 1.226 2004/06/19 16:06:12 drh Exp $ */ #include "sqliteInt.h" #include /* @@ -33,28 +33,11 @@ ** be parsed. Check to see if the schema for the database needs ** to be read from the SQLITE_MASTER and SQLITE_TEMP_MASTER tables. ** If it does, then read it. */ void sqlite3BeginParse(Parse *pParse, int explainFlag){ - sqlite *db = pParse->db; - int i; pParse->explain = explainFlag; -#if 0 - if((db->flags & SQLITE_Initialized)==0 && db->init.busy==0 ){ - int rc = sqlite3Init(db, &pParse->zErrMsg); - if( rc!=SQLITE_OK ){ - pParse->rc = rc; - pParse->nErr++; - } - } -#endif - for(i=0; inDb; i++){ - DbClearProperty(db, i, DB_Locked); - if( !db->aDb[i].inTrans ){ - DbClearProperty(db, i, DB_Cookie); - } - } pParse->nVar = 0; } /* ** This routine is called after a single SQL statement has been Index: src/sqliteInt.h ================================================================== --- src/sqliteInt.h +++ src/sqliteInt.h @@ -9,11 +9,11 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.294 2004/06/19 15:22:56 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.295 2004/06/19 16:06:12 drh Exp $ */ #include "config.h" #include "sqlite3.h" #include "hash.h" #include "parse.h" @@ -306,28 +306,19 @@ #define DbClearProperty(D,I,P) (D)->aDb[I].flags&=~(P) /* ** Allowed values for the DB.flags field. ** -** The DB_Locked flag is set when the first OP_Transaction or OP_Checkpoint -** opcode is emitted for a database. This prevents multiple occurances -** of those opcodes for the same database in the same program. Similarly, -** the DB_Cookie flag is set when the OP_VerifyCookie opcode is emitted, -** and prevents duplicate OP_VerifyCookies from taking up space and slowing -** down execution. -** ** The DB_SchemaLoaded flag is set after the database schema has been ** read into internal hash tables. ** ** DB_UnresetViews means that one or more views have column names that ** have been filled out. If the schema changes, these column names might ** changes and so the view will need to be reset. */ -#define DB_Locked 0x0001 /* OP_Transaction opcode has been emitted */ -#define DB_Cookie 0x0002 /* OP_VerifyCookie opcode has been emiited */ -#define DB_SchemaLoaded 0x0004 /* The schema has been loaded */ -#define DB_UnresetViews 0x0008 /* Some views have defined column names */ +#define DB_SchemaLoaded 0x0001 /* The schema has been loaded */ +#define DB_UnresetViews 0x0002 /* Some views have defined column names */ #if 0 /* ** Possible values for the Db.textEnc field. */