]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Modify the behaviour of writable_schema to ignore schema parsing errors. (CVS 3686)
authordanielk1977 <danielk1977@noemail.net>
Wed, 14 Mar 2007 15:37:04 +0000 (15:37 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Wed, 14 Mar 2007 15:37:04 +0000 (15:37 +0000)
FossilOrigin-Name: a8d6d935fbe32a759a55c1ef90adda7fe534acc1

manifest
manifest.uuid
src/pragma.c
src/prepare.c
src/sqliteInt.h

index 12800ee2605e83abcad7cc723b62d5aec6fdb982..f83973768db78ed0c85f22a3c6fe6d716ffde03c 100644 (file)
--- 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
index 9fe5df2e689aeb0df9e945ed0a7f2b6a0412ba17..dd359f05c53c547bb22ed389ade948b36f9b792c 100644 (file)
@@ -1 +1 @@
-3e66ea6f61abc0f95af3bb46ebc0e10b4dcd069b
\ No newline at end of file
+a8d6d935fbe32a759a55c1ef90adda7fe534acc1
\ No newline at end of file
index 26bdba224c848d699e9900b2a096f46713373ce4..217709728777b80c619f08006bb98a89510b9080 100644 (file)
@@ -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
index 2c68112de1a010ee08172ef20caea76e5c56dc1d..36864baa5421a40a696c790485da8c59c9b75c2d 100644 (file)
@@ -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;
 }
index 1d5f21a6e04922361c92b57459e8b52bef21df59..075f2fa82ef6d8fb3b15c15c8d92e39a6c6712fb 100644 (file)
@@ -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