diff options
author | drh <drh@noemail.net> | 2018-10-30 16:25:35 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-10-30 16:25:35 +0000 |
commit | fd748c6460a5ccfc7db0c2f0564d3f78f6845d19 (patch) | |
tree | f25a2f37b4536c0eecb8e143e7858e9f34b9621b /src | |
parent | a751f39c3fb8f9abd162b44c6d754142f232f1dd (diff) | |
download | sqlite-fd748c6460a5ccfc7db0c2f0564d3f78f6845d19.tar.gz sqlite-fd748c6460a5ccfc7db0c2f0564d3f78f6845d19.zip |
Split the SQLITE_WriteSchema flag in two flags, WriteSchema and
SQLITE_NoSchemaError. Set only WriteSchema on a VACUUM to avoid problems
when trying to vacuum a corrupt database. With this change, the size
of the flags field on sqlite3 must grow from 32 to 64 bytes.
FossilOrigin-Name: 4f9878107a54356b7105fa1db7655ee239685d570436f6ad4d4221c9bd829b3d
Diffstat (limited to 'src')
-rw-r--r-- | src/pragma.c | 2 | ||||
-rw-r--r-- | src/pragma.h | 4 | ||||
-rw-r--r-- | src/prepare.c | 4 | ||||
-rw-r--r-- | src/sqliteInt.h | 14 |
4 files changed, 13 insertions, 11 deletions
diff --git a/src/pragma.c b/src/pragma.c index c3c62a722..52d6338ca 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -1037,7 +1037,7 @@ void sqlite3Pragma( setPragmaResultColumnNames(v, pPragma); returnSingleInt(v, (db->flags & pPragma->iArg)!=0 ); }else{ - int mask = pPragma->iArg; /* Mask of bits to set or clear. */ + u64 mask = pPragma->iArg; /* Mask of bits to set or clear. */ if( db->autoCommit==0 ){ /* Foreign key support may not be enabled or disabled while not ** in auto-commit mode. */ diff --git a/src/pragma.h b/src/pragma.h index 93e7116f0..b1d4155ef 100644 --- a/src/pragma.h +++ b/src/pragma.h @@ -127,7 +127,7 @@ typedef struct PragmaName { u8 mPragFlg; /* Zero or more PragFlg_XXX values */ u8 iPragCName; /* Start of column names in pragCName[] */ u8 nPragCName; /* Num of col names. 0 means use pragma name */ - u32 iArg; /* Extra argument */ + u64 iArg; /* Extra argument */ } PragmaName; static const PragmaName aPragmaName[] = { #if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD) @@ -663,7 +663,7 @@ static const PragmaName aPragmaName[] = { /* ePragTyp: */ PragTyp_FLAG, /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, /* ColNames: */ 0, 0, - /* iArg: */ SQLITE_WriteSchema }, + /* iArg: */ SQLITE_WriteSchema|SQLITE_NoSchemaError }, #endif }; /* Number of pragmas: 62 on by default, 81 total. */ diff --git a/src/prepare.c b/src/prepare.c index 602e4dc49..f7e829acb 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -327,8 +327,8 @@ int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFlags){ rc = SQLITE_NOMEM_BKPT; sqlite3ResetAllSchemasOfConnection(db); } - if( rc==SQLITE_OK || (db->flags&SQLITE_WriteSchema)){ - /* Black magic: If the SQLITE_WriteSchema flag is set, then consider + if( rc==SQLITE_OK || (db->flags&SQLITE_NoSchemaError)){ + /* Black magic: If the SQLITE_NoSchemaError flag is set, then consider ** the schema loaded, even if errors occurred. In this situation the ** current sqlite3_prepare() operation will fail, but the following one ** will attempt to compile the supplied statement against whatever subset diff --git a/src/sqliteInt.h b/src/sqliteInt.h index f0ed023c6..c8a6fe90e 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1371,7 +1371,7 @@ struct sqlite3 { Db *aDb; /* All backends */ int nDb; /* Number of backends currently in use */ u32 mDbFlags; /* flags recording internal state */ - u32 flags; /* flags settable by pragmas. See below */ + u64 flags; /* flags settable by pragmas. See below */ i64 lastRowid; /* ROWID of most recent insert (see above) */ i64 szMmap; /* Default mmap_size setting */ u32 nSchemaLock; /* Do not reset the schema when non-zero */ @@ -1537,14 +1537,16 @@ struct sqlite3 { #define SQLITE_TriggerEQP 0x01000000 /* Show trigger EXPLAIN QUERY PLAN */ #define SQLITE_ResetDatabase 0x02000000 /* Reset the database */ #define SQLITE_LegacyAlter 0x04000000 /* Legacy ALTER TABLE behaviour */ +#define SQLITE_NoSchemaError 0x08000000 /* Do not report schema parse errors*/ /* Flags used only if debugging */ +#define HI(X) ((u64)(X)<<32) #ifdef SQLITE_DEBUG -#define SQLITE_SqlTrace 0x08000000 /* Debug print SQL as it executes */ -#define SQLITE_VdbeListing 0x10000000 /* Debug listings of VDBE programs */ -#define SQLITE_VdbeTrace 0x20000000 /* True to trace VDBE execution */ -#define SQLITE_VdbeAddopTrace 0x40000000 /* Trace sqlite3VdbeAddOp() calls */ -#define SQLITE_VdbeEQP 0x80000000 /* Debug EXPLAIN QUERY PLAN */ +#define SQLITE_SqlTrace HI(0x0001) /* Debug print SQL as it executes */ +#define SQLITE_VdbeListing HI(0x0002) /* Debug listings of VDBE progs */ +#define SQLITE_VdbeTrace HI(0x0004) /* True to trace VDBE execution */ +#define SQLITE_VdbeAddopTrace HI(0x0008) /* Trace sqlite3VdbeAddOp() calls */ +#define SQLITE_VdbeEQP HI(0x0010) /* Debug EXPLAIN QUERY PLAN */ #endif /* |