mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-01 06:27:03 +03:00
Minor comment and formatting changes.
FossilOrigin-Name: cf2add064f70c477fee1473c3196b72deb41222eb0cdbbdbdcf4a79995184e2b
This commit is contained in:
@ -21,18 +21,16 @@
|
|||||||
**
|
**
|
||||||
** When opening a database using this VFS, the connection might treat
|
** When opening a database using this VFS, the connection might treat
|
||||||
** the file as an ordinary SQLite database, or it might treat it as a
|
** the file as an ordinary SQLite database, or it might treat it as a
|
||||||
** database appended onto some other file. Here are the rules:
|
** database appended onto some other file. The decision is made by
|
||||||
|
** applying the following rules in order:
|
||||||
**
|
**
|
||||||
** (1) When opening a new empty file, that file is treated as an ordinary
|
** (1) An empty file is an ordinary database.
|
||||||
** database.
|
|
||||||
**
|
**
|
||||||
** (2) When opening a file that ends with the appendvfs trailer string
|
** (2) If the file begins with the standard SQLite prefix string
|
||||||
** "Start-Of-SQLite3-NNNNNNNN" that file is treated as an appended
|
** "SQLite format 3", that file is an ordinary database.
|
||||||
** database, even if rule 3 otherwise applies.
|
|
||||||
**
|
**
|
||||||
** (3) When opening a file that begins with the standard SQLite prefix
|
** (2) If the file ends with the appendvfs trailer string
|
||||||
** string "SQLite format 3", that file is treated as an ordinary
|
** "Start-Of-SQLite3-NNNNNNNN" that file is an appended database.
|
||||||
** database, unless rule 2 applies.
|
|
||||||
**
|
**
|
||||||
** (4) If none of the above apply and the SQLITE_OPEN_CREATE flag is
|
** (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.
|
** set, then a new database is appended to the already existing file.
|
||||||
@ -46,7 +44,7 @@
|
|||||||
** database, then keep it in a separate file.
|
** database, then keep it in a separate file.
|
||||||
**
|
**
|
||||||
** If the file being opened is a plain database (not an appended one), then
|
** 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 3)
|
** this shim is a pass-through into the default underlying VFS. (rule 2)
|
||||||
**/
|
**/
|
||||||
#include "sqlite3ext.h"
|
#include "sqlite3ext.h"
|
||||||
SQLITE_EXTENSION_INIT1
|
SQLITE_EXTENSION_INIT1
|
||||||
@ -351,7 +349,7 @@ static int apndFileControl(sqlite3_file *pFile, int op, void *pArg){
|
|||||||
pFile = ORIGFILE(pFile);
|
pFile = ORIGFILE(pFile);
|
||||||
rc = pFile->pMethods->xFileControl(pFile, op, pArg);
|
rc = pFile->pMethods->xFileControl(pFile, op, pArg);
|
||||||
if( rc==SQLITE_OK && op==SQLITE_FCNTL_VFSNAME ){
|
if( rc==SQLITE_OK && op==SQLITE_FCNTL_VFSNAME ){
|
||||||
*(char**)pArg = sqlite3_mprintf("apnd(%lld)/%z", paf->iPgOne, *(char**)pArg);
|
*(char**)pArg = sqlite3_mprintf("apnd(%lld)/%z", paf->iPgOne,*(char**)pArg);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -474,12 +472,15 @@ static int apndIsAppendvfsDatabase(sqlite3_int64 sz, sqlite3_file *pFile){
|
|||||||
*/
|
*/
|
||||||
static int apndIsOrdinaryDatabaseFile(sqlite3_int64 sz, sqlite3_file *pFile){
|
static int apndIsOrdinaryDatabaseFile(sqlite3_int64 sz, sqlite3_file *pFile){
|
||||||
char zHdr[16];
|
char zHdr[16];
|
||||||
if( apndIsAppendvfsDatabase(sz, pFile) /* rule 2 */
|
if( apndIsAppendvfsDatabase(sz, pFile) /* rule 3 */
|
||||||
|| (sz & 0x1ff) != 0
|
|| (sz & 0x1ff) != 0
|
||||||
|| SQLITE_OK!=pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), 0)
|
|| SQLITE_OK!=pFile->pMethods->xRead(pFile, zHdr, sizeof(zHdr), 0)
|
||||||
|| memcmp(zHdr, apvfsSqliteHdr, sizeof(zHdr))!=0 )
|
|| memcmp(zHdr, apvfsSqliteHdr, sizeof(zHdr))!=0
|
||||||
|
){
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
}else{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Round-up used to get appendvfs portion to begin at a page boundary. */
|
/* Round-up used to get appendvfs portion to begin at a page boundary. */
|
||||||
@ -502,11 +503,8 @@ static int apndOpen(
|
|||||||
int rc;
|
int rc;
|
||||||
sqlite3_int64 sz;
|
sqlite3_int64 sz;
|
||||||
pSubVfs = ORIGVFS(pVfs);
|
pSubVfs = ORIGVFS(pVfs);
|
||||||
/* The appendvfs is not to be used for auxillary DB files.
|
|
||||||
* Attempting such will result in simply opening the named
|
|
||||||
* file however the underlying VFS does that.
|
|
||||||
*/
|
|
||||||
if( (flags & SQLITE_OPEN_MAIN_DB)==0 ){
|
if( (flags & SQLITE_OPEN_MAIN_DB)==0 ){
|
||||||
|
/* The appendvfs is not to be used for transient or temporary databases. */
|
||||||
return pSubVfs->xOpen(pSubVfs, zName, pFile, flags, pOutFlags);
|
return pSubVfs->xOpen(pSubVfs, zName, pFile, flags, pOutFlags);
|
||||||
}
|
}
|
||||||
p = (ApndFile*)pFile;
|
p = (ApndFile*)pFile;
|
||||||
|
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
|||||||
C Add\stests\sfor\ssqlite3\sshell\swith\s-append\sflag.
|
C Minor\scomment\sand\sformatting\schanges.
|
||||||
D 2021-03-08T01:31:53.568
|
D 2021-03-08T12:59:16.579
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@ -286,7 +286,7 @@ F ext/lsm1/tool/mklsm1c.tcl f31561bbee5349f0a554d1ad7236ac1991fc09176626f529f607
|
|||||||
F ext/misc/README.md d6dd0fe1d8af77040216798a6a2b0c46c73054d2f0ea544fbbcdccf6f238c240
|
F ext/misc/README.md d6dd0fe1d8af77040216798a6a2b0c46c73054d2f0ea544fbbcdccf6f238c240
|
||||||
F ext/misc/amatch.c e3ad5532799cee9a97647f483f67f43b38796b84b5a8c60594fe782a4338f358
|
F ext/misc/amatch.c e3ad5532799cee9a97647f483f67f43b38796b84b5a8c60594fe782a4338f358
|
||||||
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
|
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
|
||||||
F ext/misc/appendvfs.c 747f1ee3d0cd708426f8569bc5a74f76a6c5c9a9effd9dbbdb1d72ebef978f25
|
F ext/misc/appendvfs.c 8c55f1dfca78069dccb39a6500044b2a5f1750001c716bdcf826f8eac84b1a4b
|
||||||
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
|
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
|
||||||
F ext/misc/btreeinfo.c d28ce349b40054eaa9473e835837bad7a71deec33ba13e39f963d50933bfa0f9
|
F ext/misc/btreeinfo.c d28ce349b40054eaa9473e835837bad7a71deec33ba13e39f963d50933bfa0f9
|
||||||
F ext/misc/carray.c b75a0f207391038bf1540d3372f482a95c3613511c7c474db51ede1196321c7c
|
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.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P c9521fa55620d0cb3cec20db7b42bc5f18876b42dca07811d1cd0f4b2907eab2
|
P d1790288729441d53603709df02aa5fb5f04714e2da86ce128ca81840b0b545f
|
||||||
R 23f68eed98007d707ef4373f281e795f
|
R f2bae5e6acbf372112d893828920ec3e
|
||||||
U larrybr
|
U drh
|
||||||
Z 8c93033ed5f0b875a3a05a4dccf1c0c4
|
Z 7017ad4c0c56b9068565f01b047d25a0
|
||||||
|
@ -1 +1 @@
|
|||||||
d1790288729441d53603709df02aa5fb5f04714e2da86ce128ca81840b0b545f
|
cf2add064f70c477fee1473c3196b72deb41222eb0cdbbdbdcf4a79995184e2b
|
Reference in New Issue
Block a user