Correct the precendence order for rules that determine how a database is

opened by appendvfs when a database is appended to another database.

FossilOrigin-Name: 92989fc56f2e81ac13f8106ec83c930f43d10715269b988ee47c9bfa53621995
This commit is contained in:
drh 2021-03-08 13:30:29 +00:00
parent 40942f22f1
commit 1e6f334645
3 changed files with 12 additions and 12 deletions

View File

@ -26,12 +26,12 @@
**
** (1) An empty file is an ordinary database.
**
** (2) If the file begins with the standard SQLite prefix string
** "SQLite format 3", that file is an ordinary database.
**
** (2) If the file ends with the appendvfs trailer string
** "Start-Of-SQLite3-NNNNNNNN" that file is an appended database.
**
** (3) If the file begins with the standard SQLite prefix string
** "SQLite format 3", that file is an ordinary database.
**
** (4) If none of the above apply and the SQLITE_OPEN_CREATE flag is
** set, then a new database is appended to the already existing file.
**
@ -44,7 +44,7 @@
** database, then keep it in a separate file.
**
** If the file being opened is a plain database (not an appended one), then
** this shim is a pass-through into the default underlying VFS. (rule 2)
** this shim is a pass-through into the default underlying VFS. (rule 3)
**/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
@ -472,7 +472,7 @@ static int apndIsAppendvfsDatabase(sqlite3_int64 sz, sqlite3_file *pFile){
*/
static int apndIsOrdinaryDatabaseFile(sqlite3_int64 sz, sqlite3_file *pFile){
char zHdr[16];
if( apndIsAppendvfsDatabase(sz, pFile) /* rule 3 */
if( apndIsAppendvfsDatabase(sz, pFile) /* rule 2 */
|| (sz & 0x1ff) != 0
|| SQLITE_OK!=pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), 0)
|| memcmp(zHdr, apvfsSqliteHdr, sizeof(zHdr))!=0

View File

@ -1,5 +1,5 @@
C Minor\scomment\sand\sformatting\schanges.
D 2021-03-08T12:59:16.579
C Correct\sthe\sprecendence\sorder\sfor\srules\sthat\sdetermine\show\sa\sdatabase\sis\nopened\sby\sappendvfs\swhen\sa\sdatabase\sis\sappended\sto\sanother\sdatabase.
D 2021-03-08T13:30:29.886
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -286,7 +286,7 @@ F ext/lsm1/tool/mklsm1c.tcl f31561bbee5349f0a554d1ad7236ac1991fc09176626f529f607
F ext/misc/README.md d6dd0fe1d8af77040216798a6a2b0c46c73054d2f0ea544fbbcdccf6f238c240
F ext/misc/amatch.c e3ad5532799cee9a97647f483f67f43b38796b84b5a8c60594fe782a4338f358
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
F ext/misc/appendvfs.c 8c55f1dfca78069dccb39a6500044b2a5f1750001c716bdcf826f8eac84b1a4b
F ext/misc/appendvfs.c abbfc1a10f283fb5f282523e52e48fa52a0aa5112894ed692aa468b8018c55fe
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
F ext/misc/btreeinfo.c d28ce349b40054eaa9473e835837bad7a71deec33ba13e39f963d50933bfa0f9
F ext/misc/carray.c b75a0f207391038bf1540d3372f482a95c3613511c7c474db51ede1196321c7c
@ -1910,7 +1910,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P d1790288729441d53603709df02aa5fb5f04714e2da86ce128ca81840b0b545f
R f2bae5e6acbf372112d893828920ec3e
P cf2add064f70c477fee1473c3196b72deb41222eb0cdbbdbdcf4a79995184e2b
R c65cd003e96185a8d777feb682b63283
U drh
Z 7017ad4c0c56b9068565f01b047d25a0
Z 77d29435258e5f198f92fac302448d30

View File

@ -1 +1 @@
cf2add064f70c477fee1473c3196b72deb41222eb0cdbbdbdcf4a79995184e2b
92989fc56f2e81ac13f8106ec83c930f43d10715269b988ee47c9bfa53621995