From 03b808a694f12421dea2e58f7d92a81e43908c49 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 13 Mar 2006 15:06:05 +0000 Subject: [PATCH] Get parserless builds working again. (CVS 3133) FossilOrigin-Name: 5ddc09a5e4d81a73228cd8038c6dc345b1fdf4af --- manifest | 18 ++++++++--------- manifest.uuid | 2 +- src/callback.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++- src/main.c | 6 ++---- src/prepare.c | 53 +------------------------------------------------ src/sqliteInt.h | 5 ++++- 6 files changed, 69 insertions(+), 68 deletions(-) diff --git a/manifest b/manifest index 1dde3aef71..f2d68932dd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sdocumentation\sto\sshow\sthe\scorrect\sreturn\stype\sfrom\ssqlite3_db_handle().\nTicket\s#1716.\s(CVS\s3132) -D 2006-03-13T14:31:39 +C Get\sparserless\sbuilds\sworking\sagain.\s(CVS\s3133) +D 2006-03-13T15:06:06 F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -37,7 +37,7 @@ F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2 F src/btree.c 96a383ddf9a391d017bfa36c89dc528ccfc5d9bb F src/btree.h 40055cfc09defd1146bc5b922399c035f969e56d F src/build.c 4bd8471e4f20f5623c15fd71d2aaee0f66e394d8 -F src/callback.c 1bf497306c32229114f826707054df7ebe10abf2 +F src/callback.c 2c69d539224fa29a70bedda821d59f99e1591df5 F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675 F src/date.c cd2bd5d1ebc6fa12d6312f69789ae5b0a2766f2e F src/delete.c 2dea1a83e6ef534346e74fd03114d3a7b16f08fc @@ -48,7 +48,7 @@ F src/hash.c 449f3d6620193aa557f5d86cbc5cc6b87702b185 F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564 F src/insert.c 2b0eb1f7d50b1d94782bac9644b41a53cf65c019 F src/legacy.c fa15d505dd4e45044177ee4d1c6aeaf8c836d390 -F src/main.c b2fae87237011250f0d553fbcdf80b65a98701fb +F src/main.c 631ad93d030f0cef159eb98be173cdd472c5d3b0 F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217 F src/os.c 59f05de8c5777c34876607114a2fbe55ae578235 F src/os.h 93035a0e3b9dd05cdd0aaef32ea28ca28e02fe78 @@ -63,14 +63,14 @@ F src/pager.c 7b1975e2fa56fc3c9859bec321f57cd3d75ec36b F src/pager.h 43f32f3847421f7502cfbb66f4eb2302b8033818 F src/parse.y ee1887ce0e6eea15cc728913ad3462898f88e9b0 F src/pragma.c 27d5e395c5d950931c7ac4fe610e7c2993e2fa55 -F src/prepare.c fe3f5b7524575d378e82d3d7d4f1371884087c4e +F src/prepare.c 6afd730cc8851c0920b5f9050294646b1c2ab28c F src/printf.c 341e488b549b1a41f83b05a69ce1d7a8258b624c F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261 F src/select.c 38203fd2851e2accac1ece7a8f1ce68f1c6d86be F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c 7a4b16f85d8f6f25d917cdc3d0f7e18f84867adf F src/sqlite.h.in 0bf6f03f9a14dde5f3a4f87471840803acaa4497 -F src/sqliteInt.h ccc6c2351fb454aec927b5da8d83561c7d4b48cd +F src/sqliteInt.h 8c5788a32da5c0b8fdfddc1497b5b38ee3a2c17d F src/table.c f64ec4fbfe333f8df925bc6ba494f55e05b0e75e F src/tclsqlite.c 607ccf5ade808ed3620544baca42b13e3411bf6d F src/test1.c 9d299609a0ce35157fe15cdf8b4c663db5d40386 @@ -355,7 +355,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 255fdbe6fa31ce276a8e6511af4ec6c36a741c20 -R e418fbe26d30f0c9ccaae6a1d916af2a +P f4fb047d0a0939ab6a25b75999501f5956e9f67c +R 6aed0072db6a7040096e4fdf5bd6fa26 U drh -Z fc3d1b43b7ed07c37fd2233a9595ad86 +Z cb6f6f80a408e1622368754a6e64a089 diff --git a/manifest.uuid b/manifest.uuid index f2fd7a1ae2..c74f4d48d4 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f4fb047d0a0939ab6a25b75999501f5956e9f67c \ No newline at end of file +5ddc09a5e4d81a73228cd8038c6dc345b1fdf4af \ No newline at end of file diff --git a/src/callback.c b/src/callback.c index 5847b66d0d..55b3add3fd 100644 --- a/src/callback.c +++ b/src/callback.c @@ -13,7 +13,7 @@ ** This file contains functions used to access the internal hash tables ** of user defined functions and collation sequences. ** -** $Id: callback.c,v 1.12 2006/01/18 16:51:35 danielk1977 Exp $ +** $Id: callback.c,v 1.13 2006/03/13 15:06:06 drh Exp $ */ #include "sqliteInt.h" @@ -312,3 +312,54 @@ FuncDef *sqlite3FindFunction( } return 0; } + +/* +** Free all resources held by the schema structure. The void* argument points +** at a Schema struct. This function does not call sqliteFree() on the +** pointer itself, it just cleans up subsiduary resources (i.e. the contents +** of the schema hash tables). +*/ +void sqlite3SchemaFree(void *p){ + Hash temp1; + Hash temp2; + HashElem *pElem; + Schema *pSchema = (Schema *)p; + + temp1 = pSchema->tblHash; + temp2 = pSchema->trigHash; + sqlite3HashInit(&pSchema->trigHash, SQLITE_HASH_STRING, 0); + sqlite3HashClear(&pSchema->aFKey); + sqlite3HashClear(&pSchema->idxHash); + for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){ + sqlite3DeleteTrigger((Trigger*)sqliteHashData(pElem)); + } + sqlite3HashClear(&temp2); + sqlite3HashInit(&pSchema->tblHash, SQLITE_HASH_STRING, 0); + for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){ + Table *pTab = sqliteHashData(pElem); + sqlite3DeleteTable(0, pTab); + } + sqlite3HashClear(&temp1); + pSchema->pSeqTab = 0; + pSchema->flags &= ~DB_SchemaLoaded; +} + +/* +** Find and return the schema associated with a BTree. Create +** a new one if necessary. +*/ +Schema *sqlite3SchemaGet(Btree *pBt){ + Schema * p; + if( pBt ){ + p = (Schema *)sqlite3BtreeSchema(pBt,sizeof(Schema),sqlite3SchemaFree); + }else{ + p = (Schema *)sqliteMalloc(sizeof(Schema)); + } + if( p && 0==p->file_format ){ + sqlite3HashInit(&p->tblHash, SQLITE_HASH_STRING, 0); + sqlite3HashInit(&p->idxHash, SQLITE_HASH_STRING, 0); + sqlite3HashInit(&p->trigHash, SQLITE_HASH_STRING, 0); + sqlite3HashInit(&p->aFKey, SQLITE_HASH_STRING, 1); + } + return p; +} diff --git a/src/main.c b/src/main.c index 471bd9fd95..1561b1c43e 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.336 2006/03/03 20:54:41 drh Exp $ +** $Id: main.c,v 1.337 2006/03/13 15:06:07 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -846,15 +846,13 @@ static int openDatabase( db->magic = SQLITE_MAGIC_CLOSED; goto opendb_out; } -#ifndef SQLITE_OMIT_PARSER db->aDb[0].pSchema = sqlite3SchemaGet(db->aDb[0].pBt); db->aDb[1].pSchema = sqlite3SchemaGet(0); -#endif - if( db->aDb[0].pSchema ){ ENC(db) = SQLITE_UTF8; } + /* The default safety_level for the main database is 'full'; for the temp ** database it is 'NONE'. This matches the pager layer defaults. */ diff --git a/src/prepare.c b/src/prepare.c index c345614ebe..97532c8c41 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -13,7 +13,7 @@ ** interface, and routines that contribute to loading the database schema ** from disk. ** -** $Id: prepare.c,v 1.32 2006/03/06 20:55:46 drh Exp $ +** $Id: prepare.c,v 1.33 2006/03/13 15:06:07 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -410,57 +410,6 @@ static int schemaIsValid(sqlite3 *db){ return allOk; } -/* -** Free all resources held by the schema structure. The void* argument points -** at a Schema struct. This function does not call sqliteFree() on the -** pointer itself, it just cleans up subsiduary resources (i.e. the contents -** of the schema hash tables). -*/ -void sqlite3SchemaFree(void *p){ - Hash temp1; - Hash temp2; - HashElem *pElem; - Schema *pSchema = (Schema *)p; - - temp1 = pSchema->tblHash; - temp2 = pSchema->trigHash; - sqlite3HashInit(&pSchema->trigHash, SQLITE_HASH_STRING, 0); - sqlite3HashClear(&pSchema->aFKey); - sqlite3HashClear(&pSchema->idxHash); - for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){ - sqlite3DeleteTrigger((Trigger*)sqliteHashData(pElem)); - } - sqlite3HashClear(&temp2); - sqlite3HashInit(&pSchema->tblHash, SQLITE_HASH_STRING, 0); - for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){ - Table *pTab = sqliteHashData(pElem); - sqlite3DeleteTable(0, pTab); - } - sqlite3HashClear(&temp1); - pSchema->pSeqTab = 0; - pSchema->flags &= ~DB_SchemaLoaded; -} - -/* -** Find and return the schema associated with a BTree. Create -** a new one if necessary. -*/ -Schema *sqlite3SchemaGet(Btree *pBt){ - Schema * p; - if( pBt ){ - p = (Schema *)sqlite3BtreeSchema(pBt,sizeof(Schema),sqlite3SchemaFree); - }else{ - p = (Schema *)sqliteMalloc(sizeof(Schema)); - } - if( p && 0==p->file_format ){ - sqlite3HashInit(&p->tblHash, SQLITE_HASH_STRING, 0); - sqlite3HashInit(&p->idxHash, SQLITE_HASH_STRING, 0); - sqlite3HashInit(&p->trigHash, SQLITE_HASH_STRING, 0); - sqlite3HashInit(&p->aFKey, SQLITE_HASH_STRING, 1); - } - return p; -} - /* ** Convert a schema pointer into the iDb index that indicates ** which database file in db->aDb[] the schema refers to. diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 517ee4f8d3..dd63745799 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.488 2006/02/27 22:22:29 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.489 2006/03/13 15:06:07 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -510,6 +510,9 @@ struct sqlite3 { #endif }; +/* +** A macro to discover the encoding of a database. +*/ #define ENC(db) ((db)->aDb[0].pSchema->enc) /*