From: drh Date: Sat, 9 Apr 2011 02:34:33 +0000 (+0000) Subject: When ATTACH-ing a new database to an existing database with a codec, do X-Git-Tag: version-3.7.6~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9f6106f5ee181bec83544572a2a6810df38c943f;p=thirdparty%2Fsqlite.git 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 --- diff --git a/manifest b/manifest index 1c6fe4c3e0..e52034906d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\sdo\sa\sbackup\sif\sthe\snumber\sof\sreserved\sbytes\sin\sthe\ssource\sand\ndestination\sdo\snot\smatch.\s\sTry\sto\smake\sthe\smatch,\sbut\sif\sunable\sfail. -D 2011-04-09T02:09:44.933 +C When\sATTACH-ing\sa\snew\sdatabase\sto\san\sexisting\sdatabase\swith\sa\scodec,\sdo\nnot\senable\sthe\scodec\sin\sthe\sattached\sdatabase\sif\sit\sis\snot\senabled\sin\sthe\nexisting\sdatabase\sand\sit\sis\snot\srequested\sby\sthe\sUSING\sclause. +D 2011-04-09T02:34:33.149 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -116,7 +116,7 @@ F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad F src/alter.c 280f5c04b11b492703a342222b3de0a999445280 F src/analyze.c a1ad9f4d8aac055c4a4bbd99073e2e78fe66129c -F src/attach.c 7cae2cf0c14762ce14c074a860ec52890a973a56 +F src/attach.c 7f97ca76ef2453440170929531a9c778267c0830 F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 F src/backup.c 8d738af17e87eb6fcf2dab8b26153a918a114e48 F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef @@ -927,7 +927,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 543f75a6abe3aa4f49df43e71a462702d40b3251 -R ecb9137cdfc6a112de5c41c40942b0a2 +P 0ca8a2332b28d88585dc890e5162b095e783fc20 +R b19292a0a4e4c797c8f7e19da3cea01c U drh -Z e9521ab4b4c4425c6bb8ec5417657a53 +Z 6219854df534fe7fd4126ed86b170468 diff --git a/manifest.uuid b/manifest.uuid index bc219ca403..d14c40154d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -0ca8a2332b28d88585dc890e5162b095e783fc20 \ No newline at end of file +4caa5fc86e7fe404cd188713277f2801cd02dbc9 \ No newline at end of file diff --git a/src/attach.c b/src/attach.c index fe88aa73cd..bda1c87445 100644 --- a/src/attach.c +++ b/src/attach.c @@ -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; } }