From 124b27e65463e8897de17b067ce4a7b11b5602f5 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 19 Jun 2004 16:06:10 +0000 Subject: [PATCH] Omit the DB_Locked and DB_Cookie flags. Other minor cleanup. (CVS 1642) FossilOrigin-Name: 01f74b420c3f24918c066172e09cebbb22568faf --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/attach.c | 19 +++++++++++-------- src/auth.c | 8 ++------ src/build.c | 19 +------------------ src/sqliteInt.h | 15 +++------------ 6 files changed, 27 insertions(+), 54 deletions(-) diff --git a/manifest b/manifest index f4878cc032..a4ee70045f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Clear\sup\sanother\szero-length\sarray.\s\sThis\sseems\sto\sfix\sthe\ssegfault\sin\nfunc-13.4\stoo.\s(CVS\s1641) -D 2004-06-19T15:40:23 +C Omit\sthe\sDB_Locked\sand\sDB_Cookie\sflags.\s\sOther\sminor\scleanup.\s(CVS\s1642) +D 2004-06-19T16:06:11 F Makefile.in d69d53c543518c1572ee0a8e8723d7e00bdb2266 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -24,11 +24,11 @@ F spec.template a38492f1c1dd349fc24cb0565e08afc53045304b F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2 F sqlite3.def c4bc3f10bccded91d06328c4b2b742ace4d3ed9f -F src/attach.c 78ca379f2db3701cca20055cdd802c6bd3b49870 -F src/auth.c 204e1e9c45e64315589bc8b62cba5d9de29b6a3c +F src/attach.c 05102e2e8ac43ce639d07b47a99c7772a62420e6 +F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217 F src/btree.c 0cf8a52a57a7eb13d50719114ee1fa353e89d7d3 F src/btree.h 32f96abef464cf8765b23ca669acfe90d191fcc5 -F src/build.c c843ef3d4440b591e154d0e78c664e213236db68 +F src/build.c 09d8863a5dc174bac8bd3fc293a3e2519b9d7a49 F src/date.c b3e8b2bef1e3f2ce24e5b057203036defb18c3f1 F src/delete.c a5191011b7429dff939df631b8bdcc1714b8d7aa F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37 @@ -57,7 +57,7 @@ F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 F src/select.c 9aa82bbc63983a304bc51d4a7c259e759f92c8dc F src/shell.c 24b641700c9d90f361fcfa4f432c5b4aff704e6d F src/sqlite.h.in c34414b9f5330f875e26a69fe685e38ca45f11b9 -F src/sqliteInt.h b776ee9d096bcd90c0ebdca7ae827e7c89747120 +F src/sqliteInt.h 421687a0b3111d4b3df058aa1a5400739d3d3584 F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2 F src/tclsqlite.c ddef9b18271fb46344d3d35446bd7c001465a69a F src/test1.c ee426e026ad9223483e7a84bb68849fc6e9f542e @@ -225,7 +225,7 @@ F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9 F www/version3.tcl af528563442e3039928f9018327a18157e53a44f F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P fbfc3c95a8abf25bb9e2b44cfeb7186c5b0591d7 -R 8b1896930be175cc145ac47aedd2f4cb +P 70680a34b4b617286d92730bd3042b8b569b3371 +R b1a9e75569a189850c5300b5594dbc5c U drh -Z 4a06f27d3dc21ce0ad6cfd96c4ae0233 +Z 1c5518adfc53e32ee655b3ffea101b0b diff --git a/manifest.uuid b/manifest.uuid index af2a45d4bc..a34933ebcf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -70680a34b4b617286d92730bd3042b8b569b3371 \ No newline at end of file +01f74b420c3f24918c066172e09cebbb22568faf \ No newline at end of file diff --git a/src/attach.c b/src/attach.c index 509db05a74..9468f203a4 100644 --- a/src/attach.c +++ b/src/attach.c @@ -11,7 +11,7 @@ ************************************************************************* ** 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" @@ -59,7 +59,8 @@ void sqlite3Attach(Parse *pParse, Token *pFilename, Token *pDbname, Token *pKey) 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); @@ -133,15 +134,17 @@ 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); @@ -161,9 +164,9 @@ void sqlite3Detach(Parse *pParse, Token *pDbname){ 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 ){ diff --git a/src/auth.c b/src/auth.c index d93ea9b0b6..0ac623c957 100644 --- a/src/auth.c +++ b/src/auth.c @@ -14,7 +14,7 @@ ** 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" @@ -33,7 +33,6 @@ ** 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 @@ -150,7 +149,7 @@ void sqlite3AuthRead( 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 ){ @@ -222,6 +221,3 @@ void sqlite3AuthContextPop(AuthContext *pContext){ } #endif /* SQLITE_OMIT_AUTHORIZATION */ - - - diff --git a/src/build.c b/src/build.c index f24130263a..c2aac44c9b 100644 --- a/src/build.c +++ b/src/build.c @@ -23,7 +23,7 @@ ** 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 @@ -35,24 +35,7 @@ ** 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; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 5848b074d4..c8531ab900 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** 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" @@ -308,13 +308,6 @@ struct Db { /* ** 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. ** @@ -322,10 +315,8 @@ struct Db { ** 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 /*