-C Fix\sa\smemory\sleak\sintroduced\sby\s(3842)\sassociated\swith\sticket\s#2296.\s(CVS\s3848)
-D 2007-04-16T17:07:55
+C Avoid\sreloading\sthe\sdb\sschema\safter\sa\sfailed\sOP_VerifyCookie\sif\sthe\sin-memory\sschema\scookie\salready\smatches\sthe\sdatabase\sfile.\s(CVS\s3849)
+D 2007-04-17T08:32:34
F Makefile.in 8cab54f7c9f5af8f22fd97ddf1ecfd1e1860de62
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/utf.c e64a48bc21aa973eb622dd47da87d56a4cdcf528
F src/util.c b6344325378e75b9e18175d8b6aed1723d73dad9
F src/vacuum.c 8bd895d29e7074e78d4e80f948e35ddc9cf2beef
-F src/vdbe.c 8f5faea02cfcd21cd0799fe170e76ab0f99295d8
+F src/vdbe.c cf7808e8db2e5d1547e898ce29531295183ede6e
F src/vdbe.h 0025259af1939fb264a545816c69e4b5b8d52691
F src/vdbeInt.h 4b19fd8febad3fd14c4c97adaefc06754d323132
F src/vdbeapi.c 1fca7ff056d03f131caa6b1296bb221da65ed7f4
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 66e468adfcf0132e558a666b847ce7c1e024d6fd
-R 3b50384c2975fd4abff376a4b850ec92
-U drh
-Z 608cb9d6d6e4358bd5d53def8d3cbd39
+P cdc7608b8d590b2ca19be37f94f2cd17423ba8ac
+R a95eb9701833203362ade6cf45a79fc8
+U danielk1977
+Z 5fca2c9a355f9d34fbf42735e6435fcb
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.599 2007/04/16 15:06:25 danielk1977 Exp $
+** $Id: vdbe.c,v 1.600 2007/04/17 08:32:34 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
}
if( rc==SQLITE_OK && iMeta!=pOp->p2 ){
sqlite3SetString(&p->zErrMsg, "database schema has changed", (char*)0);
- sqlite3ResetInternalSchema(db, pOp->p1);
+ /* If the schema-cookie from the database file matches the cookie
+ ** stored with the in-memory representation of the schema, do
+ ** not reload the schema from the database file.
+ **
+ ** If virtual-tables are in use, this is not just an optimisation.
+ ** Often, v-tables store their data in other SQLite tables, which
+ ** are queried from within xNext() and other v-table methods using
+ ** prepared queries. If such a query is out-of-date, we do not want to
+ ** discard the database schema, as the user code implementing the
+ ** v-table would have to be ready for the sqlite3_vtab structure itself
+ ** to be invalidated whenever sqlite3_step() is called from within
+ ** a v-table method.
+ */
+ if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
+ sqlite3ResetInternalSchema(db, pOp->p1);
+ }
+
sqlite3ExpirePreparedStatements(db);
rc = SQLITE_SCHEMA;
}