1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +03:00

Modify the behaviour of writable_schema to ignore schema parsing errors. (CVS 3686)

FossilOrigin-Name: a8d6d935fbe32a759a55c1ef90adda7fe534acc1
This commit is contained in:
danielk1977
2007-03-14 15:37:04 +00:00
parent a26cdf9a61
commit 34c68fbab6
5 changed files with 26 additions and 17 deletions

View 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;
}