aboutsummaryrefslogtreecommitdiff
path: root/src/pragma.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2020-03-05 18:04:09 +0000
committerdan <dan@noemail.net>2020-03-05 18:04:09 +0000
commit0ea2d42ac3e76c7e2b2fd8d5fdf53f76f09429f3 (patch)
tree923944b4486cca728358128d354a21f02b363106 /src/pragma.c
parent42a630b1daf1df13850095251cc73be84dbdeac8 (diff)
downloadsqlite-0ea2d42ac3e76c7e2b2fd8d5fdf53f76f09429f3.tar.gz
sqlite-0ea2d42ac3e76c7e2b2fd8d5fdf53f76f09429f3.zip
Report an error if the main, or any other, database encoding is modified by an external process (perhaps using the backup API) after the db has been opened.
FossilOrigin-Name: 895bd20b29e223496e1585483c6ce3335ae9050f2e5de4d6b69d0e40df396862
Diffstat (limited to 'src/pragma.c')
-rw-r--r--src/pragma.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/pragma.c b/src/pragma.c
index 504f51ec0..c5b5bb667 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -1824,17 +1824,7 @@ void sqlite3Pragma(
** will be overwritten when the schema is next loaded. If it does not
** already exists, it will be created to use the new encoding value.
*/
- int canChangeEnc = 1; /* True if allowed to change the encoding */
- int i; /* For looping over all attached databases */
- for(i=0; i<db->nDb; i++){
- if( db->aDb[i].pBt!=0
- && DbHasProperty(db,i,DB_SchemaLoaded)
- && !DbHasProperty(db,i,DB_Empty)
- ){
- canChangeEnc = 0;
- }
- }
- if( canChangeEnc ){
+ if( (db->mDbFlags & DBFLAG_EncodingFixed)==0 ){
for(pEnc=&encnames[0]; pEnc->zName; pEnc++){
if( 0==sqlite3StrICmp(zRight, pEnc->zName) ){
u8 enc = pEnc->enc ? pEnc->enc : SQLITE_UTF16NATIVE;