1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

When ATTACH-ing a new database to an existing database with a codec, do

not enable the codec in the attached database if it is not enabled in the
existing database and it is not requested by the USING clause.

FossilOrigin-Name: 4caa5fc86e7fe404cd188713277f2801cd02dbc9
This commit is contained in:
drh
2011-04-09 02:34:33 +00:00
parent 2b89fbcb1e
commit 9f6106f5ee
3 changed files with 10 additions and 8 deletions

View File

@@ -176,7 +176,9 @@ static void attachFunc(
case SQLITE_NULL:
/* No key specified. Use the key from the main database */
sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
if( nKey>0 || sqlite3BtreeGetReserve(db->aDb[0].pBt)>0 ){
rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
}
break;
}
}