From: danielk1977 Date: Wed, 14 Mar 2007 15:37:04 +0000 (+0000) Subject: Modify the behaviour of writable_schema to ignore schema parsing errors. (CVS 3686) X-Git-Tag: version-3.6.10~2484 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=34c68fbab6247f7abba114c6978bb08003f61737;p=thirdparty%2Fsqlite.git Modify the behaviour of writable_schema to ignore schema parsing errors. (CVS 3686) FossilOrigin-Name: a8d6d935fbe32a759a55c1ef90adda7fe534acc1 --- diff --git a/manifest b/manifest index 12800ee260..f83973768d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\shyperlink\sanchors\sto\sthe\slockingv3.html\sdocument.\s(CVS\s3685) -D 2007-03-13T16:33:43 +C Modify\sthe\sbehaviour\sof\swritable_schema\sto\signore\sschema\sparsing\serrors.\s(CVS\s3686) +D 2007-03-14T15:37:04 F Makefile.in 1fe3d0b46e40fd684e1e61f8e8056cefed16de9f F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -89,8 +89,8 @@ F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/pager.c 680bf115aa1678a011ce046f2a1ef4cad45576cb F src/pager.h 8881591ca23d1e5fd83c95fa8317245fbcf64227 F src/parse.y bcfe366c1fd61cfc40e5344eb69a31997a821af0 -F src/pragma.c 5091300911670ddaa552bfa12c45cbca1bb7e7d6 -F src/prepare.c 484389c6811415b8f23d259ac9c029613e1c72c3 +F src/pragma.c b52dcf2fbb46f3266f9d00b88054c684df3af2e7 +F src/prepare.c 4e075fe28591b7d4ffbf818fb88a7e19bbe98065 F src/printf.c aade23a789d7cc88b397ec0d33a0a01a33a7a9c1 F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88 F src/select.c 4d68a0d7f98fb59bcedd0be69750e0445b05899c @@ -98,7 +98,7 @@ F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/shell.c 3ae4654560e91220a95738a73d135d91d937cda1 F src/sqlite.h.in 6b7383baf76070214f6381f603328ca9b22a7fae F src/sqlite3ext.h 011c75fd6459a61454514af07c7a4f1f5c767f27 -F src/sqliteInt.h 50ea4ff5df788c7ea66a9183ece84bb972a06014 +F src/sqliteInt.h 6e3ac7a1a8f51e24ce4784236aa957e9bd11217f F src/table.c 6d0da66dde26ee75614ed8f584a1996467088d06 F src/tclsqlite.c cd2b3b86ab07c0e0779f6c6e71e72c6c7dc1e704 F src/test1.c b4ff8f82f84d2ccdf07a2db5acae7b47c12f60d7 @@ -436,7 +436,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P 48b2a40008a09881ed9da3548095495a3d4a6647 -R 71fd10c40372f71bc80b6c2d2832c818 -U drh -Z c1407752a27a9f8ad9c30a93e200acaf +P 3e66ea6f61abc0f95af3bb46ebc0e10b4dcd069b +R 0b1c631304a4b999548c4f37d3474b4f +U danielk1977 +Z ecfae2838ed01abd8679701901a6da11 diff --git a/manifest.uuid b/manifest.uuid index 9fe5df2e68..dd359f05c5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3e66ea6f61abc0f95af3bb46ebc0e10b4dcd069b \ No newline at end of file +a8d6d935fbe32a759a55c1ef90adda7fe534acc1 \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index 26bdba224c..2177097287 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.127 2007/01/27 02:24:56 drh Exp $ +** $Id: pragma.c,v 1.128 2007/03/14 15:37:04 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -157,7 +157,7 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){ { "ignore_check_constraints", SQLITE_IgnoreChecks }, #endif /* The following is VERY experimental */ - { "writable_schema", SQLITE_WriteSchema }, + { "writable_schema", SQLITE_WriteSchema|SQLITE_RecoveryMode }, { "omit_readlock", SQLITE_NoReadlock }, /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted diff --git a/src/prepare.c b/src/prepare.c index 2c68112de1..36864baa54 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.43 2007/01/09 14:01:13 drh Exp $ +** $Id: prepare.c,v 1.44 2007/03/14 15:37:04 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -310,10 +310,17 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){ rc = SQLITE_NOMEM; sqlite3ResetInternalSchema(db, 0); } - if( rc==SQLITE_OK ){ + if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){ + /* Black magic: If the SQLITE_RecoveryMode flag is set, then consider + ** the schema loaded, even if errors occured. In this situation the + ** current sqlite3_prepare() operation will fail, but the following one + ** will attempt to compile the supplied statement against whatever subset + ** of the schema was loaded before the error occured. The primary + ** purpose of this is to allow access to the sqlite_master table + ** even when it's contents have been corrupted. + */ DbSetProperty(db, iDb, DB_SchemaLoaded); - }else{ - sqlite3ResetInternalSchema(db, iDb); + rc = SQLITE_OK; } return rc; } diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 1d5f21a6e0..075f2fa82e 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.541 2007/03/02 06:24:19 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.542 2007/03/14 15:37:04 danielk1977 Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -545,6 +545,8 @@ struct sqlite3 { #define SQLITE_FullFSync 0x00010000 /* Use full fsync on the backend */ #define SQLITE_LoadExtension 0x00020000 /* Enable load_extension */ +#define SQLITE_RecoveryMode 0x00040000 /* Ignore schema errors */ + /* ** Possible values for the sqlite.magic field. ** The numbers are obtained at random and have no special meaning, other