From 5efb3145256ed3a87a4c25ad5899e136ff132eca Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 16 May 2012 01:24:34 +0000 Subject: [PATCH] Avoid using sqlite3ResetAllSchemasOfConnection() purely for its side-effects. FossilOrigin-Name: 5587c73badc07d3e01a7c5c5964e178b5112dd24 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/main.c | 11 ++++++++--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 2d4da7eb65..7f50ea50c8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\sformer\ssqlite3ResetInternalSchema()\sroutine\swas\sreally\stwo\sdifferent\s\nroutines,\sselected\sby\sparameter,\seach\swith\sa\sconfused\smission.\s\sSo\ssplit\nthis\sroutine\sup\sinto\sthree\sseparate\ssmaller\sroutines,\scalling\seach\nseparately\sas\sneeded.\s\sHopefully\sthis\swill\smake\sfurther\srefactoring\sand\nschema\sreset\scollateral\sdamage\scontainment\seasier. -D 2012-05-15T18:28:27.325 +C Avoid\susing\ssqlite3ResetAllSchemasOfConnection()\spurely\sfor\sits\sside-effects. +D 2012-05-16T01:24:34.201 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2f37e468503dbe79d35c9f6dffcf3fae1ae9ec20 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -140,7 +140,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f F src/lempar.c 0ee69fca0be54cd93939df98d2aca4ca46f44416 F src/loadext.c f20382fbaeec832438a1ba7797bee3d3c8a6d51d -F src/main.c 28804c01149c1e707418434a42dc36438acdc5c8 +F src/main.c 48f47554ccedb2e800aa8f5fb316835a584f709f F src/malloc.c 15afac5e59b6584efe072e9933aefb4230e74f97 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c b3677415e69603d6a0e7c5410a1b3731d55beda1 @@ -998,7 +998,7 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings-clang.sh a8a0a3babda96dfb1ff51adda3cbbf3dfb7266c2 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 46f4eb5430d7bc9a339cdf7124ff4bd518eaa39b -R 3470c7e3b0ec734f279c648e5bd9b93d +P aa0c3493d3647d7efe527067e9fcccefda8e3008 +R f77d3725cc1e7473c355856cafd6e6e6 U drh -Z 93dd6b08b78f998064cdd25b32f8367e +Z 8c590823c466df3da4ff72040b91d983 diff --git a/manifest.uuid b/manifest.uuid index 680e37e511..657abd7526 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -aa0c3493d3647d7efe527067e9fcccefda8e3008 \ No newline at end of file +5587c73badc07d3e01a7c5c5964e178b5112dd24 \ No newline at end of file diff --git a/src/main.c b/src/main.c index c0c7aa5f66..41adb0e932 100644 --- a/src/main.c +++ b/src/main.c @@ -793,6 +793,7 @@ int sqlite3_close(sqlite3 *db){ /* Free any outstanding Savepoint structures. */ sqlite3CloseSavepoints(db); + /* Close all database connections */ for(j=0; jnDb; j++){ struct Db *pDb = &db->aDb[j]; if( pDb->pBt ){ @@ -803,10 +804,14 @@ int sqlite3_close(sqlite3 *db){ } } } + /* Clear the TEMP schema separately and last */ + if( db->aDb[1].pSchema ){ + sqlite3SchemaClear(db->aDb[1].pSchema); + } + sqlite3VtabUnlockList(db); - /* This call frees the schema associated with the temp database only (if - ** any). It also frees the db->aDb array, if required. */ - sqlite3ResetAllSchemasOfConnection(db); + /* Free up the array of auxiliary databases */ + sqlite3CollapseDatabaseArray(db); assert( db->nDb<=2 ); assert( db->aDb==db->aDbStatic );