Back out the new device capability. The determination of whether or not a
file has moved is now done strictly using a file-control. FossilOrigin-Name: 9c59f5af7ac4908583fab85d37241f200c40f02d
This commit is contained in:
@@ -3192,7 +3192,6 @@ static int winSectorSize(sqlite3_file *id){
|
||||
static int winDeviceCharacteristics(sqlite3_file *id){
|
||||
winFile *p = (winFile*)id;
|
||||
return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN |
|
||||
SQLITE_IOCAP_UNMOVABLE_WHEN_OPEN |
|
||||
((p->ctrlFlags & WINFILE_PSOW)?SQLITE_IOCAP_POWERSAFE_OVERWRITE:0);
|
||||
}
|
||||
|
||||
|
||||
+8
-6
@@ -4803,19 +4803,21 @@ int sqlite3PagerOpen(
|
||||
** code from sqlite3OsAccess()) if the database has gone missing.
|
||||
*/
|
||||
static int databaseIsUnmoved(Pager *pPager){
|
||||
const int fixedFlags = SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN |
|
||||
SQLITE_IOCAP_UNMOVABLE_WHEN_OPEN;
|
||||
int dc;
|
||||
int bHasMoved = 0;
|
||||
int rc;
|
||||
|
||||
if( pPager->tempFile ) return SQLITE_OK;
|
||||
if( pPager->dbSize==0 ) return SQLITE_OK;
|
||||
assert( pPager->zFilename && pPager->zFilename[0] );
|
||||
dc = sqlite3OsDeviceCharacteristics(pPager->fd);
|
||||
if( (dc&fixedFlags)==fixedFlags ) return SQLITE_OK;
|
||||
rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_HAS_MOVED, &bHasMoved);
|
||||
if( rc==SQLITE_OK && bHasMoved ) rc = SQLITE_READONLY_DBMOVED;
|
||||
if( rc==SQLITE_NOTFOUND ){
|
||||
/* If the HAS_MOVED file-control is unimplemented, assume that the file
|
||||
** has not been moved. That is the historical behavior of SQLite: prior to
|
||||
** version 3.8.3, it never checked */
|
||||
rc = SQLITE_OK;
|
||||
}else if( rc==SQLITE_OK && bHasMoved ){
|
||||
rc = SQLITE_READONLY_DBMOVED;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -555,8 +555,7 @@ int sqlite3_exec(
|
||||
** file that were written at the application level might have changed
|
||||
** and that adjacent bytes, even bytes within the same sector are
|
||||
** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
|
||||
** and SQLITE_IOCAP_UNMOVABLE_WHEN_OPEN flags indicate that a file
|
||||
** cannot be deleted or renamed when open, respectively.
|
||||
** flag indicate that a file cannot be deleted when open.
|
||||
*/
|
||||
#define SQLITE_IOCAP_ATOMIC 0x00000001
|
||||
#define SQLITE_IOCAP_ATOMIC512 0x00000002
|
||||
@@ -571,7 +570,6 @@ int sqlite3_exec(
|
||||
#define SQLITE_IOCAP_SEQUENTIAL 0x00000400
|
||||
#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
|
||||
#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
|
||||
#define SQLITE_IOCAP_UNMOVABLE_WHEN_OPEN 0x00002000
|
||||
|
||||
/*
|
||||
** CAPI3REF: File Locking Levels
|
||||
|
||||
Reference in New Issue
Block a user